Skip to content

Commit 6306663

Browse files
committed
refactor: use rollup and api-extractor API instead of CLI
use scripts instead of CLI for better reusability of rollup/api-extractor configs
1 parent 4607a91 commit 6306663

49 files changed

Lines changed: 389 additions & 709 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ docs/.vuepress/dist/
1111
packages/purgecss-webpack-plugin/__tests__/js
1212
packages/grunt-purgecss/__tests__/tmp
1313

14+
.temp
15+
.cache
16+
1417
npm-shrinkwrap.json
1518
yarn.lock
1619

@@ -72,7 +75,3 @@ typings/
7275

7376
# dotenv environment variables file
7477
.env
75-
76-
packages/purgecss/bin/purgecss.d.ts
77-
.temp
78-
.cache

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@
4343
},
4444
"scripts": {
4545
"bootstrap": "lerna bootstrap --hoist",
46-
"build": "lerna run build",
46+
"build": "lerna run --stream build",
4747
"docs:dev": "vuepress dev docs",
4848
"docs:build": "vuepress build docs",
4949
"generate-api-reference": "api-documenter markdown -i ./docs/.vuepress/.temp/api-reference/ -o ./docs/api-reference/",
5050
"generate-changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
5151
"lint": "eslint . --ext .ts --ignore-path .gitignore --fix",
5252
"postinstall": "npm run bootstrap",
5353
"prettier": "prettier --write --parser typescript '**/*.ts'",
54-
"test": "lerna run test"
54+
"test": "lerna run --stream test"
5555
},
5656
"husky": {
5757
"hooks": {

packages/grunt-purgecss/build.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {
2+
buildRollup,
3+
createRollupConfig,
4+
} from "../../scripts/build";
5+
import { promises as asyncFs } from "fs";
6+
import * as path from "path";
7+
import { RollupOptions } from "rollup";
8+
9+
(async () => {
10+
await asyncFs.rm(path.resolve(__dirname, "tasks"), {
11+
recursive: true,
12+
force: true,
13+
});
14+
const rollupConfig: RollupOptions = {
15+
...createRollupConfig("grunt-purgecss", ["purgecss"]),
16+
output: [
17+
{
18+
exports: "auto",
19+
file: "./tasks/purgecss.js",
20+
format: "cjs",
21+
},
22+
],
23+
}
24+
await buildRollup(rollupConfig);
25+
})();

packages/grunt-purgecss/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"directory": "packages/grunt-purgecss"
2828
},
2929
"scripts": {
30-
"build": "npm run clean && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
31-
"clean": "rm -rf ./tasks",
30+
"build": "ts-node build.ts",
3231
"test": "jest"
3332
},
3433
"dependencies": {

packages/grunt-purgecss/rollup.config.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/grunt-purgecss/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
"compilerOptions": {
44
"declaration": false,
55
"baseUrl": ".",
6-
"rootDir": "./../",
76
"paths": {
87
"purgecss": ["../purgecss/src"],
98
}
109
},
11-
"include": ["./src/**/*", "./rollup.config.ts", "./../purgecss/src/*"]
10+
"include": ["./src/**/*", "./../purgecss/src/*"]
1211
}

packages/gulp-purgecss/api-extractor.json

Lines changed: 0 additions & 41 deletions
This file was deleted.

packages/gulp-purgecss/build.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {
2+
buildRollup,
3+
createRollupConfig,
4+
extractAPI,
5+
} from "../../scripts/build";
6+
import { promises as asyncFs } from "fs";
7+
import * as path from "path";
8+
9+
(async () => {
10+
await asyncFs.rm(path.resolve(__dirname, "lib"), {
11+
recursive: true,
12+
force: true,
13+
});
14+
const rollupConfig = createRollupConfig("gulp-purgecss", [
15+
"through2", "plugin-error", "purgecss", "glob"
16+
]);
17+
await buildRollup(rollupConfig);
18+
await extractAPI(__dirname);
19+
await asyncFs.rm(path.resolve(__dirname, "lib", ".temp"), {
20+
recursive: true,
21+
force: true,
22+
});
23+
})();

packages/gulp-purgecss/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
"url": "git+https://github.com/FullHuman/purgecss.git"
3333
},
3434
"scripts": {
35-
"api-extractor": "api-extractor run && rm -rf ./lib/.temp",
36-
"build": "npm run clean && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript && npm run api-extractor",
37-
"clean": "rm -rf ./lib",
35+
"build": "ts-node build.ts",
3836
"test": "jest"
3937
},
4038
"dependencies": {

packages/gulp-purgecss/rollup.config.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)