@smapiot/pilet-template-angular 1.0.6 → 1.0.7-beta.6258
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 +175 -146
- package/package.json +4 -4
- package/src/helpers.ts +2 -2
- package/src/versions.ts +3 -0
package/lib/index.js
CHANGED
|
@@ -43,6 +43,167 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
43
43
|
};
|
|
44
44
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
45
45
|
|
|
46
|
+
// ../../packages/template-utils/lib/log.js
|
|
47
|
+
var require_log = __commonJS({
|
|
48
|
+
"../../packages/template-utils/lib/log.js"(exports) {
|
|
49
|
+
"use strict";
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.log = exports.setLogLevel = void 0;
|
|
52
|
+
var logLevel = "warn";
|
|
53
|
+
function setLogLevel(level) {
|
|
54
|
+
logLevel = level;
|
|
55
|
+
}
|
|
56
|
+
exports.setLogLevel = setLogLevel;
|
|
57
|
+
function log2(level, message) {
|
|
58
|
+
if (level === "error") {
|
|
59
|
+
if (logLevel !== "disabled") {
|
|
60
|
+
console.error(`[template] ${message}`);
|
|
61
|
+
}
|
|
62
|
+
} else if (level === "warn") {
|
|
63
|
+
if (logLevel !== "error" && logLevel !== "disabled") {
|
|
64
|
+
console.warn(`[template] ${message}`);
|
|
65
|
+
}
|
|
66
|
+
} else if (level === "info") {
|
|
67
|
+
if (logLevel === "verbose" || logLevel === "info") {
|
|
68
|
+
console.info(`[template] ${message}`);
|
|
69
|
+
}
|
|
70
|
+
} else if (level === "verbose") {
|
|
71
|
+
if (logLevel === "verbose") {
|
|
72
|
+
console.log(`[template] ${message}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.log = log2;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// ../../packages/template-utils/lib/utils.js
|
|
81
|
+
var require_utils = __commonJS({
|
|
82
|
+
"../../packages/template-utils/lib/utils.js"(exports) {
|
|
83
|
+
"use strict";
|
|
84
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
|
+
exports.getLanguageExtension = exports.getPlugins = exports.getPiralInstance = exports.getProjectJson = exports.getPackageJsonWithSource = exports.makeRelative = void 0;
|
|
86
|
+
var path_1 = require("path");
|
|
87
|
+
var fs_1 = require("fs");
|
|
88
|
+
var log_1 = require_log();
|
|
89
|
+
function makeRelative(path, root2) {
|
|
90
|
+
const relPath = (0, path_1.isAbsolute)(path) ? (0, path_1.relative)(root2, path) : path;
|
|
91
|
+
return relPath.split(path_1.sep).join(path_1.posix.sep);
|
|
92
|
+
}
|
|
93
|
+
exports.makeRelative = makeRelative;
|
|
94
|
+
function getPackageJsonWithSource(root2, targetDir, fileName) {
|
|
95
|
+
const path = makeRelative(path_1.posix.join(targetDir, fileName), root2);
|
|
96
|
+
(0, log_1.log)("verbose", `Adding "source" to package.json: "${path}"`);
|
|
97
|
+
return {
|
|
98
|
+
languages: ["ts", "js"],
|
|
99
|
+
name: "package.json",
|
|
100
|
+
content: JSON.stringify({ source: path }),
|
|
101
|
+
target: "<root>/package.json"
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
exports.getPackageJsonWithSource = getPackageJsonWithSource;
|
|
105
|
+
function getProjectJson(root2) {
|
|
106
|
+
try {
|
|
107
|
+
return require(`${root2}/package.json`);
|
|
108
|
+
} catch (ex) {
|
|
109
|
+
(0, log_1.log)("error", `Error when reading the "package.json": ${ex}`);
|
|
110
|
+
}
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
113
|
+
exports.getProjectJson = getProjectJson;
|
|
114
|
+
function getPiralInstance2(root2, sourceName) {
|
|
115
|
+
try {
|
|
116
|
+
const packageJsonPath = require.resolve(`${sourceName}/package.json`, {
|
|
117
|
+
paths: [root2]
|
|
118
|
+
});
|
|
119
|
+
(0, log_1.log)("verbose", `Found package JSON in "${packageJsonPath}"`);
|
|
120
|
+
const sourcePath = (0, path_1.dirname)(packageJsonPath);
|
|
121
|
+
const details = require(packageJsonPath);
|
|
122
|
+
const types = details.types || details.typings;
|
|
123
|
+
(0, log_1.log)("verbose", `Looking for types in "${types}"`);
|
|
124
|
+
const typingsPath = types !== void 0 ? (0, path_1.resolve)(sourcePath, types) : void 0;
|
|
125
|
+
const app = details.app;
|
|
126
|
+
(0, log_1.log)("verbose", `Looking for types in "${app}"`);
|
|
127
|
+
const appPath = app !== void 0 ? (0, path_1.resolve)(sourcePath, app) : void 0;
|
|
128
|
+
return {
|
|
129
|
+
sourceName,
|
|
130
|
+
sourcePath,
|
|
131
|
+
details,
|
|
132
|
+
appPath,
|
|
133
|
+
typingsPath
|
|
134
|
+
};
|
|
135
|
+
} catch (ex) {
|
|
136
|
+
(0, log_1.log)("error", `Error when getting Piral instance: ${ex}`);
|
|
137
|
+
}
|
|
138
|
+
return void 0;
|
|
139
|
+
}
|
|
140
|
+
exports.getPiralInstance = getPiralInstance2;
|
|
141
|
+
function getPlugins(root2, sourceName) {
|
|
142
|
+
const plugins = {};
|
|
143
|
+
(0, log_1.log)("verbose", `Getting the plugins of "${sourceName}/package.json" ...`);
|
|
144
|
+
const piralInstance = getPiralInstance2(root2, sourceName);
|
|
145
|
+
const typingsPath = piralInstance === null || piralInstance === void 0 ? void 0 : piralInstance.typingsPath;
|
|
146
|
+
if (typingsPath) {
|
|
147
|
+
(0, log_1.log)("verbose", `Reading file in "${typingsPath}"`);
|
|
148
|
+
const typing = (0, fs_1.readFileSync)(typingsPath, "utf8");
|
|
149
|
+
const match = /export interface PiletCustomApi extends (.*?) \{/g.exec(typing);
|
|
150
|
+
if (!match) {
|
|
151
|
+
(0, log_1.log)("verbose", `No Piral instance plugins have been found`);
|
|
152
|
+
return [];
|
|
153
|
+
}
|
|
154
|
+
const apis = match[1].split(", ");
|
|
155
|
+
(0, log_1.log)("verbose", `Found Piral instance plugins "${match[1]}"`);
|
|
156
|
+
for (const api of apis) {
|
|
157
|
+
const pluginMatch = /^Pilet(.*)Api$/.exec(api);
|
|
158
|
+
if (pluginMatch) {
|
|
159
|
+
const name = pluginMatch[1].toLowerCase();
|
|
160
|
+
plugins[name] = true;
|
|
161
|
+
} else {
|
|
162
|
+
(0, log_1.log)("warn", `Could not find plugin for Pilet API "${api}"`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return plugins;
|
|
167
|
+
}
|
|
168
|
+
exports.getPlugins = getPlugins;
|
|
169
|
+
function getLanguageExtension(language, isJsx = true) {
|
|
170
|
+
switch (language) {
|
|
171
|
+
case "js":
|
|
172
|
+
return isJsx ? ".jsx" : ".js";
|
|
173
|
+
case "ts":
|
|
174
|
+
default:
|
|
175
|
+
return isJsx ? ".tsx" : ".ts";
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
exports.getLanguageExtension = getLanguageExtension;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// ../../packages/template-utils/lib/bundler.js
|
|
183
|
+
var require_bundler = __commonJS({
|
|
184
|
+
"../../packages/template-utils/lib/bundler.js"(exports) {
|
|
185
|
+
"use strict";
|
|
186
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
187
|
+
exports.detectBundler = void 0;
|
|
188
|
+
var utils_1 = require_utils();
|
|
189
|
+
function detectBundler(root2) {
|
|
190
|
+
const projectJson = (0, utils_1.getProjectJson)(root2);
|
|
191
|
+
const devDependencies = projectJson === null || projectJson === void 0 ? void 0 : projectJson.devDependencies;
|
|
192
|
+
if (projectJson) {
|
|
193
|
+
const bundlers = ["esbuild", "webpack5", "webpack", "vite", "parcel2", "parcel", "bun", "rspack", "rollup"];
|
|
194
|
+
for (const bundler of bundlers) {
|
|
195
|
+
const dependencyName = `piral-cli-${bundler}`;
|
|
196
|
+
if (dependencyName in devDependencies) {
|
|
197
|
+
return bundler;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return "xbuild";
|
|
202
|
+
}
|
|
203
|
+
exports.detectBundler = detectBundler;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
46
207
|
// ../../packages/template-utils/lib/merge.js
|
|
47
208
|
var require_merge = __commonJS({
|
|
48
209
|
"../../packages/template-utils/lib/merge.js"(exports) {
|
|
@@ -140,40 +301,6 @@ var require_io = __commonJS({
|
|
|
140
301
|
}
|
|
141
302
|
});
|
|
142
303
|
|
|
143
|
-
// ../../packages/template-utils/lib/log.js
|
|
144
|
-
var require_log = __commonJS({
|
|
145
|
-
"../../packages/template-utils/lib/log.js"(exports) {
|
|
146
|
-
"use strict";
|
|
147
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
148
|
-
exports.log = exports.setLogLevel = void 0;
|
|
149
|
-
var logLevel = "warn";
|
|
150
|
-
function setLogLevel(level) {
|
|
151
|
-
logLevel = level;
|
|
152
|
-
}
|
|
153
|
-
exports.setLogLevel = setLogLevel;
|
|
154
|
-
function log2(level, message) {
|
|
155
|
-
if (level === "error") {
|
|
156
|
-
if (logLevel !== "disabled") {
|
|
157
|
-
console.error(`[template] ${message}`);
|
|
158
|
-
}
|
|
159
|
-
} else if (level === "warn") {
|
|
160
|
-
if (logLevel !== "error" && logLevel !== "disabled") {
|
|
161
|
-
console.warn(`[template] ${message}`);
|
|
162
|
-
}
|
|
163
|
-
} else if (level === "info") {
|
|
164
|
-
if (logLevel === "verbose" || logLevel === "info") {
|
|
165
|
-
console.info(`[template] ${message}`);
|
|
166
|
-
}
|
|
167
|
-
} else if (level === "verbose") {
|
|
168
|
-
if (logLevel === "verbose") {
|
|
169
|
-
console.log(`[template] ${message}`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
exports.log = log2;
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
|
|
177
304
|
// ../../packages/template-utils/lib/version.js
|
|
178
305
|
var require_version = __commonJS({
|
|
179
306
|
"../../packages/template-utils/lib/version.js"(exports) {
|
|
@@ -364,7 +491,7 @@ var require_parent = __commonJS({
|
|
|
364
491
|
});
|
|
365
492
|
|
|
366
493
|
// ../../node_modules/ejs/lib/utils.js
|
|
367
|
-
var
|
|
494
|
+
var require_utils2 = __commonJS({
|
|
368
495
|
"../../node_modules/ejs/lib/utils.js"(exports) {
|
|
369
496
|
"use strict";
|
|
370
497
|
var regExpChars = /[|\\{}()[\]^$+*?.]/g;
|
|
@@ -486,7 +613,7 @@ var require_ejs = __commonJS({
|
|
|
486
613
|
"use strict";
|
|
487
614
|
var fs = require("fs");
|
|
488
615
|
var path = require("path");
|
|
489
|
-
var utils =
|
|
616
|
+
var utils = require_utils2();
|
|
490
617
|
var scopeOptionWarned = false;
|
|
491
618
|
var _VERSION_STRING = require_package().version;
|
|
492
619
|
var _DEFAULT_OPEN_DELIMITER = "<";
|
|
@@ -1041,108 +1168,6 @@ var require_ejs = __commonJS({
|
|
|
1041
1168
|
}
|
|
1042
1169
|
});
|
|
1043
1170
|
|
|
1044
|
-
// ../../packages/template-utils/lib/utils.js
|
|
1045
|
-
var require_utils2 = __commonJS({
|
|
1046
|
-
"../../packages/template-utils/lib/utils.js"(exports) {
|
|
1047
|
-
"use strict";
|
|
1048
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1049
|
-
exports.getLanguageExtension = exports.getPlugins = exports.getPiralInstance = exports.getProjectJson = exports.getPackageJsonWithSource = exports.makeRelative = void 0;
|
|
1050
|
-
var path_1 = require("path");
|
|
1051
|
-
var fs_1 = require("fs");
|
|
1052
|
-
var log_1 = require_log();
|
|
1053
|
-
function makeRelative(path, root2) {
|
|
1054
|
-
const relPath = (0, path_1.isAbsolute)(path) ? (0, path_1.relative)(root2, path) : path;
|
|
1055
|
-
return relPath.split(path_1.sep).join(path_1.posix.sep);
|
|
1056
|
-
}
|
|
1057
|
-
exports.makeRelative = makeRelative;
|
|
1058
|
-
function getPackageJsonWithSource(root2, targetDir, fileName) {
|
|
1059
|
-
const path = makeRelative(path_1.posix.join(targetDir, fileName), root2);
|
|
1060
|
-
(0, log_1.log)("verbose", `Adding "source" to package.json: "${path}"`);
|
|
1061
|
-
return {
|
|
1062
|
-
languages: ["ts", "js"],
|
|
1063
|
-
name: "package.json",
|
|
1064
|
-
content: JSON.stringify({ source: path }),
|
|
1065
|
-
target: "<root>/package.json"
|
|
1066
|
-
};
|
|
1067
|
-
}
|
|
1068
|
-
exports.getPackageJsonWithSource = getPackageJsonWithSource;
|
|
1069
|
-
function getProjectJson(root2) {
|
|
1070
|
-
try {
|
|
1071
|
-
return require(`${root2}/package.json`);
|
|
1072
|
-
} catch (ex) {
|
|
1073
|
-
(0, log_1.log)("error", `Error when reading the "package.json": ${ex}`);
|
|
1074
|
-
}
|
|
1075
|
-
return void 0;
|
|
1076
|
-
}
|
|
1077
|
-
exports.getProjectJson = getProjectJson;
|
|
1078
|
-
function getPiralInstance2(root2, sourceName) {
|
|
1079
|
-
try {
|
|
1080
|
-
const packageJsonPath = require.resolve(`${sourceName}/package.json`, {
|
|
1081
|
-
paths: [root2]
|
|
1082
|
-
});
|
|
1083
|
-
(0, log_1.log)("verbose", `Found package JSON in "${packageJsonPath}"`);
|
|
1084
|
-
const sourcePath = (0, path_1.dirname)(packageJsonPath);
|
|
1085
|
-
const details = require(packageJsonPath);
|
|
1086
|
-
const types = details.types || details.typings;
|
|
1087
|
-
(0, log_1.log)("verbose", `Looking for types in "${types}"`);
|
|
1088
|
-
const typingsPath = types !== void 0 ? (0, path_1.resolve)(sourcePath, types) : void 0;
|
|
1089
|
-
const app = details.app;
|
|
1090
|
-
(0, log_1.log)("verbose", `Looking for types in "${app}"`);
|
|
1091
|
-
const appPath = app !== void 0 ? (0, path_1.resolve)(sourcePath, app) : void 0;
|
|
1092
|
-
return {
|
|
1093
|
-
sourceName,
|
|
1094
|
-
sourcePath,
|
|
1095
|
-
details,
|
|
1096
|
-
appPath,
|
|
1097
|
-
typingsPath
|
|
1098
|
-
};
|
|
1099
|
-
} catch (ex) {
|
|
1100
|
-
(0, log_1.log)("error", `Error when getting Piral instance: ${ex}`);
|
|
1101
|
-
}
|
|
1102
|
-
return void 0;
|
|
1103
|
-
}
|
|
1104
|
-
exports.getPiralInstance = getPiralInstance2;
|
|
1105
|
-
function getPlugins(root2, sourceName) {
|
|
1106
|
-
const plugins = {};
|
|
1107
|
-
(0, log_1.log)("verbose", `Getting the plugins of "${sourceName}/package.json" ...`);
|
|
1108
|
-
const piralInstance = getPiralInstance2(root2, sourceName);
|
|
1109
|
-
const typingsPath = piralInstance === null || piralInstance === void 0 ? void 0 : piralInstance.typingsPath;
|
|
1110
|
-
if (typingsPath) {
|
|
1111
|
-
(0, log_1.log)("verbose", `Reading file in "${typingsPath}"`);
|
|
1112
|
-
const typing = (0, fs_1.readFileSync)(typingsPath, "utf8");
|
|
1113
|
-
const match = /export interface PiletCustomApi extends (.*?) \{/g.exec(typing);
|
|
1114
|
-
if (!match) {
|
|
1115
|
-
(0, log_1.log)("verbose", `No Piral instance plugins have been found`);
|
|
1116
|
-
return [];
|
|
1117
|
-
}
|
|
1118
|
-
const apis = match[1].split(", ");
|
|
1119
|
-
(0, log_1.log)("verbose", `Found Piral instance plugins "${match[1]}"`);
|
|
1120
|
-
for (const api of apis) {
|
|
1121
|
-
const pluginMatch = /^Pilet(.*)Api$/.exec(api);
|
|
1122
|
-
if (pluginMatch) {
|
|
1123
|
-
const name = pluginMatch[1].toLowerCase();
|
|
1124
|
-
plugins[name] = true;
|
|
1125
|
-
} else {
|
|
1126
|
-
(0, log_1.log)("warn", `Could not find plugin for Pilet API "${api}"`);
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
return plugins;
|
|
1131
|
-
}
|
|
1132
|
-
exports.getPlugins = getPlugins;
|
|
1133
|
-
function getLanguageExtension(language, isJsx = true) {
|
|
1134
|
-
switch (language) {
|
|
1135
|
-
case "js":
|
|
1136
|
-
return isJsx ? ".jsx" : ".js";
|
|
1137
|
-
case "ts":
|
|
1138
|
-
default:
|
|
1139
|
-
return isJsx ? ".tsx" : ".ts";
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
exports.getLanguageExtension = getLanguageExtension;
|
|
1143
|
-
}
|
|
1144
|
-
});
|
|
1145
|
-
|
|
1146
1171
|
// ../../packages/template-utils/lib/template.js
|
|
1147
1172
|
var require_template = __commonJS({
|
|
1148
1173
|
"../../packages/template-utils/lib/template.js"(exports) {
|
|
@@ -1179,7 +1204,7 @@ var require_template = __commonJS({
|
|
|
1179
1204
|
var path_1 = require("path");
|
|
1180
1205
|
var ejs_1 = require_ejs();
|
|
1181
1206
|
var log_1 = require_log();
|
|
1182
|
-
var utils_1 =
|
|
1207
|
+
var utils_1 = require_utils();
|
|
1183
1208
|
var findVariable = /<(\w+)>/g;
|
|
1184
1209
|
function replaceVariables(str, data) {
|
|
1185
1210
|
let match = findVariable.exec(str);
|
|
@@ -1274,7 +1299,7 @@ var require_factory = __commonJS({
|
|
|
1274
1299
|
var io_1 = require_io();
|
|
1275
1300
|
var parent_1 = require_parent();
|
|
1276
1301
|
var template_1 = require_template();
|
|
1277
|
-
var utils_1 =
|
|
1302
|
+
var utils_1 = require_utils();
|
|
1278
1303
|
function createPiletTemplateFactory2(templateRoot, getAllSources, defaultArgs = {}) {
|
|
1279
1304
|
const sourceDir = (0, path_1.resolve)(templateRoot, "templates");
|
|
1280
1305
|
return (projectRoot, args, details) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1356,11 +1381,12 @@ var require_lib = __commonJS({
|
|
|
1356
1381
|
__createBinding(exports2, m, p);
|
|
1357
1382
|
};
|
|
1358
1383
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1384
|
+
__exportStar(require_bundler(), exports);
|
|
1359
1385
|
__exportStar(require_factory(), exports);
|
|
1360
1386
|
__exportStar(require_log(), exports);
|
|
1361
1387
|
__exportStar(require_template(), exports);
|
|
1362
1388
|
__exportStar(require_types(), exports);
|
|
1363
|
-
__exportStar(
|
|
1389
|
+
__exportStar(require_utils(), exports);
|
|
1364
1390
|
}
|
|
1365
1391
|
});
|
|
1366
1392
|
|
|
@@ -1387,7 +1413,8 @@ var tsVersions = {
|
|
|
1387
1413
|
13: "~4.4",
|
|
1388
1414
|
14: "~4.7",
|
|
1389
1415
|
15: "~4.8",
|
|
1390
|
-
16: "~4.9"
|
|
1416
|
+
16: "~4.9",
|
|
1417
|
+
17: "~5.2"
|
|
1391
1418
|
};
|
|
1392
1419
|
var rxjsVersions = {
|
|
1393
1420
|
2: "^5.0",
|
|
@@ -1403,7 +1430,8 @@ var rxjsVersions = {
|
|
|
1403
1430
|
13: "^7.4",
|
|
1404
1431
|
14: "^7.4",
|
|
1405
1432
|
15: "^7.4",
|
|
1406
|
-
16: "^7.4"
|
|
1433
|
+
16: "^7.4",
|
|
1434
|
+
17: "^7.4"
|
|
1407
1435
|
};
|
|
1408
1436
|
var zoneVersions = {
|
|
1409
1437
|
2: "~0.9",
|
|
@@ -1419,7 +1447,8 @@ var zoneVersions = {
|
|
|
1419
1447
|
13: "0.11.4",
|
|
1420
1448
|
14: "0.12.0",
|
|
1421
1449
|
15: "0.13.0",
|
|
1422
|
-
16: "0.13.0"
|
|
1450
|
+
16: "0.13.0",
|
|
1451
|
+
17: "0.14.0"
|
|
1423
1452
|
};
|
|
1424
1453
|
|
|
1425
1454
|
// src/helpers.ts
|
|
@@ -1435,14 +1464,14 @@ function detectNgVersion(piralInstance) {
|
|
|
1435
1464
|
const dependencies = ((_a = piralInstance == null ? void 0 : piralInstance.details) == null ? void 0 : _a.dependencies) || {};
|
|
1436
1465
|
const devDependencies = ((_b = piralInstance == null ? void 0 : piralInstance.details) == null ? void 0 : _b.devDependencies) || {};
|
|
1437
1466
|
const allDependencies = __spreadValues(__spreadValues({}, devDependencies), dependencies);
|
|
1438
|
-
const version = allDependencies["@angular/core"] || "
|
|
1467
|
+
const version = allDependencies["@angular/core"] || "17.0.0";
|
|
1439
1468
|
if (typeof version === "string") {
|
|
1440
1469
|
const result = /\d+/.exec(version);
|
|
1441
1470
|
if (result) {
|
|
1442
1471
|
return +result[0];
|
|
1443
1472
|
}
|
|
1444
1473
|
}
|
|
1445
|
-
return
|
|
1474
|
+
return 17;
|
|
1446
1475
|
}
|
|
1447
1476
|
function isKnownVersion(majorNgVersion) {
|
|
1448
1477
|
return typeof zoneVersions[majorNgVersion] !== "undefined";
|
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.7-beta.6258",
|
|
4
4
|
"description": "Official scaffolding template for pilets: 'angular'.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral-cli",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"ngVersion": {
|
|
26
26
|
"description": "Defines the (major) version of Angular to use in case of a standalone pilet.",
|
|
27
|
-
"default":
|
|
27
|
+
"default": 17,
|
|
28
28
|
"type": "number"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@smapiot/template-utils": "
|
|
57
|
+
"@smapiot/template-utils": "1.0.7-beta.6258"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "0af617390450f6cd8daf2fa32c7cbcccdc3cb994"
|
|
60
60
|
}
|
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'] || '17.0.0';
|
|
15
15
|
|
|
16
16
|
if (typeof version === 'string') {
|
|
17
17
|
const result = /\d+/.exec(version);
|
|
@@ -22,7 +22,7 @@ export function detectNgVersion(piralInstance: { details: any }) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
return
|
|
25
|
+
return 17;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export function isKnownVersion(majorNgVersion: number) {
|
package/src/versions.ts
CHANGED
|
@@ -14,6 +14,7 @@ export const tsVersions = {
|
|
|
14
14
|
14: '~4.7',
|
|
15
15
|
15: '~4.8',
|
|
16
16
|
16: '~4.9',
|
|
17
|
+
17: '~5.2',
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
// Mapping of Angular to RxJs versions
|
|
@@ -32,6 +33,7 @@ export const rxjsVersions = {
|
|
|
32
33
|
14: '^7.4',
|
|
33
34
|
15: '^7.4',
|
|
34
35
|
16: '^7.4',
|
|
36
|
+
17: '^7.4',
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
// Mapping of Angular to Zone.js versions
|
|
@@ -50,4 +52,5 @@ export const zoneVersions = {
|
|
|
50
52
|
14: '0.12.0',
|
|
51
53
|
15: '0.13.0',
|
|
52
54
|
16: '0.13.0',
|
|
55
|
+
17: '0.14.0',
|
|
53
56
|
};
|