@smapiot/pilet-template-angular 0.15.4 → 0.15.6-beta.5446

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 CHANGED
@@ -1362,6 +1362,53 @@ __export(src_exports, {
1362
1362
  var import_path = require("path");
1363
1363
  var import_template_utils = __toESM(require_lib());
1364
1364
 
1365
+ // src/versions.ts
1366
+ var tsVersions = {
1367
+ 2: "~2.0",
1368
+ 4: "~2.1",
1369
+ 5: "2.4.2",
1370
+ 6: "~2.7",
1371
+ 7: "~3.1",
1372
+ 8: "~3.4",
1373
+ 9: "~3.8",
1374
+ 10: "~3.9",
1375
+ 11: "~4.0",
1376
+ 12: "~4.2",
1377
+ 13: "~4.4",
1378
+ 14: "~4.7",
1379
+ 15: "~4.8"
1380
+ };
1381
+ var rxjsVersions = {
1382
+ 2: "^5.0",
1383
+ 4: "^5.0",
1384
+ 5: "^5.0",
1385
+ 6: "~6.0",
1386
+ 7: "^6.3",
1387
+ 8: "^6.4",
1388
+ 9: "^6.5",
1389
+ 10: "^6.5",
1390
+ 11: "^6.5",
1391
+ 12: "^6.5",
1392
+ 13: "^7.4",
1393
+ 14: "^7.4",
1394
+ 15: "^7.4"
1395
+ };
1396
+ var zoneVersions = {
1397
+ 2: "~0.9",
1398
+ 4: "~0.9",
1399
+ 5: "~0.9",
1400
+ 6: "~0.9",
1401
+ 7: "~0.9",
1402
+ 8: "~0.9",
1403
+ 9: "~0.9",
1404
+ 10: "~0.9",
1405
+ 11: "~0.9",
1406
+ 12: "0.11.4",
1407
+ 13: "0.11.4",
1408
+ 14: "0.12.0",
1409
+ 15: "0.13.0"
1410
+ };
1411
+
1365
1412
  // src/helpers.ts
1366
1413
  function detectMode(piralInstance) {
1367
1414
  var _a, _b;
@@ -1384,7 +1431,7 @@ function detectNgVersion(piralInstance) {
1384
1431
  }
1385
1432
  return 14;
1386
1433
  }
1387
- function getStandalonePackageJson(cliVersion, ngVersion) {
1434
+ function getStandalonePackageJson(cliVersion, ngVersion, majorNgVersion) {
1388
1435
  return {
1389
1436
  importmap: {
1390
1437
  imports: {
@@ -1405,8 +1452,8 @@ function getStandalonePackageJson(cliVersion, ngVersion) {
1405
1452
  "@angular/router": ngVersion,
1406
1453
  "piral-ng": cliVersion,
1407
1454
  "core-js": "^3.19.0",
1408
- rxjs: "~7.4",
1409
- "zone.js": "~0.11"
1455
+ rxjs: rxjsVersions[majorNgVersion] || "^7.4",
1456
+ "zone.js": zoneVersions[majorNgVersion] || "^0.13"
1410
1457
  },
1411
1458
  devDependencies: {
1412
1459
  "@angular/compiler-cli": ngVersion,
@@ -1414,11 +1461,12 @@ function getStandalonePackageJson(cliVersion, ngVersion) {
1414
1461
  "@ngtools/webpack": ngVersion,
1415
1462
  "copy-webpack-plugin": "^10",
1416
1463
  "html-loader": "^3",
1417
- "to-string-loader": "^1"
1464
+ "to-string-loader": "^1",
1465
+ typescript: tsVersions[majorNgVersion] || "latest"
1418
1466
  }
1419
1467
  };
1420
1468
  }
1421
- function getStandardPackageJson(cliVersion, ngVersion) {
1469
+ function getStandardPackageJson(cliVersion, ngVersion, majorNgVersion) {
1422
1470
  return {
1423
1471
  devDependencies: {
1424
1472
  "@angular/compiler-cli": ngVersion,
@@ -1426,7 +1474,8 @@ function getStandardPackageJson(cliVersion, ngVersion) {
1426
1474
  "copy-webpack-plugin": "^10",
1427
1475
  "html-loader": "^3",
1428
1476
  "to-string-loader": "^1",
1429
- "piral-ng": cliVersion
1477
+ "piral-ng": cliVersion,
1478
+ typescript: tsVersions[majorNgVersion] || "latest"
1430
1479
  }
1431
1480
  };
1432
1481
  }
@@ -1441,9 +1490,11 @@ var src_default = (0, import_template_utils.createPiletTemplateFactory)(root, (p
1441
1490
  }
1442
1491
  if (typeof args.ngVersion !== "number") {
1443
1492
  args.ngVersion = detectNgVersion(piralInstance);
1493
+ } else if (args.ngVersion !== detectNgVersion(piralInstance)) {
1494
+ args.standalone = true;
1444
1495
  }
1445
1496
  const ngVersion = `^${args.ngVersion}`;
1446
- const packageJson = args.standalone ? getStandalonePackageJson(details.cliVersion, ngVersion) : getStandardPackageJson(details.cliVersion, ngVersion);
1497
+ const packageJson = args.standalone ? getStandalonePackageJson(details.cliVersion, ngVersion, args.ngVersion) : getStandardPackageJson(details.cliVersion, ngVersion, args.ngVersion);
1447
1498
  return [
1448
1499
  {
1449
1500
  languages: ["ts", "js"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smapiot/pilet-template-angular",
3
- "version": "0.15.4",
3
+ "version": "0.15.6-beta.5446",
4
4
  "description": "Official scaffolding template for pilets: 'angular'.",
5
5
  "keywords": [
6
6
  "piral-cli",
@@ -54,7 +54,7 @@
54
54
  "test": "echo \"Error: run tests from root\" && exit 1"
55
55
  },
56
56
  "devDependencies": {
57
- "@smapiot/template-utils": "^0.15.4"
57
+ "@smapiot/template-utils": "0.15.6-beta.5446"
58
58
  },
59
- "gitHead": "c7d21e5bd76b9878f610c62e4865186280d70094"
59
+ "gitHead": "105b1d32dc1c97d649503edfb0b2ffc5236c404e"
60
60
  }
package/src/helpers.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { rxjsVersions, tsVersions, zoneVersions } from './versions';
2
+
1
3
  export function detectMode(piralInstance: { details: any }) {
2
4
  const dependencies = piralInstance?.details?.dependencies || {};
3
5
  const devDependencies = piralInstance?.details?.devDependencies || {};
@@ -23,7 +25,7 @@ export function detectNgVersion(piralInstance: { details: any }) {
23
25
  return 14;
24
26
  }
25
27
 
26
- export function getStandalonePackageJson(cliVersion: string, ngVersion: string) {
28
+ export function getStandalonePackageJson(cliVersion: string, ngVersion: string, majorNgVersion: number) {
27
29
  return {
28
30
  importmap: {
29
31
  imports: {
@@ -44,8 +46,8 @@ export function getStandalonePackageJson(cliVersion: string, ngVersion: string)
44
46
  '@angular/router': ngVersion,
45
47
  'piral-ng': cliVersion,
46
48
  'core-js': '^3.19.0',
47
- rxjs: '~7.4',
48
- 'zone.js': '~0.11',
49
+ rxjs: rxjsVersions[majorNgVersion] || '^7.4',
50
+ 'zone.js': zoneVersions[majorNgVersion] || '^0.13',
49
51
  },
50
52
  devDependencies: {
51
53
  '@angular/compiler-cli': ngVersion,
@@ -54,11 +56,12 @@ export function getStandalonePackageJson(cliVersion: string, ngVersion: string)
54
56
  'copy-webpack-plugin': '^10',
55
57
  'html-loader': '^3',
56
58
  'to-string-loader': '^1',
59
+ typescript: tsVersions[majorNgVersion] || 'latest',
57
60
  },
58
61
  };
59
62
  }
60
63
 
61
- export function getStandardPackageJson(cliVersion: string, ngVersion: string) {
64
+ export function getStandardPackageJson(cliVersion: string, ngVersion: string, majorNgVersion: number) {
62
65
  return {
63
66
  devDependencies: {
64
67
  '@angular/compiler-cli': ngVersion,
@@ -67,6 +70,7 @@ export function getStandardPackageJson(cliVersion: string, ngVersion: string) {
67
70
  'html-loader': '^3',
68
71
  'to-string-loader': '^1',
69
72
  'piral-ng': cliVersion,
73
+ typescript: tsVersions[majorNgVersion] || 'latest',
70
74
  },
71
75
  };
72
76
  }
package/src/index.ts CHANGED
@@ -19,12 +19,14 @@ export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot,
19
19
 
20
20
  if (typeof args.ngVersion !== 'number') {
21
21
  args.ngVersion = detectNgVersion(piralInstance);
22
+ } else if (args.ngVersion !== detectNgVersion(piralInstance)) {
23
+ args.standalone = true;
22
24
  }
23
25
 
24
26
  const ngVersion = `^${args.ngVersion}`;
25
27
  const packageJson = args.standalone
26
- ? getStandalonePackageJson(details.cliVersion, ngVersion)
27
- : getStandardPackageJson(details.cliVersion, ngVersion);
28
+ ? getStandalonePackageJson(details.cliVersion, ngVersion, args.ngVersion)
29
+ : getStandardPackageJson(details.cliVersion, ngVersion, args.ngVersion);
28
30
 
29
31
  return [
30
32
  {
@@ -0,0 +1,50 @@
1
+ // Mapping of Angular to TypeScript versions
2
+ export const tsVersions = {
3
+ 2: '~2.0',
4
+ 4: '~2.1',
5
+ 5: '2.4.2',
6
+ 6: '~2.7',
7
+ 7: '~3.1',
8
+ 8: '~3.4',
9
+ 9: '~3.8',
10
+ 10: '~3.9',
11
+ 11: '~4.0',
12
+ 12: '~4.2',
13
+ 13: '~4.4',
14
+ 14: '~4.7',
15
+ 15: '~4.8',
16
+ };
17
+
18
+ // Mapping of Angular to RxJs versions
19
+ export const rxjsVersions = {
20
+ 2: '^5.0',
21
+ 4: '^5.0',
22
+ 5: '^5.0',
23
+ 6: '~6.0',
24
+ 7: '^6.3',
25
+ 8: '^6.4',
26
+ 9: '^6.5',
27
+ 10: '^6.5',
28
+ 11: '^6.5',
29
+ 12: '^6.5',
30
+ 13: '^7.4',
31
+ 14: '^7.4',
32
+ 15: '^7.4',
33
+ };
34
+
35
+ // Mapping of Angular to Zone.js versions
36
+ export const zoneVersions = {
37
+ 2: '~0.9',
38
+ 4: '~0.9',
39
+ 5: '~0.9',
40
+ 6: '~0.9',
41
+ 7: '~0.9',
42
+ 8: '~0.9',
43
+ 9: '~0.9',
44
+ 10: '~0.9',
45
+ 11: '~0.9',
46
+ 12: '0.11.4',
47
+ 13: '0.11.4',
48
+ 14: '0.12.0',
49
+ 15: '0.13.0',
50
+ };