Skip to content

Commit

Permalink
Update build configuration (closes #36)
Browse files Browse the repository at this point in the history
  • Loading branch information
dokmic committed Oct 17, 2021
1 parent d102324 commit d1aa052
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 62 deletions.
20 changes: 0 additions & 20 deletions babel.config.js

This file was deleted.

12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
],
"main": "dist/index.js",
"module": "dist/index.mjs",
"es2015": "dist/index.es6.mjs",
"types": "dist/index.d.ts",
"scripts": {
"build": "rollup -c rollup.config.js",
"build": "rollup -c",
"lint": "eslint --ext .ts src/",
"prepare": "$npm_execpath run build",
"test": "jest --coverage"
Expand All @@ -33,8 +32,6 @@
"node": ">=6.4.0"
},
"devDependencies": {
"@babel/core": "^7.0",
"@babel/preset-env": "^7.0",
"@types/jest": "^27.0",
"@typescript-eslint/eslint-plugin": "^5.0",
"@typescript-eslint/parser": "^5.0",
Expand All @@ -46,10 +43,9 @@
"eslint-plugin-prettier": "^4.0",
"jest": "^27.2",
"prettier": "^2.4",
"rollup": "^1.23",
"rollup-plugin-babel": "^4.0",
"rollup-plugin-terser": "^5.0",
"rollup-plugin-typescript2": "^0.24",
"rollup": "^2.58",
"rollup-plugin-dts": "^4.0",
"rollup-plugin-typescript2": "^0.30",
"ts-jest": "^27.0",
"typescript": "^4.4"
},
Expand Down
34 changes: 12 additions & 22 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 dokmic, Snowplow Analytics Ltd. All rights reserved.
* Copyright (c) 2019-2021 dokmic, Snowplow Analytics Ltd. All rights reserved.
*
* This program is licensed to you under the Apache License Version 2.0,
* and you may not use this file except in compliance with the Apache License Version 2.0.
Expand All @@ -11,56 +11,46 @@
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
*/

import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
import dts from 'rollup-plugin-dts';
import typescript from 'rollup-plugin-typescript2';
import terserOptions from './terser.json';

export default [
{
input: 'src/index.ts',
output: [
{
dir: 'dist',
entryFileNames: '[name].js',
exports: 'named',
file: 'dist/index.js',
format: 'umd',
name: 'SnowplowAnalyticsSdk',
sourcemap: true,
sourcemapExcludeSources: true,
},
{
file: 'dist/index.mjs',
dir: 'dist',
entryFileNames: '[name].mjs',
format: 'esm',
},
],
plugins: [
typescript({
cacheRoot: './node_modules/.cache/rpt2',
compilerOptions: {
declaration: false,
clean: true,
tsconfigOverride: {
compilerOptions: { removeComments: true },
},
}),
babel({ extensions: ['.ts'] }),
terser(terserOptions),
],
},

{
input: 'src/index.ts',
output: [
{
file: 'dist/index.es6.mjs',
dir: 'dist',
entryFileNames: '[name].d.ts',
format: 'esm',
},
],
plugins: [
typescript({
cacheRoot: './node_modules/.cache/rpt2',
tsconfigOverride: {
useTsconfigDeclarationDir: true,
},
}),
terser(terserOptions),
],
plugins: [dts()],
},
];
10 changes: 0 additions & 10 deletions terser.json

This file was deleted.

2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"compilerOptions": {
"declaration": true,
"declarationDir": "./dist",
"esModuleInterop": true,
"lib": [
"es6"
Expand Down

0 comments on commit d1aa052

Please sign in to comment.