create-widget 24.1.1-beta.40 → 24.1.1-beta.41
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/index.cjs +59 -5
- package/package.json +4 -6
- package/template/package.json +5 -5
- package/template/vite.config.ts +22 -17
- package/unocss/src/main.ts +13 -0
- package/unocss/uno.config.ts +5 -0
- package/unocss/vite.config.ts +24 -0
package/index.cjs
CHANGED
|
@@ -7804,7 +7804,7 @@ var FileUtils = class {
|
|
|
7804
7804
|
if (stats.isDirectory()) {
|
|
7805
7805
|
await this.copyFolderRecursive(srcPath, destPath);
|
|
7806
7806
|
} else {
|
|
7807
|
-
await (0, import_fs_extra.copy)(srcPath, destPath);
|
|
7807
|
+
await (0, import_fs_extra.copy)(srcPath, destPath, { overwrite: true });
|
|
7808
7808
|
}
|
|
7809
7809
|
}
|
|
7810
7810
|
} catch (error) {
|
|
@@ -7845,7 +7845,9 @@ async function init() {
|
|
|
7845
7845
|
{ color: "#42d392", pos: 0.1 },
|
|
7846
7846
|
{ color: "#647eff", pos: 1 }
|
|
7847
7847
|
])(defaultBanner);
|
|
7848
|
-
console.log(
|
|
7848
|
+
console.log(
|
|
7849
|
+
process2.stdout.isTTY && process2.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner
|
|
7850
|
+
);
|
|
7849
7851
|
console.log();
|
|
7850
7852
|
const argv2 = (0, import_minimist.default)(process2.argv.slice(2), {
|
|
7851
7853
|
alias: {
|
|
@@ -7860,6 +7862,9 @@ async function init() {
|
|
|
7860
7862
|
let targetDir = argv2._[0];
|
|
7861
7863
|
const defaultProjectName = !targetDir ? "widget-project" : targetDir;
|
|
7862
7864
|
const forceOverwrite = argv2.force;
|
|
7865
|
+
const unocss = argv2.unocss;
|
|
7866
|
+
const vueuse = argv2.vueuse;
|
|
7867
|
+
const iconpark = argv2.iconpark;
|
|
7863
7868
|
const cwd2 = process2.cwd();
|
|
7864
7869
|
let result = {};
|
|
7865
7870
|
result = await (0, import_prompts.default)(
|
|
@@ -7878,6 +7883,27 @@ async function init() {
|
|
|
7878
7883
|
const dirForPrompt = targetDir === "." ? "Current directory" : `Target directory "${targetDir}"`;
|
|
7879
7884
|
return `${dirForPrompt} is not empty. Remove existing files and continue?`;
|
|
7880
7885
|
}
|
|
7886
|
+
},
|
|
7887
|
+
{
|
|
7888
|
+
name: "useVueUse",
|
|
7889
|
+
type: () => vueuse ? null : "confirm",
|
|
7890
|
+
message: () => {
|
|
7891
|
+
return `Use VueUse (Collection of Essential Vue Composition Utilities)?`;
|
|
7892
|
+
}
|
|
7893
|
+
},
|
|
7894
|
+
{
|
|
7895
|
+
name: "useUnoCss",
|
|
7896
|
+
type: () => unocss ? null : "confirm",
|
|
7897
|
+
message: () => {
|
|
7898
|
+
return `Use Unocss(Atomic CSS Engine)?`;
|
|
7899
|
+
}
|
|
7900
|
+
},
|
|
7901
|
+
{
|
|
7902
|
+
name: "useIconPark",
|
|
7903
|
+
type: () => iconpark ? null : "confirm",
|
|
7904
|
+
message: () => {
|
|
7905
|
+
return `Use IconPark (2000+ high-quality icons)?`;
|
|
7906
|
+
}
|
|
7881
7907
|
}
|
|
7882
7908
|
],
|
|
7883
7909
|
{
|
|
@@ -7886,7 +7912,13 @@ async function init() {
|
|
|
7886
7912
|
}
|
|
7887
7913
|
}
|
|
7888
7914
|
);
|
|
7889
|
-
const {
|
|
7915
|
+
const {
|
|
7916
|
+
projectName,
|
|
7917
|
+
shouldOverwrite = argv2.force,
|
|
7918
|
+
useVueUse = argv2.vueuse,
|
|
7919
|
+
useUnoCss = argv2.unocss,
|
|
7920
|
+
useIconPark = argv2.iconpark
|
|
7921
|
+
} = result;
|
|
7890
7922
|
const root = import_node_path.default.join(cwd2, targetDir);
|
|
7891
7923
|
if (import_node_fs.default.existsSync(root) && shouldOverwrite) {
|
|
7892
7924
|
emptyDir(root);
|
|
@@ -7897,6 +7929,20 @@ async function init() {
|
|
|
7897
7929
|
Scaffolding project in ${root}...`);
|
|
7898
7930
|
const templateRoot = import_node_path.default.join(__dirname, "./template");
|
|
7899
7931
|
await FileUtils.copyFolderRecursive(templateRoot, root);
|
|
7932
|
+
const packageJsonPath = import_node_path.default.resolve(`${root}/package.json`);
|
|
7933
|
+
const packageJson = JSON.parse(import_node_fs.default.readFileSync(packageJsonPath).toString());
|
|
7934
|
+
if (useVueUse) {
|
|
7935
|
+
packageJson.dependencies["@vueuse/core"] = "latest";
|
|
7936
|
+
}
|
|
7937
|
+
if (useUnoCss) {
|
|
7938
|
+
packageJson.devDependencies.unocss = "latest";
|
|
7939
|
+
const unocssTemplateRoot = import_node_path.default.join(__dirname, "./unocss");
|
|
7940
|
+
await FileUtils.copyFolderRecursive(unocssTemplateRoot, root);
|
|
7941
|
+
}
|
|
7942
|
+
if (useIconPark) {
|
|
7943
|
+
packageJson.dependencies["@icon-park/vue-next"] = "latest";
|
|
7944
|
+
}
|
|
7945
|
+
import_node_fs.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
7900
7946
|
const userAgent = process2.env.npm_config_user_agent ?? "";
|
|
7901
7947
|
const packageManager = /pnpm/.test(userAgent) ? "pnpm" : /yarn/.test(userAgent) ? "yarn" : "npm";
|
|
7902
7948
|
console.log(`
|
|
@@ -7904,9 +7950,17 @@ Done. Now run:
|
|
|
7904
7950
|
`);
|
|
7905
7951
|
if (root !== cwd2) {
|
|
7906
7952
|
const cdProjectName = import_node_path.default.relative(cwd2, root);
|
|
7907
|
-
console.log(
|
|
7953
|
+
console.log(
|
|
7954
|
+
` ${import_chalk.default.bold(
|
|
7955
|
+
import_chalk.default.green(
|
|
7956
|
+
`cd ${cdProjectName.includes(" ") ? `"${cdProjectName}"` : cdProjectName}`
|
|
7957
|
+
)
|
|
7958
|
+
)}`
|
|
7959
|
+
);
|
|
7908
7960
|
}
|
|
7909
|
-
console.log(
|
|
7961
|
+
console.log(
|
|
7962
|
+
` ${import_chalk.default.bold(import_chalk.default.green(getCommand(packageManager, "install")))}`
|
|
7963
|
+
);
|
|
7910
7964
|
}
|
|
7911
7965
|
init().catch((e) => {
|
|
7912
7966
|
console.error(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-widget",
|
|
3
|
-
"version": "24.1.1-beta.
|
|
3
|
+
"version": "24.1.1-beta.41",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An easy way to start a Widget project",
|
|
6
6
|
"author": "Neo Fu <rtugeek@gmail.com>",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"index.cjs",
|
|
14
|
-
"template"
|
|
14
|
+
"template",
|
|
15
|
+
"unocss"
|
|
15
16
|
],
|
|
16
17
|
"engines": {
|
|
17
18
|
"node": ">=v16.20.0"
|
|
@@ -21,9 +22,6 @@
|
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"chalk": "^4.1.2",
|
|
24
|
-
"consola": "^2.15.3",
|
|
25
|
-
"ejs": "^3.1.8",
|
|
26
|
-
"esno": "^4.0.0",
|
|
27
25
|
"fs-extra": "^11.2.0",
|
|
28
26
|
"gradient-string": "^2.0.2",
|
|
29
27
|
"minimist": "^1.2.8",
|
|
@@ -49,7 +47,7 @@
|
|
|
49
47
|
"zx": "^7.2.3"
|
|
50
48
|
},
|
|
51
49
|
"scripts": {
|
|
52
|
-
"build": "
|
|
50
|
+
"build": "zx ./scripts/build.mjs",
|
|
53
51
|
"build:only": "zx ./scripts/build.mjs",
|
|
54
52
|
"watch": "tsup-node src/index.ts --format cjs --watch",
|
|
55
53
|
"build:run": "npm run build && npm exec create-widget",
|
package/template/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@vueuse/core": "^11.0.1",
|
|
14
|
-
"@widget-js/core": "
|
|
15
|
-
"@widget-js/vue3": "
|
|
14
|
+
"@widget-js/core": "latest",
|
|
15
|
+
"@widget-js/vue3": "latest",
|
|
16
16
|
"vue": "^3.3.11",
|
|
17
17
|
"vue-router": "^4.2.5",
|
|
18
18
|
"element-plus": "^2.8.1"
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"@vue/tsconfig": "^0.5.0",
|
|
25
25
|
"unplugin-auto-import": "^0.11.4",
|
|
26
26
|
"unplugin-vue-components": "^0.22.9",
|
|
27
|
-
"@widget-js/vite-plugin-widget": "
|
|
28
|
-
"@widget-js/cli": "
|
|
27
|
+
"@widget-js/vite-plugin-widget": "latest",
|
|
28
|
+
"@widget-js/cli": "latest",
|
|
29
29
|
"typescript": "~5.3.0",
|
|
30
30
|
"vite": "^5.0.10",
|
|
31
31
|
"vue-tsc": "^1.8.25"
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|
package/template/vite.config.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { URL, fileURLToPath } from
|
|
2
|
-
import widget from
|
|
3
|
-
import AutoImport from
|
|
4
|
-
import Components from
|
|
5
|
-
import { defineConfig } from
|
|
6
|
-
import vue from
|
|
7
|
-
import { ElementPlusResolver } from
|
|
8
|
-
|
|
9
|
-
// https://vitejs.dev/config/
|
|
10
|
-
export default defineConfig({
|
|
11
|
-
plugins: [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { URL, fileURLToPath } from "node:url";
|
|
2
|
+
import widget from "@widget-js/vite-plugin-widget";
|
|
3
|
+
import AutoImport from "unplugin-auto-import/vite";
|
|
4
|
+
import Components from "unplugin-vue-components/vite";
|
|
5
|
+
import { defineConfig } from "vite";
|
|
6
|
+
import vue from "@vitejs/plugin-vue";
|
|
7
|
+
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
8
|
+
|
|
9
|
+
// https://vitejs.dev/config/
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
plugins: [
|
|
12
|
+
vue(),
|
|
13
|
+
widget(),
|
|
14
|
+
AutoImport({ resolvers: [ElementPlusResolver()] }),
|
|
15
|
+
Components({ resolvers: [ElementPlusResolver()] }),
|
|
16
|
+
],
|
|
17
|
+
resolve: {
|
|
18
|
+
alias: {
|
|
19
|
+
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'virtual:uno.css'
|
|
2
|
+
import { WidgetJsPlugin } from '@widget-js/vue3'
|
|
3
|
+
import '@widget-js/vue3/dist/style.css'
|
|
4
|
+
import '@/assets/main.css'
|
|
5
|
+
import { createApp } from 'vue'
|
|
6
|
+
import App from './App.vue'
|
|
7
|
+
import router from './router'
|
|
8
|
+
|
|
9
|
+
const app = createApp(App)
|
|
10
|
+
|
|
11
|
+
app.use(router)
|
|
12
|
+
app.use(WidgetJsPlugin)
|
|
13
|
+
app.mount('#app')
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { URL, fileURLToPath } from "node:url";
|
|
2
|
+
import widget from "@widget-js/vite-plugin-widget";
|
|
3
|
+
import AutoImport from "unplugin-auto-import/vite";
|
|
4
|
+
import Components from "unplugin-vue-components/vite";
|
|
5
|
+
import UnoCSS from 'unocss/vite'
|
|
6
|
+
import { defineConfig } from "vite";
|
|
7
|
+
import vue from "@vitejs/plugin-vue";
|
|
8
|
+
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
9
|
+
|
|
10
|
+
// https://vitejs.dev/config/
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
plugins: [
|
|
13
|
+
vue(),
|
|
14
|
+
UnoCSS(),
|
|
15
|
+
widget(),
|
|
16
|
+
AutoImport({ resolvers: [ElementPlusResolver()] }),
|
|
17
|
+
Components({ resolvers: [ElementPlusResolver()] }),
|
|
18
|
+
],
|
|
19
|
+
resolve: {
|
|
20
|
+
alias: {
|
|
21
|
+
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|