@smapiot/pilet-template-angular 0.15.0-beta.4612 → 0.15.0-beta.4835
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 +77 -12
- package/package.json +3 -3
- package/src/helpers.ts +9 -8
- package/templates/index.tsx.ejs +1 -0
package/lib/index.js
CHANGED
|
@@ -46,9 +46,73 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
46
46
|
// ../../packages/template-utils/lib/merge.js
|
|
47
47
|
var require_merge = __commonJS({
|
|
48
48
|
"../../packages/template-utils/lib/merge.js"(exports) {
|
|
49
|
+
"use strict";
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.deepMerge = void 0;
|
|
52
|
+
function isMergeableObject(val) {
|
|
53
|
+
const nonNullObject = val && typeof val === "object";
|
|
54
|
+
return nonNullObject && Object.prototype.toString.call(val) !== "[object RegExp]" && Object.prototype.toString.call(val) !== "[object Date]";
|
|
55
|
+
}
|
|
56
|
+
function emptyTarget(val) {
|
|
57
|
+
return Array.isArray(val) ? [] : {};
|
|
58
|
+
}
|
|
59
|
+
function cloneIfNecessary(value) {
|
|
60
|
+
switch (typeof value) {
|
|
61
|
+
case "boolean":
|
|
62
|
+
case "number":
|
|
63
|
+
case "string":
|
|
64
|
+
case "symbol":
|
|
65
|
+
case "undefined":
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
return deepMerge(emptyTarget(value), value);
|
|
69
|
+
}
|
|
70
|
+
function defaultArrayMerge(target, source) {
|
|
71
|
+
const destination = target.slice();
|
|
72
|
+
source.forEach((e, i) => {
|
|
73
|
+
if (typeof destination[i] === "undefined") {
|
|
74
|
+
destination[i] = cloneIfNecessary(e);
|
|
75
|
+
} else if (isMergeableObject(e)) {
|
|
76
|
+
destination[i] = deepMerge(target[i], e);
|
|
77
|
+
} else if (target.indexOf(e) === -1) {
|
|
78
|
+
destination.push(cloneIfNecessary(e));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return destination;
|
|
82
|
+
}
|
|
83
|
+
function mergeObject(target, source) {
|
|
84
|
+
const destination = {};
|
|
85
|
+
if (isMergeableObject(target)) {
|
|
86
|
+
Object.keys(target).forEach((key) => {
|
|
87
|
+
destination[key] = cloneIfNecessary(target[key]);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
Object.keys(source).forEach((key) => {
|
|
91
|
+
if (!isMergeableObject(source[key]) || !target[key]) {
|
|
92
|
+
destination[key] = cloneIfNecessary(source[key]);
|
|
93
|
+
} else {
|
|
94
|
+
destination[key] = deepMerge(target[key], source[key]);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return destination;
|
|
98
|
+
}
|
|
99
|
+
function deepMerge(target, source) {
|
|
100
|
+
if (Array.isArray(source)) {
|
|
101
|
+
return Array.isArray(target) ? defaultArrayMerge(target, source) : cloneIfNecessary(source);
|
|
102
|
+
}
|
|
103
|
+
return mergeObject(target, source);
|
|
104
|
+
}
|
|
105
|
+
exports.deepMerge = deepMerge;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// ../../packages/template-utils/lib/io.js
|
|
110
|
+
var require_io = __commonJS({
|
|
111
|
+
"../../packages/template-utils/lib/io.js"(exports) {
|
|
49
112
|
"use strict";
|
|
50
113
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
114
|
exports.mergeFiles = void 0;
|
|
115
|
+
var merge_1 = require_merge();
|
|
52
116
|
function mergeFiles(files) {
|
|
53
117
|
const result = {};
|
|
54
118
|
for (const file of files) {
|
|
@@ -62,7 +126,7 @@ var require_merge = __commonJS({
|
|
|
62
126
|
return Object.keys(result).map((path) => {
|
|
63
127
|
const items = result[path];
|
|
64
128
|
if (items.length !== 1 && path.endsWith("package.json")) {
|
|
65
|
-
const obj = items.map(({ content }) => JSON.parse(content.toString("utf8"))).reduce((p, c) =>
|
|
129
|
+
const obj = items.map(({ content }) => JSON.parse(content.toString("utf8"))).reduce((p, c) => (0, merge_1.deepMerge)(p, c), {});
|
|
66
130
|
const str = JSON.stringify(obj);
|
|
67
131
|
return {
|
|
68
132
|
path,
|
|
@@ -1175,7 +1239,7 @@ var require_factory = __commonJS({
|
|
|
1175
1239
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1176
1240
|
exports.createPiralTemplateFactory = exports.createPiletTemplateFactory = void 0;
|
|
1177
1241
|
var path_1 = require("path");
|
|
1178
|
-
var
|
|
1242
|
+
var io_1 = require_io();
|
|
1179
1243
|
var template_1 = require_template();
|
|
1180
1244
|
var parent_1 = require_parent();
|
|
1181
1245
|
var utils_1 = require_utils2();
|
|
@@ -1199,7 +1263,7 @@ var require_factory = __commonJS({
|
|
|
1199
1263
|
});
|
|
1200
1264
|
const defaultSource = (0, utils_1.getPackageJsonWithSource)(data.projectRoot, data.src, `index${data.extension}`);
|
|
1201
1265
|
const files = yield Promise.all([...sources, defaultSource].map((source) => (0, template_1.getFileFromTemplate)(sourceDir, source, data)));
|
|
1202
|
-
return (0,
|
|
1266
|
+
return (0, io_1.mergeFiles)(files);
|
|
1203
1267
|
});
|
|
1204
1268
|
}
|
|
1205
1269
|
exports.createPiletTemplateFactory = createPiletTemplateFactory2;
|
|
@@ -1224,7 +1288,7 @@ var require_factory = __commonJS({
|
|
|
1224
1288
|
mocks
|
|
1225
1289
|
});
|
|
1226
1290
|
const files = yield Promise.all(sources.map((source) => (0, template_1.getFileFromTemplate)(sourceDir, source, data)));
|
|
1227
|
-
return (0,
|
|
1291
|
+
return (0, io_1.mergeFiles)(files);
|
|
1228
1292
|
});
|
|
1229
1293
|
}
|
|
1230
1294
|
exports.createPiralTemplateFactory = createPiralTemplateFactory;
|
|
@@ -1301,14 +1365,14 @@ function getStandalonePackageJson(cliVersion, ngVersion) {
|
|
|
1301
1365
|
return {
|
|
1302
1366
|
importmap: {
|
|
1303
1367
|
imports: {
|
|
1304
|
-
"@angular/animations": "
|
|
1305
|
-
"@angular/common": "
|
|
1306
|
-
"@angular/compiler": "
|
|
1307
|
-
"@angular/core": "
|
|
1308
|
-
"@angular/forms": "
|
|
1309
|
-
"@angular/platform-browser": "
|
|
1310
|
-
"@angular/platform-browser-dynamic": "
|
|
1311
|
-
"@angular/router": "
|
|
1368
|
+
"@angular/animations": "@angular/animations",
|
|
1369
|
+
"@angular/common": "@angular/common",
|
|
1370
|
+
"@angular/compiler": "@angular/compiler",
|
|
1371
|
+
"@angular/core": "@angular/core",
|
|
1372
|
+
"@angular/forms": "@angular/forms",
|
|
1373
|
+
"@angular/platform-browser": "@angular/platform-browser",
|
|
1374
|
+
"@angular/platform-browser-dynamic": "@angular/platform-browser-dynamic",
|
|
1375
|
+
"@angular/router": "@angular/router"
|
|
1312
1376
|
}
|
|
1313
1377
|
},
|
|
1314
1378
|
dependencies: {
|
|
@@ -1321,6 +1385,7 @@ function getStandalonePackageJson(cliVersion, ngVersion) {
|
|
|
1321
1385
|
"@angular/platform-browser-dynamic": ngVersion,
|
|
1322
1386
|
"@angular/router": ngVersion,
|
|
1323
1387
|
"piral-ng": cliVersion,
|
|
1388
|
+
"core-js": "^3.19.0",
|
|
1324
1389
|
rxjs: "~7.4",
|
|
1325
1390
|
"zone.js": "~0.11"
|
|
1326
1391
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smapiot/pilet-template-angular",
|
|
3
|
-
"version": "0.15.0-beta.
|
|
3
|
+
"version": "0.15.0-beta.4835",
|
|
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.0-beta.
|
|
57
|
+
"@smapiot/template-utils": "0.15.0-beta.4835"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "08674642d233b0d9166c805b61bc0224bb504876"
|
|
60
60
|
}
|
package/src/helpers.ts
CHANGED
|
@@ -27,14 +27,14 @@ export function getStandalonePackageJson(cliVersion: string, ngVersion: string)
|
|
|
27
27
|
return {
|
|
28
28
|
importmap: {
|
|
29
29
|
imports: {
|
|
30
|
-
'@angular/animations': '
|
|
31
|
-
'@angular/common': '
|
|
32
|
-
'@angular/compiler': '
|
|
33
|
-
'@angular/core': '
|
|
34
|
-
'@angular/forms': '
|
|
35
|
-
'@angular/platform-browser': '
|
|
36
|
-
'@angular/platform-browser-dynamic': '
|
|
37
|
-
'@angular/router': '
|
|
30
|
+
'@angular/animations': '@angular/animations',
|
|
31
|
+
'@angular/common': '@angular/common',
|
|
32
|
+
'@angular/compiler': '@angular/compiler',
|
|
33
|
+
'@angular/core': '@angular/core',
|
|
34
|
+
'@angular/forms': '@angular/forms',
|
|
35
|
+
'@angular/platform-browser': '@angular/platform-browser',
|
|
36
|
+
'@angular/platform-browser-dynamic': '@angular/platform-browser-dynamic',
|
|
37
|
+
'@angular/router': '@angular/router',
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
dependencies: {
|
|
@@ -47,6 +47,7 @@ export function getStandalonePackageJson(cliVersion: string, ngVersion: string)
|
|
|
47
47
|
'@angular/platform-browser-dynamic': ngVersion,
|
|
48
48
|
'@angular/router': ngVersion,
|
|
49
49
|
'piral-ng': cliVersion,
|
|
50
|
+
'core-js': '^3.19.0',
|
|
50
51
|
rxjs: '~7.4',
|
|
51
52
|
'zone.js': '~0.11',
|
|
52
53
|
},
|