From 51d75a0a502ad3d05858ad3876a41df1a0f34a72 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Mon, 5 Dec 2022 10:35:31 +0100 Subject: [PATCH] chore(ng-schematics): Use WireIt for builds and tests (#9356) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **What kind of change does this PR introduce?** It moves all the `ng-schematics` commands to WireIt **Did you add tests for your changes?** N/A **Summary** We want all our packages to use the same processes to build and test. This also allows us to have better build times and also watch mode 👀. **Does this PR introduce a breaking change?** No **Other information** --- .gitignore | 3 +- .prettierignore | 3 +- .vscode/extensions.json | 3 ++ packages/ng-schematics/package.json | 54 ++++++++++++++++++++--- packages/ng-schematics/tsconfig.json | 3 +- packages/ng-schematics/tsconfig.spec.json | 2 +- 6 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 .vscode/extensions.json diff --git a/.gitignore b/.gitignore index da41541f790..04c4e0e162b 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,8 @@ generated/ /.cache/ # IDE Artifacts -.vscode +.vscode/* +!.vscode/extensions.json .devcontainer # Misc diff --git a/.prettierignore b/.prettierignore index c3f732fa9d3..90dbef6a62e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -21,7 +21,8 @@ generated/ /.cache/ # IDE Artifacts -.vscode +.vscode/* +!.vscode/extensions.json .devcontainer # Misc diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000000..9c681f0665a --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["google.wireit"] +} diff --git a/packages/ng-schematics/package.json b/packages/ng-schematics/package.json index 2a6c3b898ad..81c47a4e0f0 100644 --- a/packages/ng-schematics/package.json +++ b/packages/ng-schematics/package.json @@ -3,13 +3,53 @@ "version": "0.1.0", "description": "Puppeteer Angular schematics", "scripts": { - "copy": "node copySchemaFiles.js", - "clean": "tsc -b --clean && rimraf lib", - "dev": "run-s clean copy && tsc -p tsconfig.json --watch", - "build": "run-s build:*", - "build:schematics": "npm run copy && tsc -p tsconfig.json", - "build:test": "tsc -p tsconfig.spec.json", - "test": "run-s clean build && mocha" + "dev": "npm run build --watch", + "dev:test": "npm run test --watch", + "copy": "wireit", + "build": "wireit", + "clean": "tsc --build --clean && rimraf lib", + "clean:test": "rimraf test/build", + "test": "wireit" + }, + "wireit": { + "copy": { + "clean": "if-file-deleted", + "command": "node copySchemaFiles.js", + "files": [ + "src/**/files/**", + "src/**/*.json" + ], + "output": [ + "lib/**/files/**", + "lib/**/*.json" + ], + "dependencies": [ + "clean" + ] + }, + "build": { + "command": "tsc -b", + "files": [ + "src/**/*.ts", + "!src/**/files", + "!src/**/*.json" + ], + "output": [ + "lib/**", + "!lib/**/files", + "!lib/**/*.json" + ], + "dependencies": [ + "copy" + ] + }, + "test": { + "command": "mocha", + "dependencies": [ + "clean:test", + "build" + ] + } }, "keywords": [ "angular", diff --git a/packages/ng-schematics/tsconfig.json b/packages/ng-schematics/tsconfig.json index 87c0e289ec7..115c833159c 100644 --- a/packages/ng-schematics/tsconfig.json +++ b/packages/ng-schematics/tsconfig.json @@ -14,5 +14,6 @@ "target": "ES6" }, "include": ["src/**/*"], - "exclude": ["src/**/files/**/*"] + "exclude": ["src/**/files/**/*"], + "references": [{"path": "./tsconfig.spec.json"}] } diff --git a/packages/ng-schematics/tsconfig.spec.json b/packages/ng-schematics/tsconfig.spec.json index 954ef7bfee3..8afa532cb13 100644 --- a/packages/ng-schematics/tsconfig.spec.json +++ b/packages/ng-schematics/tsconfig.spec.json @@ -5,6 +5,6 @@ "outDir": "test/build/", "types": ["node", "mocha"] }, - "include": ["test/**/*"], + "include": ["test/src/**/*"], "exclude": ["test/build/**/*"] }