@smapiot/pilet-template-angular 0.15.0-beta.4550 → 0.15.0-beta.4610
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
|
@@ -43,6 +43,39 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
|
43
43
|
};
|
|
44
44
|
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
45
45
|
|
|
46
|
+
// ../../packages/template-utils/lib/merge.js
|
|
47
|
+
var require_merge = __commonJS({
|
|
48
|
+
"../../packages/template-utils/lib/merge.js"(exports) {
|
|
49
|
+
"use strict";
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.mergeFiles = void 0;
|
|
52
|
+
function mergeFiles(files) {
|
|
53
|
+
const result = {};
|
|
54
|
+
for (const file of files) {
|
|
55
|
+
const items = result[file.path];
|
|
56
|
+
if (Array.isArray(items)) {
|
|
57
|
+
items.push(file);
|
|
58
|
+
} else {
|
|
59
|
+
result[file.path] = [file];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return Object.keys(result).map((path) => {
|
|
63
|
+
const items = result[path];
|
|
64
|
+
if (items.length !== 1 && path.endsWith("package.json")) {
|
|
65
|
+
const obj = items.map(({ content }) => JSON.parse(content.toString("utf8"))).reduce((p, c) => Object.assign(p, c), {});
|
|
66
|
+
const str = JSON.stringify(obj);
|
|
67
|
+
return {
|
|
68
|
+
path,
|
|
69
|
+
content: Buffer.from(str, "utf8")
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return items.pop();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
exports.mergeFiles = mergeFiles;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
46
79
|
// ../../node_modules/ejs/lib/utils.js
|
|
47
80
|
var require_utils = __commonJS({
|
|
48
81
|
"../../node_modules/ejs/lib/utils.js"(exports) {
|
|
@@ -1036,10 +1069,12 @@ var require_utils2 = __commonJS({
|
|
|
1036
1069
|
const absPath = path_1.posix.join(targetDir, fileName);
|
|
1037
1070
|
const path = (0, path_1.isAbsolute)(absPath) ? (0, path_1.relative)(root2, absPath) : absPath;
|
|
1038
1071
|
(0, log_1.log)("verbose", `Adding "source" to package.json: "${path}"`);
|
|
1039
|
-
return
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1072
|
+
return {
|
|
1073
|
+
languages: ["ts", "js"],
|
|
1074
|
+
name: "package.json",
|
|
1075
|
+
content: JSON.stringify({ source: path }),
|
|
1076
|
+
target: "<root>/package.json"
|
|
1077
|
+
};
|
|
1043
1078
|
}
|
|
1044
1079
|
exports.getPackageJsonWithSource = getPackageJsonWithSource;
|
|
1045
1080
|
function getPiralInstance2(root2, sourceName) {
|
|
@@ -1140,12 +1175,13 @@ var require_factory = __commonJS({
|
|
|
1140
1175
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1141
1176
|
exports.createPiralTemplateFactory = exports.createPiletTemplateFactory = void 0;
|
|
1142
1177
|
var path_1 = require("path");
|
|
1178
|
+
var merge_1 = require_merge();
|
|
1143
1179
|
var template_1 = require_template();
|
|
1144
1180
|
var parent_1 = require_parent();
|
|
1145
1181
|
var utils_1 = require_utils2();
|
|
1146
1182
|
function createPiletTemplateFactory2(templateRoot, getAllSources, defaultArgs = {}) {
|
|
1147
1183
|
const sourceDir = (0, path_1.resolve)(templateRoot, "templates");
|
|
1148
|
-
return (projectRoot, args, details) => {
|
|
1184
|
+
return (projectRoot, args, details) => __awaiter(this, void 0, void 0, function* () {
|
|
1149
1185
|
(0, parent_1.configure)(templateRoot, details);
|
|
1150
1186
|
const allArgs = Object.assign(Object.assign({}, defaultArgs), args);
|
|
1151
1187
|
const { language = "ts", sourceName, src = "<root>/src", plugins = (0, utils_1.getPlugins)(projectRoot, sourceName), mocks = "<src>/mocks" } = allArgs;
|
|
@@ -1161,11 +1197,10 @@ var require_factory = __commonJS({
|
|
|
1161
1197
|
src,
|
|
1162
1198
|
mocks
|
|
1163
1199
|
});
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
};
|
|
1200
|
+
const defaultSource = (0, utils_1.getPackageJsonWithSource)(data.projectRoot, data.src, `index${data.extension}`);
|
|
1201
|
+
const files = yield Promise.all([...sources, defaultSource].map((source) => (0, template_1.getFileFromTemplate)(sourceDir, source, data)));
|
|
1202
|
+
return (0, merge_1.mergeFiles)(files);
|
|
1203
|
+
});
|
|
1169
1204
|
}
|
|
1170
1205
|
exports.createPiletTemplateFactory = createPiletTemplateFactory2;
|
|
1171
1206
|
function createPiralTemplateFactory(templateRoot, getAllSources, defaultArgs = {}) {
|
|
@@ -1188,7 +1223,8 @@ var require_factory = __commonJS({
|
|
|
1188
1223
|
src,
|
|
1189
1224
|
mocks
|
|
1190
1225
|
});
|
|
1191
|
-
|
|
1226
|
+
const files = yield Promise.all(sources.map((source) => (0, template_1.getFileFromTemplate)(sourceDir, source, data)));
|
|
1227
|
+
return (0, merge_1.mergeFiles)(files);
|
|
1192
1228
|
});
|
|
1193
1229
|
}
|
|
1194
1230
|
exports.createPiralTemplateFactory = createPiralTemplateFactory;
|
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.4610",
|
|
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.4610"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "198b49c082726c9d902fb4a1530199c0939c2eca"
|
|
60
60
|
}
|
|
File without changes
|