@haxtheweb/create 9.0.10 → 9.0.12

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
@@ -1,20 +1,67 @@
1
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
2
+ [![Lit](https://img.shields.io/badge/-Lit-324fff?style=flat&logo=data:image/svg%2bxml;base64,PHN2ZyBmaWxsPSIjZmZmIiB2aWV3Qm94PSIwIDAgMTYwIDIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMTYwIDgwdjgwbC00MC00MHptLTQwIDQwdjgwbDQwLTQwem0wLTgwdjgwbC00MC00MHptLTQwIDQwdjgwbDQwLTQwem0tNDAtNDB2ODBsNDAtNDB6bTQwLTQwdjgwbC00MC00MHptLTQwIDEyMHY4MGwtNDAtNDB6bS00MC00MHY4MGw0MC00MHoiLz48L3N2Zz4%3D)](https://lit.dev/)
3
+ [![#HAXTheWeb](https://img.shields.io/badge/-HAXTheWeb-999999FF?style=flat&logo=data:image/svg%2bxml;base64,PHN2ZyBpZD0iZmVhMTExZTAtMjEwZC00Y2QwLWJhMWQtZGZmOTQyODc0Njg1IiBkYXRhLW5hbWU9IkxheWVyIDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDE4NC40IDEzNS45NyI+PGRlZnM+PHN0eWxlPi5lMWJjMjAyNS0xODAwLTRkYzItODc4NS1jNDZlZDEwM2Y0OTJ7ZmlsbDojMjMxZjIwO308L3N0eWxlPjwvZGVmcz48cGF0aCBjbGFzcz0iZTFiYzIwMjUtMTgwMC00ZGMyLTg3ODUtYzQ2ZWQxMDNmNDkyIiBkPSJNNzguMDcsODMuNDVWNTVIODYuMnY4LjEzaDE2LjI2djQuMDdoNC4wN1Y4My40NUg5OC40VjY3Lj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/@haxtheweb/create?style=flat)](https://www.npmjs.com/package/@haxtheweb/create)
5
+ [![build](https://github.com/haxtheweb/create/workflows/build/badge.svg)](https://github.com/haxtheweb/create/actions)
6
+ [![X](https://img.shields.io/twitter/follow/haxtheweb.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=haxtheweb)
7
+
1
8
  # HAX The CLI
2
9
  Rapidly build web components for the Web that work with HAX. HAX The Web's CLI tools empower you to rapidly..
3
10
 
4
11
  ```bash
5
12
  # this allows you to then use hax command
6
13
  npm install @haxtheweb/create --global
7
- # then run
8
- hax
14
+ # then run this for interactive prompt
15
+ hax start
9
16
  ```
10
17
 
11
18
  # Commands
12
19
 
13
20
  ## Default / global / new context
14
- - `hax` - fun ascii art and interactive CLI (via [clack](https://www.clack.cc/) )
15
- - `hax --name my-element --y` - Make a new HAX capable, i18n wired, Design system (DDD) driven web component
21
+ - `hax start` - fun ascii art and interactive CLI (via [clack](https://www.clack.cc/) )
22
+ - `hax webcomponent my-element --y` - Make a new HAX capable, i18n wired, Design system (DDD) driven web component
16
23
  - if in a monorepo root, will place in correct location / inherit settings
17
- - `hax --type haxsite --name mysite --y` - create a new HAXsite (HAXcms, single site)
24
+ - `hax site mysite --y` - create a new HAXsite (HAXcms, single site)
25
+
26
+ ## --help
27
+ Run `hax help` or `hax webcomponent --help` or `hax site --help` for up-to-date listing
28
+ ```
29
+ Usage: hax [options] [command]
30
+
31
+ Options:
32
+ --
33
+ --v Verbose output for developers
34
+ --path <char> where to perform operation
35
+ --npm-client <char> npm client to use (must be installed) npm,
36
+ yarn, pnpm (default: "npm")
37
+ --y yes to all questions
38
+ --skip skip frills like animations
39
+ --auto yes to all questions, alias of y
40
+ --org <char> organization for package.json
41
+ --author <char> author for site / package.json
42
+ --import-site <char> URL of site to import
43
+ --node-op <char> node operation to perform
44
+ --item-id <char> node ID to operate on
45
+ --name <char> name of the project
46
+ --domain <char> published domain name
47
+ --title <char> Title
48
+ --content <char> Page content
49
+ --slug <char> Path (slug)
50
+ --published <char> Publishing status
51
+ --tags <char> Tags
52
+ --parent <char> Parent
53
+ --order <char> Order
54
+ --theme <char> Theme
55
+ --hide-in-menu <char> Hide in menu
56
+ -h, --help display help for command
57
+
58
+ Commands:
59
+ start Interactive program to pick options
60
+ site [options] [action]
61
+ webcomponent [options] [name] Create Lit based web components, with HAX
62
+ recommendations
63
+ help [command] display help for command
64
+ ```
18
65
 
19
66
  ## Site context
20
67
  - listing stats
@@ -31,12 +78,8 @@ hax
31
78
  npx @haxtheweb/create
32
79
  # this is same as above, better windows CLI support
33
80
  npm init @haxtheweb
34
- ```
35
-
36
- ## Usage in other programs
37
- https://stackoverflow.com/questions/69208298/use-node-bins-without-installing-the-package-globally explains it but you should be able to use the CLI as part of another project as follows:
38
- ```json
39
- {
81
+ - Try Hax: https://hax.cloud
82
+ - HAXCellence https://haxtheweb.org/what-is-hax
40
83
  "scripts": {
41
84
  "hax": "hax"
42
85
  }
@@ -70,3 +113,25 @@ Build a HAX site that can be published and transported anywhere. Your users migh
70
113
  - Ability to import via URL just like the front-end
71
114
  - Theme development starting point to be able to build themes locally
72
115
  - Primed to publish to gh-pages, vercel and more
116
+
117
+ # Get Help / Issues / Support
118
+ - Discord Channel - https://bit.ly/hax-discord
119
+ - Unified issue queue - https://github.com/haxtheweb/issues/issues
120
+ - Using Merlin directly in any HAX spaces and type "Issue" to jump start a report!
121
+
122
+ ## Watch and Learn more about HAX here:
123
+ - Try Hax: https://hax.cloud
124
+ - HAXCellence https://haxtheweb.org/what-is-hax
125
+ - Youtube channel - https://www.youtube.com/@haxtheweb
126
+
127
+ # Related links and tech
128
+ - [NPM Package list](https://www.npmjs.com/org/haxtheweb)
129
+ - [HAXcms (NodeJS)](https://github.com/haxtheweb/haxcms-nodejs)
130
+ - [HAXcms (PHP)](https://github.com/haxtheweb/haxcms-php)
131
+ - [Storybook docs](https://open-apis.hax.cloud/)
132
+ - [HAX [dot] PSU](https://hax.psu.edu)
133
+ - [HAX doc site](https://haxtheweb.org/)
134
+ - [HAX + 11ty](https://github.com/haxtheweb/hax11ty)
135
+
136
+
137
+ ![HAX Traveler: World Changer](https://raw.githubusercontent.com/haxtheweb/art/refs/heads/main/haxtheweb/hax-traveler-world-changer.jpg)
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 for developers').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')
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')
32
32
 
33
33
  // options for webcomponent
34
- .option('--org <char>', 'organization for package.json').option('--author <char>', 'author for site / package.json')
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('--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').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('--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').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').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,14 +80,14 @@ 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');
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');
84
84
  // process program arguments
85
85
  _commander.program.parse();
86
86
  commandRun.options = {
87
87
  ...commandRun.options,
88
88
  ..._commander.program.opts()
89
89
  };
90
- if (commandRun.options.v) {
90
+ if (commandRun.options.debug) {
91
91
  console.log(commandRun);
92
92
  }
93
93
  // auto and y assume same thing
@@ -109,9 +109,14 @@ async function main() {
109
109
  if (!commandRun.options.path && commandRun.options.skip) {
110
110
  commandRun.options.path = process.cwd();
111
111
  }
112
- if (commandRun.options.auto) {
113
- commandRun.options.org = '';
114
- commandRun.options.author = author;
112
+ // if we skip stuff then set org/author automatically
113
+ if (commandRun.options.skip || commandRun.options.auto) {
114
+ if (!commandRun.options.org) {
115
+ commandRun.options.org = '';
116
+ }
117
+ if (!commandRun.options.author) {
118
+ commandRun.options.author = author;
119
+ }
115
120
  }
116
121
  let packageData = {};
117
122
  let testPackages = [path.join(process.cwd(), 'package.json'), path.join(process.cwd(), '../', 'package.json'), path.join(process.cwd(), '../', '../', 'package.json')];
@@ -121,7 +126,10 @@ async function main() {
121
126
  let packLoc = testPackages.shift();
122
127
  if (fs.existsSync(packLoc)) {
123
128
  try {
124
- packageData = JSON.parse(fs.readFileSync(`${process.cwd()}/package.json`));
129
+ packageData = {
130
+ ...JSON.parse(fs.readFileSync(packLoc)),
131
+ ...packageData
132
+ };
125
133
  // assume we are working on a web component / existing if we find this key
126
134
  if (packageData.hax && packageData.hax.cli) {
127
135
  commandRun.program = 'webcomponent';
@@ -129,6 +137,8 @@ async function main() {
129
137
  // leverage these values if they exist downstream
130
138
  if (packageData.npmClient) {
131
139
  commandRun.options.npmClient = packageData.npmClient;
140
+ } else {
141
+ commandRun.options.npmClient = 'npm';
132
142
  }
133
143
  // see if we're in a monorepo
134
144
  if (packageData.useWorkspaces && packageData.workspaces && packageData.workspaces.packages && packageData.workspaces.packages[0]) {
@@ -149,12 +159,15 @@ async function main() {
149
159
  }
150
160
  }
151
161
  }
162
+ if (commandRun.options.debug) {
163
+ console.log(packageData);
164
+ }
152
165
  // CLI works within context of the site if one is detected, otherwise we can do other thingss
153
166
  if (await hax.systemStructureContext()) {
154
167
  commandRun.program = 'site';
155
168
  commandRun.options.skip = true;
156
169
  await (0, _site.siteCommandDetected)(commandRun);
157
- } else if (packageData && packageData.hax && packageData.hax.cli && packageData.scripts.start) {
170
+ } else if (packageData && (packageData.customElements || packageData.hax && packageData.hax.cli) && packageData.scripts.start) {
158
171
  commandRun.program = 'webcomponent';
159
172
  commandRun.options.skip = true;
160
173
  await (0, _webcomponent.webcomponentCommandDetected)(commandRun, packageData);
@@ -169,6 +182,12 @@ async function main() {
169
182
  while (project.type !== 'quit') {
170
183
  if (activeProject) {
171
184
  p.note(` 🧙🪄 BE GONE ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgGreen(activeProject)))} sub-process daemon! 🪄 + ✨ 👹 = 💀 `);
185
+ // ensure if we were automatically running the command we end
186
+ if (commandRun.options.y) {
187
+ (0, _statements.communityStatement)();
188
+ process.exit(0);
189
+ }
190
+ // otherwise null to reset the program to run again
172
191
  commandRun = {
173
192
  command: null,
174
193
  arguments: {},
@@ -192,7 +211,7 @@ async function main() {
192
211
  label: '🏗️ Create a Web Component'
193
212
  }, {
194
213
  value: 'site',
195
- label: '🏡 Create a HAXcms site (single)'
214
+ label: '🏡 Create a HAXsite'
196
215
  }, {
197
216
  value: 'quit',
198
217
  label: '🚪 Quit'
@@ -206,6 +225,12 @@ async function main() {
206
225
  }
207
226
  });
208
227
  }
228
+ // detect being in a haxcms scaffold. easiest way is _sites being in this directory
229
+ // set the path automatically so we skip the question
230
+ if (commandRun.command === "site" && fs.existsSync(`${process.cwd()}/_sites`)) {
231
+ p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` HAXcms detected : Path set automatically `))}`);
232
+ commandRun.options.path = `${process.cwd()}/_sites`;
233
+ }
209
234
  activeProject = project.type;
210
235
  // silly but this way we don't have to take options for quitting
211
236
  if (project.type !== 'quit') {