@smapiot/pilet-template-angular 1.0.16-beta.8201 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +20 -15
- package/package.json +4 -4
- package/src/helpers.ts +6 -2
- package/src/index.ts +8 -7
- package/src/versions.ts +3 -0
- package/templates/index.standalone.tsx.ejs +2 -0
package/lib/index.js
CHANGED
|
@@ -1430,7 +1430,7 @@ var require_types = __commonJS({
|
|
|
1430
1430
|
var require_lib = __commonJS({
|
|
1431
1431
|
"../../packages/template-utils/lib/index.js"(exports2) {
|
|
1432
1432
|
"use strict";
|
|
1433
|
-
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
1433
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1434
1434
|
if (k2 === void 0) k2 = k;
|
|
1435
1435
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1436
1436
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
@@ -1439,10 +1439,10 @@ var require_lib = __commonJS({
|
|
|
1439
1439
|
} };
|
|
1440
1440
|
}
|
|
1441
1441
|
Object.defineProperty(o, k2, desc);
|
|
1442
|
-
} : function(o, m, k, k2) {
|
|
1442
|
+
}) : (function(o, m, k, k2) {
|
|
1443
1443
|
if (k2 === void 0) k2 = k;
|
|
1444
1444
|
o[k2] = m[k];
|
|
1445
|
-
});
|
|
1445
|
+
}));
|
|
1446
1446
|
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
1447
1447
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
1448
1448
|
};
|
|
@@ -1484,7 +1484,8 @@ var tsVersions = {
|
|
|
1484
1484
|
17: "~5.2",
|
|
1485
1485
|
18: "~5.5",
|
|
1486
1486
|
19: "~5.7",
|
|
1487
|
-
20: "~5.8"
|
|
1487
|
+
20: "~5.8",
|
|
1488
|
+
21: "~5.9"
|
|
1488
1489
|
};
|
|
1489
1490
|
var rxjsVersions = {
|
|
1490
1491
|
2: "^5.0",
|
|
@@ -1504,7 +1505,8 @@ var rxjsVersions = {
|
|
|
1504
1505
|
17: "^7.4",
|
|
1505
1506
|
18: "^7.4",
|
|
1506
1507
|
19: "^7.4",
|
|
1507
|
-
20: "^7.4"
|
|
1508
|
+
20: "^7.4",
|
|
1509
|
+
21: "^7.4"
|
|
1508
1510
|
};
|
|
1509
1511
|
var zoneVersions = {
|
|
1510
1512
|
2: "~0.9",
|
|
@@ -1524,7 +1526,8 @@ var zoneVersions = {
|
|
|
1524
1526
|
17: "~0.14",
|
|
1525
1527
|
18: "~0.14",
|
|
1526
1528
|
19: "~0.15",
|
|
1527
|
-
20: "~0.15"
|
|
1529
|
+
20: "~0.15",
|
|
1530
|
+
21: false
|
|
1528
1531
|
};
|
|
1529
1532
|
|
|
1530
1533
|
// src/helpers.ts
|
|
@@ -1538,7 +1541,7 @@ function detectNgVersion(piralInstance) {
|
|
|
1538
1541
|
const dependencies = piralInstance?.details?.dependencies || {};
|
|
1539
1542
|
const devDependencies = piralInstance?.details?.devDependencies || {};
|
|
1540
1543
|
const allDependencies = { ...devDependencies, ...dependencies };
|
|
1541
|
-
const version = allDependencies["@angular/core"] || "
|
|
1544
|
+
const version = allDependencies["@angular/core"] || "20.0.0";
|
|
1542
1545
|
if (typeof version === "string") {
|
|
1543
1546
|
const result = /\d+/.exec(version);
|
|
1544
1547
|
if (result) {
|
|
@@ -1551,6 +1554,8 @@ function isKnownVersion(majorNgVersion) {
|
|
|
1551
1554
|
return typeof zoneVersions[majorNgVersion] !== "undefined";
|
|
1552
1555
|
}
|
|
1553
1556
|
function getStandalonePackageJson(cliVersion, ngVersion, majorNgVersion) {
|
|
1557
|
+
const zoneVersion = zoneVersions[majorNgVersion];
|
|
1558
|
+
const extraDeps = typeof zoneVersion === "string" ? { "zone.js": zoneVersion } : {};
|
|
1554
1559
|
return {
|
|
1555
1560
|
importmap: {
|
|
1556
1561
|
imports: {
|
|
@@ -1574,7 +1579,7 @@ function getStandalonePackageJson(cliVersion, ngVersion, majorNgVersion) {
|
|
|
1574
1579
|
"piral-ng-common": ngVersion,
|
|
1575
1580
|
"core-js": "^3",
|
|
1576
1581
|
rxjs: rxjsVersions[majorNgVersion] || "^7.4",
|
|
1577
|
-
|
|
1582
|
+
...extraDeps
|
|
1578
1583
|
},
|
|
1579
1584
|
devDependencies: {
|
|
1580
1585
|
"@angular/compiler-cli": ngVersion,
|
|
@@ -1589,6 +1594,7 @@ function getStandalonePackageJson(cliVersion, ngVersion, majorNgVersion) {
|
|
|
1589
1594
|
}
|
|
1590
1595
|
function getStandardPackageJson(cliVersion, ngVersion, majorNgVersion) {
|
|
1591
1596
|
return {
|
|
1597
|
+
dependencies: {},
|
|
1592
1598
|
devDependencies: {
|
|
1593
1599
|
"@angular/compiler-cli": ngVersion,
|
|
1594
1600
|
"@angular/cli": ngVersion,
|
|
@@ -1631,6 +1637,7 @@ var index_default = (0, import_template_utils.createPiletTemplateFactory)(root,
|
|
|
1631
1637
|
}
|
|
1632
1638
|
const ngVersion = `^${args.ngVersion}`;
|
|
1633
1639
|
const packageJson = args.standalone ? getStandalonePackageJson(details.cliVersion, ngVersion, args.ngVersion) : getStandardPackageJson(details.cliVersion, ngVersion, args.ngVersion);
|
|
1640
|
+
args.withZone = "zone.js" in packageJson.dependencies;
|
|
1634
1641
|
const templates = [
|
|
1635
1642
|
{
|
|
1636
1643
|
languages: ["ts", "js"],
|
|
@@ -1685,13 +1692,11 @@ var index_default = (0, import_template_utils.createPiletTemplateFactory)(root,
|
|
|
1685
1692
|
}
|
|
1686
1693
|
];
|
|
1687
1694
|
if (args.ngStandalone) {
|
|
1688
|
-
templates.push(
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
}
|
|
1694
|
-
);
|
|
1695
|
+
templates.push({
|
|
1696
|
+
languages: ["ts"],
|
|
1697
|
+
name: "index.standalone.tsx",
|
|
1698
|
+
target: "<src>/index.tsx"
|
|
1699
|
+
});
|
|
1695
1700
|
} else {
|
|
1696
1701
|
templates.push(
|
|
1697
1702
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smapiot/pilet-template-angular",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "Official scaffolding template for pilets: 'angular'.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral-cli",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"ngVersion": {
|
|
31
31
|
"description": "Defines the (major) version of Angular to use in case of a standalone pilet.",
|
|
32
|
-
"default":
|
|
32
|
+
"default": 20,
|
|
33
33
|
"type": "number"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@smapiot/template-utils": "1.0.
|
|
62
|
+
"@smapiot/template-utils": "^1.0.17"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "eb7210cf002ada02748dde32b715bc88cc85276c"
|
|
65
65
|
}
|
package/src/helpers.ts
CHANGED
|
@@ -11,7 +11,7 @@ export function detectNgVersion(piralInstance: { details: any }) {
|
|
|
11
11
|
const dependencies = piralInstance?.details?.dependencies || {};
|
|
12
12
|
const devDependencies = piralInstance?.details?.devDependencies || {};
|
|
13
13
|
const allDependencies = { ...devDependencies, ...dependencies };
|
|
14
|
-
const version = allDependencies['@angular/core'] || '
|
|
14
|
+
const version = allDependencies['@angular/core'] || '20.0.0';
|
|
15
15
|
|
|
16
16
|
if (typeof version === 'string') {
|
|
17
17
|
const result = /\d+/.exec(version);
|
|
@@ -30,6 +30,9 @@ export function isKnownVersion(majorNgVersion: number) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function getStandalonePackageJson(cliVersion: string, ngVersion: string, majorNgVersion: number) {
|
|
33
|
+
const zoneVersion = zoneVersions[majorNgVersion];
|
|
34
|
+
const extraDeps = typeof zoneVersion === 'string' ? { 'zone.js': zoneVersion } : {};
|
|
35
|
+
|
|
33
36
|
return {
|
|
34
37
|
importmap: {
|
|
35
38
|
imports: {
|
|
@@ -53,7 +56,7 @@ export function getStandalonePackageJson(cliVersion: string, ngVersion: string,
|
|
|
53
56
|
'piral-ng-common': ngVersion,
|
|
54
57
|
'core-js': '^3',
|
|
55
58
|
rxjs: rxjsVersions[majorNgVersion] || '^7.4',
|
|
56
|
-
|
|
59
|
+
...extraDeps,
|
|
57
60
|
},
|
|
58
61
|
devDependencies: {
|
|
59
62
|
'@angular/compiler-cli': ngVersion,
|
|
@@ -69,6 +72,7 @@ export function getStandalonePackageJson(cliVersion: string, ngVersion: string,
|
|
|
69
72
|
|
|
70
73
|
export function getStandardPackageJson(cliVersion: string, ngVersion: string, majorNgVersion: number) {
|
|
71
74
|
return {
|
|
75
|
+
dependencies: {},
|
|
72
76
|
devDependencies: {
|
|
73
77
|
'@angular/compiler-cli': ngVersion,
|
|
74
78
|
'@angular/cli': ngVersion,
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ interface AngularPiletArgs {
|
|
|
14
14
|
standalone: boolean;
|
|
15
15
|
ngVersion: number;
|
|
16
16
|
ngStandalone: boolean;
|
|
17
|
+
withZone?: boolean;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot, args, details) => {
|
|
@@ -52,6 +53,8 @@ export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot,
|
|
|
52
53
|
? getStandalonePackageJson(details.cliVersion, ngVersion, args.ngVersion)
|
|
53
54
|
: getStandardPackageJson(details.cliVersion, ngVersion, args.ngVersion);
|
|
54
55
|
|
|
56
|
+
args.withZone = 'zone.js' in packageJson.dependencies;
|
|
57
|
+
|
|
55
58
|
const templates: Array<PiletTemplateSource> = [
|
|
56
59
|
{
|
|
57
60
|
languages: ['ts', 'js'],
|
|
@@ -107,13 +110,11 @@ export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot,
|
|
|
107
110
|
];
|
|
108
111
|
|
|
109
112
|
if (args.ngStandalone) {
|
|
110
|
-
templates.push(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
);
|
|
113
|
+
templates.push({
|
|
114
|
+
languages: ['ts'],
|
|
115
|
+
name: 'index.standalone.tsx',
|
|
116
|
+
target: '<src>/index.tsx',
|
|
117
|
+
});
|
|
117
118
|
} else {
|
|
118
119
|
templates.push(
|
|
119
120
|
{
|
package/src/versions.ts
CHANGED
|
@@ -20,6 +20,7 @@ export const tsVersions = {
|
|
|
20
20
|
18: '~5.5',
|
|
21
21
|
19: '~5.7',
|
|
22
22
|
20: '~5.8',
|
|
23
|
+
21: '~5.9',
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
// Mapping of Angular to RxJs versions
|
|
@@ -42,6 +43,7 @@ export const rxjsVersions = {
|
|
|
42
43
|
18: '^7.4',
|
|
43
44
|
19: '^7.4',
|
|
44
45
|
20: '^7.4',
|
|
46
|
+
21: '^7.4',
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
// Mapping of Angular to Zone.js versions
|
|
@@ -64,4 +66,5 @@ export const zoneVersions = {
|
|
|
64
66
|
18: '~0.14',
|
|
65
67
|
19: '~0.15',
|
|
66
68
|
20: '~0.15',
|
|
69
|
+
21: false,
|
|
67
70
|
};
|