Skip to content

Commit

Permalink
feat(node): add deleteOutputPath option to @nrwl/node:webpack executor
Browse files Browse the repository at this point in the history
    ISSUES CLOSED: #9167
  • Loading branch information
jaytavares committed Apr 29, 2022
1 parent bef8240 commit 95a2cc2
Show file tree
Hide file tree
Showing 7 changed files with 5,160 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/generated/packages/node.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@
"type": "string",
"description": "The output path of the generated files."
},
"deleteOutputPath": {
"type": "boolean",
"description": "Delete the output path before building.",
"default": true
},
"watch": {
"type": "boolean",
"description": "Run build when files change.",
Expand Down
37 changes: 37 additions & 0 deletions e2e/node/src/node.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
import {
createFile,
checkFilesDoNotExist,
checkFilesExist,
killPorts,
Expand Down Expand Up @@ -285,6 +286,42 @@ describe('Build Node apps', () => {
);
}, 300000);

it('should remove previous output before building with the --deleteOutputPath option set', async () => {
const appName = uniq('app');
const libName = uniq('lib');

runCLI(
`generate @nrwl/node:app ${appName} --no-interactive --compiler swc`
);
runCLI(
`generate @nrwl/node:lib ${libName} --buildable --no-interactive --compiler swc`
);

createFile(`dist/apps/${appName}/_should_remove.txt`);
createFile(`dist/libs/${libName}/_should_remove.txt`);
createFile(`dist/apps/_should_not_remove.txt`);
checkFilesExist(
`dist/apps/${appName}/_should_remove.txt`,
`dist/apps/_should_not_remove.txt`
);
runCLI(`build ${appName} --outputHashing none`);
runCLI(`build ${libName}`);
checkFilesDoNotExist(
`dist/apps/${appName}/_should_remove.txt`,
`dist/libs/${libName}/_should_remove.txt`
);
checkFilesExist(`dist/apps/_should_not_remove.txt`);

// `delete-output-path`
createFile(`dist/apps/${appName}/_should_keep.txt`);
runCLI(`build ${appName} --delete-output-path=false --outputHashing none`);
checkFilesExist(`dist/apps/${appName}/_should_keep.txt`);

createFile(`dist/libs/${libName}/_should_keep.txt`);
runCLI(`build ${libName} --delete-output-path=false --outputHashing none`);
checkFilesExist(`dist/libs/${libName}/_should_keep.txt`);
}, 120000);

describe('NestJS', () => {
it('should have plugin output if specified in `tsPlugins`', async () => {
newProject();
Expand Down

0 comments on commit 95a2cc2

Please sign in to comment.