@haxtheweb/create 0.1.4 → 0.1.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/dist/create.js +78 -43
- package/dist/templates/webcomponent/hax/LICENSE +1 -1
- package/dist/templates/webcomponent/hax/README.md +24 -13
- package/dist/templates/webcomponent/hax/index.html +104 -16
- package/dist/templates/webcomponent/hax/lib/webcomponent.haxProperties.json +40 -31
- package/dist/templates/webcomponent/hax/package.json +24 -15
- package/dist/templates/webcomponent/hax/rollup.config.js +9 -24
- package/dist/templates/webcomponent/hax/src/webcomponent.js +16 -8
- package/dist/utils.js +1 -1
- package/package.json +5 -7
package/dist/create.js
CHANGED
|
@@ -105,6 +105,7 @@ async function main() {
|
|
|
105
105
|
}, {
|
|
106
106
|
onCancel: () => {
|
|
107
107
|
p.cancel('🧙 Merlin: Canceling CLI.. HAX ya later 🪄');
|
|
108
|
+
communityStatement();
|
|
108
109
|
process.exit(0);
|
|
109
110
|
}
|
|
110
111
|
});
|
|
@@ -139,7 +140,7 @@ async function main() {
|
|
|
139
140
|
}
|
|
140
141
|
break;
|
|
141
142
|
case "quit":
|
|
142
|
-
|
|
143
|
+
// quit
|
|
143
144
|
break;
|
|
144
145
|
}
|
|
145
146
|
}
|
|
@@ -150,7 +151,7 @@ async function main() {
|
|
|
150
151
|
};
|
|
151
152
|
while (project.type !== 'quit') {
|
|
152
153
|
if (activeProject) {
|
|
153
|
-
p.note(` 🧙🪄 BE GONE ${activeProject} sub-process daemon! 🪄 + ✨ 👹 = 💀 `);
|
|
154
|
+
p.note(` 🧙🪄 BE GONE ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgGreen(activeProject)))} sub-process daemon! 🪄 + ✨ 👹 = 💀 `);
|
|
154
155
|
}
|
|
155
156
|
project = await p.group({
|
|
156
157
|
type: ({
|
|
@@ -176,6 +177,7 @@ async function main() {
|
|
|
176
177
|
}, {
|
|
177
178
|
onCancel: () => {
|
|
178
179
|
p.cancel('🧙🪄 Merlin: Leaving so soon? HAX ya later');
|
|
180
|
+
communityStatement();
|
|
179
181
|
process.exit(0);
|
|
180
182
|
}
|
|
181
183
|
});
|
|
@@ -226,6 +228,9 @@ async function main() {
|
|
|
226
228
|
if (!value) {
|
|
227
229
|
return "Name is required (tab writes default)";
|
|
228
230
|
}
|
|
231
|
+
if (/^\d/.test(value)) {
|
|
232
|
+
return "Name cannot start with a number";
|
|
233
|
+
}
|
|
229
234
|
if (value.indexOf(' ') !== -1) {
|
|
230
235
|
return "No spaces allowed in project name";
|
|
231
236
|
}
|
|
@@ -253,19 +258,19 @@ async function main() {
|
|
|
253
258
|
let initialValues = [];
|
|
254
259
|
if (results.type === "webcomponent") {
|
|
255
260
|
options = [{
|
|
261
|
+
value: 'launch',
|
|
262
|
+
label: 'Launch project',
|
|
263
|
+
hint: 'recommended, requires install'
|
|
264
|
+
}, {
|
|
256
265
|
value: 'install',
|
|
257
|
-
label: 'Install dependencies
|
|
266
|
+
label: 'Install dependencies via npm',
|
|
258
267
|
hint: 'recommended'
|
|
259
268
|
}, {
|
|
260
269
|
value: 'git',
|
|
261
|
-
label: '
|
|
270
|
+
label: 'Apply version control via git',
|
|
262
271
|
hint: 'recommended'
|
|
263
|
-
}, {
|
|
264
|
-
value: 'launch',
|
|
265
|
-
label: 'Launch project on creation',
|
|
266
|
-
hint: 'recommended (requires install)'
|
|
267
272
|
}];
|
|
268
|
-
initialValues = ['
|
|
273
|
+
initialValues = ['launch', 'install', 'git'];
|
|
269
274
|
} else {
|
|
270
275
|
options = [{
|
|
271
276
|
value: 'launch',
|
|
@@ -275,7 +280,7 @@ async function main() {
|
|
|
275
280
|
initialValues = ['launch'];
|
|
276
281
|
}
|
|
277
282
|
return p.multiselect({
|
|
278
|
-
message: 'Additional setup
|
|
283
|
+
message: 'Additional setup',
|
|
279
284
|
initialValues: initialValues,
|
|
280
285
|
options: options,
|
|
281
286
|
required: false
|
|
@@ -284,11 +289,13 @@ async function main() {
|
|
|
284
289
|
}, {
|
|
285
290
|
onCancel: () => {
|
|
286
291
|
p.cancel('🧙🪄 Merlin: Canceling CLI.. HAX ya later');
|
|
292
|
+
communityStatement();
|
|
287
293
|
process.exit(0);
|
|
288
294
|
}
|
|
289
295
|
});
|
|
290
|
-
// values not set but
|
|
296
|
+
// values not set by user but used in templating
|
|
291
297
|
project.className = (0, _utils.dashToCamel)(project.name);
|
|
298
|
+
project.year = new Date().getFullYear();
|
|
292
299
|
project.version = await HAXCMS.getHAXCMSVersion();
|
|
293
300
|
let s = p.spinner();
|
|
294
301
|
// we can do this if it's a multisite
|
|
@@ -330,6 +337,21 @@ async function main() {
|
|
|
330
337
|
await (0, _promises.setTimeout)(500);
|
|
331
338
|
break;
|
|
332
339
|
case 'webcomponent':
|
|
340
|
+
// option to build github repo link for the user
|
|
341
|
+
if (project.extras.includes('git')) {
|
|
342
|
+
project.gitRepo = await p.text({
|
|
343
|
+
message: 'Git Repo location:',
|
|
344
|
+
placeholder: `git@github.com:${project.author}/${project.name}.git`
|
|
345
|
+
});
|
|
346
|
+
// if they supplied one and it has github in it, build a link automatically for ejs index
|
|
347
|
+
if (project.gitRepo && project.gitRepo.includes('github.com')) {
|
|
348
|
+
project.githubLink = project.gitRepo.replace('git@github.com:', 'https://github.com/').replace('.git', '');
|
|
349
|
+
} else {
|
|
350
|
+
project.githubLink = null;
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
project.githubLink = null;
|
|
354
|
+
}
|
|
333
355
|
s.start(merlinSays('Copying project files'));
|
|
334
356
|
// leverage this little helper from HAXcms
|
|
335
357
|
await HAXCMS.recurseCopy(`${process.mainModule.path}/templates/${project.type}/hax/`, `${project.path}/${project.name}`);
|
|
@@ -356,18 +378,15 @@ async function main() {
|
|
|
356
378
|
s.stop('Files are now awesome!');
|
|
357
379
|
break;
|
|
358
380
|
}
|
|
359
|
-
if (project.
|
|
360
|
-
project.gitRepo = await p.text({
|
|
361
|
-
message: 'Git Repo location:',
|
|
362
|
-
placeholder: `git@github.com:${project.author}/${project.name}.git`
|
|
363
|
-
});
|
|
381
|
+
if (project.gitRepo) {
|
|
364
382
|
try {
|
|
365
|
-
await exec(`cd ${project.path}/${project.name} && git init && git add -A && git commit -m "first commit" && git branch -M main${project.gitRepo
|
|
383
|
+
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}` : ''}`);
|
|
366
384
|
} catch (e) {}
|
|
367
385
|
}
|
|
368
386
|
// options for install, git and other extras
|
|
369
|
-
if
|
|
370
|
-
|
|
387
|
+
// can't launch if we didn't install first so launch implies installation
|
|
388
|
+
if (project.extras.includes('launch') || project.extras.includes('install')) {
|
|
389
|
+
s.start(merlinSays(`Installation magic (npm install)`));
|
|
371
390
|
try {
|
|
372
391
|
await exec(`cd ${project.path}/${project.name} && npm install`);
|
|
373
392
|
} catch (e) {
|
|
@@ -377,22 +396,30 @@ async function main() {
|
|
|
377
396
|
}
|
|
378
397
|
// autolaunch if default was selected
|
|
379
398
|
if (project.extras.includes('launch')) {
|
|
399
|
+
let optionPath = `${project.path}/${project.name}`;
|
|
400
|
+
let command = `npx @haxtheweb/haxcms-nodejs`;
|
|
401
|
+
if (project.type === "webcomponent") {
|
|
402
|
+
command = `npm start`;
|
|
403
|
+
}
|
|
380
404
|
p.note(`${merlinSays(`I have summoned a sub-process daemon 👹`)}
|
|
381
|
-
Running ${project.type}
|
|
382
|
-
Launched from: ${project.path}/${project.name}
|
|
383
405
|
|
|
384
|
-
|
|
406
|
+
🚀 Running your ${_picocolors.default.bold(project.type)} ${_picocolors.default.bold(project.name)}:
|
|
407
|
+
${_picocolors.default.underline(_picocolors.default.cyan('http://localhost:8000'))}
|
|
408
|
+
|
|
409
|
+
🏠 Launched from: ${_picocolors.default.underline(_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`${optionPath}`))))}
|
|
410
|
+
💻 Navigate to folder: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`cd ${optionPath}`)))}
|
|
411
|
+
🚧 Launch later with command: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`${command}`)))}
|
|
412
|
+
📂 Open folder: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`open ${optionPath}`)))}
|
|
413
|
+
📘 VS Code Project: ${_picocolors.default.bold(_picocolors.default.yellow(_picocolors.default.bgBlack(`code ${optionPath}`)))}
|
|
414
|
+
|
|
415
|
+
⌨️ To resume 🧙 Merlin press: ${_picocolors.default.bold(_picocolors.default.black(_picocolors.default.bgRed(` CTRL + C `)))}
|
|
385
416
|
`);
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
} else {
|
|
393
|
-
try {
|
|
394
|
-
await exec(`cd ${optionPath} && npx @haxtheweb/haxcms-nodejs`);
|
|
395
|
-
} catch (e) {}
|
|
417
|
+
// at least a second to see the message print at all
|
|
418
|
+
await (0, _promises.setTimeout)(1000);
|
|
419
|
+
try {
|
|
420
|
+
await exec(`cd ${optionPath} && ${command}`);
|
|
421
|
+
} catch (e) {
|
|
422
|
+
// don't log bc output is weird
|
|
396
423
|
}
|
|
397
424
|
} else {
|
|
398
425
|
let nextSteps = `cd ${project.path}/${project.name} && `;
|
|
@@ -412,16 +439,24 @@ To resume 🧙 Merlin press ⌨️: ${_picocolors.default.black(_picocolors.defa
|
|
|
412
439
|
}
|
|
413
440
|
}
|
|
414
441
|
}
|
|
415
|
-
p.outro(`
|
|
416
|
-
🔮 Ideas to HAX better, faster, stronger: ${_picocolors.default.underline(_picocolors.default.cyan('https://github.com/haxtheweb/issues'))}
|
|
417
|
-
|
|
418
|
-
👔 Share on LinkedIn: ${_picocolors.default.underline(_picocolors.default.cyan('https://bit.ly/hax-linkedin'))}
|
|
419
|
-
|
|
420
|
-
🧵 Share on X: ${_picocolors.default.underline(_picocolors.default.cyan('https://bit.ly/hax-x'))}
|
|
421
|
-
|
|
422
|
-
💬 Join our Community: ${_picocolors.default.underline(_picocolors.default.cyan('https://bit.ly/hax-discord'))}
|
|
423
|
-
|
|
424
|
-
`);
|
|
425
442
|
}
|
|
443
|
+
communityStatement();
|
|
426
444
|
}
|
|
427
|
-
main().catch(console.error);
|
|
445
|
+
main().catch(console.error);
|
|
446
|
+
|
|
447
|
+
// standard community statement so we can leverage on cancel executions
|
|
448
|
+
function communityStatement() {
|
|
449
|
+
p.outro(`
|
|
450
|
+
🧙 HAX @ Penn State: ${_picocolors.default.underline(_picocolors.default.cyan('https://hax.psu.edu'))}
|
|
451
|
+
|
|
452
|
+
🔮 Ideas to HAX Harder, Better, Faster, Stronger: ${_picocolors.default.underline(_picocolors.default.white('https://github.com/haxtheweb/issues/issues'))}
|
|
453
|
+
|
|
454
|
+
👔 Share on LinkedIn: ${_picocolors.default.underline(_picocolors.default.cyan('https://bit.ly/hax-the-linkedin'))}
|
|
455
|
+
|
|
456
|
+
🧵 Tweet on X: ${_picocolors.default.underline(_picocolors.default.white('https://bit.ly/hax-the-x'))}
|
|
457
|
+
|
|
458
|
+
💬 Join Community: ${_picocolors.default.underline(_picocolors.default.cyan('https://bit.ly/hax-discord'))}
|
|
459
|
+
|
|
460
|
+
💡 ${_picocolors.default.bold(_picocolors.default.white(`Never. Stop. Innovating.`))}
|
|
461
|
+
`);
|
|
462
|
+
}
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright (c)
|
|
189
|
+
Copyright (c) <%= year %> <%= author %>
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
# <%= name %>
|
|
2
|
-
|
|
2
|
+
DDD + Lit web component based on OpenWC toolchain. This is intended to provide the following:
|
|
3
|
+
- Look good via DDD, HAX design system
|
|
4
|
+
- Simple, easy to read code via Lit
|
|
5
|
+
- Great workflow via OpenWC tooling + Vercel for sharing demos
|
|
6
|
+
- Simplify contribution to the HAX ecosystem
|
|
7
|
+
- Publish and distribute via npmjs.com
|
|
3
8
|
|
|
4
|
-
## Install
|
|
5
|
-
- `
|
|
9
|
+
## Install dependencies
|
|
10
|
+
- `npm install` - installs dependencies so you can work
|
|
6
11
|
|
|
7
|
-
##
|
|
8
|
-
- `
|
|
9
|
-
- `
|
|
12
|
+
## Commands
|
|
13
|
+
- `npm start` - runs your web component for development, reloading on file changes
|
|
14
|
+
- `npm run build` - builds your web component and outputs it in your `dist` directory for placement on web servers in a compiled form. Vercel automatically does this on commit to github.
|
|
15
|
+
- `npm run release` - this will build your code, update the version, and publish it to npm for others to use
|
|
10
16
|
|
|
11
17
|
## Working with your web component
|
|
12
|
-
- edit
|
|
18
|
+
- edit `/src/<%= name %>.js`
|
|
19
|
+
- edit your 'demo' by modifying `./index.html`
|
|
20
|
+
- add dependencies using `npm install --save @whatever/repo` or editing `./package.json` directly
|
|
13
21
|
- if you must reference additional non-JS files, ensure you use the `new URL('./my-file.jpg', import.meta.url).href` syntax so that it builds correctly
|
|
22
|
+
- if you add additional `.js` files / web components then place them under `/src/`
|
|
23
|
+
- to improve HAX wiring edit file in `/lib/<%= name %>.haxProperties.json`
|
|
14
24
|
|
|
15
25
|
## Recommended setup
|
|
16
26
|
- Load VS code in 1 window to project root
|
|
@@ -18,20 +28,21 @@ HAX The Web Boilerplate based on OpenWC intended to quick start contribution via
|
|
|
18
28
|
- Right click -> Inspect and open the Console to see error output
|
|
19
29
|
|
|
20
30
|
## Recommended Integrated Development Environment (IDE)
|
|
21
|
-
- VSCode
|
|
31
|
+
- [VSCode](https://code.visualstudio.com/Download)
|
|
22
32
|
|
|
23
33
|
### Plugins
|
|
24
34
|
|
|
25
35
|
Name: lit-html
|
|
26
|
-
Id: bierner.lit-html
|
|
27
36
|
Description: Syntax highlighting and IntelliSense for html inside of JavaScript and TypeScript tagged template strings
|
|
28
|
-
Version: 1.11.1
|
|
29
37
|
Publisher: Matt Bierner
|
|
30
38
|
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=bierner.lit-html
|
|
31
39
|
|
|
32
40
|
Name: lit-plugin
|
|
33
|
-
Id: runem.lit-plugin
|
|
34
41
|
Description: Syntax highlighting, type checking and code completion for lit-html
|
|
35
|
-
Version: 1.4.3
|
|
36
42
|
Publisher: Rune Mehlsen
|
|
37
|
-
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=runem.lit-plugin
|
|
43
|
+
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=runem.lit-plugin
|
|
44
|
+
|
|
45
|
+
# Credits
|
|
46
|
+
A brighter future dreamed and developed by the Penn State [HAXTheWeb](https://hax.psu.edu/) initative.
|
|
47
|
+
|
|
48
|
+
Never. Stop. innovating.
|
|
@@ -8,35 +8,123 @@
|
|
|
8
8
|
<meta name="Description" content="Demonstration for <%= name %>">
|
|
9
9
|
|
|
10
10
|
<style>
|
|
11
|
-
:root,
|
|
12
|
-
html,
|
|
13
|
-
body {
|
|
11
|
+
:root, html, body {
|
|
14
12
|
margin: 0;
|
|
15
13
|
padding: 0;
|
|
16
|
-
background-color:
|
|
14
|
+
background-color: var(--ddd-accent-1);
|
|
15
|
+
}
|
|
16
|
+
#demo {
|
|
17
|
+
margin: var(--ddd-spacing-2);
|
|
17
18
|
}
|
|
18
19
|
<%= name %> {
|
|
19
|
-
margin:
|
|
20
|
+
margin: var(--ddd-spacing-2);
|
|
21
|
+
border: var(--ddd-border-md);
|
|
22
|
+
border-radius: var(--ddd-radius-lg);
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
background-color: var(--ddd-accent-5);
|
|
24
|
+
<%= name %>:hover {
|
|
25
|
+
box-shadow: var(--ddd-boxShadow-sm);
|
|
24
26
|
}
|
|
25
|
-
#
|
|
27
|
+
#example {
|
|
26
28
|
--<%= name %>-font-size: var(--ddd-font-size-l);
|
|
27
|
-
background-color: var(--ddd-accent-
|
|
28
|
-
color: var(--ddd-primary-
|
|
29
|
+
background-color: var(--ddd-accent-2);
|
|
30
|
+
color: var(--ddd-primary-17);
|
|
29
31
|
}
|
|
30
32
|
</style>
|
|
31
33
|
<title><%= name %></title>
|
|
32
34
|
</head>
|
|
33
35
|
|
|
34
36
|
<body>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
<div id="demo">
|
|
38
|
+
<h1><%= name %></h1>
|
|
39
|
+
<!-- this is going to do whatever the tag's defaults are -->
|
|
40
|
+
<h2>Default</h2>
|
|
41
|
+
<<%= name %>></<%= name %>>
|
|
42
|
+
<h2>Slot usage</h2>
|
|
43
|
+
<<%= name %> data-accent="2" data-primary="17"><div>Sample slot content</div></<%= name %>>
|
|
44
|
+
<h2>Property usage</h2>
|
|
45
|
+
<<%= name %> id="example" title="Sample property title"></<%= name %>>
|
|
46
|
+
</div>
|
|
39
47
|
<script type="module" src="./src/<%= name %>.js"></script>
|
|
40
|
-
</body>
|
|
41
48
|
|
|
49
|
+
<!-- Take HAX, the Web and you further down the rabbit hole -->
|
|
50
|
+
<style>
|
|
51
|
+
#follow-the-white-rabbit {
|
|
52
|
+
margin: var(--ddd-spacing-4) auto 64px 16px;
|
|
53
|
+
background-color: var(--ddd-accent-4);
|
|
54
|
+
}
|
|
55
|
+
#follow-the-white-rabbit[open] summary {
|
|
56
|
+
background-color: var(--ddd-accent-4) !important;
|
|
57
|
+
}
|
|
58
|
+
#follow-the-white-rabbit[open] .content {
|
|
59
|
+
padding: 0 var(--ddd-spacing-4);
|
|
60
|
+
}
|
|
61
|
+
#follow-the-white-rabbit ul,
|
|
62
|
+
#follow-the-white-rabbit li {
|
|
63
|
+
padding: 0;
|
|
64
|
+
margin: 0;
|
|
65
|
+
}
|
|
66
|
+
#follow-the-white-rabbit li {
|
|
67
|
+
font-size: var(--ddd-font-size-xs);
|
|
68
|
+
list-style: none;
|
|
69
|
+
}
|
|
70
|
+
#follow-the-white-rabbit li strong,
|
|
71
|
+
#follow-the-white-rabbit li a {
|
|
72
|
+
padding: var(--ddd-spacing-2) var(--ddd-spacing-4);
|
|
73
|
+
color: black;
|
|
74
|
+
display: block;
|
|
75
|
+
font-weight: bold;
|
|
76
|
+
}
|
|
77
|
+
#follow-the-white-rabbit li:focus-within a,
|
|
78
|
+
#follow-the-white-rabbit li:hover a {
|
|
79
|
+
background-color: black;
|
|
80
|
+
color: yellow;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
83
|
+
<details id="follow-the-white-rabbit" open>
|
|
84
|
+
<summary>How to Develop</summary>
|
|
85
|
+
<div class="content">
|
|
86
|
+
<p>
|
|
87
|
+
<%if (githubLink) { %>
|
|
88
|
+
<strong>Checkout project on github:</strong> <a href="<%= githubLink %>" target="_blank" rel="nofollow"><%= author %>/<%= name %></a>
|
|
89
|
+
<% } %>
|
|
90
|
+
</p>
|
|
91
|
+
<p>
|
|
92
|
+
You can edit the current page by modifying <code>index.html</code><br />
|
|
93
|
+
To edit your <strong><%= name %></strong> tag, modify <code>src/<%= name %>.js</code>.
|
|
94
|
+
This file contains all the HTML, CSS and JavaScript used to render your elements above!
|
|
95
|
+
</p>
|
|
96
|
+
<p>
|
|
97
|
+
Web components are easy to follow once you get used to their pattern.
|
|
98
|
+
Below are links to help on your journey. Good luck, we need you!
|
|
99
|
+
</p>
|
|
100
|
+
<ul>
|
|
101
|
+
<li><a href="https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation/ddd" target="_blank">🧑🎨 Learn DDD HAX Design system</a></li>
|
|
102
|
+
<li><a href="https://lit.dev/playground/" target="_blank" rel="nofollow">🔥 Learn Lit</a></li>
|
|
103
|
+
<li><a href="https://hax.psu.edu" target="_blank">🧙 HAX The Web @ Penn State</a></li>
|
|
104
|
+
</ul>
|
|
105
|
+
<h2>Join and Share HAX</h2>
|
|
106
|
+
<ul>
|
|
107
|
+
<li><a href="https://github.com/haxtheweb/issues/issues" target="_blank" rel="nofollow">🔮 Ideas to HAX Harder, Better, Faster, Stronger</a></li>
|
|
108
|
+
<li><a href="https://bit.ly/hax-the-linkedin" target="_blank" rel="nofollow">👔 Share on LinkedIn</a></li>
|
|
109
|
+
<li><a href="https://bit.ly/hax-the-x" target="_blank" rel="nofollow">🧵 Tweet on X</a></li>
|
|
110
|
+
<li><a href="https://bit.ly/hax-discord" target="_blank" rel="nofollow">💬 Join Community</a></li>
|
|
111
|
+
</ul>
|
|
112
|
+
<h2>Learn the languages and tools</h2>
|
|
113
|
+
<ul>
|
|
114
|
+
<li><a href="https://w3schools.com" target="_blank" rel="nofollow">🌐 Learn HTML</a></li>
|
|
115
|
+
<li><a href="https://web.dev/learn/css/" target="_blank" rel="nofollow">🎨 Learn CSS</a></li>
|
|
116
|
+
<li><a href="http://Javascript.info" target="_blank" rel="nofollow">💻 Learn JavaScript (JS)</a></li>
|
|
117
|
+
<li><a href="https://gitimmersion.com" target="_blank" rel="nofollow">🦺 Learn Git / Github</a></li>
|
|
118
|
+
<li><a href="https://nodesource.com/blog/an-absolute-beginners-guide-to-using-npm/" target="_blank" rel="nofollow">📦 Learn NPM</a></li>
|
|
119
|
+
<li><a href="http://learnux.io" target="_blank" rel="nofollow">📐 Learn UX / UI development</a></li>
|
|
120
|
+
</ul>
|
|
121
|
+
<h2>Find purpose and inspiration</h2>
|
|
122
|
+
<ul>
|
|
123
|
+
<li><a href="https://www.youtube.com/watch?v=eC7xzavzEKY" target="_blank" rel="nofollow">🐟 This is Water - David Foster Wallace</a></li>
|
|
124
|
+
<li><a href="https://www.youtube.com/watch?v=kYfNvmF0Bqw" target="_blank" rel="nofollow">🏗️ Secrets of Life - Steve Jobs</a></li>
|
|
125
|
+
<li><strong>💡 <em>Never. Stop. Innovating.</em></strong></li>
|
|
126
|
+
</ul>
|
|
127
|
+
</div>
|
|
128
|
+
</details>
|
|
129
|
+
</body>
|
|
42
130
|
</html>
|
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
{
|
|
2
|
+
"api": "1",
|
|
2
3
|
"canScale": true,
|
|
3
4
|
"canEditSource": true,
|
|
5
|
+
"type": "element",
|
|
6
|
+
"designSystem": {
|
|
7
|
+
"accent": true,
|
|
8
|
+
"primary": true,
|
|
9
|
+
"card": true,
|
|
10
|
+
"text": true,
|
|
11
|
+
"designTreatment": false
|
|
12
|
+
},
|
|
4
13
|
"gizmo": {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
"title": "<%= name %>",
|
|
15
|
+
"description": "",
|
|
16
|
+
"icon": "icons:android",
|
|
17
|
+
"color": "purple",
|
|
18
|
+
"tags": [
|
|
19
|
+
"Other"
|
|
20
|
+
],
|
|
21
|
+
"handles": [],
|
|
22
|
+
"meta": {
|
|
23
|
+
"author": "<%= author %>"
|
|
24
|
+
}
|
|
16
25
|
},
|
|
17
26
|
"settings": {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
"configure": [
|
|
28
|
+
{
|
|
29
|
+
"property": "title",
|
|
30
|
+
"title": "Title",
|
|
31
|
+
"description": "",
|
|
32
|
+
"inputMethod": "textfield",
|
|
33
|
+
"icon": "editor:title",
|
|
34
|
+
"required": true
|
|
35
|
+
}
|
|
36
|
+
]
|
|
28
37
|
},
|
|
29
38
|
"saveOptions": {
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
"wipeSlot": false,
|
|
40
|
+
"unsetAttributes": []
|
|
32
41
|
},
|
|
33
42
|
"demoSchema": [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
{
|
|
44
|
+
"tag": "<%= name %>",
|
|
45
|
+
"properties": {
|
|
46
|
+
"title": "Sample property title"
|
|
47
|
+
},
|
|
48
|
+
"content": ""
|
|
49
|
+
}
|
|
40
50
|
]
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
}
|
|
@@ -4,30 +4,39 @@
|
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "<%= author %>",
|
|
6
6
|
"version": "0.0.0",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
9
|
+
"start": "web-dev-server",
|
|
10
|
+
"build": "rimraf public && rollup -c rollup.config.js && npm run analyze",
|
|
11
|
+
"analyze": "cem analyze --litelement --exclude public",
|
|
12
|
+
"release": "npm run build && commit-and-tag-version && git push --follow-tags origin main && npm publish"
|
|
11
13
|
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"haxtheweb",
|
|
16
|
+
"webcomponents",
|
|
17
|
+
"lit",
|
|
18
|
+
"generator",
|
|
19
|
+
"starter-app"
|
|
20
|
+
],
|
|
12
21
|
"dependencies": {
|
|
13
|
-
"lit": "^3.1.
|
|
22
|
+
"lit": "^3.1.4",
|
|
14
23
|
"@haxtheweb/d-d-d": "<%= version %>"
|
|
15
24
|
},
|
|
16
25
|
"devDependencies": {
|
|
17
26
|
"@babel/preset-env": "^7.16.4",
|
|
18
27
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
19
|
-
"@open-wc/building-rollup": "^
|
|
20
|
-
"@
|
|
21
|
-
"@rollup/plugin-
|
|
22
|
-
"@rollup/plugin-
|
|
23
|
-
"@web/dev-server": "^0.
|
|
24
|
-
"@web/rollup-plugin-html": "^
|
|
25
|
-
"@web/rollup-plugin-import-meta-assets": "^
|
|
28
|
+
"@open-wc/building-rollup": "^3.0.2",
|
|
29
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
30
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
31
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
32
|
+
"@web/dev-server": "^0.4.5",
|
|
33
|
+
"@web/rollup-plugin-html": "^2.3.0",
|
|
34
|
+
"@web/rollup-plugin-import-meta-assets": "^2.2.1",
|
|
26
35
|
"babel-plugin-template-html-minifier": "^4.1.0",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
36
|
+
"babel-plugin-transform-dynamic-import": "^2.1.0",
|
|
37
|
+
"rollup-plugin-esbuild": "^6.1.1",
|
|
38
|
+
"rimraf": "^5.0.7",
|
|
39
|
+
"commit-and-tag-version": "^12.4.1"
|
|
31
40
|
},
|
|
32
41
|
"customElements": "custom-elements.json"
|
|
33
42
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
2
2
|
import babel from '@rollup/plugin-babel';
|
|
3
|
-
import html from '@web/rollup-plugin-html';
|
|
3
|
+
import { rollupPluginHTML as html } from '@web/rollup-plugin-html';
|
|
4
4
|
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets';
|
|
5
|
-
import
|
|
5
|
+
import esbuild from 'rollup-plugin-esbuild';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
input: 'index.html',
|
|
@@ -19,36 +19,21 @@ export default {
|
|
|
19
19
|
/** Enable using HTML as rollup entrypoint */
|
|
20
20
|
html({
|
|
21
21
|
minify: true,
|
|
22
|
-
injectServiceWorker: true,
|
|
23
|
-
serviceWorkerPath: 'public/sw.js',
|
|
24
22
|
}),
|
|
25
23
|
/** Resolve bare module imports */
|
|
26
24
|
nodeResolve(),
|
|
27
|
-
/** Minify JS */
|
|
28
|
-
|
|
25
|
+
/** Minify JS, compile JS to a lower language target */
|
|
26
|
+
esbuild({
|
|
27
|
+
minify: true,
|
|
28
|
+
target: ['chrome64', 'firefox67', 'safari11.1'],
|
|
29
|
+
}),
|
|
29
30
|
/** Bundle assets references via import.meta.url */
|
|
30
31
|
importMetaAssets(),
|
|
31
|
-
/**
|
|
32
|
+
/** Minify html and css tagged template literals */
|
|
32
33
|
babel({
|
|
33
|
-
babelHelpers: 'bundled',
|
|
34
|
-
presets: [
|
|
35
|
-
[
|
|
36
|
-
require.resolve('@babel/preset-env'),
|
|
37
|
-
{
|
|
38
|
-
targets: [
|
|
39
|
-
'last 3 Chrome major versions',
|
|
40
|
-
'last 3 Firefox major versions',
|
|
41
|
-
'last 3 Edge major versions',
|
|
42
|
-
'last 3 Safari major versions',
|
|
43
|
-
],
|
|
44
|
-
modules: false,
|
|
45
|
-
bugfixes: true,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
],
|
|
49
34
|
plugins: [
|
|
50
35
|
[
|
|
51
|
-
|
|
36
|
+
'babel-plugin-template-html-minifier',
|
|
52
37
|
{
|
|
53
38
|
modules: { lit: ['html', { name: 'css', encapsulation: 'style' }] },
|
|
54
39
|
failOnError: false,
|
|
@@ -23,20 +23,28 @@ export class <%= className %> extends DDDSuper(LitElement) {
|
|
|
23
23
|
css`
|
|
24
24
|
:host {
|
|
25
25
|
display: block;
|
|
26
|
+
color: var(--ddd-theme-primary);
|
|
27
|
+
background-color: var(--ddd-theme-accent);
|
|
28
|
+
font-family: var(--ddd-font-navigation);
|
|
29
|
+
font-size: var(--<%= name %>-font-size, var(--ddd-font-size-s));
|
|
26
30
|
}
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
.wrapper {
|
|
32
|
+
margin: var(--ddd-spacing-2);
|
|
33
|
+
padding: var(--ddd-spacing-4);
|
|
34
|
+
}
|
|
35
|
+
div {
|
|
36
|
+
padding: 0;
|
|
37
|
+
margin: 0;
|
|
29
38
|
}
|
|
30
39
|
`];
|
|
31
40
|
}
|
|
32
|
-
|
|
33
41
|
|
|
34
42
|
render() {
|
|
35
43
|
return html`
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
<div class="wrapper">
|
|
45
|
+
<div>${this.title}</div>
|
|
46
|
+
<slot></slot>
|
|
47
|
+
</div>`;
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
/**
|
|
@@ -48,4 +56,4 @@ export class <%= className %> extends DDDSuper(LitElement) {
|
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
|
|
51
|
-
globalThis.customElements.define(<%= className %>.tag,
|
|
59
|
+
globalThis.customElements.define(<%= className %>.tag, <%= className %>);
|
package/dist/utils.js
CHANGED
|
@@ -17,7 +17,7 @@ const SITE_FILE_NAME = exports.SITE_FILE_NAME = "site.json";
|
|
|
17
17
|
* Helper to convert dash to camel; important when reading attributes.
|
|
18
18
|
*/
|
|
19
19
|
function dashToCamel(str) {
|
|
20
|
-
return str.replace(/-([a-
|
|
20
|
+
return str.replace(/-([a-z0-9])/g, function (g) {
|
|
21
21
|
return g[1].toUpperCase();
|
|
22
22
|
});
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haxtheweb/create",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"release": "npm run build && commit-and-tag-version && git push --follow-tags origin main && npm publish"
|
|
25
25
|
},
|
|
26
26
|
"bin": {
|
|
27
|
-
"create-haxtheweb": "./dist/create.js"
|
|
27
|
+
"create-haxtheweb": "./dist/create.js",
|
|
28
|
+
"hax": "./dist/create.js"
|
|
28
29
|
},
|
|
29
30
|
"files": [
|
|
30
31
|
"dist"
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"htw",
|
|
37
38
|
"webcomponents",
|
|
38
39
|
"lit",
|
|
40
|
+
"cms",
|
|
39
41
|
"generator",
|
|
40
42
|
"starter-app"
|
|
41
43
|
],
|
|
@@ -44,17 +46,13 @@
|
|
|
44
46
|
"@clack/prompts": "0.7.0",
|
|
45
47
|
"picocolors": "1.0.1",
|
|
46
48
|
"ejs": "3.1.10",
|
|
47
|
-
"@haxtheweb/haxcms-nodejs": "0.0.
|
|
49
|
+
"@haxtheweb/haxcms-nodejs": "^0.0.15"
|
|
48
50
|
},
|
|
49
51
|
"devDependencies": {
|
|
50
52
|
"@babel/cli": "^7.24.6",
|
|
51
53
|
"@babel/core": "^7.24.6",
|
|
52
54
|
"@babel/register": "^7.24.6",
|
|
53
55
|
"@custom-elements-manifest/analyzer": "^0.10.2",
|
|
54
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
55
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
56
|
-
"@web/rollup-plugin-html": "^2.3.0",
|
|
57
|
-
"@web/rollup-plugin-import-meta-assets": "^2.2.1",
|
|
58
56
|
"babel-plugin-transform-dynamic-import": "^2.1.0",
|
|
59
57
|
"@babel/preset-env": "7.24.6",
|
|
60
58
|
"commit-and-tag-version": "12.4.1"
|