Skip to content

Commit b7f01f6

Browse files
committed
Bundle schematics
1 parent 3c67b48 commit b7f01f6

File tree

4 files changed

+38
-43
lines changed

4 files changed

+38
-43
lines changed

package-lock.json

Lines changed: 3 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@angular/platform-browser-dynamic": "^19.0.0",
5656
"@angular/router": "^19.0.0",
5757
"@schematics/angular": "^19.0.0",
58+
"esbuild": "^0.24.0",
5859
"firebase": "^11.0.0",
5960
"firebase-functions": "^6.1.0",
6061
"fs-extra": "^8.0.1",

src/package.json

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,20 @@
2727
"@angular/core": "^19.0.0",
2828
"@angular/platform-browser": "^19.0.0",
2929
"@angular/platform-browser-dynamic": "^19.0.0",
30+
"@angular/platform-server": "^19.0.0",
3031
"rxjs": "~7.8.0",
3132
"firebase-tools": "^13.0.0"
3233
},
3334
"peerDependenciesMeta": {
34-
"firebase-tools": { "optional": true }
35+
"firebase-tools": { "optional": true },
36+
"@angular/platform-server": { "optional": true }
3537
},
3638
"dependencies": {
3739
"firebase": "^11.0.0",
3840
"rxfire": "^6.0.5",
3941
"@angular-devkit/schematics": "^19.0.0",
4042
"@schematics/angular": "^19.0.0",
41-
"tslib": "^2.3.0",
42-
"fuzzy": "^0.1.3",
43-
"inquirer-autocomplete-prompt": "^1.0.1",
44-
"open": "^8.0.0",
45-
"jsonc-parser": "^3.0.0",
46-
"ora": "^5.3.0",
47-
"winston": "^3.0.0",
48-
"triple-beam": "^1.3.0",
49-
"node-fetch": "^2.6.1",
50-
"semver": "^7.1.3",
51-
"inquirer": "^8.1.1",
52-
"fs-extra": "^8.0.1"
43+
"tslib": "^2.3.0"
5344
},
5445
"ng-update": {
5546
"migrations": "./schematics/migration.json"

tools/build.ts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { spawn } from 'cross-spawn';
22
import { copy, writeFile } from 'fs-extra';
33
import { join } from 'path';
44
import { keys as tsKeys } from 'ts-transformer-keys';
5+
import * as esbuild from "esbuild";
56

67
interface OverrideOptions {
78
exportName?: string;
@@ -165,16 +166,42 @@ function spawnPromise(command: string, args: string[]) {
165166
}
166167

167168
async function compileSchematics() {
168-
await spawnPromise(`npx`, ['tsc', '-p', src('schematics', 'tsconfig.json')]);
169-
return Promise.all([
169+
await esbuild.build({
170+
entryPoints: [
171+
src('schematics', "update", "index.ts"),
172+
src('schematics', "deploy", "actions.ts"),
173+
src('schematics', "deploy", "builder.ts"),
174+
src('schematics', "add", "index.ts"),
175+
src('schematics', "setup", "index.ts"),
176+
src('schematics', "update", "v7", "index.ts"),
177+
],
178+
format: "cjs",
179+
bundle: true,
180+
minify: true,
181+
platform: "node",
182+
target: "es2016",
183+
external: [
184+
"@angular-devkit/schematics",
185+
"@angular-devkit/architect",
186+
"@angular-devkit/core",
187+
"rxjs",
188+
"@schematics/angular",
189+
"jsonc-parser",
190+
"firebase-tools"
191+
],
192+
outdir: dest('schematics'),
193+
//outExtension: {".js": ".mjs"},
194+
});
195+
await Promise.all([
196+
copy(src('schematics', 'versions.json'), dest('schematics', 'versions.json')),
170197
copy(src('schematics', 'builders.json'), dest('schematics', 'builders.json')),
171198
copy(src('schematics', 'collection.json'), dest('schematics', 'collection.json')),
172199
copy(src('schematics', 'migration.json'), dest('schematics', 'migration.json')),
173200
copy(src('schematics', 'deploy', 'schema.json'), dest('schematics', 'deploy', 'schema.json')),
174201
copy(src('schematics', 'add', 'schema.json'), dest('schematics', 'add', 'schema.json')),
175202
copy(src('schematics', 'setup', 'schema.json'), dest('schematics', 'setup', 'schema.json')),
176-
replaceSchematicVersions()
177203
]);
204+
await replaceSchematicVersions();
178205
}
179206

180207
async function buildLibrary() {

0 commit comments

Comments
 (0)