@haxtheweb/create 10.0.4 → 10.0.5
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 +109 -38
- package/dist/create.js +25 -8
- package/dist/docs/hax.1 +37 -3
- package/dist/lib/micro-frontend-registry.js +6 -6
- package/dist/lib/programs/audit.js +929 -0
- package/dist/lib/programs/site.js +2 -2
- package/dist/lib/programs/webcomponent.js +1 -0
- package/dist/templates/sitetheme/base-theme.js +158 -15
- package/dist/templates/sitetheme/flex-theme.js +1 -1
- package/dist/templates/sitetheme/sidebar-theme.js +1 -1
- package/dist/templates/webcomponent/hax/_dddignore +37 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ hax start
|
|
|
22
22
|
- `hax webcomponent my-element --y` - Make a new HAX capable, i18n wired, Design system (DDD) driven web component
|
|
23
23
|
- if in a monorepo root, will place in correct location / inherit settings
|
|
24
24
|
- `hax site mysite --y` - create a new HAXsite (HAXcms, single site)
|
|
25
|
+
- `hax audit` - Audits web components for compliance with DDD (HAX design system)
|
|
25
26
|
|
|
26
27
|
## --help
|
|
27
28
|
Run `hax help` or `hax webcomponent --help` or `hax site --help` for up-to-date listing
|
|
@@ -30,53 +31,74 @@ Usage: hax [options] [command]
|
|
|
30
31
|
|
|
31
32
|
Options:
|
|
32
33
|
--
|
|
33
|
-
--v
|
|
34
|
-
--
|
|
35
|
-
--
|
|
36
|
-
|
|
37
|
-
--
|
|
38
|
-
|
|
39
|
-
--
|
|
40
|
-
--
|
|
41
|
-
--
|
|
42
|
-
--
|
|
43
|
-
--
|
|
44
|
-
|
|
45
|
-
--
|
|
46
|
-
--
|
|
47
|
-
--
|
|
48
|
-
--
|
|
49
|
-
--
|
|
50
|
-
--
|
|
51
|
-
--
|
|
52
|
-
--
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
57
84
|
|
|
58
85
|
Commands:
|
|
59
|
-
start
|
|
60
|
-
site [options] [action]
|
|
61
|
-
webcomponent [options] [name]
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|
64
93
|
```
|
|
65
|
-
|
|
94
|
+
## Examples
|
|
95
|
+
For a detailed list of example commands that you can perform with `hax` see [examples](examples.md).
|
|
66
96
|
## Manual
|
|
67
97
|
|
|
68
98
|
### Linux / macOS
|
|
69
99
|
|
|
70
100
|
Run `man hax` to get detailed manual.
|
|
71
101
|
|
|
72
|
-
## Site context
|
|
73
|
-
- listing stats
|
|
74
|
-
- launch site
|
|
75
|
-
- publish to surge.sh (if installed)
|
|
76
|
-
|
|
77
|
-
## Web component context
|
|
78
|
-
- launch element
|
|
79
|
-
|
|
80
102
|
# Alternative Usage
|
|
81
103
|
|
|
82
104
|
```bash
|
|
@@ -128,9 +150,58 @@ Build a HAX site that can be published and transported anywhere. Your users migh
|
|
|
128
150
|
- Theme development starting point to be able to build themes locally
|
|
129
151
|
- Primed to publish to gh-pages, vercel and more
|
|
130
152
|
|
|
153
|
+
## HAX Audit
|
|
154
|
+
Audits your HAX based web components to suggest improvements to better align with DDD, the design system built into HAX components.
|
|
155
|
+
- Use `.dddignore` file to instruct audit program what files should be ignored. Each component generated comes with a `.dddignore` file in its root directory.
|
|
156
|
+
- Run command from root of the component project.
|
|
157
|
+
- Provides suggested changes for component CSS to align with DDD design standards, if a change cannot be suggested, developer will be refered to look at the manual for a change that works for them!
|
|
158
|
+
|
|
159
|
+
### `.dddignore` Template
|
|
160
|
+
|
|
161
|
+
```gitignore
|
|
162
|
+
# Directories
|
|
163
|
+
# (Must start with with / or \, as seen below)
|
|
164
|
+
/.github # Inline comments are supported
|
|
165
|
+
/.vscode
|
|
166
|
+
/.idea
|
|
167
|
+
/locales
|
|
168
|
+
\test
|
|
169
|
+
/dist
|
|
170
|
+
/build
|
|
171
|
+
/public # ignored by program regardless of presence in .dddignore
|
|
172
|
+
/node_modules # ignored by program regardless of presence in .dddignore
|
|
173
|
+
|
|
174
|
+
# Files
|
|
175
|
+
# (Must include filename and extension, as seen below)
|
|
176
|
+
LICENSE
|
|
177
|
+
.dddignore
|
|
178
|
+
.editorconfig
|
|
179
|
+
.gitignore
|
|
180
|
+
.nojekyll
|
|
181
|
+
.npmignore
|
|
182
|
+
.surgeignore
|
|
183
|
+
rollup.config.js
|
|
184
|
+
|
|
185
|
+
# File extension
|
|
186
|
+
# (Must start with *, as seen below)
|
|
187
|
+
*.html
|
|
188
|
+
*.md
|
|
189
|
+
*.yml
|
|
190
|
+
*.json
|
|
191
|
+
*.toml
|
|
192
|
+
*.mjs
|
|
193
|
+
*.cjs
|
|
194
|
+
*.png
|
|
195
|
+
*.ico
|
|
196
|
+
*.svg
|
|
197
|
+
*.jpg
|
|
198
|
+
*.jpeg
|
|
199
|
+
```
|
|
200
|
+
|
|
131
201
|
# Get Help / Issues / Support
|
|
132
202
|
- Discord Channel - https://bit.ly/hax-discord
|
|
133
203
|
- Unified issue queue - https://github.com/haxtheweb/issues/issues
|
|
204
|
+
- DDD Documentation - https://haxtheweb.org/documentation/ddd
|
|
134
205
|
- Using Merlin directly in any HAX spaces and type "Issue" to jump start a report!
|
|
135
206
|
|
|
136
207
|
## Watch and Learn more about HAX here:
|
package/dist/create.js
CHANGED
|
@@ -8,6 +8,7 @@ var p = _interopRequireWildcard(require("@clack/prompts"));
|
|
|
8
8
|
var _picocolors = _interopRequireDefault(require("picocolors"));
|
|
9
9
|
var _statements = require("./lib/statements.js");
|
|
10
10
|
var _logging = require("./lib/logging.js");
|
|
11
|
+
var _audit = require("./lib/programs/audit.js");
|
|
11
12
|
var _webcomponent = require("./lib/programs/webcomponent.js");
|
|
12
13
|
var _site = require("./lib/programs/site.js");
|
|
13
14
|
var _utils = require("./lib/utils.js");
|
|
@@ -61,7 +62,7 @@ async function main() {
|
|
|
61
62
|
commandRun.arguments.action = action;
|
|
62
63
|
commandRun.options.skip = true;
|
|
63
64
|
}
|
|
64
|
-
}).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('--
|
|
65
|
+
}).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());
|
|
65
66
|
let siteNodeOps = (0, _site.siteNodeOperations)();
|
|
66
67
|
for (var i in siteNodeOps) {
|
|
67
68
|
_commander.program.option(`--${(0, _utils.camelToDash)(siteNodeOps[i].value)} <char>`, `${siteNodeOps[i].label}`);
|
|
@@ -80,6 +81,16 @@ async function main() {
|
|
|
80
81
|
commandRun.options.skip = true;
|
|
81
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('--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());
|
|
84
|
+
|
|
85
|
+
// audit program
|
|
86
|
+
_commander.program.command('audit').description('Audits web components for compliance with DDD (HAX design system)').action(() => {
|
|
87
|
+
commandRun = {
|
|
88
|
+
command: 'audit',
|
|
89
|
+
arguments: {},
|
|
90
|
+
options: {}
|
|
91
|
+
};
|
|
92
|
+
}).option('--debug', 'Output for developers').version(await HAXCMS.getHAXCMSVersion());
|
|
93
|
+
|
|
83
94
|
// process program arguments
|
|
84
95
|
_commander.program.parse();
|
|
85
96
|
commandRun.options = {
|
|
@@ -168,13 +179,17 @@ async function main() {
|
|
|
168
179
|
commandRun.options.isMonorepo = true;
|
|
169
180
|
commandRun.options.auto = true;
|
|
170
181
|
// assumed if monorepo
|
|
171
|
-
commandRun.command
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
commandRun.
|
|
182
|
+
if (commandRun.command === "audit") {
|
|
183
|
+
(0, _audit.auditCommandDetected)(commandRun);
|
|
184
|
+
} else {
|
|
185
|
+
commandRun.command = 'webcomponent';
|
|
186
|
+
commandRun.options.path = path.join(process.cwd(), packageData.workspaces.packages[0].replace('/*', ''));
|
|
187
|
+
if (packageData.orgNpm) {
|
|
188
|
+
commandRun.options.org = packageData.orgNpm;
|
|
189
|
+
}
|
|
190
|
+
commandRun.options.gitRepo = packageData.repository.url;
|
|
191
|
+
commandRun.options.author = packageData.author.name ? packageData.author.name : author;
|
|
175
192
|
}
|
|
176
|
-
commandRun.options.gitRepo = packageData.repository.url;
|
|
177
|
-
commandRun.options.author = packageData.author.name ? packageData.author.name : author;
|
|
178
193
|
}
|
|
179
194
|
} catch (err) {
|
|
180
195
|
console.error(err);
|
|
@@ -189,6 +204,8 @@ async function main() {
|
|
|
189
204
|
commandRun.program = 'site';
|
|
190
205
|
commandRun.options.skip = true;
|
|
191
206
|
await (0, _site.siteCommandDetected)(commandRun);
|
|
207
|
+
} else if (commandRun.command === 'audit') {
|
|
208
|
+
(0, _audit.auditCommandDetected)(commandRun);
|
|
192
209
|
} else if (packageData && (packageData.customElements || packageData.hax && packageData.hax.cli) && packageData.scripts.start) {
|
|
193
210
|
commandRun.program = 'webcomponent';
|
|
194
211
|
commandRun.options.skip = true;
|
|
@@ -220,7 +237,7 @@ async function main() {
|
|
|
220
237
|
options: {}
|
|
221
238
|
};
|
|
222
239
|
}
|
|
223
|
-
if (['site', 'webcomponent'].includes(commandRun.command)) {
|
|
240
|
+
if (['site', 'webcomponent', 'audit'].includes(commandRun.command)) {
|
|
224
241
|
project = {
|
|
225
242
|
type: commandRun.command
|
|
226
243
|
};
|
package/dist/docs/hax.1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.TH HAX\-CREATE 1 hax
|
|
1
|
+
.TH HAX\-CREATE 1 hax hax "HAX COMMAND INTERFACE MANUAL"
|
|
2
2
|
|
|
3
3
|
.SH NAME
|
|
4
4
|
hax \- a tool to create HAX websites and web components quickly.
|
|
@@ -22,6 +22,9 @@ This command line tool can be used to create and modify two different HAX based
|
|
|
22
22
|
.B webcomponent
|
|
23
23
|
[options] [name] \- Create Lit based web components, with HAX recommendations
|
|
24
24
|
.PP
|
|
25
|
+
.B audit
|
|
26
|
+
[options] \- Audits web components for compliance with DDD (HAX design system)
|
|
27
|
+
.PP
|
|
25
28
|
.B help
|
|
26
29
|
[command] \- Display help for command
|
|
27
30
|
|
|
@@ -57,6 +60,12 @@ Prevent interactions / sub\-process, good for scripting
|
|
|
57
60
|
\--to\-file [char]
|
|
58
61
|
Redirect command output to a file
|
|
59
62
|
.TP
|
|
63
|
+
\--no\-extras
|
|
64
|
+
Skip all extra / automatic commmand processing
|
|
65
|
+
.TP
|
|
66
|
+
\--root [location]
|
|
67
|
+
Root location to execute the command from
|
|
68
|
+
.TP
|
|
60
69
|
\--org [organization]
|
|
61
70
|
Organization for package.json
|
|
62
71
|
.TP
|
|
@@ -84,9 +93,27 @@ Name of the project
|
|
|
84
93
|
\--domain [name]
|
|
85
94
|
Published domain name
|
|
86
95
|
.TP
|
|
96
|
+
\--title\-scrape [selector]
|
|
97
|
+
CSS selector for `title` in resource
|
|
98
|
+
.TP
|
|
99
|
+
\--content\-scrape [selector[
|
|
100
|
+
CSS selector for `body` in resource
|
|
101
|
+
.TP
|
|
87
102
|
\--items\-import [char]
|
|
88
103
|
Import items from a file / site
|
|
89
104
|
.TP
|
|
105
|
+
\--recipe [path]
|
|
106
|
+
Path to recipe file
|
|
107
|
+
.TP
|
|
108
|
+
\--custom\-theme\-name [name]
|
|
109
|
+
Custom theme name
|
|
110
|
+
.TP
|
|
111
|
+
\--custom\-theme\-template [option]
|
|
112
|
+
Custom theme template (Options: base | polaris-flex | polaris-sidebar)
|
|
113
|
+
.TP
|
|
114
|
+
\-V, \--version
|
|
115
|
+
Output the version number
|
|
116
|
+
.TP
|
|
90
117
|
\--title [title]
|
|
91
118
|
Title
|
|
92
119
|
.TP
|
|
@@ -122,11 +149,14 @@ Display help for command
|
|
|
122
149
|
.B hax start
|
|
123
150
|
Navigatable interface
|
|
124
151
|
.TP
|
|
152
|
+
.B hax site mysite --y
|
|
153
|
+
Create a new HAXsite (HAXcms, single site)
|
|
154
|
+
.TP
|
|
125
155
|
.B hax webcomponent my-element --y
|
|
126
156
|
Make a new HAX capable, i18n wired, design system (DDD) driven web component
|
|
127
157
|
.TP
|
|
128
|
-
.B hax
|
|
129
|
-
|
|
158
|
+
.B hax audit
|
|
159
|
+
Audit web components for compliance with DDD (HAX design system)
|
|
130
160
|
|
|
131
161
|
.SH BUGS
|
|
132
162
|
Bugs can be viewed at GitHub Issues: https://github.com/haxtheweb/issues/issues
|
|
@@ -143,6 +173,10 @@ https://github.com/haxtheweb/create
|
|
|
143
173
|
.PP
|
|
144
174
|
.B Web Components Repository:
|
|
145
175
|
https://github.com/haxtheweb/webcomponents
|
|
176
|
+
.PP
|
|
177
|
+
.B DDD Design System Documentation
|
|
178
|
+
https://haxtheweb.org/documentation/ddd
|
|
179
|
+
|
|
146
180
|
|
|
147
181
|
.SH AUTHORS
|
|
148
182
|
.PP
|
|
@@ -8,7 +8,7 @@ exports.enableCoreServices = enableCoreServices;
|
|
|
8
8
|
exports.enableExperimentalServices = enableExperimentalServices;
|
|
9
9
|
exports.enableHAXcmsServices = enableHAXcmsServices;
|
|
10
10
|
exports.enableServices = enableServices;
|
|
11
|
-
var
|
|
11
|
+
var _logging = require("./logging.js");
|
|
12
12
|
// because node hates mixing modern web at times this is a fork of @haxtheweb/micro-frontend-registry
|
|
13
13
|
// and can fall out of date
|
|
14
14
|
/**
|
|
@@ -51,8 +51,8 @@ const MicroFrontendRegCapabilities = function (SuperClass) {
|
|
|
51
51
|
*/
|
|
52
52
|
define(item) {
|
|
53
53
|
if (!(item instanceof MicroFrontend)) {
|
|
54
|
-
(0,
|
|
55
|
-
(0,
|
|
54
|
+
(0, _logging.log)("MicroFrontendRegistry: use class MicroFrontend instance but if keys match it will register still.", 'warn');
|
|
55
|
+
(0, _logging.log)(item, 'warn');
|
|
56
56
|
}
|
|
57
57
|
// validate item has all keys we care about
|
|
58
58
|
if (Object.keys(item).every(key => MicroFrontendKeys.includes(key))) {
|
|
@@ -103,7 +103,7 @@ const MicroFrontendRegCapabilities = function (SuperClass) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
if (!testOnly) {
|
|
106
|
-
(0,
|
|
106
|
+
(0, _logging.log)(`call for ${name} but not found in micro-frontend-registry`, 'error');
|
|
107
107
|
}
|
|
108
108
|
return null;
|
|
109
109
|
}
|
|
@@ -171,7 +171,7 @@ const MicroFrontendRegCapabilities = function (SuperClass) {
|
|
|
171
171
|
data: null
|
|
172
172
|
};
|
|
173
173
|
}).catch((e, d) => {
|
|
174
|
-
(0,
|
|
174
|
+
(0, _logging.log)("Request failed", 'warn');
|
|
175
175
|
// this is endpoint completely failed to respond
|
|
176
176
|
return {
|
|
177
177
|
status: 500,
|
|
@@ -191,7 +191,7 @@ const MicroFrontendRegCapabilities = function (SuperClass) {
|
|
|
191
191
|
data: null
|
|
192
192
|
};
|
|
193
193
|
}).catch((e, d) => {
|
|
194
|
-
(0,
|
|
194
|
+
(0, _logging.log)("Request failed", 'warn');
|
|
195
195
|
// this is endpoint completely failed to respond
|
|
196
196
|
return {
|
|
197
197
|
status: 500,
|