@smapiot/pilet-template-angular 1.0.2 → 1.0.3

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
@@ -151,7 +151,7 @@ var require_log = __commonJS({
151
151
  logLevel = level;
152
152
  }
153
153
  exports.setLogLevel = setLogLevel;
154
- function log(level, message) {
154
+ function log2(level, message) {
155
155
  if (level === "error") {
156
156
  if (logLevel !== "disabled") {
157
157
  console.error(`[template] ${message}`);
@@ -170,7 +170,7 @@ var require_log = __commonJS({
170
170
  }
171
171
  }
172
172
  }
173
- exports.log = log;
173
+ exports.log = log2;
174
174
  }
175
175
  });
176
176
 
@@ -1348,6 +1348,7 @@ var require_lib = __commonJS({
1348
1348
  };
1349
1349
  Object.defineProperty(exports, "__esModule", { value: true });
1350
1350
  __exportStar(require_factory(), exports);
1351
+ __exportStar(require_log(), exports);
1351
1352
  __exportStar(require_template(), exports);
1352
1353
  __exportStar(require_types(), exports);
1353
1354
  __exportStar(require_utils2(), exports);
@@ -1434,16 +1435,20 @@ function detectNgVersion(piralInstance) {
1434
1435
  }
1435
1436
  return 14;
1436
1437
  }
1438
+ function isKnownVersion(majorNgVersion) {
1439
+ return typeof zoneVersions[majorNgVersion] !== "undefined";
1440
+ }
1437
1441
  function getStandalonePackageJson(cliVersion, ngVersion, majorNgVersion) {
1438
1442
  return {
1439
1443
  importmap: {
1440
1444
  imports: {
1441
- "@angular/common": "@angular/common",
1442
- "@angular/compiler": "@angular/compiler",
1443
- "@angular/core": "@angular/core",
1444
- "@angular/platform-browser": "@angular/platform-browser",
1445
- "@angular/platform-browser-dynamic": "@angular/platform-browser-dynamic",
1446
- "@angular/router": "@angular/router"
1445
+ "@angular/common": "",
1446
+ "@angular/compiler": "",
1447
+ "@angular/core": "",
1448
+ "@angular/platform-browser": "",
1449
+ "@angular/platform-browser-dynamic": "",
1450
+ "@angular/router": "",
1451
+ "piral-ng-common": ""
1447
1452
  }
1448
1453
  },
1449
1454
  dependencies: {
@@ -1454,6 +1459,7 @@ function getStandalonePackageJson(cliVersion, ngVersion, majorNgVersion) {
1454
1459
  "@angular/platform-browser-dynamic": ngVersion,
1455
1460
  "@angular/router": ngVersion,
1456
1461
  "piral-ng": cliVersion,
1462
+ "piral-ng-common": ngVersion,
1457
1463
  "core-js": "^3.19.0",
1458
1464
  rxjs: rxjsVersions[majorNgVersion] || "^7.4",
1459
1465
  "zone.js": zoneVersions[majorNgVersion] || "^0.13"
@@ -1496,6 +1502,11 @@ var src_default = (0, import_template_utils.createPiletTemplateFactory)(root, (p
1496
1502
  } else if (args.ngVersion !== detectNgVersion(piralInstance)) {
1497
1503
  args.standalone = true;
1498
1504
  }
1505
+ if (args.ngVersion < 9) {
1506
+ (0, import_template_utils.log)("warn", `Angular version ${args.ngVersion} is not officially supported. It might not work.`);
1507
+ } else if (isKnownVersion(args.ngVersion)) {
1508
+ (0, import_template_utils.log)("warn", `Angular version ${args.ngVersion} is not known and therefore not yet officially supported. It might not work.`);
1509
+ }
1499
1510
  const ngVersion = `^${args.ngVersion}`;
1500
1511
  const packageJson = args.standalone ? getStandalonePackageJson(details.cliVersion, ngVersion, args.ngVersion) : getStandardPackageJson(details.cliVersion, ngVersion, args.ngVersion);
1501
1512
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smapiot/pilet-template-angular",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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": "^1.0.2"
57
+ "@smapiot/template-utils": "^1.0.3"
58
58
  },
59
- "gitHead": "dd0dffc66c8087a5247e6f710e3cb96c6396aa0f"
59
+ "gitHead": "6fd3837caf7f3a9192fe768827ba673170bb6c6e"
60
60
  }
package/src/helpers.ts CHANGED
@@ -25,16 +25,21 @@ export function detectNgVersion(piralInstance: { details: any }) {
25
25
  return 14;
26
26
  }
27
27
 
28
+ export function isKnownVersion(majorNgVersion: number) {
29
+ return typeof zoneVersions[majorNgVersion] !== 'undefined';
30
+ }
31
+
28
32
  export function getStandalonePackageJson(cliVersion: string, ngVersion: string, majorNgVersion: number) {
29
33
  return {
30
34
  importmap: {
31
35
  imports: {
32
- '@angular/common': '@angular/common',
33
- '@angular/compiler': '@angular/compiler',
34
- '@angular/core': '@angular/core',
35
- '@angular/platform-browser': '@angular/platform-browser',
36
- '@angular/platform-browser-dynamic': '@angular/platform-browser-dynamic',
37
- '@angular/router': '@angular/router',
36
+ '@angular/common': '',
37
+ '@angular/compiler': '',
38
+ '@angular/core': '',
39
+ '@angular/platform-browser': '',
40
+ '@angular/platform-browser-dynamic': '',
41
+ '@angular/router': '',
42
+ 'piral-ng-common': '',
38
43
  },
39
44
  },
40
45
  dependencies: {
@@ -45,6 +50,7 @@ export function getStandalonePackageJson(cliVersion: string, ngVersion: string,
45
50
  '@angular/platform-browser-dynamic': ngVersion,
46
51
  '@angular/router': ngVersion,
47
52
  'piral-ng': cliVersion,
53
+ 'piral-ng-common': ngVersion,
48
54
  'core-js': '^3.19.0',
49
55
  rxjs: rxjsVersions[majorNgVersion] || '^7.4',
50
56
  'zone.js': zoneVersions[majorNgVersion] || '^0.13',
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve } from 'path';
2
- import { createPiletTemplateFactory, getPiralInstance } from '@smapiot/template-utils';
3
- import { detectMode, detectNgVersion, getStandalonePackageJson, getStandardPackageJson } from './helpers';
2
+ import { createPiletTemplateFactory, getPiralInstance, log } from '@smapiot/template-utils';
3
+ import { detectMode, detectNgVersion, getStandalonePackageJson, getStandardPackageJson, isKnownVersion } from './helpers';
4
4
 
5
5
  const root = resolve(__dirname, '..');
6
6
 
@@ -23,6 +23,12 @@ export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot,
23
23
  args.standalone = true;
24
24
  }
25
25
 
26
+ if (args.ngVersion < 9) {
27
+ log('warn', `Angular version ${args.ngVersion} is not officially supported. It might not work.`);
28
+ } else if (isKnownVersion(args.ngVersion)) {
29
+ log('warn', `Angular version ${args.ngVersion} is not known and therefore not yet officially supported. It might not work.`);
30
+ }
31
+
26
32
  const ngVersion = `^${args.ngVersion}`;
27
33
  const packageJson = args.standalone
28
34
  ? getStandalonePackageJson(details.cliVersion, ngVersion, args.ngVersion)