create-ui0 0.1.4 → 0.1.6
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/index.js +26 -3
- package/package.json +1 -1
- package/template/package.json.tpl +3 -3
- package/template/src/App.vue +22 -25
- package/template-component/name.vue +7 -6
- package/template-nuxt/package.json.tpl +4 -4
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const FEATURES = [
|
|
|
34
34
|
{
|
|
35
35
|
id: 'flex',
|
|
36
36
|
title: 'Flex layout',
|
|
37
|
-
deps: { '@ui0/flex': '^0.1.
|
|
37
|
+
deps: { '@ui0/flex': '^0.1.4' },
|
|
38
38
|
importLine: "import Flex from '@ui0/flex'",
|
|
39
39
|
cssLines: ["'@ui0/flex/style.css'"],
|
|
40
40
|
section: ` <section>
|
|
@@ -49,7 +49,7 @@ const FEATURES = [
|
|
|
49
49
|
{
|
|
50
50
|
id: 'button',
|
|
51
51
|
title: 'Button component',
|
|
52
|
-
deps: { '@ui0/button': '^0.1.
|
|
52
|
+
deps: { '@ui0/button': '^0.1.4' },
|
|
53
53
|
importLine: "import Button from '@ui0/button'",
|
|
54
54
|
cssLines: ["'@ui0/button/style.css'"],
|
|
55
55
|
section: ` <section>
|
|
@@ -60,7 +60,7 @@ const FEATURES = [
|
|
|
60
60
|
{
|
|
61
61
|
id: 'icon',
|
|
62
62
|
title: 'Icon component + ui0 icon pack',
|
|
63
|
-
deps: { '@ui0/icon': '^0.1.
|
|
63
|
+
deps: { '@ui0/icon': '^0.1.4', '@ui0/icons': '^0.1.4' },
|
|
64
64
|
importLine: "import { Icon } from '@ui0/icon'",
|
|
65
65
|
cssLines: ["'@ui0/icon/style.css'", "'@ui0/icons/style.css'"],
|
|
66
66
|
section: ` <section>
|
|
@@ -80,6 +80,28 @@ const onCancel = () => {
|
|
|
80
80
|
console.log('aborted');
|
|
81
81
|
process.exit(0);
|
|
82
82
|
};
|
|
83
|
+
/** the @ui0 specs a template manifest carries (deps + devDeps merged) */
|
|
84
|
+
const ui0Specs = (manifest) => Object.entries({ ...manifest.dependencies, ...manifest.devDependencies }).filter(([name]) => name.startsWith('@ui0/'));
|
|
85
|
+
/**
|
|
86
|
+
* startup banner: own version + the @ui0 package specs the scaffold can
|
|
87
|
+
* pull (base template deps, per-feature deps, the nuxt host additions) -
|
|
88
|
+
* everything read from the manifests/FEATURES, never hardcoded
|
|
89
|
+
*/
|
|
90
|
+
const showBanner = () => {
|
|
91
|
+
const own = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
92
|
+
const base = JSON.parse(readFileSync(path.join(templateDir, 'package.json.tpl'), 'utf8'));
|
|
93
|
+
const nuxt = JSON.parse(readFileSync(path.join(templateNuxtDir, 'package.json.tpl'), 'utf8'));
|
|
94
|
+
const baseDeps = ui0Specs(base);
|
|
95
|
+
const nuxtExtra = ui0Specs(nuxt).filter(([name]) => !baseDeps.some(([baseName]) => baseName === name));
|
|
96
|
+
console.log(`\ncreate-ui0 v${own.version}\n`);
|
|
97
|
+
console.log(` always: ${baseDeps.map(([n, s]) => `${n} ${s}`).join(', ')}`);
|
|
98
|
+
for (const feature of FEATURES) {
|
|
99
|
+
console.log(` ${feature.id}: ${Object.entries(feature.deps).map(([n, s]) => `${n} ${s}`).join(', ')}`);
|
|
100
|
+
}
|
|
101
|
+
if (nuxtExtra.length)
|
|
102
|
+
console.log(` nuxt adds: ${nuxtExtra.map(([n, s]) => `${n} ${s}`).join(', ')}`);
|
|
103
|
+
console.log();
|
|
104
|
+
};
|
|
83
105
|
/**
|
|
84
106
|
* `create-ui0 component [Name]` - scaffolds a single component folder from
|
|
85
107
|
* template-component/ into the project at cwd (src/components/<kebab>/).
|
|
@@ -139,6 +161,7 @@ const run = async () => {
|
|
|
139
161
|
const argDir = process.argv[2];
|
|
140
162
|
const argHost = process.argv[3];
|
|
141
163
|
const argFeatures = process.argv[4]?.split(',').filter(Boolean);
|
|
164
|
+
showBanner();
|
|
142
165
|
const { dir } = await prompts({
|
|
143
166
|
type: argDir ? null : 'text',
|
|
144
167
|
name: 'dir',
|
package/package.json
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"vue": "^3.5.45",
|
|
13
|
-
"@ui0/core": "^0.1.
|
|
14
|
-
"@ui0/theme": "^0.1.
|
|
13
|
+
"@ui0/core": "^0.1.5",
|
|
14
|
+
"@ui0/theme": "^0.1.5"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@ui0/types": "^0.1.
|
|
17
|
+
"@ui0/types": "^0.1.6",
|
|
18
18
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
19
19
|
"sass-embedded": "^1.80.0",
|
|
20
20
|
"typescript": "~6.0.3",
|
package/template/src/App.vue
CHANGED
|
@@ -4,41 +4,38 @@
|
|
|
4
4
|
title="ui0 app"
|
|
5
5
|
name="app"
|
|
6
6
|
>
|
|
7
|
-
|
|
8
|
-
<h1>ui0 app</h1>
|
|
9
|
-
|
|
10
|
-
/* FEATURE_SECTIONS */
|
|
11
|
-
</main>
|
|
7
|
+
/* FEATURE_SECTIONS */
|
|
12
8
|
</App>
|
|
13
9
|
</ThemeProvider>
|
|
14
10
|
</template>
|
|
15
11
|
|
|
16
12
|
<script setup lang="ts">
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
import { App } from '@ui0/core'
|
|
14
|
+
import { ThemeProvider } from '@ui0/theme'
|
|
19
15
|
/* FEATURE_IMPORTS */
|
|
20
16
|
</script>
|
|
21
17
|
|
|
22
18
|
<style module lang="scss">
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
@value app from '@ui0/core/app';
|
|
20
|
+
.page {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: 24px;
|
|
24
|
+
padding: 32px;
|
|
25
|
+
font-family: system-ui, sans-serif;
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
h2 {
|
|
34
|
-
font-size: 14px;
|
|
35
|
-
opacity: 0.7;
|
|
36
|
-
margin-bottom: 8px;
|
|
37
|
-
}
|
|
27
|
+
h1 {
|
|
28
|
+
font-size: 20px;
|
|
38
29
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
h2 {
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
opacity: 0.7;
|
|
33
|
+
margin-bottom: 8px;
|
|
43
34
|
}
|
|
35
|
+
}
|
|
36
|
+
.box {
|
|
37
|
+
padding: 12px 16px;
|
|
38
|
+
border: 1px solid rgba(127, 127, 127, 0.4);
|
|
39
|
+
border-radius: 6px;
|
|
40
|
+
}
|
|
44
41
|
</style>
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
data-0="{%kebab%}"
|
|
4
|
-
:class="$styles.{%camel%}"
|
|
4
|
+
:class="$styles.{%camel%}"
|
|
5
|
+
>
|
|
5
6
|
<slot />
|
|
6
7
|
</div>
|
|
7
8
|
</template>
|
|
8
9
|
|
|
9
10
|
<script setup lang="ts">
|
|
10
|
-
|
|
11
|
+
import { useCssModule } from 'vue'
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
import type { {%Pascal%}Props } from './{%kebab%}.types'
|
|
14
|
+
import './{%kebab%}.module.css'
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const props = withDefaults(defineProps<{%Pascal%}Props>(), {})
|
|
17
|
+
const $styles = useCssModule()
|
|
17
18
|
</script>
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"preview": "nuxt preview"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@ui0/core": "^0.1.
|
|
13
|
-
"@ui0/nuxt": "^0.1.
|
|
14
|
-
"@ui0/theme": "^0.1.
|
|
12
|
+
"@ui0/core": "^0.1.5",
|
|
13
|
+
"@ui0/nuxt": "^0.1.2",
|
|
14
|
+
"@ui0/theme": "^0.1.5",
|
|
15
15
|
"nuxt": "^4.6.4",
|
|
16
16
|
"vue": "^3.5.45"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@ui0/types": "^0.1.
|
|
19
|
+
"@ui0/types": "^0.1.6",
|
|
20
20
|
"sass-embedded": "^1.80.0"
|
|
21
21
|
}
|
|
22
22
|
}
|