create-ui0 0.1.5 → 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 +23 -0
- package/package.json +1 -1
- package/template-component/name.vue +7 -6
package/dist/index.js
CHANGED
|
@@ -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
|
@@ -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>
|