Skip to content

Commit

Permalink
fix: update TS types files for better TS support
Browse files Browse the repository at this point in the history
Semver: patch
  • Loading branch information
TerryMooreII committed May 18, 2021
1 parent cf1c21e commit 0b91a4e
Show file tree
Hide file tree
Showing 10 changed files with 228 additions and 20 deletions.
194 changes: 190 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@logdna/browser",
"version": "1.1.0",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"license": "MIT",
"types": "./dist/types/index.d.ts",
"scripts": {
"build": "rollup -c rollup.config.ts",
"clean": "rm -rf dist",
"build": "npm run clean && rollup -c rollup.config.ts",
"start": "rollup -c rollup.config.ts -w",
"test": "jest",
"test:watch": "jest --watch",
Expand Down Expand Up @@ -41,7 +42,7 @@
},
"homepage": "https://github.com/logdna/logdna-browser#readme",
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-replace": "^2.3.4",
Expand All @@ -56,7 +57,9 @@
"prettier": "^1.14.3",
"pretty-quick": "^3.1.0",
"rollup": "^2.33.1",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"semantic-release": "^17.4.2",
"semantic-release-config-logdna": "^1.1.1",
"serve": "^11.3.2",
Expand Down Expand Up @@ -84,4 +87,4 @@
],
"extends": "semantic-release-config-logdna"
}
}
}
31 changes: 25 additions & 6 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import typescript from 'rollup-plugin-typescript2';
import json from '@rollup/plugin-json';
import { terser } from 'rollup-plugin-terser';
import replace from '@rollup/plugin-replace';
import copy from 'rollup-plugin-copy';

export default {
const OUTPUT_DATA = [
{
file: 'dist/index.esm.js',
format: 'es',
},
{
file: 'dist/index.js',
format: 'umd',
},
];

const config = OUTPUT_DATA.map(({ file, format }) => ({
input: `src/index.ts`,
output: {
dir: 'dist',
format: 'umd',
file,
format,
sourcemap: true,
name: 'logdna',
},
Expand All @@ -19,7 +31,9 @@ export default {
},
plugins: [
json(),
typescript(),
typescript({
useTsconfigDeclarationDir: true,
}),
commonjs(),
resolve(),
replace({
Expand All @@ -32,5 +46,10 @@ export default {
comments: false,
},
}),
copy({
targets: [{ src: 'src/logdna.d.ts', dest: 'dist/types' }],
}),
],
};
}));

export default config;
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
StaticContext,
ILogDNABrowserLogger,
Plugin,
} from './index.d';
} from './logdna.d';
import utils from './utils';
import {
DEFAULT_INGESTION_URL,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LoggerOptionsT, LogDNALogLine } from './index.d';
import { LoggerOptionsT, LogDNALogLine } from './logdna.d';
import {
LOG_LINE_FLUSH_TIMEOUT,
FLUSH_BYTE_LIMIT,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/console.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, ILogDNABrowserLogger } from '../index.d';
import { Plugin, ILogDNABrowserLogger } from '../logdna.d';

type LogType = 'log' | 'debug' | 'error' | 'warn' | 'info' | 'assert';

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/global-handlers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, ILogDNABrowserLogger } from '../index.d';
import { Plugin, ILogDNABrowserLogger } from '../logdna.d';

export type Options = {
enableErrorHandler?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/performance-measure.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, ILogDNABrowserLogger, LogType } from '../index.d';
import { Plugin, ILogDNABrowserLogger, LogType } from '../logdna.d';
export type Options = {
prefix?: String;
logLevel?: LogType;
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import safeStringify from 'fast-safe-stringify';
import { ContextT, LogDNABrowserOptionsT } from './index.d';
import { ContextT, LogDNABrowserOptionsT } from './logdna.d';
import { HOSTNAME_CHECK } from './constants';
import { version } from '../package.json';

Expand Down

0 comments on commit 0b91a4e

Please sign in to comment.