Skip to content

Commit 34bae0c

Browse files
committed
chore: fix angular build
1 parent 411c18f commit 34bae0c

File tree

11 files changed

+966
-716
lines changed

11 files changed

+966
-716
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"karma-sinon": "^1.0.5",
9090
"karma-webpack": "5.0.0",
9191
"lint-staged": "^11.0.0",
92-
"ng-packagr": "~13.0.0",
92+
"ng-packagr": "~13.0.8",
9393
"postcss": "^8.3.9",
9494
"postcss-import": "^14.0.2",
9595
"postcss-preset-env": "^6.7.0",

packages/angular/ng-package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "../../node_modules/ng-packagr/package.schema.json",
3+
"lib": {
4+
"entryFile": "src/index.ts"
5+
},
6+
"allowedNonPeerDependencies": ["."]
7+
}

packages/angular/package.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,5 @@
1717
],
1818
"dependencies": {
1919
"@nativescript/zone-js": "~2.2.0"
20-
},
21-
"ngPackage": {
22-
"lib": {
23-
"entryFile": "src/index.ts",
24-
"umdModuleIds": {
25-
"@nativescript/core": "ns-core"
26-
}
27-
},
28-
"allowedNonPeerDependencies": [
29-
"."
30-
]
3120
}
3221
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3+
"lib": {
4+
"entryFile": "./src/index.ts"
5+
}
6+
}

packages/angular/polyfills/package.json

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

packages/angular/src/lib/application.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ function ZoneCanWorkSync() {
137137
* @returns if global.__drainMicrotaskQueue can be called
138138
*/
139139
function nativeQueueCanBeDrained(makeTestDrain: boolean) {
140-
if (typeof global.__drainMicrotaskQueue !== 'function') {
140+
if (typeof (global as any).__drainMicrotaskQueue !== 'function') {
141141
return false;
142142
}
143143
if (!makeTestDrain) {
144144
return true;
145145
}
146146
let canRunSync = false;
147147
Promise.resolve().then(() => (canRunSync = true));
148-
global.__drainMicrotaskQueue();
148+
(global as any).__drainMicrotaskQueue();
149149
return canRunSync;
150150
}
151151

@@ -162,7 +162,7 @@ function runSynchronously(fn: () => void, done?: () => void): void {
162162
}
163163
if (nativeQueueCanBeDrained(true)) {
164164
fn();
165-
global.__drainMicrotaskQueue();
165+
(global as any).__drainMicrotaskQueue();
166166
done?.();
167167
return;
168168
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3+
"lib": {
4+
"entryFile": "./src/index.ts"
5+
}
6+
}

packages/angular/testing/package.json

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

packages/angular/tsconfig.angular.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"@nativescript/core": ["../../node_modules/@nativescript/core"]
99
}
1010
},
11+
"files": ["src/index.ts"],
1112
"angularCompilerOptions": {
12-
"compilationMode": "partial"
13+
"compilationMode": "partial",
14+
"enableResourceInlining": true
1315
}
1416
}

tools/scripts/build-angular.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,34 @@ console.log(`Building ${npmScope}/${packageName}...${publish ? 'and publishing.'
1515

1616
// build angular package
1717
function buildAngular() {
18-
ngPackage
19-
.ngPackagr()
20-
.forProject(path.join('packages', packageName, 'package.json'))
21-
.withTsConfig(path.join('packages', packageName, 'tsconfig.angular.json'))
22-
.build()
23-
.then(() => {
24-
copyAngularDist();
25-
})
26-
.catch((error) => {
27-
console.error(error);
28-
process.exit(1);
29-
});
18+
ngPackage
19+
.ngPackagr()
20+
.forProject(path.join('packages', packageName, 'ng-package.json'))
21+
.withTsConfig(path.join('packages', packageName, 'tsconfig.angular.json'))
22+
.build()
23+
.then(() => {
24+
copyAngularDist();
25+
})
26+
.catch((error) => {
27+
console.error(error);
28+
process.exit(1);
29+
});
3030
}
3131

3232
// copy angular ng-packagr output to dist/packages/{name}
3333
function copyAngularDist() {
34-
fs.copy(path.join('packages', packageName, 'dist'), path.join('dist', 'packages', packageName))
35-
.then(() => {
36-
console.log(`${packageName} angular built successfully.`);
37-
finishPreparation();
38-
})
39-
.catch((err) => console.error(err));
34+
fs.copy(path.join('packages', packageName, 'dist'), path.join('dist', 'packages', packageName))
35+
.then(() => {
36+
console.log(`${packageName} angular built successfully.`);
37+
finishPreparation();
38+
})
39+
.catch((err) => console.error(err));
4040
}
4141

4242
function finishPreparation() {
43-
fs.copy(path.join('tools', 'assets', 'publishing'), path.join('dist', 'packages', packageName))
44-
.then(() => console.log(`${npmScope}/${packageName} ready to publish.`))
45-
.catch((err) => console.error(err));
43+
fs.copy(path.join('tools', 'assets', 'publishing'), path.join('dist', 'packages', packageName))
44+
.then(() => console.log(`${npmScope}/${packageName} ready to publish.`))
45+
.catch((err) => console.error(err));
4646
}
4747

4848
buildAngular();

0 commit comments

Comments
 (0)