@haxtheweb/create 9.0.14 → 9.0.15
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/dist/create.js +37 -19
- package/dist/lib/programs/site.js +229 -62
- package/dist/lib/programs/webcomponent.js +39 -23
- package/dist/lib/statements.js +7 -0
- package/dist/templates/webcomponent/hax/_gitignore +26 -0
- package/dist/templates/webcomponent/hax/_npmignore +1 -0
- package/package.json +2 -2
- /package/dist/templates/webcomponent/hax/{.editorconfig → _editorconfig} +0 -0
- /package/dist/templates/webcomponent/hax/{.github → _github}/workflows/main.yml +0 -0
- /package/dist/templates/webcomponent/hax/{.nojekyll → _nojekyll} +0 -0
- /package/dist/templates/webcomponent/hax/{.surgeignore → _surgeignore} +0 -0
- /package/dist/templates/webcomponent/hax/{.travis.yml → _travis.yml} +0 -0
package/dist/create.js
CHANGED
|
@@ -28,13 +28,13 @@ exec('git --version', error => {
|
|
|
28
28
|
});
|
|
29
29
|
async function main() {
|
|
30
30
|
var commandRun = {};
|
|
31
|
-
_commander.program.option('--').option('--v', 'Verbose output').option('--debug', 'Output for developers').option('--format <char>', 'Output format; json (default), yaml').option('--path <char>', 'where to perform operation').option('--npm-client <char>', 'npm client to use (must be installed) npm, yarn, pnpm', 'npm').option('--y', 'yes to all questions').option('--skip', 'skip frills like animations').option('--auto', 'yes to all questions, alias of y').option('--no-i', 'prevent interactions / sub-process, good for scripting')
|
|
31
|
+
_commander.program.option('--').option('--v', 'Verbose output').option('--debug', 'Output for developers').option('--format <char>', 'Output format; json (default), yaml').option('--path <char>', 'where to perform operation').option('--npm-client <char>', 'npm client to use (must be installed) npm, yarn, pnpm', 'npm').option('--y', 'yes to all questions').option('--skip', 'skip frills like animations').option('--quiet', 'remove console logging').option('--auto', 'yes to all questions, alias of y').option('--no-i', 'prevent interactions / sub-process, good for scripting').option('--to-file <char>', 'redirect command output to a file')
|
|
32
32
|
|
|
33
33
|
// options for webcomponent
|
|
34
34
|
.option('--org <char>', 'organization for package.json').option('--author <char>', 'author for site / package.json').option('--writeHaxProperties', 'Write haxProperties for the element')
|
|
35
35
|
|
|
36
36
|
// options for site
|
|
37
|
-
.option('--import-site <char>', 'URL of site to import').option('--import-structure <char>', `import method to use:\n\rpressbooksToSite\n\relmslnToSite\n\rhaxcmsToSite\n\rnotionToSite\n\rgitbookToSite\n\revolutionToSite\n\rhtmlToSite\n\rdocxToSite`).option('--node-op <char>', 'node operation to perform').option('--item-id <char>', 'node ID to operate on').option('--name <char>', 'name of the project').option('--domain <char>', 'published domain name').helpCommand(true);
|
|
37
|
+
.option('--import-site <char>', 'URL of site to import').option('--import-structure <char>', `import method to use:\n\rpressbooksToSite\n\relmslnToSite\n\rhaxcmsToSite\n\rnotionToSite\n\rgitbookToSite\n\revolutionToSite\n\rhtmlToSite\n\rdocxToSite`).option('--node-op <char>', 'node operation to perform').option('--item-id <char>', 'node ID to operate on').option('--name <char>', 'name of the project').option('--domain <char>', 'published domain name').option('--items-import <char>', 'import items from a file / site').helpCommand(true);
|
|
38
38
|
|
|
39
39
|
// default command which runs interactively
|
|
40
40
|
_commander.program.command('start').description('Interactive program to pick options').action(() => {
|
|
@@ -61,7 +61,7 @@ async function main() {
|
|
|
61
61
|
commandRun.arguments.action = action;
|
|
62
62
|
commandRun.options.skip = true;
|
|
63
63
|
}
|
|
64
|
-
}).option('--path <char>', 'path the project should be created in').option('--import-site <char>', 'URL of site to import').option('--import-structure <char>', `import method to use:\n\rpressbooksToSite\n\relmslnToSite\n\rhaxcmsToSite\n\rnotionToSite\n\rgitbookToSite\n\revolutionToSite\n\rhtmlToSite\n\rdocxToSite`).option('--name <char>', 'name of the site (when creating a new one)').option('--domain <char>', 'published domain name').option('--node-op <char>', 'node operation to perform').option('--no-i', 'prevent interactions / sub-process, good for scripting').version(await HAXCMS.getHAXCMSVersion());
|
|
64
|
+
}).option('--path <char>', 'path the project should be created in').option('--import-site <char>', 'URL of site to import').option('--import-structure <char>', `import method to use:\n\rpressbooksToSite\n\relmslnToSite\n\rhaxcmsToSite\n\rnotionToSite\n\rgitbookToSite\n\revolutionToSite\n\rhtmlToSite\n\rdocxToSite`).option('--name <char>', 'name of the site (when creating a new one)').option('--domain <char>', 'published domain name').option('--node-op <char>', 'node operation to perform').option('--no-i', 'prevent interactions / sub-process, good for scripting').option('--to-file <char>', 'redirect command output to a file').option('--item-import <char>', 'import items from a file / site').version(await HAXCMS.getHAXCMSVersion());
|
|
65
65
|
let siteNodeOps = (0, _site.siteNodeOperations)();
|
|
66
66
|
for (var i in siteNodeOps) {
|
|
67
67
|
_commander.program.option(`--${(0, _utils.camelToDash)(siteNodeOps[i].value)} <char>`, `${siteNodeOps[i].label}`);
|
|
@@ -80,7 +80,7 @@ async function main() {
|
|
|
80
80
|
commandRun.arguments.name = name;
|
|
81
81
|
commandRun.options.skip = true;
|
|
82
82
|
}
|
|
83
|
-
}).option('--path <char>', 'path the project should be created in').option('--org <char>', 'organization for package.json').option('--author <char>', 'author for site / package.json').option('--writeHaxProperties', 'Write haxProperties for the element').option('--no-i', 'prevent interactions / sub-process, good for scripting');
|
|
83
|
+
}).option('--path <char>', 'path the project should be created in').option('--org <char>', 'organization for package.json').option('--author <char>', 'author for site / package.json').option('--writeHaxProperties', 'Write haxProperties for the element').option('--to-file <char>', 'redirect command output to a file').option('--no-i', 'prevent interactions / sub-process, good for scripting');
|
|
84
84
|
// process program arguments
|
|
85
85
|
_commander.program.parse();
|
|
86
86
|
commandRun.options = {
|
|
@@ -88,7 +88,7 @@ async function main() {
|
|
|
88
88
|
..._commander.program.opts()
|
|
89
89
|
};
|
|
90
90
|
if (commandRun.options.debug) {
|
|
91
|
-
|
|
91
|
+
(0, _statements.log)(commandRun);
|
|
92
92
|
}
|
|
93
93
|
// auto and y assume same thing
|
|
94
94
|
if (commandRun.options.y || commandRun.options.auto) {
|
|
@@ -101,9 +101,13 @@ async function main() {
|
|
|
101
101
|
let value = await exec(`git config user.name`);
|
|
102
102
|
author = value.stdout.trim();
|
|
103
103
|
} catch (e) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
(0, _statements.log)('git user name not configured. Run the following to do this:');
|
|
105
|
+
(0, _statements.log)('git config --global user.name "namehere"');
|
|
106
|
+
(0, _statements.log)('git config --global user.email "email@here');
|
|
107
|
+
}
|
|
108
|
+
// bridge to log so we can respect this setting
|
|
109
|
+
if (commandRun.options.quiet) {
|
|
110
|
+
process.haxquiet = true;
|
|
107
111
|
}
|
|
108
112
|
// only set path if not already set
|
|
109
113
|
if (!commandRun.options.path && commandRun.options.skip) {
|
|
@@ -142,7 +146,9 @@ async function main() {
|
|
|
142
146
|
}
|
|
143
147
|
// see if we're in a monorepo
|
|
144
148
|
if (packageData.useWorkspaces && packageData.workspaces && packageData.workspaces.packages && packageData.workspaces.packages[0]) {
|
|
145
|
-
|
|
149
|
+
if (!commandRun.options.quiet) {
|
|
150
|
+
p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` Monorepo detected : Setting relative defaults `))}`);
|
|
151
|
+
}
|
|
146
152
|
commandRun.options.isMonorepo = true;
|
|
147
153
|
commandRun.options.auto = true;
|
|
148
154
|
// assumed if monorepo
|
|
@@ -160,7 +166,7 @@ async function main() {
|
|
|
160
166
|
}
|
|
161
167
|
}
|
|
162
168
|
if (commandRun.options.debug) {
|
|
163
|
-
|
|
169
|
+
(0, _statements.log)(packageData);
|
|
164
170
|
}
|
|
165
171
|
// CLI works within context of the site if one is detected, otherwise we can do other thingss
|
|
166
172
|
if (await hax.systemStructureContext()) {
|
|
@@ -172,7 +178,7 @@ async function main() {
|
|
|
172
178
|
commandRun.options.skip = true;
|
|
173
179
|
await (0, _webcomponent.webcomponentCommandDetected)(commandRun, packageData);
|
|
174
180
|
} else {
|
|
175
|
-
if (commandRun.command === 'start' && !commandRun.options.y && !commandRun.options.auto && !commandRun.options.skip) {
|
|
181
|
+
if (commandRun.command === 'start' && !commandRun.options.y && !commandRun.options.auto && !commandRun.options.skip && !commandRun.options.quiet) {
|
|
176
182
|
await (0, _statements.haxIntro)();
|
|
177
183
|
}
|
|
178
184
|
let activeProject = null;
|
|
@@ -181,10 +187,14 @@ async function main() {
|
|
|
181
187
|
};
|
|
182
188
|
while (project.type !== 'quit') {
|
|
183
189
|
if (activeProject) {
|
|
184
|
-
|
|
190
|
+
if (!commandRun.options.quiet) {
|
|
191
|
+
p.note(` 🧙🪄 BE GONE ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgGreen(activeProject)))} sub-process daemon! 🪄 + ✨ 👹 = 💀 `);
|
|
192
|
+
}
|
|
185
193
|
// ensure if we were automatically running the command we end
|
|
186
194
|
if (commandRun.options.y) {
|
|
187
|
-
(
|
|
195
|
+
if (!commandRun.options.quiet) {
|
|
196
|
+
(0, _statements.communityStatement)();
|
|
197
|
+
}
|
|
188
198
|
process.exit(0);
|
|
189
199
|
}
|
|
190
200
|
// otherwise null to reset the program to run again
|
|
@@ -219,8 +229,10 @@ async function main() {
|
|
|
219
229
|
})
|
|
220
230
|
}, {
|
|
221
231
|
onCancel: () => {
|
|
222
|
-
|
|
223
|
-
|
|
232
|
+
if (!commandRun.options.quiet) {
|
|
233
|
+
p.cancel('🧙🪄 Merlin: Leaving so soon? HAX ya later');
|
|
234
|
+
(0, _statements.communityStatement)();
|
|
235
|
+
}
|
|
224
236
|
process.exit(0);
|
|
225
237
|
}
|
|
226
238
|
});
|
|
@@ -230,7 +242,9 @@ async function main() {
|
|
|
230
242
|
// detect being in a haxcms scaffold. easiest way is _sites being in this directory
|
|
231
243
|
// set the path automatically so we skip the question
|
|
232
244
|
if (commandRun.command === "site" && fs.existsSync(`${process.cwd()}/_sites`)) {
|
|
233
|
-
|
|
245
|
+
if (!commandRun.options.quiet) {
|
|
246
|
+
p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` HAXcms detected : Path set automatically `))}`);
|
|
247
|
+
}
|
|
234
248
|
commandRun.options.path = `${process.cwd()}/_sites`;
|
|
235
249
|
}
|
|
236
250
|
activeProject = project.type;
|
|
@@ -376,8 +390,10 @@ async function main() {
|
|
|
376
390
|
}
|
|
377
391
|
}, {
|
|
378
392
|
onCancel: () => {
|
|
379
|
-
|
|
380
|
-
|
|
393
|
+
if (!commandRun.options.quiet) {
|
|
394
|
+
p.cancel('🧙🪄 Merlin: Canceling CLI.. HAX ya later');
|
|
395
|
+
(0, _statements.communityStatement)();
|
|
396
|
+
}
|
|
381
397
|
process.exit(0);
|
|
382
398
|
}
|
|
383
399
|
});
|
|
@@ -418,7 +434,9 @@ async function main() {
|
|
|
418
434
|
}
|
|
419
435
|
}
|
|
420
436
|
}
|
|
421
|
-
(
|
|
437
|
+
if (!commandRun.options.quiet) {
|
|
438
|
+
(0, _statements.communityStatement)();
|
|
439
|
+
}
|
|
422
440
|
}
|
|
423
441
|
}
|
|
424
442
|
main().catch(console.error);
|
|
@@ -12,15 +12,16 @@ exports.siteNodeStatsOperations = siteNodeStatsOperations;
|
|
|
12
12
|
exports.siteProcess = siteProcess;
|
|
13
13
|
exports.siteThemeList = siteThemeList;
|
|
14
14
|
var _promises = require("node:timers/promises");
|
|
15
|
+
var fs = _interopRequireWildcard(require("node:fs"));
|
|
15
16
|
var p = _interopRequireWildcard(require("@clack/prompts"));
|
|
16
17
|
var _picocolors = _interopRequireDefault(require("picocolors"));
|
|
17
18
|
var _jsYaml = require("js-yaml");
|
|
18
19
|
var _nodeHtmlParser = require("node-html-parser");
|
|
19
20
|
var _statements = require("../statements.js");
|
|
20
|
-
var _utils = require("../utils.js");
|
|
21
21
|
var _microFrontendRegistry = require("../micro-frontend-registry.js");
|
|
22
22
|
var haxcmsNodejsCli = _interopRequireWildcard(require("@haxtheweb/haxcms-nodejs/dist/cli.js"));
|
|
23
23
|
var hax = _interopRequireWildcard(require("@haxtheweb/haxcms-nodejs"));
|
|
24
|
+
var josfile = _interopRequireWildcard(require("@haxtheweb/haxcms-nodejs/dist/lib/JSONOutlineSchema.js"));
|
|
24
25
|
var child_process = _interopRequireWildcard(require("child_process"));
|
|
25
26
|
var util = _interopRequireWildcard(require("node:util"));
|
|
26
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -32,6 +33,7 @@ globalThis.MicroFrontendRegistryConfig = {
|
|
|
32
33
|
};
|
|
33
34
|
// emable HAXcms routes so we have name => path just like on frontend!
|
|
34
35
|
_microFrontendRegistry.MicroFrontendRegistry.enableServices(['core', 'haxcms', 'experimental']);
|
|
36
|
+
const JSONOutlineSchema = josfile.default;
|
|
35
37
|
const HAXCMS = hax.HAXCMS;
|
|
36
38
|
const exec = util.promisify(child_process.exec);
|
|
37
39
|
var sysSurge = true;
|
|
@@ -87,6 +89,9 @@ function siteActions() {
|
|
|
87
89
|
}, {
|
|
88
90
|
value: 'site:items',
|
|
89
91
|
label: "Site items"
|
|
92
|
+
}, {
|
|
93
|
+
value: 'site:items-import',
|
|
94
|
+
label: "Import items (JOS / site.json)"
|
|
90
95
|
}, {
|
|
91
96
|
value: 'site:list-files',
|
|
92
97
|
label: "List site files"
|
|
@@ -114,7 +119,7 @@ async function siteCommandDetected(commandRun) {
|
|
|
114
119
|
commandRun.arguments.action = 'status';
|
|
115
120
|
}
|
|
116
121
|
commandRun.command = "site";
|
|
117
|
-
if (!commandRun.options.y && commandRun.options.i) {
|
|
122
|
+
if (!commandRun.options.y && commandRun.options.i && !commandRun.options.quiet) {
|
|
118
123
|
p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` HAXTheWeb : Site detected `))}`);
|
|
119
124
|
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Name: ${activeHaxsite.name} `))}`);
|
|
120
125
|
}
|
|
@@ -159,8 +164,10 @@ async function siteCommandDetected(commandRun) {
|
|
|
159
164
|
})
|
|
160
165
|
}, {
|
|
161
166
|
onCancel: () => {
|
|
162
|
-
|
|
163
|
-
|
|
167
|
+
if (!commandRun.options.quiet) {
|
|
168
|
+
p.cancel('🧙 Merlin: Canceling CLI.. HAX ya later 🪄');
|
|
169
|
+
(0, _statements.communityStatement)();
|
|
170
|
+
}
|
|
164
171
|
process.exit(0);
|
|
165
172
|
}
|
|
166
173
|
});
|
|
@@ -199,7 +206,7 @@ async function siteCommandDetected(commandRun) {
|
|
|
199
206
|
lastUpdated: date.toLocaleDateString("en-US"),
|
|
200
207
|
tagUsage: els
|
|
201
208
|
};
|
|
202
|
-
if (!commandRun.options.format) {
|
|
209
|
+
if (!commandRun.options.format && !commandRun.options.quiet) {
|
|
203
210
|
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Title: ${siteStats.title} `))}`);
|
|
204
211
|
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Description: ${siteStats.description} `))}`);
|
|
205
212
|
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Theme: ${siteStats.themeName} (${siteStats.themeElement})`))}`);
|
|
@@ -207,25 +214,123 @@ async function siteCommandDetected(commandRun) {
|
|
|
207
214
|
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Last updated: ${siteStats.lastUpdated} `))}`);
|
|
208
215
|
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Tags used: ${JSON.stringify(siteStats.tagUsage, null, 2)} `))}`);
|
|
209
216
|
} else if (commandRun.options.format === 'yaml') {
|
|
210
|
-
|
|
217
|
+
(0, _statements.log)((0, _jsYaml.dump)(siteStats));
|
|
211
218
|
} else {
|
|
212
|
-
|
|
219
|
+
(0, _statements.log)(siteStats);
|
|
220
|
+
}
|
|
221
|
+
// simple redirecting to file
|
|
222
|
+
if (commandRun.options.toFile) {
|
|
223
|
+
if (commandRun.options.format === 'yaml') {
|
|
224
|
+
fs.writeFileSync(commandRun.options.toFile, (0, _jsYaml.dump)(siteStats));
|
|
225
|
+
} else {
|
|
226
|
+
fs.writeFileSync(commandRun.options.toFile, JSON.stringify(siteStats, null, 2));
|
|
227
|
+
}
|
|
213
228
|
}
|
|
214
229
|
break;
|
|
215
230
|
case "site:items":
|
|
216
|
-
|
|
217
|
-
|
|
231
|
+
let siteitems = [];
|
|
232
|
+
if (commandRun.options.itemId != null) {
|
|
233
|
+
siteitems = activeHaxsite.manifest.findBranch(commandRun.options.itemId);
|
|
218
234
|
} else {
|
|
219
|
-
|
|
235
|
+
siteitems = activeHaxsite.manifest.orderTree(activeHaxsite.manifest.items);
|
|
236
|
+
}
|
|
237
|
+
for (let i in siteitems) {
|
|
238
|
+
let page = await activeHaxsite.loadNode(siteitems[i].id);
|
|
239
|
+
siteitems[i].content = await activeHaxsite.getPageContent(page);
|
|
240
|
+
}
|
|
241
|
+
// simple redirecting to file if asked for
|
|
242
|
+
if (commandRun.options.toFile) {
|
|
243
|
+
let contents = '';
|
|
244
|
+
if (commandRun.options.format === 'yaml') {
|
|
245
|
+
contents = (0, _jsYaml.dump)(siteitems);
|
|
246
|
+
} else {
|
|
247
|
+
contents = JSON.stringify(siteitems, null, 2);
|
|
248
|
+
}
|
|
249
|
+
fs.writeFileSync(commandRun.options.toFile, contents);
|
|
250
|
+
} else {
|
|
251
|
+
if (commandRun.options.format === 'yaml') {
|
|
252
|
+
(0, _statements.log)((0, _jsYaml.dump)(siteitems));
|
|
253
|
+
} else {
|
|
254
|
+
(0, _statements.log)(siteitems);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
break;
|
|
258
|
+
case "site:items-import":
|
|
259
|
+
// need source, then resolve what it is
|
|
260
|
+
if (commandRun.options.itemsImport) {
|
|
261
|
+
let location = commandRun.options.itemsImport;
|
|
262
|
+
let josImport = new JSONOutlineSchema();
|
|
263
|
+
var itemsImport = [];
|
|
264
|
+
// support for address, as in import from some place else
|
|
265
|
+
if (location.startsWith('https://') || location.startsWith('http://')) {
|
|
266
|
+
if (location.endsWith('/site.json')) {
|
|
267
|
+
location = location.replace('/site.json', '');
|
|
268
|
+
} else if (!location.endsWith('/')) {
|
|
269
|
+
location = location + '/';
|
|
270
|
+
}
|
|
271
|
+
let f = await fetch(`${location}site.json`).then(d => d.ok ? d.json() : null);
|
|
272
|
+
if (f && f.items) {
|
|
273
|
+
josImport.items = f.items;
|
|
274
|
+
} else {
|
|
275
|
+
// invalid data
|
|
276
|
+
process.exit(0);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// look on prem
|
|
280
|
+
else if (fs.existsSync(location)) {
|
|
281
|
+
let fileContents = await fs.readFileSync(location);
|
|
282
|
+
if (location.endsWith('.json')) {
|
|
283
|
+
josImport.items = JSON.parse(fileContents);
|
|
284
|
+
} else if (location.endsWith('.yaml')) {
|
|
285
|
+
josImport.items = await (0, _jsYaml.load)(fileContents);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// allows for filtering
|
|
289
|
+
if (commandRun.options.itemId) {
|
|
290
|
+
itemsImport = josImport.findBranch(commandRun.options.itemId);
|
|
291
|
+
} else {
|
|
292
|
+
itemsImport = josImport.items;
|
|
293
|
+
}
|
|
294
|
+
for (let i in josImport.items) {
|
|
295
|
+
if (josImport.items[i].location && !josImport.items[i].content) {
|
|
296
|
+
josImport.items[i].content = await fetch(`${location}${josImport.items[i].location}`).then(d => d.ok ? d.text() : '');
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
let itemIdMap = {};
|
|
300
|
+
for (let i in josImport.items) {
|
|
301
|
+
// if we have a parent set by force to append this structure to
|
|
302
|
+
// then see if parent = null (implying top level in full site import)
|
|
303
|
+
// or match on itemId to imply that it's the top (no matter parent status)
|
|
304
|
+
if (commandRun.options.parentId) {
|
|
305
|
+
if (josImport.items[i].parent === null || josImport.items[i].id === commandRun.options.itemId) {
|
|
306
|
+
josImport.items[i].parent = commandRun.options.parentId;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// see if map has an entry that is already set
|
|
310
|
+
if (itemIdMap[josImport.items[i].parent]) {
|
|
311
|
+
// remaps the parent of this item bc the thing imported has changed ID
|
|
312
|
+
josImport.items[i].parent = itemIdMap[josImport.items[i].parent];
|
|
313
|
+
}
|
|
314
|
+
let tmpAddedItem = await activeHaxsite.addPage(josImport.items[i].parent, josImport.items[i].title, 'html', josImport.items[i].slug, null, josImport.items[i].indent, josImport.items[i].content, josImport.items[i].order, josImport.items[i].metadata);
|
|
315
|
+
// set in the map for future translations
|
|
316
|
+
itemIdMap[josImport.items[i].id] = tmpAddedItem.id;
|
|
317
|
+
}
|
|
318
|
+
if (!commandRun.options.quiet) {
|
|
319
|
+
(0, _statements.log)(`${josImport.items.length} nodes imported`);
|
|
320
|
+
}
|
|
321
|
+
} else if (!commandRun.options.quiet) {
|
|
322
|
+
(0, _statements.log)('Must specify --item-import as path to valid item export file or URL', 'error');
|
|
220
323
|
}
|
|
221
324
|
break;
|
|
222
325
|
case "start":
|
|
223
326
|
try {
|
|
224
|
-
|
|
225
|
-
|
|
327
|
+
if (!commandRun.options.quiet) {
|
|
328
|
+
p.intro(`Starting server.. `);
|
|
329
|
+
p.intro(`⌨️ To stop server, press: ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgRed(` CTRL + C `)))}`);
|
|
330
|
+
}
|
|
226
331
|
await exec(`cd ${activeHaxsite.directory} && npx @haxtheweb/haxcms-nodejs`);
|
|
227
332
|
} catch (e) {
|
|
228
|
-
|
|
333
|
+
(0, _statements.log)(e.stderr);
|
|
229
334
|
}
|
|
230
335
|
break;
|
|
231
336
|
case "node:stats":
|
|
@@ -257,10 +362,28 @@ async function siteCommandDetected(commandRun) {
|
|
|
257
362
|
if (commandRun.options.nodeOp && siteNodeStatsOperations(commandRun.options.nodeOp)) {
|
|
258
363
|
switch (commandRun.options.nodeOp) {
|
|
259
364
|
case 'details':
|
|
260
|
-
|
|
365
|
+
if (commandRun.options.format === 'yaml') {
|
|
366
|
+
(0, _statements.log)((0, _jsYaml.dump)(page));
|
|
367
|
+
} else {
|
|
368
|
+
(0, _statements.log)(page);
|
|
369
|
+
}
|
|
370
|
+
// simple redirecting to file
|
|
371
|
+
if (commandRun.options.toFile) {
|
|
372
|
+
if (commandRun.options.format === 'yaml') {
|
|
373
|
+
fs.writeFileSync(commandRun.options.toFile, (0, _jsYaml.dump)(page));
|
|
374
|
+
} else {
|
|
375
|
+
fs.writeFileSync(commandRun.options.toFile, JSON.stringify(page, null, 2));
|
|
376
|
+
}
|
|
377
|
+
}
|
|
261
378
|
break;
|
|
262
379
|
case 'html':
|
|
263
|
-
|
|
380
|
+
let itemHTML = await activeHaxsite.getPageContent(page);
|
|
381
|
+
// simple redirecting to file
|
|
382
|
+
if (commandRun.options.toFile) {
|
|
383
|
+
fs.writeFileSync(commandRun.options.toFile, itemHTML);
|
|
384
|
+
} else {
|
|
385
|
+
(0, _statements.log)(itemHTML);
|
|
386
|
+
}
|
|
264
387
|
break;
|
|
265
388
|
case 'schema':
|
|
266
389
|
// next up
|
|
@@ -273,20 +396,38 @@ async function siteCommandDetected(commandRun) {
|
|
|
273
396
|
els.push(await nodeToHaxElement(node, null));
|
|
274
397
|
}
|
|
275
398
|
}
|
|
276
|
-
|
|
399
|
+
// simple redirecting to file
|
|
400
|
+
if (commandRun.options.toFile) {
|
|
401
|
+
if (commandRun.options.format === 'yaml') {
|
|
402
|
+
fs.writeFileSync(commandRun.options.toFile, (0, _jsYaml.dump)(els));
|
|
403
|
+
} else {
|
|
404
|
+
fs.writeFileSync(commandRun.options.toFile, JSON.stringify(els, null, 2));
|
|
405
|
+
}
|
|
406
|
+
} else {
|
|
407
|
+
if (commandRun.options.format === 'yaml') {
|
|
408
|
+
(0, _statements.log)((0, _jsYaml.dump)(els));
|
|
409
|
+
} else {
|
|
410
|
+
(0, _statements.log)(els);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
277
413
|
break;
|
|
278
414
|
case 'md':
|
|
279
415
|
let resp = await openApiBroker('@core', 'htmlToMd', {
|
|
280
416
|
html: await activeHaxsite.getPageContent(page)
|
|
281
417
|
});
|
|
282
|
-
|
|
418
|
+
// simple redirecting to file
|
|
419
|
+
if (commandRun.options.toFile) {
|
|
420
|
+
fs.writeFileSync(commandRun.options.toFile, resp.res.data.data);
|
|
421
|
+
} else {
|
|
422
|
+
(0, _statements.log)(resp.res.data.data);
|
|
423
|
+
}
|
|
283
424
|
break;
|
|
284
425
|
}
|
|
285
426
|
}
|
|
286
427
|
}
|
|
287
428
|
} catch (e) {
|
|
288
|
-
|
|
289
|
-
|
|
429
|
+
(0, _statements.log)(e.stderr);
|
|
430
|
+
(0, _statements.log)(e);
|
|
290
431
|
}
|
|
291
432
|
break;
|
|
292
433
|
case "node:add":
|
|
@@ -311,11 +452,11 @@ async function siteCommandDetected(commandRun) {
|
|
|
311
452
|
}
|
|
312
453
|
});
|
|
313
454
|
if (commandRun.options.v) {
|
|
314
|
-
|
|
455
|
+
(0, _statements.log)(resp.res.data);
|
|
315
456
|
}
|
|
316
|
-
|
|
457
|
+
(0, _statements.log)(`"${commandRun.options.title}" added to site`);
|
|
317
458
|
} catch (e) {
|
|
318
|
-
|
|
459
|
+
(0, _statements.log)(e.stderr);
|
|
319
460
|
}
|
|
320
461
|
break;
|
|
321
462
|
case "node:edit":
|
|
@@ -398,7 +539,7 @@ async function siteCommandDetected(commandRun) {
|
|
|
398
539
|
if (typeof commandRun.options[commandRun.options.nodeOp] !== "undefined") {
|
|
399
540
|
if (commandRun.options.nodeOp === 'content') {
|
|
400
541
|
if (commandRun.options.content && (await page.writeLocation(commandRun.options.content))) {
|
|
401
|
-
|
|
542
|
+
(0, _statements.log)(`node:edit success updated page content: "${page.id}`);
|
|
402
543
|
} else {
|
|
403
544
|
console.warn(`node:edit failure to write page content : ${page.id}`);
|
|
404
545
|
}
|
|
@@ -413,13 +554,13 @@ async function siteCommandDetected(commandRun) {
|
|
|
413
554
|
}
|
|
414
555
|
let resp = await activeHaxsite.updateNode(page);
|
|
415
556
|
if (commandRun.options.v) {
|
|
416
|
-
|
|
557
|
+
(0, _statements.log)(resp);
|
|
417
558
|
}
|
|
418
559
|
}
|
|
419
560
|
}
|
|
420
561
|
}
|
|
421
562
|
} catch (e) {
|
|
422
|
-
|
|
563
|
+
(0, _statements.log)(e.stderr);
|
|
423
564
|
}
|
|
424
565
|
break;
|
|
425
566
|
case "node:delete":
|
|
@@ -455,14 +596,14 @@ async function siteCommandDetected(commandRun) {
|
|
|
455
596
|
if (resp.res.data === 500) {
|
|
456
597
|
console.warn(`node:delete failed "${commandRun.options.itemId} not found`);
|
|
457
598
|
} else {
|
|
458
|
-
|
|
599
|
+
(0, _statements.log)(`"${commandRun.options.itemId}" deleted`);
|
|
459
600
|
}
|
|
460
601
|
} else {
|
|
461
|
-
|
|
602
|
+
(0, _statements.log)(`Delete operation canceled`);
|
|
462
603
|
}
|
|
463
604
|
}
|
|
464
605
|
} catch (e) {
|
|
465
|
-
|
|
606
|
+
(0, _statements.log)(e.stderr);
|
|
466
607
|
}
|
|
467
608
|
break;
|
|
468
609
|
case "site:sync":
|
|
@@ -470,7 +611,7 @@ async function siteCommandDetected(commandRun) {
|
|
|
470
611
|
try {
|
|
471
612
|
await exec(`cd ${activeHaxsite.directory} && git pull && git push`);
|
|
472
613
|
} catch (e) {
|
|
473
|
-
|
|
614
|
+
(0, _statements.log)(e.stderr);
|
|
474
615
|
}
|
|
475
616
|
break;
|
|
476
617
|
case "site:theme":
|
|
@@ -493,7 +634,7 @@ async function siteCommandDetected(commandRun) {
|
|
|
493
634
|
}
|
|
494
635
|
}
|
|
495
636
|
} catch (e) {
|
|
496
|
-
|
|
637
|
+
(0, _statements.log)(e.stderr);
|
|
497
638
|
}
|
|
498
639
|
break;
|
|
499
640
|
case "site:surge":
|
|
@@ -511,9 +652,9 @@ async function siteCommandDetected(commandRun) {
|
|
|
511
652
|
});
|
|
512
653
|
}
|
|
513
654
|
let execOutput = await exec(`cd ${activeHaxsite.directory} && surge . ${commandRun.options.domain}`);
|
|
514
|
-
|
|
655
|
+
(0, _statements.log)(execOutput.stdout.trim());
|
|
515
656
|
} catch (e) {
|
|
516
|
-
|
|
657
|
+
(0, _statements.log)(e.stderr);
|
|
517
658
|
}
|
|
518
659
|
break;
|
|
519
660
|
case "site:file-list":
|
|
@@ -523,9 +664,9 @@ async function siteCommandDetected(commandRun) {
|
|
|
523
664
|
filename: commandRun.options.filename
|
|
524
665
|
}, res);
|
|
525
666
|
if (commandRun.options.format === 'yaml') {
|
|
526
|
-
|
|
667
|
+
(0, _statements.log)((0, _jsYaml.dump)(res.data));
|
|
527
668
|
} else {
|
|
528
|
-
|
|
669
|
+
(0, _statements.log)(res.data);
|
|
529
670
|
}
|
|
530
671
|
break;
|
|
531
672
|
case "site:html":
|
|
@@ -559,7 +700,20 @@ async function siteCommandDetected(commandRun) {
|
|
|
559
700
|
}
|
|
560
701
|
}
|
|
561
702
|
}
|
|
562
|
-
|
|
703
|
+
// simple redirecting to file
|
|
704
|
+
if (commandRun.options.toFile) {
|
|
705
|
+
if (commandRun.options.format === 'yaml') {
|
|
706
|
+
fs.writeFileSync(commandRun.options.toFile, (0, _jsYaml.dump)(els));
|
|
707
|
+
} else {
|
|
708
|
+
fs.writeFileSync(commandRun.options.toFile, JSON.stringify(els, null, 2));
|
|
709
|
+
}
|
|
710
|
+
} else {
|
|
711
|
+
if (commandRun.options.format === 'yaml') {
|
|
712
|
+
(0, _statements.log)((0, _jsYaml.dump)(els));
|
|
713
|
+
} else {
|
|
714
|
+
(0, _statements.log)(els);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
563
717
|
} else {
|
|
564
718
|
for (var i in items) {
|
|
565
719
|
let page = activeHaxsite.loadNode(items[i].id);
|
|
@@ -570,9 +724,13 @@ async function siteCommandDetected(commandRun) {
|
|
|
570
724
|
let resp = await openApiBroker('@core', 'htmlToMd', {
|
|
571
725
|
html: siteContent
|
|
572
726
|
});
|
|
573
|
-
|
|
727
|
+
if (commandRun.options.toFile) {
|
|
728
|
+
fs.writeFileSync(commandRun.options.toFile, resp.res.data.data);
|
|
729
|
+
} else {
|
|
730
|
+
(0, _statements.log)(resp.res.data.data);
|
|
731
|
+
}
|
|
574
732
|
} else {
|
|
575
|
-
|
|
733
|
+
(0, _statements.log)(siteContent);
|
|
576
734
|
}
|
|
577
735
|
}
|
|
578
736
|
break;
|
|
@@ -586,7 +744,9 @@ async function siteCommandDetected(commandRun) {
|
|
|
586
744
|
}
|
|
587
745
|
operation.action = null;
|
|
588
746
|
}
|
|
589
|
-
(
|
|
747
|
+
if (!commandRun.options.quiet) {
|
|
748
|
+
(0, _statements.communityStatement)();
|
|
749
|
+
}
|
|
590
750
|
}
|
|
591
751
|
function siteNodeStatsOperations(search = null) {
|
|
592
752
|
let obj = [{
|
|
@@ -679,14 +839,16 @@ async function openApiBroker(scope, call, body) {
|
|
|
679
839
|
// process site creation
|
|
680
840
|
async function siteProcess(commandRun, project, port = '3000') {
|
|
681
841
|
// auto select operations to perform if requested
|
|
842
|
+
var s = p.spinner();
|
|
682
843
|
if (!project.extras) {
|
|
683
844
|
project.extras = [];
|
|
684
845
|
if (commandRun.options.i) {
|
|
685
846
|
project.extras = ['launch'];
|
|
686
847
|
}
|
|
687
848
|
}
|
|
688
|
-
|
|
689
|
-
|
|
849
|
+
if (!commandRun.options.quiet) {
|
|
850
|
+
s.start((0, _statements.merlinSays)(`Creating new site: ${project.name}`));
|
|
851
|
+
}
|
|
690
852
|
let siteRequest = {
|
|
691
853
|
"site": {
|
|
692
854
|
"name": project.name,
|
|
@@ -731,13 +893,15 @@ async function siteProcess(commandRun, project, port = '3000') {
|
|
|
731
893
|
}, res);
|
|
732
894
|
if (commandRun.options.v) {
|
|
733
895
|
if (commandRun.options.format === 'yaml') {
|
|
734
|
-
|
|
896
|
+
(0, _statements.log)((0, _jsYaml.dump)(res.data));
|
|
735
897
|
} else {
|
|
736
|
-
|
|
898
|
+
(0, _statements.log)(res.data);
|
|
737
899
|
}
|
|
738
900
|
}
|
|
739
|
-
|
|
740
|
-
|
|
901
|
+
if (!commandRun.options.quiet) {
|
|
902
|
+
s.stop((0, _statements.merlinSays)(`${project.name} created!`));
|
|
903
|
+
await (0, _promises.setTimeout)(500);
|
|
904
|
+
}
|
|
741
905
|
if (project.gitRepo && !commandRun.options.isMonorepo) {
|
|
742
906
|
try {
|
|
743
907
|
await exec(`cd ${project.path}/${project.name} && git init && git add -A && git commit -m "first commit" && git branch -M main${project.gitRepo ? ` && git remote add origin ${project.gitRepo}` : ''}`);
|
|
@@ -748,19 +912,21 @@ async function siteProcess(commandRun, project, port = '3000') {
|
|
|
748
912
|
if (project.extras.includes('launch')) {
|
|
749
913
|
let optionPath = `${project.path}/${project.name}`;
|
|
750
914
|
let command = `npx @haxtheweb/haxcms-nodejs`;
|
|
751
|
-
|
|
915
|
+
if (!commandRun.options.quiet) {
|
|
916
|
+
p.note(`${(0, _statements.merlinSays)(`I have summoned a sub-process daemon 👹`)}
|
|
752
917
|
|
|
753
|
-
|
|
754
|
-
|
|
918
|
+
🚀 Running your ${_picocolors.default.bold(project.type)} ${_picocolors.default.bold(project.name)}:
|
|
919
|
+
${_picocolors.default.underline(_picocolors.default.cyan(`http://localhost:${port}`))}
|
|
755
920
|
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
921
|
+
🏠 Launched: ${_picocolors.default.underline(_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`${optionPath}`))))}
|
|
922
|
+
💻 Folder: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`cd ${optionPath}`)))}
|
|
923
|
+
📂 Open folder: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`open ${optionPath}`)))}
|
|
924
|
+
📘 VS Code Project: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`code ${optionPath}`)))}
|
|
925
|
+
🚧 Launch later: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`${command}`)))}
|
|
761
926
|
|
|
762
|
-
|
|
763
|
-
|
|
927
|
+
⌨️ To resume 🧙 Merlin press: ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgRed(` CTRL + C `)))}
|
|
928
|
+
`);
|
|
929
|
+
}
|
|
764
930
|
// at least a second to see the message print at all
|
|
765
931
|
await (0, _promises.setTimeout)(1000);
|
|
766
932
|
try {
|
|
@@ -768,24 +934,25 @@ async function siteProcess(commandRun, project, port = '3000') {
|
|
|
768
934
|
} catch (e) {
|
|
769
935
|
// don't log bc output is weird
|
|
770
936
|
}
|
|
771
|
-
} else {
|
|
937
|
+
} else if (!commandRun.options.quiet) {
|
|
772
938
|
let nextSteps = `cd ${project.path}/${project.name} && hax start`;
|
|
773
939
|
p.note(`${project.name} is ready to go. Run the following to start working with it:`);
|
|
774
940
|
p.outro(nextSteps);
|
|
775
941
|
}
|
|
776
942
|
}
|
|
777
943
|
async function siteItemsOptionsList(activeHaxsite, skipId = null) {
|
|
778
|
-
let items =
|
|
779
|
-
|
|
944
|
+
let items = activeHaxsite.manifest.orderTree(activeHaxsite.manifest.items);
|
|
945
|
+
let optionItems = [];
|
|
946
|
+
for (var i in items) {
|
|
780
947
|
// ensure we remove self if operation is about page in question like parent selector
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
value:
|
|
784
|
-
label:
|
|
948
|
+
if (items[i].id !== skipId) {
|
|
949
|
+
optionItems.push({
|
|
950
|
+
value: items[i].id,
|
|
951
|
+
label: ` ${'-'.repeat(parseInt(items[i].indent))}${items[i].title}`
|
|
785
952
|
});
|
|
786
953
|
}
|
|
787
954
|
}
|
|
788
|
-
return
|
|
955
|
+
return optionItems;
|
|
789
956
|
}
|
|
790
957
|
async function siteThemeList() {
|
|
791
958
|
let themes = await HAXCMS.getThemes();
|
|
@@ -175,6 +175,14 @@ async function webcomponentProcess(commandRun, project, port = "8000") {
|
|
|
175
175
|
s.start((0, _statements.merlinSays)('Copying project files'));
|
|
176
176
|
// leverage this little helper from HAXcms
|
|
177
177
|
await HAXCMS.recurseCopy(`${process.mainModule.path}/templates/${project.type}/hax/`, `${project.path}/${project.name}`);
|
|
178
|
+
// rename gitignore to improve copy cross platform compat
|
|
179
|
+
await fs.renameSync(`${project.path}/${project.name}/_github`, `${project.path}/${project.name}/.github`);
|
|
180
|
+
await fs.renameSync(`${project.path}/${project.name}/_editorconfig`, `${project.path}/${project.name}/.editorconfig`);
|
|
181
|
+
await fs.renameSync(`${project.path}/${project.name}/_gitignore`, `${project.path}/${project.name}/.gitignore`);
|
|
182
|
+
await fs.renameSync(`${project.path}/${project.name}/_nojekyll`, `${project.path}/${project.name}/.nojekyll`);
|
|
183
|
+
await fs.renameSync(`${project.path}/${project.name}/_npmignore`, `${project.path}/${project.name}/.npmignore`);
|
|
184
|
+
await fs.renameSync(`${project.path}/${project.name}/_surgeignore`, `${project.path}/${project.name}/.surgeignore`);
|
|
185
|
+
await fs.renameSync(`${project.path}/${project.name}/_travis.yml`, `${project.path}/${project.name}/.travis.yml`);
|
|
178
186
|
// rename paths that are of the element name in question
|
|
179
187
|
await fs.renameSync(`${project.path}/${project.name}/lib/webcomponent.haxProperties.json`, `${project.path}/${project.name}/lib/${project.name}.haxProperties.json`);
|
|
180
188
|
// loop through and rename all the localization files
|
|
@@ -250,7 +258,7 @@ ${_picocolors.default.underline(_picocolors.default.cyan(`http://localhost:${por
|
|
|
250
258
|
} catch (e) {
|
|
251
259
|
// don't log bc output is weird
|
|
252
260
|
}
|
|
253
|
-
} else {
|
|
261
|
+
} else if (!commandRun.options.quiet) {
|
|
254
262
|
let nextSteps = `cd ${project.path}/${project.name} && ${project.extras.includes('install') ? '' : `${commandRun.options.npmClient} install && `}${commandRun.options.npmClient} start`;
|
|
255
263
|
p.note(`${project.name} is ready to go. Run the following to start development:`);
|
|
256
264
|
p.outro(nextSteps);
|
|
@@ -259,33 +267,41 @@ ${_picocolors.default.underline(_picocolors.default.cyan(`http://localhost:${por
|
|
|
259
267
|
|
|
260
268
|
// autodetect webcomponent
|
|
261
269
|
async function webcomponentCommandDetected(commandRun, packageData = {}, port = "8000") {
|
|
262
|
-
|
|
263
|
-
|
|
270
|
+
if (!commandRun.options.quiet) {
|
|
271
|
+
p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` HAXTheWeb : Webcomponent detected `))}`);
|
|
272
|
+
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Web component name: ${packageData.name} `))}`);
|
|
273
|
+
}
|
|
264
274
|
// if we support customElement analyzer (hax wcs do) then generate if asked
|
|
265
275
|
if (commandRun.options.writeHaxProperties && packageData.customElements) {
|
|
266
276
|
webcomponentGenerateHAXSchema(commandRun, packageData);
|
|
267
277
|
} else {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
if (!commandRun.options.quiet) {
|
|
279
|
+
p.note(`${(0, _statements.merlinSays)(`I have summoned a sub-process daemon 👹`)}
|
|
280
|
+
|
|
281
|
+
🚀 Running your ${_picocolors.default.bold('webcomponent')} ${_picocolors.default.bold(packageData.name)}:
|
|
282
|
+
${_picocolors.default.underline(_picocolors.default.cyan(`http://localhost:${port}`))}
|
|
283
|
+
|
|
284
|
+
🏠 Launched: ${_picocolors.default.underline(_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`${process.cwd()}`))))}
|
|
285
|
+
💻 Folder: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`cd ${process.cwd()}`)))}
|
|
286
|
+
📂 Open folder: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`open ${process.cwd()}`)))}
|
|
287
|
+
📘 VS Code Project: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`code ${process.cwd()}`)))}
|
|
288
|
+
🚧 Launch later: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`${commandRun.options.npmClient} start`)))}
|
|
289
|
+
|
|
290
|
+
⌨️ To exit 🧙 Merlin press: ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgRed(` CTRL + C `)))}
|
|
291
|
+
`);
|
|
292
|
+
}
|
|
281
293
|
try {
|
|
282
294
|
// ensure it's installed first, unless it's a monorepo. basic check for node_modules
|
|
283
295
|
// folder as far as if already installed so we don't double install needlessly
|
|
284
296
|
if (!commandRun.options.isMonorepo && !fs.existsSync("./node_modules")) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
297
|
+
if (!commandRun.options.quiet) {
|
|
298
|
+
let s = p.spinner();
|
|
299
|
+
s.start((0, _statements.merlinSays)(`Installation magic (${commandRun.options.npmClient} install)`));
|
|
300
|
+
await exec(`${commandRun.options.npmClient} install`);
|
|
301
|
+
s.stop((0, _statements.merlinSays)(`Everything is installed. It's go time`));
|
|
302
|
+
} else {
|
|
303
|
+
await exec(`${commandRun.options.npmClient} install`);
|
|
304
|
+
}
|
|
289
305
|
}
|
|
290
306
|
await exec(`${commandRun.options.npmClient} start`);
|
|
291
307
|
} catch (e) {
|
|
@@ -310,7 +326,7 @@ async function webcomponentGenerateHAXSchema(commandRun, packageData) {
|
|
|
310
326
|
});
|
|
311
327
|
let wiring = new HAXWiring();
|
|
312
328
|
if (commandRun.options.debug) {
|
|
313
|
-
|
|
329
|
+
(0, _statements.log)(ceFileData);
|
|
314
330
|
}
|
|
315
331
|
if (ceFileData) {
|
|
316
332
|
let ce = JSON.parse(ceFileData);
|
|
@@ -366,10 +382,10 @@ async function webcomponentGenerateHAXSchema(commandRun, packageData) {
|
|
|
366
382
|
}
|
|
367
383
|
});
|
|
368
384
|
if (commandRun.options.v) {
|
|
369
|
-
|
|
385
|
+
(0, _statements.log)(JSON.stringify(props, null, 2));
|
|
370
386
|
}
|
|
371
387
|
fs.writeFileSync(`./lib/${declarations.tagName}.haxProperties.json`, JSON.stringify(props, null, 2));
|
|
372
|
-
|
|
388
|
+
(0, _statements.log)(`schema written to: ./lib/${declarations.tagName}.haxProperties.json`);
|
|
373
389
|
});
|
|
374
390
|
});
|
|
375
391
|
}
|
package/dist/lib/statements.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.communityStatement = communityStatement;
|
|
7
7
|
exports.haxIntro = haxIntro;
|
|
8
|
+
exports.log = log;
|
|
8
9
|
exports.merlinSays = merlinSays;
|
|
9
10
|
var _art = require("./art.js");
|
|
10
11
|
var p = _interopRequireWildcard(require("@clack/prompts"));
|
|
@@ -13,6 +14,12 @@ var _promises = require("node:timers/promises");
|
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
// wrapper so we can silence all log messages at the same time
|
|
18
|
+
function log(msg, level = 'log') {
|
|
19
|
+
if (!process.haxquiet) {
|
|
20
|
+
console[level](msg);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
16
23
|
async function haxIntro() {
|
|
17
24
|
console.clear();
|
|
18
25
|
await (0, _promises.setTimeout)(10);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
## editors
|
|
2
|
+
/.idea
|
|
3
|
+
/.vscode
|
|
4
|
+
|
|
5
|
+
## system files
|
|
6
|
+
.DS_Store
|
|
7
|
+
|
|
8
|
+
## npm
|
|
9
|
+
/node_modules/
|
|
10
|
+
/npm-debug.log
|
|
11
|
+
|
|
12
|
+
## testing
|
|
13
|
+
/coverage/
|
|
14
|
+
|
|
15
|
+
## temp folders
|
|
16
|
+
/.tmp/
|
|
17
|
+
|
|
18
|
+
# build
|
|
19
|
+
/_site/
|
|
20
|
+
/dist/
|
|
21
|
+
/out-tsc/
|
|
22
|
+
/public/
|
|
23
|
+
|
|
24
|
+
storybook-static
|
|
25
|
+
custom-elements.json
|
|
26
|
+
.vercel
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node_modules
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haxtheweb/create",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.15",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"release": "npm run build && commit-and-tag-version && git push --follow-tags origin main && npm publish",
|
|
25
25
|
"hax": "hax",
|
|
26
26
|
"dev": "nodemon --watch src",
|
|
27
|
-
"haxcms-nodejs
|
|
27
|
+
"haxcms-nodejs": "haxcms-nodejs"
|
|
28
28
|
},
|
|
29
29
|
"bin": {
|
|
30
30
|
"create-haxtheweb": "./dist/create.js",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|