@haxtheweb/create 10.0.7 → 11.0.0
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/README.md +65 -62
- package/dist/create.js +208 -35
- package/dist/lib/programs/audit.js +3 -3
- package/dist/lib/programs/party.js +332 -0
- package/dist/lib/programs/site.js +234 -41
- package/dist/lib/programs/webcomponent.js +83 -18
- package/dist/lib/utils.js +76 -1
- package/dist/lib/wc-registry.json +1 -1
- package/dist/templates/generic/sitecomponent.js +64 -0
- package/dist/templates/generic/webcomponent.js +3 -37
- package/package.json +8 -6
|
@@ -14,6 +14,7 @@ exports.siteThemeList = siteThemeList;
|
|
|
14
14
|
var _promises = require("node:timers/promises");
|
|
15
15
|
var fs = _interopRequireWildcard(require("node:fs"));
|
|
16
16
|
var path = _interopRequireWildcard(require("node:path"));
|
|
17
|
+
var _open = _interopRequireDefault(require("open"));
|
|
17
18
|
var p = _interopRequireWildcard(require("@clack/prompts"));
|
|
18
19
|
var ejs = _interopRequireWildcard(require("ejs"));
|
|
19
20
|
var _picocolors = _interopRequireDefault(require("picocolors"));
|
|
@@ -27,8 +28,6 @@ var _microFrontendRegistry = require("../micro-frontend-registry.js");
|
|
|
27
28
|
var haxcmsNodejsCli = _interopRequireWildcard(require("@haxtheweb/haxcms-nodejs/dist/cli.js"));
|
|
28
29
|
var hax = _interopRequireWildcard(require("@haxtheweb/haxcms-nodejs"));
|
|
29
30
|
var josfile = _interopRequireWildcard(require("@haxtheweb/haxcms-nodejs/dist/lib/JSONOutlineSchema.js"));
|
|
30
|
-
var child_process = _interopRequireWildcard(require("child_process"));
|
|
31
|
-
var util = _interopRequireWildcard(require("node:util"));
|
|
32
31
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
33
32
|
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); }
|
|
34
33
|
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; }
|
|
@@ -40,9 +39,8 @@ globalThis.MicroFrontendRegistryConfig = {
|
|
|
40
39
|
_microFrontendRegistry.MicroFrontendRegistry.enableServices(['core', 'haxcms', 'experimental']);
|
|
41
40
|
const JSONOutlineSchema = josfile.default;
|
|
42
41
|
const HAXCMS = hax.HAXCMS;
|
|
43
|
-
const exec = util.promisify(child_process.exec);
|
|
44
42
|
var sysSurge = true;
|
|
45
|
-
exec('surge --version', error => {
|
|
43
|
+
(0, _utils.exec)('surge --version', error => {
|
|
46
44
|
if (error) {
|
|
47
45
|
sysSurge = false;
|
|
48
46
|
}
|
|
@@ -80,6 +78,9 @@ function siteActions() {
|
|
|
80
78
|
return [{
|
|
81
79
|
value: 'start',
|
|
82
80
|
label: "Launch site in browser (http://localhost)"
|
|
81
|
+
}, {
|
|
82
|
+
value: 'serve',
|
|
83
|
+
label: "Launch site in development mode"
|
|
83
84
|
}, {
|
|
84
85
|
value: 'node:stats',
|
|
85
86
|
label: "Node Stats / data"
|
|
@@ -107,6 +108,9 @@ function siteActions() {
|
|
|
107
108
|
}, {
|
|
108
109
|
value: 'site:theme',
|
|
109
110
|
label: "Change theme"
|
|
111
|
+
}, {
|
|
112
|
+
value: 'site:element',
|
|
113
|
+
label: "Add new Lit component to custom/src"
|
|
110
114
|
}, {
|
|
111
115
|
value: 'site:html',
|
|
112
116
|
label: "Full site as HTML"
|
|
@@ -128,6 +132,12 @@ function siteActions() {
|
|
|
128
132
|
}, {
|
|
129
133
|
value: 'recipe:play',
|
|
130
134
|
label: "Play recipe file"
|
|
135
|
+
}, {
|
|
136
|
+
value: 'issue:general',
|
|
137
|
+
label: "Issue: Submit an issue or suggestion"
|
|
138
|
+
}, {
|
|
139
|
+
value: 'issue:theme',
|
|
140
|
+
label: "Issue: Suggest custom theme"
|
|
131
141
|
}];
|
|
132
142
|
}
|
|
133
143
|
async function siteCommandDetected(commandRun) {
|
|
@@ -355,9 +365,23 @@ async function siteCommandDetected(commandRun) {
|
|
|
355
365
|
try {
|
|
356
366
|
if (!commandRun.options.quiet) {
|
|
357
367
|
p.intro(`Starting server.. `);
|
|
358
|
-
p.
|
|
368
|
+
p.note(`🚀 Server running at: ${_picocolors.default.underline(_picocolors.default.cyan(`http://localhost:3000`))}
|
|
369
|
+
⌨️ To stop server, press: ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgRed(` CTRL + C or CTRL + BREAK `)))}`);
|
|
370
|
+
}
|
|
371
|
+
await (0, _utils.exec)(`cd ${activeHaxsite.directory} && npx @haxtheweb/haxcms-nodejs`);
|
|
372
|
+
} catch (e) {
|
|
373
|
+
(0, _logging.log)(e.stderr);
|
|
374
|
+
}
|
|
375
|
+
break;
|
|
376
|
+
case "serve":
|
|
377
|
+
try {
|
|
378
|
+
if (!commandRun.options.quiet) {
|
|
379
|
+
p.intro(`Starting server in development mode.. `);
|
|
380
|
+
p.note(`🚀 Server running at: ${_picocolors.default.underline(_picocolors.default.cyan(`http://localhost:3000`))}
|
|
381
|
+
💻 Site will live reload on changes to ${_picocolors.default.bold('custom/src')}
|
|
382
|
+
⌨️ To stop server, press: ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgRed(` CTRL + C or CTRL + BREAK `)))}`);
|
|
359
383
|
}
|
|
360
|
-
await exec(`cd ${activeHaxsite.directory} && npx @haxtheweb/haxcms-nodejs`);
|
|
384
|
+
await (0, _utils.exec)(`cd ${activeHaxsite.directory} && NODE_ENV=development npx @haxtheweb/haxcms-nodejs`);
|
|
361
385
|
} catch (e) {
|
|
362
386
|
(0, _logging.log)(e.stderr);
|
|
363
387
|
}
|
|
@@ -736,7 +760,7 @@ async function siteCommandDetected(commandRun) {
|
|
|
736
760
|
case "site:sync":
|
|
737
761
|
// @todo git sync might need other arguments / be combined with publishing
|
|
738
762
|
try {
|
|
739
|
-
await exec(`cd ${activeHaxsite.directory} && git pull && git push`);
|
|
763
|
+
await (0, _utils.exec)(`cd ${activeHaxsite.directory} && git pull && git push`);
|
|
740
764
|
} catch (e) {
|
|
741
765
|
(0, _logging.log)(e.stderr);
|
|
742
766
|
}
|
|
@@ -825,6 +849,135 @@ async function siteCommandDetected(commandRun) {
|
|
|
825
849
|
(0, _logging.log)(e.stderr);
|
|
826
850
|
}
|
|
827
851
|
break;
|
|
852
|
+
case "site:element":
|
|
853
|
+
try {
|
|
854
|
+
const reservedNames = ["annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph"];
|
|
855
|
+
activeHaxsite = await hax.systemStructureContext();
|
|
856
|
+
if (!commandRun.options.name) {
|
|
857
|
+
commandRun.options.name = await p.text({
|
|
858
|
+
message: 'Component name:',
|
|
859
|
+
placeholder: 'my-component',
|
|
860
|
+
required: true,
|
|
861
|
+
validate: value => {
|
|
862
|
+
if (!value) {
|
|
863
|
+
return "Name is required (tab writes default)";
|
|
864
|
+
}
|
|
865
|
+
if (reservedNames.includes(value)) {
|
|
866
|
+
return `Reserved name ${_picocolors.default.bold(value)} cannot be used`;
|
|
867
|
+
}
|
|
868
|
+
if (value.toLocaleLowerCase() !== value) {
|
|
869
|
+
return "Name must be lowercase";
|
|
870
|
+
}
|
|
871
|
+
if (/^\d/.test(value)) {
|
|
872
|
+
return "Name cannot start with a number";
|
|
873
|
+
}
|
|
874
|
+
if (/[`~!@#$%^&*()_=+\[\]{}|;:\'",<.>\/?\\]/.test(value)) {
|
|
875
|
+
return "No special characters allowed in name";
|
|
876
|
+
}
|
|
877
|
+
if (value.indexOf(' ') !== -1) {
|
|
878
|
+
return "No spaces allowed in name";
|
|
879
|
+
}
|
|
880
|
+
if (value.indexOf('-') === -1 || value.replace('--', '') !== value || value[0] === '-' || value[value.length - 1] === '-') {
|
|
881
|
+
return "Name must include at least one `-` and must not start or end name.";
|
|
882
|
+
}
|
|
883
|
+
// Check for any other syntax errors
|
|
884
|
+
if (!/^[a-z][a-z0-9.\-]*\-[a-z0-9.\-]*$/.test(value)) {
|
|
885
|
+
return `Name must follow the syntax ${_picocolors.default.bold("my-component")}`;
|
|
886
|
+
}
|
|
887
|
+
// assumes auto was selected in CLI
|
|
888
|
+
let joint = process.cwd();
|
|
889
|
+
if (commandRun.options.path) {
|
|
890
|
+
joint = commandRun.options.path;
|
|
891
|
+
}
|
|
892
|
+
if (fs.existsSync(path.join(joint, value))) {
|
|
893
|
+
return `${path.join(joint, value)} exists, rename this project`;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
} else {
|
|
898
|
+
let value = commandRun.options.name;
|
|
899
|
+
if (!value) {
|
|
900
|
+
console.error(_picocolors.default.red("Name is required (tab writes default)"));
|
|
901
|
+
process.exit(1);
|
|
902
|
+
}
|
|
903
|
+
if (reservedNames.includes(value)) {
|
|
904
|
+
console.error(_picocolors.default.red(`Reserved name ${_picocolors.default.bold(value)} cannot be used`));
|
|
905
|
+
process.exit(1);
|
|
906
|
+
}
|
|
907
|
+
if (value.toLocaleLowerCase() !== value) {
|
|
908
|
+
console.error(_picocolors.default.red("Name must be lowercase"));
|
|
909
|
+
process.exit(1);
|
|
910
|
+
}
|
|
911
|
+
if (/^\d/.test(value)) {
|
|
912
|
+
console.error(_picocolors.default.red("Name cannot start with a number"));
|
|
913
|
+
process.exit(1);
|
|
914
|
+
}
|
|
915
|
+
if (/[`~!@#$%^&*()_=+\[\]{}|;:\'",<.>\/?\\]/.test(value)) {
|
|
916
|
+
console.error(_picocolors.default.red("No special characters allowed in name"));
|
|
917
|
+
process.exit(1);
|
|
918
|
+
}
|
|
919
|
+
if (value.indexOf(' ') !== -1) {
|
|
920
|
+
console.error(_picocolors.default.red("No spaces allowed in name"));
|
|
921
|
+
process.exit(1);
|
|
922
|
+
}
|
|
923
|
+
if (value.indexOf('-') === -1 || value.replace('--', '') !== value || value[0] === '-' || value[value.length - 1] === '-') {
|
|
924
|
+
console.error(_picocolors.default.red("Name must include at least one `-` and must not start or end name."));
|
|
925
|
+
process.exit(1);
|
|
926
|
+
}
|
|
927
|
+
// Check for any other syntax errors
|
|
928
|
+
if (!/^[a-z][a-z0-9.\-]*\-[a-z0-9.\-]*$/.test(value)) {
|
|
929
|
+
console.error(_picocolors.default.red(`Name must follow the syntax ${_picocolors.default.bold("my-component")}`));
|
|
930
|
+
process.exit(1);
|
|
931
|
+
}
|
|
932
|
+
// assumes auto was selected in CLI
|
|
933
|
+
let joint = process.cwd();
|
|
934
|
+
if (commandRun.options.path) {
|
|
935
|
+
joint = commandRun.options.path;
|
|
936
|
+
}
|
|
937
|
+
if (fs.existsSync(path.join(joint, value))) {
|
|
938
|
+
console.error(_picocolors.default.red(`${path.join(joint, value)} exists, rename this project`));
|
|
939
|
+
process.exit(1);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
const project = {
|
|
943
|
+
name: commandRun.options.name,
|
|
944
|
+
path: activeHaxsite.directory,
|
|
945
|
+
className: (0, _utils.dashToCamel)(commandRun.options.name),
|
|
946
|
+
year: new Date().getFullYear()
|
|
947
|
+
};
|
|
948
|
+
if (!project.author) {
|
|
949
|
+
try {
|
|
950
|
+
let value = await (0, _utils.exec)(`git config user.name`);
|
|
951
|
+
project.author = value.stdout.trim();
|
|
952
|
+
} catch (e) {
|
|
953
|
+
(0, _logging.log)(`
|
|
954
|
+
git user name not configured. Run the following to do this:\n
|
|
955
|
+
git config --global user.name "namehere"\n
|
|
956
|
+
git config --global user.email "email@here`, 'debug');
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
const filePath = `${project.path}/custom/src/${project.name}.js`;
|
|
960
|
+
await fs.copyFileSync(`${process.mainModule.path}/templates/generic/sitecomponent.js`, filePath);
|
|
961
|
+
const ejsString = ejs.fileLoader(filePath, 'utf8');
|
|
962
|
+
let content = ejs.render(ejsString, project);
|
|
963
|
+
// file written successfully
|
|
964
|
+
fs.writeFileSync(filePath, content);
|
|
965
|
+
if (!commandRun.options.npmClient) {
|
|
966
|
+
commandRun.options.npmClient = 'npm';
|
|
967
|
+
}
|
|
968
|
+
if (fs.existsSync(`${project.path}/custom/custom-elements.json`)) {
|
|
969
|
+
await (0, _utils.exec)(`cd custom && ${commandRun.options.npmClient} run analyze`);
|
|
970
|
+
}
|
|
971
|
+
p.note(`🧙 Add to another web component (.js): ${_picocolors.default.underline(_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`import ./${project.name}.js`))))}`);
|
|
972
|
+
// at least a second to see the message print at all
|
|
973
|
+
await (0, _promises.setTimeout)(1000);
|
|
974
|
+
} catch (e) {
|
|
975
|
+
(0, _logging.log)(e.stderr);
|
|
976
|
+
// Original ejs.render error checking
|
|
977
|
+
console.error(_picocolors.default.red(process.cwd()));
|
|
978
|
+
console.error(_picocolors.default.red(e));
|
|
979
|
+
}
|
|
980
|
+
break;
|
|
828
981
|
case "site:surge":
|
|
829
982
|
try {
|
|
830
983
|
// attempt to install; implies they asked to publish with surge but
|
|
@@ -832,28 +985,31 @@ async function siteCommandDetected(commandRun) {
|
|
|
832
985
|
if (!sysSurge) {
|
|
833
986
|
let s = p.spinner();
|
|
834
987
|
s.start((0, _statements.merlinSays)('Installing Surge.sh globally so we can publish'));
|
|
835
|
-
let execOutput = await exec(`npm install --global surge`);
|
|
988
|
+
let execOutput = await (0, _utils.exec)(`npm install --global surge`);
|
|
836
989
|
s.stop((0, _statements.merlinSays)('surge.sh installed globally'));
|
|
837
990
|
(0, _logging.log)(execOutput.stdout.trim());
|
|
838
991
|
sysSurge = true;
|
|
839
992
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
993
|
+
let execOutput;
|
|
994
|
+
if (commandRun.options.domain && commandRun.options.y) {
|
|
995
|
+
let s = p.spinner();
|
|
996
|
+
s.start((0, _statements.merlinSays)('Sending site to Surge.sh ..'));
|
|
997
|
+
execOutput = await (0, _utils.exec)(`cd ${activeHaxsite.directory} && surge . ${commandRun.options.domain}`);
|
|
998
|
+
(0, _logging.log)(execOutput.stdout.trim());
|
|
999
|
+
s.stop((0, _statements.merlinSays)(`Site published: https://${commandRun.options.domain}`));
|
|
1000
|
+
} else {
|
|
1001
|
+
let surgeArgs = ['.'];
|
|
1002
|
+
// could get here bc of being interactive, yet passed in a domain...
|
|
1003
|
+
if (commandRun.options.domain) {
|
|
1004
|
+
surgeArgs.push(commandRun.options.domain);
|
|
1005
|
+
}
|
|
1006
|
+
execOutput = await (0, _utils.interactiveExec)('surge', surgeArgs, {
|
|
1007
|
+
cwd: activeHaxsite.directory
|
|
851
1008
|
});
|
|
1009
|
+
(0, _logging.log)((0, _statements.merlinSays)(`Site published: https://${commandRun.options.domain}`));
|
|
852
1010
|
}
|
|
853
|
-
let execOutput = await exec(`cd ${activeHaxsite.directory} && surge . ${commandRun.options.domain}`);
|
|
854
|
-
(0, _logging.log)(execOutput.stdout.trim());
|
|
855
|
-
(0, _logging.log)(`Site published: https://${commandRun.options.domain}`);
|
|
856
1011
|
} catch (e) {
|
|
1012
|
+
console.log("?");
|
|
857
1013
|
(0, _logging.log)(e.stderr);
|
|
858
1014
|
}
|
|
859
1015
|
break;
|
|
@@ -990,14 +1146,14 @@ async function siteCommandDetected(commandRun) {
|
|
|
990
1146
|
let commandMatch = siteActions().filter(action => action.value === commandList[i].split(' ')[2]);
|
|
991
1147
|
// if we found a command that means it is a valid command to run against the site
|
|
992
1148
|
if (commandMatch.length > 0) {
|
|
993
|
-
await exec(`${commandList[i]} --y --no-i --auto --quiet${rootDir}`);
|
|
1149
|
+
await (0, _utils.exec)(`${commandList[i]} --y --no-i --auto --quiet${rootDir}`);
|
|
994
1150
|
}
|
|
995
1151
|
// 1st command won't match as the argument creates a new site
|
|
996
1152
|
// but ensure we don't have a site context prior to running this
|
|
997
1153
|
// or we'll get a site in a site with the same name which is not
|
|
998
1154
|
// the desired result
|
|
999
1155
|
else if (!(await hax.systemStructureContext())) {
|
|
1000
|
-
await exec(`${commandList[i]} --y --no-i --auto --quiet --no-extras`);
|
|
1156
|
+
await (0, _utils.exec)(`${commandList[i]} --y --no-i --auto --quiet --no-extras`);
|
|
1001
1157
|
// site will have been created, obtain the site name and set root so
|
|
1002
1158
|
// the other commands get piped into it correctly
|
|
1003
1159
|
rootDir = ` --root ${commandList[i].split(' ')[2]}`;
|
|
@@ -1009,6 +1165,40 @@ async function siteCommandDetected(commandRun) {
|
|
|
1009
1165
|
}
|
|
1010
1166
|
}
|
|
1011
1167
|
break;
|
|
1168
|
+
case "issue:general":
|
|
1169
|
+
// open the issues
|
|
1170
|
+
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Submit issue / suggestion on Github `))}`);
|
|
1171
|
+
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Opening in browser `))}`);
|
|
1172
|
+
await (0, _open.default)("https://github.com/haxtheweb/issues/issues/new");
|
|
1173
|
+
p.outro(`${_picocolors.default.bgBlue(_picocolors.default.white(` https://github.com/haxtheweb/issues/issues/new `))}`);
|
|
1174
|
+
break;
|
|
1175
|
+
case "issue:theme":
|
|
1176
|
+
// open the issues
|
|
1177
|
+
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Submit custom theme on Github `))}`);
|
|
1178
|
+
p.intro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Opening in browser `))}`);
|
|
1179
|
+
let allContents = '';
|
|
1180
|
+
fs.readdir(`${activeHaxsite.directory}/custom/src`, (err, files) => {
|
|
1181
|
+
if (err) {
|
|
1182
|
+
console.error('Error reading directory:', err);
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
files.forEach((file, index) => {
|
|
1186
|
+
const filePath = path.join(`${activeHaxsite.directory}/custom/src`, file);
|
|
1187
|
+
if (fs.lstatSync(filePath).isFile()) {
|
|
1188
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
1189
|
+
// append file name as a JS comment
|
|
1190
|
+
allContents += `\n// FILENAME: ${file}\n` + content + '\n'; // Add newline between files if desired
|
|
1191
|
+
}
|
|
1192
|
+
if (index === files.length - 1) {
|
|
1193
|
+
console.log('Combined contents of all files:\n', allContents);
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
});
|
|
1197
|
+
console.log(allContents);
|
|
1198
|
+
await (0, _open.default)(`https://github.com/haxtheweb/issues/issues/new?template=new-design.md`);
|
|
1199
|
+
p.outro(`${_picocolors.default.bgBlue(_picocolors.default.white(` Copy the output of the console into the issue's js template area `))}`);
|
|
1200
|
+
p.outro(`${_picocolors.default.bgBlue(_picocolors.default.white(` https://github.com/haxtheweb/issues/issues/new?template=new-design.md `))}`);
|
|
1201
|
+
break;
|
|
1012
1202
|
case "quit":
|
|
1013
1203
|
// quit
|
|
1014
1204
|
process.exit(0);
|
|
@@ -1123,9 +1313,6 @@ async function siteProcess(commandRun, project, port = '3000') {
|
|
|
1123
1313
|
project.extras = ['launch'];
|
|
1124
1314
|
}
|
|
1125
1315
|
}
|
|
1126
|
-
if (!commandRun.options.quiet) {
|
|
1127
|
-
s.start((0, _statements.merlinSays)(`Creating new site: ${project.name}`));
|
|
1128
|
-
}
|
|
1129
1316
|
let siteRequest = {
|
|
1130
1317
|
"site": {
|
|
1131
1318
|
"name": project.name,
|
|
@@ -1241,9 +1428,18 @@ async function siteProcess(commandRun, project, port = '3000') {
|
|
|
1241
1428
|
}
|
|
1242
1429
|
HAXCMS.cliWritePath = `${project.path}`;
|
|
1243
1430
|
let res = new Res();
|
|
1431
|
+
// unfortunately the twig exception is not blockable from output at this layer
|
|
1244
1432
|
await hax.RoutesMap.post.createSite({
|
|
1245
1433
|
body: siteRequest
|
|
1246
1434
|
}, res);
|
|
1435
|
+
// so we run it and then clear the screen
|
|
1436
|
+
// this is a bit of a hack but it works to give the user the feedback that the site was
|
|
1437
|
+
// created successfully, but only if not in quiet mode (default)
|
|
1438
|
+
if (!commandRun.options.quiet) {
|
|
1439
|
+
process.stdout.write('\x1Bc');
|
|
1440
|
+
s.start((0, _statements.merlinSays)(`Creating new site: ${project.name}`));
|
|
1441
|
+
await (0, _promises.setTimeout)(1000);
|
|
1442
|
+
}
|
|
1247
1443
|
// path different for this one as it's on the fly produced
|
|
1248
1444
|
const recipeFileName = path.join(project.path, '/', project.name, `${siteRecipeFile}`);
|
|
1249
1445
|
const recipeLogTransport = new winston.transports.File({
|
|
@@ -1270,7 +1466,7 @@ async function siteProcess(commandRun, project, port = '3000') {
|
|
|
1270
1466
|
}
|
|
1271
1467
|
}
|
|
1272
1468
|
if (!commandRun.options.quiet) {
|
|
1273
|
-
s.stop((0, _statements.merlinSays)(`${project.name} created!`));
|
|
1469
|
+
s.stop((0, _statements.merlinSays)(`${project.name} created successfully!`));
|
|
1274
1470
|
await (0, _promises.setTimeout)(500);
|
|
1275
1471
|
}
|
|
1276
1472
|
|
|
@@ -1282,7 +1478,7 @@ async function siteProcess(commandRun, project, port = '3000') {
|
|
|
1282
1478
|
}
|
|
1283
1479
|
if (project.gitRepo && !commandRun.options.isMonorepo) {
|
|
1284
1480
|
try {
|
|
1285
|
-
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}` : ''}`);
|
|
1481
|
+
await (0, _utils.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}` : ''}`);
|
|
1286
1482
|
} catch (e) {}
|
|
1287
1483
|
}
|
|
1288
1484
|
// ensure dot files is there because it doesn't copy for some reason for sites :\
|
|
@@ -1312,13 +1508,13 @@ ${_picocolors.default.underline(_picocolors.default.cyan(`http://localhost:${por
|
|
|
1312
1508
|
📘 VS Code Project: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`code ${optionPath}`)))}
|
|
1313
1509
|
🚧 Launch later: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`${command}`)))}
|
|
1314
1510
|
|
|
1315
|
-
⌨️ To resume 🧙 Merlin press: ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgRed(` CTRL + C `)))}
|
|
1511
|
+
⌨️ To resume 🧙 Merlin press: ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgRed(` CTRL + C or CTRL + BREAK `)))}
|
|
1316
1512
|
`);
|
|
1317
1513
|
}
|
|
1318
1514
|
// at least a second to see the message print at all
|
|
1319
1515
|
await (0, _promises.setTimeout)(1000);
|
|
1320
1516
|
try {
|
|
1321
|
-
await exec(`cd ${optionPath} && ${command}`);
|
|
1517
|
+
await (0, _utils.exec)(`cd ${optionPath} && ${command}`);
|
|
1322
1518
|
} catch (e) {
|
|
1323
1519
|
// don't log bc output is weird
|
|
1324
1520
|
}
|
|
@@ -1355,17 +1551,14 @@ async function siteThemeList(coreOnly = true, directory = null) {
|
|
|
1355
1551
|
value: 'clean-portfolio-theme',
|
|
1356
1552
|
label: 'Clean Portfolio'
|
|
1357
1553
|
}, {
|
|
1358
|
-
value: '
|
|
1359
|
-
label: '
|
|
1554
|
+
value: 'journey-theme',
|
|
1555
|
+
label: 'Journey'
|
|
1360
1556
|
}, {
|
|
1361
1557
|
value: 'polaris-flex-theme',
|
|
1362
|
-
label: '
|
|
1558
|
+
label: 'Flex'
|
|
1363
1559
|
}, {
|
|
1364
1560
|
value: 'polaris-flex-sidebar',
|
|
1365
|
-
label: '
|
|
1366
|
-
}, {
|
|
1367
|
-
value: 'polaris-invent-theme',
|
|
1368
|
-
label: 'Polaris - Invent'
|
|
1561
|
+
label: 'Flex Sidebar'
|
|
1369
1562
|
}, {
|
|
1370
1563
|
value: 'custom-theme',
|
|
1371
1564
|
label: 'Create Custom Theme'
|
|
@@ -1427,7 +1620,7 @@ async function customSiteTheme(commandRun, project) {
|
|
|
1427
1620
|
}
|
|
1428
1621
|
if (!project.author) {
|
|
1429
1622
|
try {
|
|
1430
|
-
let value = await exec(`git config user.name`);
|
|
1623
|
+
let value = await (0, _utils.exec)(`git config user.name`);
|
|
1431
1624
|
project.author = value.stdout.trim();
|
|
1432
1625
|
} catch (e) {
|
|
1433
1626
|
(0, _logging.log)(`
|
|
@@ -1464,7 +1657,7 @@ async function customSiteTheme(commandRun, project) {
|
|
|
1464
1657
|
}
|
|
1465
1658
|
|
|
1466
1659
|
// import theme to custom.js
|
|
1467
|
-
await fs.appendFileSync(`${sitePath}/custom/src/custom.js`, `\n import "./${project.customThemeName}.js"
|
|
1660
|
+
await fs.appendFileSync(`${sitePath}/custom/src/custom.js`, `\n import "./${project.customThemeName}.js";`);
|
|
1468
1661
|
var activeHaxsite = await hax.systemStructureContext(sitePath);
|
|
1469
1662
|
|
|
1470
1663
|
// add theme to site.json
|
|
@@ -1477,7 +1670,7 @@ async function customSiteTheme(commandRun, project) {
|
|
|
1477
1670
|
activeHaxsite.manifest.save(false);
|
|
1478
1671
|
|
|
1479
1672
|
// install and build theme dependencies
|
|
1480
|
-
await exec(`cd ${sitePath}/custom/ && ${commandRun.options.npmClient} install && ${commandRun.options.npmClient} run build && ${commandRun.options.npmClient} run analyze && cd ${sitePath}`);
|
|
1673
|
+
await (0, _utils.exec)(`cd ${sitePath}/custom/ && ${commandRun.options.npmClient} install && ${commandRun.options.npmClient} run build && ${commandRun.options.npmClient} run analyze && cd ${sitePath}`);
|
|
1481
1674
|
}
|
|
1482
1675
|
|
|
1483
1676
|
// @fork of the hax core util for this so that we avoid api difference between real dom and parse nodejs dom
|