@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 CHANGED
@@ -31,65 +31,73 @@ Usage: hax [options] [command]
31
31
 
32
32
  Options:
33
33
  --
34
- --v Verbose output
35
- --debug Output for developers
36
- --format <char> Output format; json (default), yaml
37
- --path <char> where to perform operation
38
- --npm-client <char> npm client to use (must be installed) npm,
39
- yarn, pnpm (default: "npm")
40
- --y yes to all questions
41
- --skip skip frills like animations
42
- --quiet remove console logging
43
- --auto yes to all questions, alias of y
44
- --no-i prevent interactions / sub-process, good for
45
- scripting
46
- --to-file <char> redirect command output to a file
47
- --no-extras skip all extra / automatic command processing
48
- --root <char> root location to execute the command from
49
- --org <char> organization for package.json
50
- --author <char> author for site / package.json
51
- --writeHaxProperties Write haxProperties for the element
52
- --import-site <char> URL of site to import
53
- --import-structure <char> import method to use:
54
- pressbooksToSite
55
- elmslnToSite
56
- haxcmsToSite
57
- notionToSite
58
- gitbookToSite
59
- evolutionToSite
60
- htmlToSite
61
- docxToSite
62
- --node-op <char> node operation to perform
63
- --item-id <char> node ID to operate on
64
- --name <char> name of the project
65
- --domain <char> published domain name
66
- --title-scrape <char> CSS Selector for `title` in resource
67
- --content-scrape <char> CSS Selector for `body` in resource
68
- --items-import <char> import items from a file / site
69
- --recipe <char> path to recipe file
70
- --custom-theme-name <char> custom theme name
71
- --custom-theme-template <char> custom theme template; (options: base,
72
- polaris-flex, polaris-sidebar)
73
- -V, --version output the version number
74
- --title <char> Title
75
- --content <char> Page content
76
- --slug <char> Path (slug)
77
- --published <char> Publishing status
78
- --tags <char> Tags
79
- --parent <char> Parent
80
- --order <char> Order
81
- --theme <char> Theme
82
- --hide-in-menu <char> Hide in menu
83
- -h, --help display help for command
34
+ --v Verbose output
35
+ --debug Output for developers
36
+ --format <char> Output format; json (default), yaml
37
+ --path <char> where to perform operation
38
+ --name <char> name of the project/web component
39
+ --npm-client <char> npm client to use (must be installed)
40
+ npm, yarn, pnpm (default: "npm")
41
+ --y yes to all questions
42
+ --skip skip frills like animations
43
+ --quiet remove console logging
44
+ --auto yes to all questions, alias of y
45
+ --no-i prevent interactions / sub-process, good
46
+ for scripting
47
+ --to-file <char> redirect command output to a file
48
+ --no-extras skip all extra / automatic command
49
+ processing
50
+ --root <char> root location to execute the command from
51
+ --org <char> organization for package.json
52
+ --author <char> author for site / package.json
53
+ --writeHaxProperties Write haxProperties for the element
54
+ --import-site <char> URL of site to import
55
+ --import-structure <char> import method to use:
56
+ pressbooksToSite
57
+ elmslnToSite
58
+ haxcmsToSite
59
+ notionToSite
60
+ gitbookToSite
61
+ evolutionToSite
62
+ htmlToSite
63
+ docxToSite
64
+ --node-op <char> node operation to perform
65
+ --item-id <char> node ID to operate on
66
+ --domain <char> published domain name
67
+ --title-scrape <char> CSS Selector for `title` in resource
68
+ --content-scrape <char> CSS Selector for `body` in resource
69
+ --items-import <char> import items from a file / site
70
+ --recipe <char> path to recipe file
71
+ --custom-theme-name <char> custom theme name
72
+ --custom-theme-template <char> custom theme template; (options: base,
73
+ polaris-flex, polaris-sidebar)
74
+ --repos <char...> repositories to clone
75
+ -V, --version output the version number
76
+ --title <char> Title
77
+ --content <char> Page content
78
+ --slug <char> Path (slug)
79
+ --published <char> Publishing status
80
+ --tags <char> Tags
81
+ --parent <char> Parent
82
+ --order <char> Order
83
+ --theme <char> Theme
84
+ --hide-in-menu <char> Hide in menu
85
+ -h, --help display help for command
84
86
 
85
87
  Commands:
86
- start Select which hax sub-program to run
87
- site [options] [action] create or administer a HAXsite
88
- webcomponent [options] [name] Create Lit based web components, with HAX
89
- recommendations
90
- audit [options] Audits web components for compliance with DDD
91
- (HAX Design System)
92
- help [command] display help for command
88
+ start Select which hax sub-program to run
89
+ update [options] hax cli self update
90
+ serve Launch HAXsite in development mode
91
+ (http://localhost)
92
+ site [options] [action] create or administer a HAXsite
93
+ wc|webcomponent [options] [action] Create Lit based web components, with HAX
94
+ recommendations
95
+ audit [options] Audits web components for compliance with
96
+ DDD (HAX design system)
97
+ party [options] [action] Party time! Join the HAX community and
98
+ get involved!
99
+ help [command] display help for command
100
+
93
101
  ```
94
102
  ## Examples
95
103
  For a detailed list of example commands that you can perform with `hax` see [examples](examples.md).
@@ -106,11 +114,6 @@ Run `man hax` to get detailed manual.
106
114
  npx @haxtheweb/create
107
115
  # this is same as above, better windows CLI support
108
116
  npm init @haxtheweb
109
- - Try Hax: https://hax.cloud
110
- - HAXCellence https://haxtheweb.org/what-is-hax
111
- "scripts": {
112
- "hax": "hax"
113
- }
114
117
  ```
115
118
 
116
119
  ```bash
package/dist/create.js CHANGED
@@ -9,21 +9,31 @@ var _picocolors = _interopRequireDefault(require("picocolors"));
9
9
  var _statements = require("./lib/statements.js");
10
10
  var _logging = require("./lib/logging.js");
11
11
  var _audit = require("./lib/programs/audit.js");
12
+ var _party = require("./lib/programs/party.js");
12
13
  var _webcomponent = require("./lib/programs/webcomponent.js");
13
14
  var _site = require("./lib/programs/site.js");
14
15
  var _utils = require("./lib/utils.js");
15
16
  var hax = _interopRequireWildcard(require("@haxtheweb/haxcms-nodejs"));
16
- var child_process = _interopRequireWildcard(require("child_process"));
17
- var util = _interopRequireWildcard(require("node:util"));
18
17
  var _commander = require("commander");
18
+ var _package = _interopRequireDefault(require("../package.json"));
19
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
20
  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); }
21
21
  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; }
22
22
  process.env.haxcms_middleware = "node-cli";
23
23
  const HAXCMS = hax.HAXCMS;
24
- const exec = util.promisify(child_process.exec);
24
+
25
+ // check the last time this was run
26
+ let lastTime = (0, _utils.readConfigFile)('hax-cli-last-run');
27
+ // first run in the event it is null assume now
28
+ if (!lastTime) {
29
+ lastTime = new Date().toISOString();
30
+ }
31
+ // check time difference broken down by unit
32
+ const timeSince = (0, _utils.getTimeDifference)(new Date().toISOString(), lastTime);
33
+ // write last run so that we know last time they were here
34
+ (0, _utils.writeConfigFile)('hax-cli-last-run', new Date().toISOString());
25
35
  let sysGit = true;
26
- exec('git --version', error => {
36
+ (0, _utils.exec)('which git', error => {
27
37
  if (error) {
28
38
  sysGit = false;
29
39
  }
@@ -45,7 +55,10 @@ async function main() {
45
55
  .option('--org <char>', 'organization for package.json').option('--author <char>', 'author for site / package.json').option('--writeHaxProperties', 'Write haxProperties for the element')
46
56
 
47
57
  // options for site
48
- .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('--domain <char>', 'published domain name').option('--title-scrape <char>', 'CSS Selector for `title` in resource').option('--content-scrape <char>', 'CSS Selector for `body` in resource').option('--items-import <char>', 'import items from a file / site').option('--recipe <char>', 'path to recipe file').option('--custom-theme-name <char>', 'custom theme name').option('--custom-theme-template <char>', 'custom theme template; (options: base, polaris-flex, polaris-sidebar)').version(await HAXCMS.getHAXCMSVersion()).helpCommand(true);
58
+ .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('--domain <char>', 'published domain name').option('--title-scrape <char>', 'CSS Selector for `title` in resource').option('--content-scrape <char>', 'CSS Selector for `body` in resource').option('--items-import <char>', 'import items from a file / site').option('--recipe <char>', 'path to recipe file').option('--custom-theme-name <char>', 'custom theme name').option('--custom-theme-template <char>', 'custom theme template; (options: base, polaris-flex, polaris-sidebar)')
59
+
60
+ // options for party
61
+ .option('--repos <char...>', 'repositories to clone').version(_package.default.version).helpCommand(true);
49
62
 
50
63
  // default command which runs interactively
51
64
  _commander.program.command('start').description('Select which hax sub-program to run').action(() => {
@@ -55,6 +68,22 @@ async function main() {
55
68
  options: {}
56
69
  };
57
70
  });
71
+ _commander.program.command('update').description('hax cli self update').option('--y', 'yes to all questions').action(() => {
72
+ commandRun = {
73
+ command: 'update',
74
+ arguments: {},
75
+ options: {}
76
+ };
77
+ });
78
+ _commander.program.command('serve').description('Launch HAXsite in development mode (http://localhost)').action(() => {
79
+ commandRun = {
80
+ command: 'serve',
81
+ arguments: {
82
+ action: 'serve'
83
+ },
84
+ options: {}
85
+ };
86
+ });
58
87
 
59
88
  // site operations and actions
60
89
  let strActions = '';
@@ -71,7 +100,7 @@ async function main() {
71
100
  commandRun.arguments.action = action;
72
101
  commandRun.options.skip = true;
73
102
  }
74
- }).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').option('--no-extras', 'skip all extra / automatic command processing').option('--root <char>', 'root location to execute the command from').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('--title-scrape <char>', 'CSS Selector for `title` in resource').option('--content-scrape <char>', 'CSS Selector for `body` in resource').option('--items-import <char>', 'import items from a file / site').option('--recipe <char>', 'path to recipe file').option('--custom-theme-name <char>', 'custom theme name').option('--custom-theme-template <char>', 'custom theme template (options: base, polaris-flex, polaris-sidebar)').version(await HAXCMS.getHAXCMSVersion());
103
+ }).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').option('--no-extras', 'skip all extra / automatic command processing').option('--root <char>', 'root location to execute the command from').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('--title-scrape <char>', 'CSS Selector for `title` in resource').option('--content-scrape <char>', 'CSS Selector for `body` in resource').option('--items-import <char>', 'import items from a file / site').option('--recipe <char>', 'path to recipe file').option('--custom-theme-name <char>', 'custom theme name').option('--custom-theme-template <char>', 'custom theme template (options: base, polaris-flex, polaris-sidebar)').version(_package.default.version);
75
104
  let siteNodeOps = (0, _site.siteNodeOperations)();
76
105
  for (var i in siteNodeOps) {
77
106
  _commander.program.option(`--${(0, _utils.camelToDash)(siteNodeOps[i].value)} <char>`, `${siteNodeOps[i].label}`);
@@ -94,7 +123,7 @@ async function main() {
94
123
  commandRun.arguments.action = action;
95
124
  commandRun.options.skip = true;
96
125
  }
97
- }).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('--name <char>', 'name of the web component').option('--writeHaxProperties', 'Write haxProperties for the element').option('--to-file <char>', 'redirect command output to a file').option('--no-extras', 'skip all extra / automatic command processing').option('--no-i', 'prevent interactions / sub-process, good for scripting').option('--root <char>', 'root location to execute the command from').version(await HAXCMS.getHAXCMSVersion());
126
+ }).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('--name <char>', 'name of the web component').option('--writeHaxProperties', 'Write haxProperties for the element').option('--to-file <char>', 'redirect command output to a file').option('--no-extras', 'skip all extra / automatic command processing').option('--no-i', 'prevent interactions / sub-process, good for scripting').option('--root <char>', 'root location to execute the command from').version(_package.default.version);
98
127
 
99
128
  // audit program
100
129
  _commander.program.command('audit').description('Audits web components for compliance with DDD (HAX design system)').action(() => {
@@ -103,7 +132,18 @@ async function main() {
103
132
  arguments: {},
104
133
  options: {}
105
134
  };
106
- }).option('--debug', 'Output for developers').version(await HAXCMS.getHAXCMSVersion());
135
+ }).option('--debug', 'Output for developers').version(_package.default.version);
136
+ _commander.program.command('party').description('Party time! Join the HAX community and get involved!').argument('[action]', 'Actions to perform on web component include:' + "\n\r" + "test").action(action => {
137
+ commandRun = {
138
+ command: 'party',
139
+ arguments: {},
140
+ options: {}
141
+ };
142
+ if (action) {
143
+ commandRun.arguments.action = action;
144
+ commandRun.options.skip = true;
145
+ }
146
+ }).option('--root <char>', 'root location to execute the command from').option('--y', 'yes to all questions').option('--auto', 'yes to all questions, alias of y').option('--repos <char...>', 'repositories to clone').version(_package.default.version);
107
147
 
108
148
  // process program arguments
109
149
  _commander.program.parse();
@@ -139,7 +179,7 @@ async function main() {
139
179
  let author = '';
140
180
  // should be able to grab if not predefined
141
181
  try {
142
- let value = await exec(`git config user.name`);
182
+ let value = await (0, _utils.exec)(`git config user.name`);
143
183
  author = value.stdout.trim();
144
184
  } catch (e) {
145
185
  (0, _logging.log)(`
@@ -213,26 +253,61 @@ async function main() {
213
253
  if (commandRun.options.debug) {
214
254
  (0, _logging.log)(packageData, 'debug');
215
255
  }
216
- // CLI works within context of the site if one is detected, otherwise we can do other thingss
217
- if (await hax.systemStructureContext()) {
218
- commandRun.program = 'site';
219
- commandRun.options.skip = true;
220
- await (0, _site.siteCommandDetected)(commandRun);
256
+ // test for updating to latest or just run the command
257
+ if (commandRun.command === "update") {
258
+ await testForUpdates(commandRun);
221
259
  } else if (commandRun.command === 'audit') {
222
- (0, _audit.auditCommandDetected)(commandRun);
260
+ let customPath = null;
261
+ // test for haxcms context
262
+ if ((await hax.systemStructureContext()) && fs.existsSync(`${process.cwd()}/custom`)) {
263
+ customPath = path.join(process.cwd(), 'custom');
264
+ }
265
+ (0, _audit.auditCommandDetected)(commandRun, customPath);
266
+ } else if (commandRun.command === 'party') {
267
+ await (0, _party.partyCommandDetected)(commandRun);
268
+ }
269
+ // CLI works within context of the site if one is detected, otherwise we can do other things
270
+ else if (await hax.systemStructureContext()) {
271
+ if (commandRun.command === 'serve') {
272
+ commandRun.program = 'serve';
273
+ commandRun.options.skip = true;
274
+ await (0, _site.siteCommandDetected)(commandRun);
275
+ } else {
276
+ commandRun.program = 'site';
277
+ commandRun.options.skip = true;
278
+ await (0, _site.siteCommandDetected)(commandRun);
279
+ }
223
280
  } else if (packageData && (packageData.customElements || packageData.hax && packageData.hax.cli) && packageData.scripts.start) {
224
- commandRun.program = 'webcomponent';
225
- commandRun.options.skip = true;
226
- await (0, _webcomponent.webcomponentCommandDetected)(commandRun, packageData);
281
+ if (commandRun.command === 'serve') {
282
+ commandRun.program = 'serve';
283
+ commandRun.options.skip = true;
284
+ await (0, _webcomponent.webcomponentCommandDetected)(commandRun, packageData);
285
+ } else {
286
+ commandRun.program = 'webcomponent';
287
+ commandRun.options.skip = true;
288
+ await (0, _webcomponent.webcomponentCommandDetected)(commandRun, packageData);
289
+ }
227
290
  } else {
228
291
  if (commandRun.command === 'start' && !commandRun.options.y && !commandRun.options.auto && !commandRun.options.skip && !commandRun.options.quiet) {
229
292
  await (0, _statements.haxIntro)();
230
293
  }
294
+ // it's been 7 days since last check, do the check and offer command to resolve if needed
295
+ if (timeSince.days > 7) {
296
+ // check for updates
297
+ let execOut = await (0, _utils.exec)(`npm view @haxtheweb/create version`);
298
+ let updateCheck = execOut.stdout.trim();
299
+ if (updateCheck !== _package.default.version && !commandRun.options.quiet) {
300
+ p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` HAX cli updates available! `))}`);
301
+ p.intro(`Current version: ${_package.default.version}`);
302
+ p.intro(`Latest version: ${updateCheck}`);
303
+ p.intro(`Run ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgGreen('hax update')))} to update to the latest version`);
304
+ }
305
+ }
231
306
  let activeProject = null;
232
307
  let project = {
233
308
  type: null
234
309
  };
235
- while (project.type !== 'quit') {
310
+ while (project.type !== 'quit' && project.type !== 'update') {
236
311
  if (activeProject) {
237
312
  if (!commandRun.options.quiet) {
238
313
  p.note(` 🧙🪄 BE GONE ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgGreen(activeProject)))} sub-process daemon! 🪄 + ✨ 👹 = 💀 `);
@@ -256,6 +331,22 @@ async function main() {
256
331
  type: commandRun.command
257
332
  };
258
333
  } else if (commandRun.options.i) {
334
+ let buildOptions = [{
335
+ value: 'webcomponent',
336
+ label: '🏗️ Create a Web Component'
337
+ }, {
338
+ value: 'site',
339
+ label: '🏡 Create a HAXsite'
340
+ }, {
341
+ value: 'party',
342
+ label: '🎉 Join the HAX community'
343
+ }, {
344
+ value: 'update',
345
+ label: '🤓 Check for hax cli updates'
346
+ }, {
347
+ value: 'quit',
348
+ label: '🚪 Quit'
349
+ }];
259
350
  project = await p.group({
260
351
  type: ({
261
352
  results
@@ -263,21 +354,12 @@ async function main() {
263
354
  message: !activeProject ? `What should we build?` : `Thirsty for more? What should we create now?`,
264
355
  initialValue: 'webcomponent',
265
356
  required: true,
266
- options: [{
267
- value: 'webcomponent',
268
- label: '🏗️ Create a Web Component'
269
- }, {
270
- value: 'site',
271
- label: '🏡 Create a HAXsite'
272
- }, {
273
- value: 'quit',
274
- label: '🚪 Quit'
275
- }]
357
+ options: buildOptions
276
358
  })
277
359
  }, {
278
360
  onCancel: () => {
279
361
  if (!commandRun.options.quiet) {
280
- p.cancel('🧙🪄 Merlin: Leaving so soon? HAX ya later');
362
+ p.cancel('🧙🪄 Merlin: Canceling cli.. HAX ya later');
281
363
  (0, _statements.communityStatement)();
282
364
  }
283
365
  process.exit(0);
@@ -286,9 +368,14 @@ async function main() {
286
368
  } else if (!commandRun.options.i) {
287
369
  process.exit(0);
288
370
  }
371
+ if (project.type === "update") {
372
+ await testForUpdates(commandRun);
373
+ } else if (project.type === "party") {
374
+ await (0, _party.partyCommandDetected)(commandRun);
375
+ }
289
376
  // detect being in a haxcms scaffold. easiest way is _sites being in this directory
290
377
  // set the path automatically so we skip the question
291
- if (commandRun.command === "site" && fs.existsSync(`${process.cwd()}/_sites`)) {
378
+ else if (commandRun.command === "site" && fs.existsSync(`${process.cwd()}/_sites`)) {
292
379
  if (!commandRun.options.quiet) {
293
380
  p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` HAXcms detected : Path set automatically `))}`);
294
381
  }
@@ -296,7 +383,7 @@ async function main() {
296
383
  }
297
384
  activeProject = project.type;
298
385
  // silly but this way we don't have to take options for quitting
299
- if (project.type !== 'quit') {
386
+ if (['site', 'webcomponent'].includes(project.type)) {
300
387
  // global spot for core themes list
301
388
  let coreThemes = await (0, _site.siteThemeList)(true);
302
389
  project = await p.group({
@@ -330,6 +417,7 @@ async function main() {
330
417
  name: ({
331
418
  results
332
419
  }) => {
420
+ const reservedNames = ["annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph"];
333
421
  if (!commandRun.arguments.action) {
334
422
  let placeholder = "mysite";
335
423
  let message = "Site name:";
@@ -345,12 +433,18 @@ async function main() {
345
433
  if (!value) {
346
434
  return "Name is required (tab writes default)";
347
435
  }
436
+ if (reservedNames.includes(value)) {
437
+ return `Reserved name ${_picocolors.default.bold(value)} cannot be used`;
438
+ }
348
439
  if (value.toLocaleLowerCase() !== value) {
349
440
  return "Name must be lowercase";
350
441
  }
351
442
  if (/^\d/.test(value)) {
352
443
  return "Name cannot start with a number";
353
444
  }
445
+ if (/[`~!@#$%^&*()_=+\[\]{}|;:\'",<.>\/?\\]/.test(value)) {
446
+ return "No special characters allowed in name";
447
+ }
354
448
  if (value.indexOf(' ') !== -1) {
355
449
  return "No spaces allowed in name";
356
450
  }
@@ -361,6 +455,10 @@ async function main() {
361
455
  if (results.type === "webcomponent" && wcReg[value]) {
362
456
  return "Name is already a web component in the wc-registry published for HAX.";
363
457
  }
458
+ // Check for any other syntax errors
459
+ if (results.type === "webcomponent" && !/^[a-z][a-z0-9.\-]*\-[a-z0-9.\-]*$/.test(value)) {
460
+ return `Name must follow the syntax ${_picocolors.default.bold("my-component")}`;
461
+ }
364
462
  // assumes auto was selected in CLI
365
463
  let joint = process.cwd();
366
464
  if (commandRun.options.path) {
@@ -380,12 +478,17 @@ async function main() {
380
478
  _commander.program.error(_picocolors.default.red("Name is required (tab writes default)"));
381
479
  process.exit(1);
382
480
  }
481
+ if (reservedNames.includes(value)) {
482
+ _commander.program.error(_picocolors.default.red(`Reserved name ${_picocolors.default.bold(value)} cannot be used`));
483
+ process.exit(1);
484
+ }
383
485
  if (value.toLocaleLowerCase() !== value) {
384
486
  _commander.program.error(_picocolors.default.red("Name must be lowercase"));
385
487
  process.exit(1);
386
488
  }
387
489
  if (/^\d/.test(value)) {
388
490
  _commander.program.error(_picocolors.default.red("Name cannot start with a number"));
491
+ process.exit(1);
389
492
  }
390
493
  if (value.indexOf(' ') !== -1) {
391
494
  _commander.program.error(_picocolors.default.red("No spaces allowed in name"));
@@ -400,6 +503,11 @@ async function main() {
400
503
  _commander.program.error(_picocolors.default.red("Name is already a web component in the wc-registry published for HAX."));
401
504
  process.exit(1);
402
505
  }
506
+ // Check for any other syntax errors
507
+ if (results.type === "webcomponent" && !/^[a-z][a-z0-9.\-]*\-[a-z0-9.\-]*$/.test(value)) {
508
+ _commander.program.error(_picocolors.default.red(`Name must follow the syntax ${_picocolors.default.bold("my-component")}`));
509
+ process.exit(1);
510
+ }
403
511
  // assumes auto was selected in CLI
404
512
  let joint = process.cwd();
405
513
  if (commandRun.options.path) {
@@ -576,7 +684,7 @@ async function main() {
576
684
  }, {
577
685
  onCancel: () => {
578
686
  if (!commandRun.options.quiet) {
579
- p.cancel('🧙🪄 Merlin: Canceling CLI.. HAX ya later');
687
+ p.cancel('🧙🪄 Merlin: Canceling cli.. HAX ya later');
580
688
  (0, _statements.communityStatement)();
581
689
  }
582
690
  process.exit(0);
@@ -599,7 +707,7 @@ async function main() {
599
707
  };
600
708
  }
601
709
  project.year = new Date().getFullYear();
602
- project.version = await HAXCMS.getHAXCMSVersion();
710
+ project.version = _package.default.version;
603
711
  if (!project.name && commandRun.arguments.action) {
604
712
  project.name = commandRun.arguments.action;
605
713
  }
@@ -625,9 +733,74 @@ async function main() {
625
733
  }
626
734
  }
627
735
  }
628
- if (!commandRun.options.quiet) {
736
+ if (!commandRun.options.quiet && project.type !== 'update') {
629
737
  (0, _statements.communityStatement)();
630
738
  }
631
739
  }
632
740
  }
741
+
742
+ // check for updates
743
+ async function testForUpdates(commandRun) {
744
+ let execOut = await (0, _utils.exec)(`npm view @haxtheweb/create version`);
745
+ let latest = execOut.stdout.trim();
746
+ if (latest !== _package.default.version) {
747
+ if (!commandRun.options.quiet) {
748
+ p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` HAX cli updates available! `))}`);
749
+ p.intro(`Current version: ${_package.default.version}`);
750
+ p.intro(`Latest version: ${latest}`);
751
+ }
752
+ let runUpdates = {
753
+ answer: false
754
+ };
755
+ if (!commandRun.options.y) {
756
+ runUpdates = await p.group({
757
+ answer: ({
758
+ results
759
+ }) => p.confirm({
760
+ message: `Do you want to update the cli to the latest version? (${latest})`,
761
+ initialValue: true
762
+ })
763
+ }, {
764
+ onCancel: () => {
765
+ if (!commandRun.options.quiet) {
766
+ p.cancel('🧙🪄 Merlin: Leaving so soon? HAX ya later');
767
+ p.outro(`
768
+ 🧙 Upgrade at any time: ${_picocolors.default.yellow('npm install --global @haxtheweb/create')}
769
+
770
+ 💡 ${_picocolors.default.bold(_picocolors.default.white(`Never. Stop. Innovating.`))}
771
+ `);
772
+ }
773
+ process.exit(0);
774
+ }
775
+ });
776
+ } else {
777
+ runUpdates.answer = true; // automatic
778
+ }
779
+ // ensure they wanted to run them
780
+ if (runUpdates.answer) {
781
+ await (0, _utils.interactiveExec)('npm', ['install', '--global', '@haxtheweb/create']);
782
+ if (!commandRun.options.quiet) {
783
+ p.outro(`
784
+ 🔮 HAX CLI updated to : ${_picocolors.default.yellow(latest)}
785
+
786
+ 🧙 Type ${_picocolors.default.yellow('hax help')} for latest commands
787
+
788
+ 💡 ${_picocolors.default.bold(_picocolors.default.white(`Never. Stop. Innovating.`))}
789
+ `);
790
+ }
791
+ } else {
792
+ if (!commandRun.options.quiet) {
793
+ p.outro(`
794
+ 🧙 Upgrade at any time: ${_picocolors.default.yellow('npm install --global @haxtheweb/create')}
795
+
796
+ 💡 ${_picocolors.default.bold(_picocolors.default.white(`Never. Stop. Innovating.`))}
797
+ `);
798
+ }
799
+ }
800
+ } else {
801
+ if (!commandRun.options.quiet) {
802
+ p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` HAX CLI (${_package.default.version}) is up to date `))}`);
803
+ }
804
+ }
805
+ }
633
806
  main().catch(console.error);
@@ -17,8 +17,8 @@ let checksPassed = true;
17
17
  /**
18
18
  * @description Runs the audit command, to be called when `hax audit` command is run
19
19
  */
20
- function auditCommandDetected(commandRun) {
21
- const PROJECT_ROOT = process.cwd();
20
+ function auditCommandDetected(commandRun, path = null) {
21
+ const PROJECT_ROOT = path || process.cwd();
22
22
  p.intro(`${_picocolors.default.bgBlack(` 🚀 Auditing DDD Compliance: ${_picocolors.default.underline(_picocolors.default.bold(_picocolors.default.yellow(PROJECT_ROOT)))} `)}`);
23
23
  let dddignore = dddignoreInterpreter(PROJECT_ROOT);
24
24
  if (commandRun.options.debug) {
@@ -42,7 +42,7 @@ function dddignoreInterpreter(root) {
42
42
  let list = [];
43
43
  (0, _nodeFs.readdirSync)(root).forEach(item => {
44
44
  const FULL_PATH = _nodePath.default.join(root, item);
45
- if (item !== "node_modules" && item !== ".git" && item !== "dist" && item !== "public" && (0, _nodeFs.statSync)(FULL_PATH).isDirectory()) {
45
+ if (item !== "node_modules" && item !== ".git" && item !== "dist" && item !== "assets" && item !== "build" && item !== "public" && (0, _nodeFs.statSync)(FULL_PATH).isDirectory()) {
46
46
  // Directory
47
47
  list = list.concat(dddignoreInterpreter(FULL_PATH));
48
48
  } else if (item === ".dddignore") {