Skip to content

Commit

Permalink
build(schematics): clean from rollup config instead of using rimraf (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
divdavem committed Feb 23, 2022
1 parent 1425962 commit 0a1275c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"ssr-app:build": "ng build ssr-app -c production && ng run ssr-app:server:production",
"test-app:serve": "ng serve test-app",
"test-app:build": "NG_BUILD_MANGLE=false ng build test-app -c production --source-map true",
"schematics:build": "rimraf schematics/dist && rollup --failAfterWarnings -c schematics/rollup.config.js",
"schematics:build": "rollup --failAfterWarnings -c schematics/rollup.config.js",
"schematics:tdd": "ts-node-dev --respawn --project schematics/tsconfig.json node_modules/jasmine/bin/jasmine schematics/**/*.spec.ts",
"schematics:test": "ts-node --project schematics/tsconfig.json node_modules/jasmine/bin/jasmine schematics/**/*.spec.ts",
"ci": "yarn test && yarn e2e && yarn build --progress false && yarn ssr"
Expand Down Expand Up @@ -136,7 +136,6 @@
"playwright": "^1.16.0",
"prismjs": "1.22.0",
"raw-loader": "^4.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.67.2",
"rxjs": "~7.4.0",
"ts-loader": "^8.0.9",
Expand Down
8 changes: 7 additions & 1 deletion schematics/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ const pkg = require("../package.json");
const typescript = require("@rollup/plugin-typescript");
const replace = require("@rollup/plugin-replace");
const path = require("path");
const {promises: fs} = require("fs");

const version = (str) => JSON.stringify(str.startsWith("^") ? str : "^" + str);

const distDir = path.join(__dirname, "dist");

const clean = () => ({async buildStart() { await fs.rm(distDir, {force: true, recursive: true}); }});

module.exports = [
{
output: {
dir: path.join(__dirname, "dist"),
dir: distDir,
format: "cjs",
exports: "named",
},
Expand All @@ -23,6 +28,7 @@ module.exports = [
dependency.startsWith(__dirname)
),
plugins: [
clean(),
replace({
preventAssignment: true,
"VERSIONS.BOOTSTRAP": version(pkg.devDependencies.bootstrap),
Expand Down

0 comments on commit 0a1275c

Please sign in to comment.