Skip to content

Commit f366ef0

Browse files
committed
feat(template): remove unnecessary rollup plugins, update rollup config
1 parent 9900cb2 commit f366ef0

File tree

2 files changed

+18
-34
lines changed

2 files changed

+18
-34
lines changed

generators/app/templates/package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
"main": "index.js",
1111
"typings": "index.d.ts",
1212
"scripts": {
13+
"dev": "rollup -cw",
14+
"prebuild": "yarn clean",
15+
"build": "rollup -c",
16+
"postbuild": "copyfiles CHANGELOG.md LICENSE package.json README.md dist",
1317
"purge": "rm -rf node_modules",
1418
"clean": "rm -rf dist",
15-
"dev": "rollup -cw",
1619
"format": "prettier --write \"**/*.*(json|js|ts|yml|md)\"",
1720
"format:check": "prettier --check \"**/*.*(json|js|ts|yml|md)\"",
1821
"lint": "tslint --project tsconfig.json --config tslint.json",
19-
"prebuild": "yarn clean",
20-
"build": "rollup -c",
21-
"postbuild": "copyfiles CHANGELOG.md LICENSE package.json README.md dist",
2222
"release": "standard-version --no-verify",
2323
"release:major": "yarn release --release-as major",
2424
"release:minor": "yarn release --release-as minor",
@@ -30,17 +30,14 @@
3030
"husky": "^2.3.0",
3131
"prettier": "^2.0.2",
3232
"pretty-quick": "^2.0.1",
33-
"rollup": "^1.12.3",
34-
"rollup-plugin-async": "^1.2.0",
35-
"rollup-plugin-commonjs": "^10.0.0",
3633
"rollup-plugin-node-resolve": "^5.0.0",
37-
"rollup-plugin-sourcemaps": "^0.4.2",
3834
"rollup-plugin-typescript2": "^0.21.1",
35+
"rollup": "^1.12.3",
3936
"standard-version": "^6.0.1",
40-
"tslint": "^5.16.0",
4137
"tslint-config-airbnb": "^5.11.1",
4238
"tslint-immutable": "^5.5.2",
4339
"tslint-sonarts": "^1.9.0",
40+
"tslint": "^5.16.0",
4441
"typescript": "^3.4.5"
4542
}
4643
}
Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,25 @@
11
import resolve from 'rollup-plugin-node-resolve';
2-
import commonjs from 'rollup-plugin-commonjs';
32
import typescript from 'rollup-plugin-typescript2';
4-
import async from 'rollup-plugin-async';
5-
import sourceMaps from 'rollup-plugin-sourcemaps';
63

74
import pkg from './package.json';
85

9-
const common = {
6+
const getConfig = (inputFile) => ({
107
external: [
118
...Object.keys(pkg.dependencies || {}),
129
...Object.keys(pkg.peerDependencies || {}),
1310
],
14-
plugins: [
15-
resolve(),
16-
commonjs(),
17-
typescript({
18-
useTsconfigDeclarationDir: true,
19-
rollupCommonJSResolveHack: true,
20-
}),
21-
async(),
22-
sourceMaps(),
11+
plugins: [resolve(), typescript({ useTsconfigDeclarationDir: true })],
12+
input: inputFile,
13+
output: [
14+
{
15+
dir: 'dist',
16+
format: 'cjs',
17+
sourcemap: true,
18+
},
2319
],
24-
};
20+
});
2521

2622
export default [
27-
{
28-
...common,
29-
input: 'src/index.ts',
30-
output: [
31-
{
32-
file: pkg.main,
33-
format: 'cjs',
34-
sourcemap: true,
35-
},
36-
],
37-
},
23+
getConfig('src/index.ts'),
24+
// TODO: add another file here
3825
];

0 commit comments

Comments
 (0)