Selaa lähdekoodia

[create]Support command parameters to quickly create projects

杜府 3 vuotta sitten
vanhempi
sitoutus
c7bf27415d

+ 10 - 10
README.md

@@ -34,15 +34,15 @@ Mobile web component library based on [Svelte](https://svelte.dev) and [Tailwind
 
 # Features
 
--   🚀 No runtime, no virtual DOM, runs faster online;
--   🧰 Rich API, easily configure component styles that meet your needs;
--   ✍ Based on Svelte and Tailwind, coding is quick and easy;
--   🍭 Supports dark mode;
--   📖 Provides extensive Chinese and English documentation and component examples;
--   🌍 Supports internationalization, with 60+ built-in language packages;
--   🫰 User-friendly interaction, animation parameters can be configured, and custom themes are supported;
--   🤝 Supports Tailwind libraries such as Windi CSS and UnoCSS;
--   🫡 No three -party dependence, no need to worry about the three -party library version and security issues.
+- 🚀 No runtime, no virtual DOM, runs faster online;
+- 🧰 Rich API, easily configure component styles that meet your needs;
+- ✍ Based on Svelte and Tailwind, coding is quick and easy;
+- 🍭 Supports dark mode;
+- 📖 Provides extensive Chinese and English documentation and component examples;
+- 🌍 Supports internationalization, with 60+ built-in language packages;
+- 🫰 User-friendly interaction, animation parameters can be configured, and custom themes are supported;
+- 🤝 Supports Tailwind libraries such as Windi CSS and UnoCSS;
+- 🫡 No three -party dependence, no need to worry about the three -party library version and security issues.
 
 # Getting Started
 
@@ -67,7 +67,7 @@ import { Button } from 'stdf';
 <Button>Default</Button>
 ```
 
-## 😓 No project? Create one!
+## 😓 No project? Create one
 
 You can try using [create-stdf](https://www.npmjs.com/package/create-stdf) to quickly create a project. (beta version, may have issues)
 

+ 9 - 9
README_CN.md

@@ -36,15 +36,15 @@
 
 # 特性
 
--   🚀 无运行时,无虚拟 DOM,线上运行更快;
--   🧰 API 丰富,轻松配置出符合需求的组件样式;
--   ✍ 基于 Svelte 和 Tailwind,编码迅速轻松;
--   🍭 支持暗色模式;
--   📖 提供丰富的中英文文档和组件示例;
--   🌍 支持国际化,已内置 60+ 种语言包;
--   🫰 交互友好,动画参数可配,可自定义主题;
--   🤝 支持 Tailwind 类库,如 Windi CSS、UnoCSS 等;
--   🫡 无三方依赖,无需担心三方库版本与安全问题。
+- 🚀 无运行时,无虚拟 DOM,线上运行更快;
+- 🧰 API 丰富,轻松配置出符合需求的组件样式;
+- ✍ 基于 Svelte 和 Tailwind,编码迅速轻松;
+- 🍭 支持暗色模式;
+- 📖 提供丰富的中英文文档和组件示例;
+- 🌍 支持国际化,已内置 60+ 种语言包;
+- 🫰 交互友好,动画参数可配,可自定义主题;
+- 🤝 支持 Tailwind 类库,如 Windi CSS、UnoCSS 等;
+- 🫡 无三方依赖,无需担心三方库版本与安全问题。
 
 # 快速上手
 

+ 53 - 5
packages/create-stdf/README.md

@@ -1,10 +1,19 @@
+
+[简体中文](https://github.com/dufu1991/stdf/blob/main/packages/create-stdf/README_CN.md)
+
 # create-stdf
 
 A CLI for creating new [STDF](https://stdf.design) projects. Just run...
 
+With PNPM:
+
+```bash
+pnpm create stdf
+```
+
+With NPM:
+
 ```bash
-pnpm create stdf@latest
-# or
 npm create stdf@latest
 # or
 npm init stdf@latest
@@ -14,11 +23,50 @@ npx create-stdf@latest
 
 ...and follow the prompts.
 
-# Introduction
+You can also directly specify the project name and the template you want to use via additional command line options. For example, to create a new project named `my-app` using the **Vite + Svelte + Tailwind + STDF** template, run:
+
+```bash
+# pnpm
+pnpm create stdf my-app
+
+# npm
+npm create stdf@latest my-app
+```
+
+If you want to use the **Vite + UnoCSS + Svelte + STDF** template, run:
+
+```bash
+# pnpm
+pnpm create stdf my-app --template vu
+# or
+pnpm create stdf my-app -t vu
+
+# npm
+npm create stdf@latest my-app --template vu
+# or
+npm create stdf@latest my-app -t vu
+```
+
+Template presets include:
+
+| abbreviation | template                                     | description         |
+| ------------ | -------------------------------------------- | ------------------- |
+| vt           | Vite + Tailwind + Svelte + STDF              | default             |
+| vu           | Vite + UnoCSS + Svelte + STDF                | -                   |
+| skt          | SvelteKit + Tailwind + STDF                  | Has not adapted yet |
+| sku          | SvelteKit + UnoCSS + STDF                    | Has not adapted yet |
+| vtt          | Vite + Tailwind + TypeScript + Svelte + STDF | Has not adapted yet |
+| vut          | Vite + UnoCSS + TypeScript + Svelte + STDF   | Has not adapted yet |
+| sktt         | SvelteKit + Tailwind + TypeScript + STDF     | Has not adapted yet |
+| skut         | SvelteKit + UnoCSS + TypeScript + STDF       | Has not adapted yet |
 
-This is a template using Vite + Svelte + TailwindCSS + STDF. It is based on [create-vite](https://www.npmjs.com/package/create-vite) and add base TailwindCSS configuration, and STDF configuration.
+# Options
 
-Omit the separate configuration of TailwindCSS and STDF, and use the template to quickly create a project that can be used directly.
+| Option          | Type   | Default | Description                                                                                           |
+| --------------- | ------ | ------- | ----------------------------------------------------------------------------------------------------- |
+| -               | string | -       | The name of the project, you can direct input.                                                        |
+| -t / --template | string | vt      | The template to use. Available templates are: `vt`, `vu`, `skt`, `sku`, `vtt`, `vut`, `sktt`, `skut`. |
+| -l / --language | string | en_US   | The language of the prompts. Available languages are: `en_US`, `zh_CN`.                               |
 
 # License
 

+ 72 - 0
packages/create-stdf/README_CN.md

@@ -0,0 +1,72 @@
+[English](https://github.com/dufu1991/stdf/blob/main/packages/create-stdf/README.md)
+
+# create-stdf
+
+一个用于创建新的 [STDF](https://stdf.design) 项目的命令行工具。只需运行以下命令...
+
+使用 PNPM:
+
+```bash
+pnpm create stdf
+```
+
+使用 NPM:
+
+```bash
+npm create stdf@latest
+# 或者
+npm init stdf@latest
+# 或者
+npx create-stdf@latest
+```
+
+...然后按照提示进行操作。
+
+你也可以通过额外的命令行选项直接指定项目名称和要使用的模板。例如,如果要使用 **Vite + Svelte + Tailwind + STDF** 模板创建一个名为 `my-app` 的新项目,请运行:
+
+```bash
+# pnpm
+pnpm create stdf my-app
+
+# npm
+npm create stdf@latest my-app
+```
+
+如果要使用 **Vite + UnoCSS + Svelte + STDF** 模板,请运行:
+
+```bash
+# pnpm
+pnpm create stdf my-app --template vu
+# 或者
+pnpm create stdf my-app -t vu
+
+# npm
+npm create stdf@latest my-app --template vu
+# 或者
+npm create stdf@latest my-app -t vu
+```
+
+模板预设包括:
+
+| 简写 | 模板                                         | 描述     |
+| ---- | -------------------------------------------- | -------- |
+| vt   | Vite + Tailwind + Svelte + STDF              | 默认     |
+| vu   | Vite + UnoCSS + Svelte + STDF                | -        |
+| skt  | SvelteKit + Tailwind + STDF                  | 尚未适配 |
+| sku  | SvelteKit + UnoCSS + STDF                    | 尚未适配 |
+| vtt  | Vite + Tailwind + TypeScript + Svelte + STDF | 尚未适配 |
+| vut  | Vite + UnoCSS + TypeScript + Svelte + STDF   | 尚未适配 |
+| sktt | SvelteKit + Tailwind + TypeScript + STDF     | 尚未适配 |
+| skut | SvelteKit + UnoCSS + TypeScript + STDF       | 尚未适配 |
+
+# 命令选项
+
+| 命令            | 类型   | 默认  | 描述                                                                                 |
+| --------------- | ------ | ----- | ------------------------------------------------------------------------------------ |
+| -               | string | -     | 项目名称,可以直接输入。                                                             |
+| -t / --template | string | vt    | 要使用的模板。可用的模板有:`vt`、`vu`、`skt`、`sku`、`vtt`、`vut`、`sktt`、`skut`。 |
+| -l / --language | string | en_US | 提示语言。可用的语言有:`en_US`、`zh_CN`。                                           |
+
+# 许可证
+
+本项目基于 [MIT 许可证](https://github.com/dufu1991/stdf/blob/main/LICENSE)。请随意享受并贡献给这个开源项目。

+ 3 - 2
packages/create-stdf/package.json

@@ -1,6 +1,6 @@
 {
     "name": "create-stdf",
-    "version": "0.0.25",
+    "version": "0.0.26",
     "description": "A CLI for creating new STDF projects",
     "bin": {
         "create-stdf": "index.js"
@@ -19,7 +19,8 @@
     "dependencies": {
         "@clack/prompts": "^0.6.3",
         "fs-extra": "^11.1.1",
-        "kleur": "^4.1.5"
+        "kleur": "^4.1.5",
+        "minimist": "^1.2.8"
     },
     "devDependencies": {
         "@rollup/plugin-terser": "^0.4.3",

+ 204 - 137
packages/create-stdf/src/index.js

@@ -5,6 +5,7 @@ import path from 'node:path';
 import { fileURLToPath } from 'node:url';
 import * as p from '@clack/prompts';
 import { bold, cyan, grey, red, blue } from 'kleur/colors';
+import minimist from 'minimist';
 
 import * as langAll from './lang';
 
@@ -20,172 +21,238 @@ const spinner = p.spinner();
 
 p.intro('Welcome to use STDF!');
 
-// 选择一种语言
-// Select a language
-const languageType = await p.select({
-    message: bold('Please select your preferred language(请选择你习惯的语言)'),
-    options: [
-        { value: 'en_US', label: 'English' },
-        { value: 'zh_CN', label: '简体中文' },
-    ],
-});
-const lang = langAll[languageType] || langAll['en_US'];
-
-if (p.isCancel(languageType)) {
-    p.cancel(red('⛔ ') + lang.oc);
-    process.exit(0);
-}
+let lang = langAll.en_US;
+
+// 获取命令行参数
+// Get command line parameters
+const argv = minimist(process.argv.slice(2));
+
+// 获取项目名称和模板名称和语言
+// Get project name and template name
+const argvProjectName = argv._[0];
+const argvTemplate = argv.template || argv.t;
+const argvLanguage = argv.language || argv.l;
+
+lang = argvLanguage && argvLanguage === 'zh_CN' ? langAll.zh_CN : langAll.en_US;
 
 const templateOptions = [
     { value: 'vt', label: 'Vite + Tailwind', template: 'vite-tailwind', pcyt: lang.pcyt_vt },
-    { value: 'vu', label: `Vite + UnoCSS`, template: 'vite-uno', pcyt: lang.pcyt_vu },
+    { value: 'vu', label: 'Vite + UnoCSS', template: 'vite-uno', pcyt: lang.pcyt_vu },
     { value: 'skt', label: `SvelteKit + Tailwind(${lang.hnay})`, template: 'sveltekit-tailwind' },
     { value: 'sku', label: `SvelteKit + UnoCSS(${lang.hnay})`, template: 'sveltekit-uno' },
     { value: 'vtt', label: `Vite + Tailwind + TypeScript(${lang.hnay})`, template: 'vite-tailwind-typescript' },
-    { value: 'vut', label: `Vite + UnoCSS+TypeScript(${lang.hnay})`, template: 'vite-uno-typescript' },
+    { value: 'vut', label: `Vite + UnoCSS + TypeScript(${lang.hnay})`, template: 'vite-uno-typescript' },
     { value: 'sktt', label: `SvelteKit + Tailwind + TypeScript(${lang.hnay})`, template: 'sveltekit-tailwind-typescript' },
     { value: 'skut', label: `SvelteKit + UnoCSS + TypeScript(${lang.hnay})`, template: 'sveltekit-uno-typescript' },
 ];
 
-//  选择一个模板
-// Select a template
-let template = await p.select({
-    message: bold(lang.psat),
-    options: templateOptions,
-});
+// 如果命令行参数中有项目名称,但没有模板名称,直接使用默认模板 vt
+// If there is a project name in the command line parameters, but no template name, use the default template vt directly
+if (argvProjectName && !argvTemplate) {
+    createFunc(argvProjectName, templateOptions[0]);
+}
 
-// 直到选择的 template 是 vt / vu 为止,否则一直重新选择
-// Until the selected template is vt or vu, otherwise keep reselecting
-while (template !== 'vt' && template !== 'vu') {
-    if (p.isCancel(template)) {
+// 如果命令行参数中有项目名称和模板名称,直接使用命令行参数中的值
+// If there is a project name and template name in the command line parameters, use the value in the command line parameters directly
+else if (argvProjectName && argvTemplate) {
+    const item = templateOptions.find(item => item.value === argvTemplate);
+    if (!item) {
+        p.intro(red(lang.pectn));
+    } else if (
+        item.value === 'skt' ||
+        item.value === 'sku' ||
+        item.value === 'vtt' ||
+        item.value === 'vut' ||
+        item.value === 'sktt' ||
+        item.value === 'skut'
+    ) {
+        p.intro(red(item.label + ' ' + lang.hnay));
+    } else {
+        createFunc(argvProjectName, item);
+    }
+} else {
+    // 选择一种语言
+    // Select a language
+    const languageType = await p.select({
+        message: bold('Please select your preferred language(请选择你习惯的语言)'),
+        options: [
+            { value: 'en_US', label: 'English' },
+            { value: 'zh_CN', label: '简体中文' },
+        ],
+    });
+    lang = langAll[languageType];
+    const templateOptions = [
+        { value: 'vt', label: 'Vite + Tailwind', template: 'vite-tailwind', pcyt: lang.pcyt_vt },
+        { value: 'vu', label: 'Vite + UnoCSS', template: 'vite-uno', pcyt: lang.pcyt_vu },
+        { value: 'skt', label: `SvelteKit + Tailwind(${lang.hnay})`, template: 'sveltekit-tailwind' },
+        { value: 'sku', label: `SvelteKit + UnoCSS(${lang.hnay})`, template: 'sveltekit-uno' },
+        { value: 'vtt', label: `Vite + Tailwind + TypeScript(${lang.hnay})`, template: 'vite-tailwind-typescript' },
+        { value: 'vut', label: `Vite + UnoCSS + TypeScript(${lang.hnay})`, template: 'vite-uno-typescript' },
+        { value: 'sktt', label: `SvelteKit + Tailwind + TypeScript(${lang.hnay})`, template: 'sveltekit-tailwind-typescript' },
+        { value: 'skut', label: `SvelteKit + UnoCSS + TypeScript(${lang.hnay})`, template: 'sveltekit-uno-typescript' },
+    ];
+
+    if (p.isCancel(languageType)) {
         p.cancel(red('⛔ ') + lang.oc);
         process.exit(0);
     }
 
-    p.intro(red(templateOptions.find(item => item.value === template).label + ' ' + lang.pca));
-    template = await p.select({
+    //  选择一个模板
+    // Select a template
+    let template = await p.select({
         message: bold(lang.psat),
         options: templateOptions,
     });
-}
-
-if (p.isCancel(template)) {
-    p.cancel(red('⛔ ') + lang.oc);
-    process.exit(0);
-}
 
-// 输入项目名称
-// Enter the project name
-const projectName = await p.text({
-    message: bold(lang.pn),
-    placeholder: 'stdf-project',
-    validate: value => {
-        if (!value) {
-            // 判断是否为空,提示 “项目名称不能为空”
-            // Determine whether it is empty, prompt "Project name cannot be empty"
-            return lang.pncbne;
-        }
-        if (fs.existsSync(value)) {
-            // 判断是否已存在,提示 “项目名称已存在”
-            // Determine whether it already exists, prompt "Project name already exists"
-            return lang.pane;
+    // 直到选择的 template 是 vt / vu 为止,否则一直重新选择
+    // Until the selected template is vt or vu, otherwise keep reselecting
+    while (template !== 'vt' && template !== 'vu') {
+        if (p.isCancel(template)) {
+            p.cancel(red('⛔ ') + lang.oc);
+            process.exit(0);
         }
-    },
-});
 
-if (p.isCancel(projectName)) {
-    p.cancel(red('⛔ ') + lang.oc);
-    process.exit(0);
+        p.intro(red(templateOptions.find(item => item.value === template).label + ' ' + lang.pca));
+        template = await p.select({
+            message: bold(lang.psat),
+            options: templateOptions,
+        });
+    }
+
+    if (p.isCancel(template)) {
+        p.cancel(red('⛔ ') + lang.oc);
+        process.exit(0);
+    }
+
+    // 输入项目名称
+    // Enter the project name
+    const projectName = await p.text({
+        message: bold(lang.pn),
+        placeholder: 'stdf-project',
+        validate: value => {
+            if (!value) {
+                // 判断是否为空,提示 “项目名称不能为空”
+                // Determine whether it is empty, prompt "Project name cannot be empty"
+                return lang.pncbne;
+            }
+            if (fs.existsSync(value)) {
+                // 判断是否已存在,提示 “项目名称已存在”
+                // Determine whether it already exists, prompt "Project name already exists"
+                return lang.pane;
+            }
+        },
+    });
+
+    if (p.isCancel(projectName)) {
+        p.cancel(red('⛔ ') + lang.oc);
+        process.exit(0);
+    }
+
+    // 项目目录
+    // Project directory
+    // const projectDir = path.join(path.resolve(), projectName);
+
+    // spinner.start('🚀 ' + lang.cfsing);
+
+    // 根据 template 的值,复制对应目录下的所有文件到当前目录
+    // According to the value of template, copy all files under the corresponding directory to the current directory
+    templateOptions.forEach(async item => {
+        if (item.value === template) {
+            createFunc(projectName, item);
+        }
+    });
 }
 
-// 项目目录
-// Project directory
-const projectDir = path.join(path.resolve(), projectName);
-
-spinner.start('🚀 ' + lang.cfsing);
-
-// 根据 template 的值,复制对应目录下的所有文件到当前目录
-// According to the value of template, copy all files under the corresponding directory to the current directory
-templateOptions.forEach(async item => {
-    if (item.value === template) {
-        fs.mkdirSync(projectDir);
-
-        // 获取模板目录的绝对路径,考虑到 Windows 系统的兼容性, 使用 path.join
-        // Get the absolute path of the template directory, considering the compatibility of the Windows system, use path.join
-        const templatePath = path.resolve(fileURLToPath(import.meta.url), '../..', `templates/${item.template}`);
-
-        // 将 templatePath 目录下的所有文件复制到 projectDir 目录下
-        // Copy all files under the templatePath directory to the projectDir directory\
-        fs.copy(templatePath, projectDir)
-            .then(() => {
-                spinner.stop();
-                p.outro(`${projectName}-${lang.pcsucc} 🎉`);
-
-                // 读取 package.json 文件
-                // Read the package.json file
-                const packageJson = JSON.parse(fs.readFileSync(`${projectDir}/package.json`, 'utf-8'));
-
-                // 将项目内的 package.json 中的 name 属性修改为 projectName
-                // Modify the name attribute in package.json in the project to projectName
-                packageJson.name = projectName;
-
-                // 将修改后的 packageJson 写入到项目内的 package.json 文件中
-                // Write the modified packageJson to the package.json file in the project
-                fs.writeFileSync(`${projectDir}/package.json`, JSON.stringify(packageJson, null, 4), 'utf-8');
-
-                // 获得依赖的版本号
-                // get the version number of the dependency
-                let versions = {};
-                if (template === 'vt') {
-                    versions = {
-                        vite: packageJson.devDependencies.vite.replace('^', ''),
-                        svelte: packageJson.devDependencies.svelte.replace('^', ''),
-                        tailwindcss: packageJson.devDependencies.tailwindcss.replace('^', ''),
-                        stdf: packageJson.devDependencies.stdf.replace('^', ''),
-                    };
-                }
-                if (template === 'vu') {
-                    versions = {
-                        vite: packageJson.devDependencies.vite.replace('^', ''),
-                        svelte: packageJson.devDependencies.svelte.replace('^', ''),
-                        unocss: packageJson.devDependencies.unocss.replace('^', ''),
-                        stdf: packageJson.devDependencies.stdf.replace('^', ''),
-                    };
-                }
-
-                // 将 versions 的键值拼接为 bold('Vite:') cyan(versions.vite) bold('Svelte:') cyan(versions.svelte) 的形式
-                // Splice the key value of versions into the form of bold('Vite:') cyan(versions.vite) bold('Svelte:') cyan(versions.svelte)
-                let versionsString = '';
-                for (const key in versions) {
-                    versionsString += bold(key) + ': ' + cyan(versions[key]) + ' ';
-                }
-
-                // 显示版本号
-                // Display version number
-                console.log(`📦 ${versionsString}
+function createFunc(projectName, item) {
+    // 如果 projectName 是数字,转为字符串
+    // If projectName is a number, convert it to a string
+    if (typeof projectName === 'number') {
+        projectName = projectName.toString();
+    }
+
+    // 项目目录
+    // Project directory
+    const projectDir = path.join(path.resolve(), projectName);
+
+    spinner.start('🚀 ' + lang.cfsing);
+
+    fs.mkdirSync(projectDir);
+
+    // 获取模板目录的绝对路径,考虑到 Windows 系统的兼容性, 使用 path.join
+    // Get the absolute path of the template directory, considering the compatibility of the Windows system, use path.join
+    const templatePath = path.resolve(fileURLToPath(import.meta.url), '../..', `templates/${item.template}`);
+
+    // 将 templatePath 目录下的所有文件复制到 projectDir 目录下
+    // Copy all files under the templatePath directory to the projectDir directory\
+    fs.copy(templatePath, projectDir)
+        .then(() => {
+            spinner.stop();
+            p.outro(`${projectName} - ${lang.pcsucc} 🎉`);
+
+            // 读取 package.json 文件
+            // Read the package.json file
+            const packageJson = JSON.parse(fs.readFileSync(`${projectDir}/package.json`, 'utf-8'));
+
+            // 将项目内的 package.json 中的 name 属性修改为 projectName
+            // Modify the name attribute in package.json in the project to projectName
+            packageJson.name = projectName;
+
+            // 将修改后的 packageJson 写入到项目内的 package.json 文件中
+            // Write the modified packageJson to the package.json file in the project
+            fs.writeFileSync(`${projectDir}/package.json`, JSON.stringify(packageJson, null, 4), 'utf-8');
+
+            // 获得依赖的版本号
+            // get the version number of the dependency
+            let versions = {};
+            if (item.value === 'vt') {
+                versions = {
+                    vite: packageJson.devDependencies.vite.replace('^', ''),
+                    svelte: packageJson.devDependencies.svelte.replace('^', ''),
+                    tailwindcss: packageJson.devDependencies.tailwindcss.replace('^', ''),
+                    stdf: packageJson.devDependencies.stdf.replace('^', ''),
+                };
+            }
+            if (item.value === 'vu') {
+                versions = {
+                    vite: packageJson.devDependencies.vite.replace('^', ''),
+                    svelte: packageJson.devDependencies.svelte.replace('^', ''),
+                    unocss: packageJson.devDependencies.unocss.replace('^', ''),
+                    stdf: packageJson.devDependencies.stdf.replace('^', ''),
+                };
+            }
+
+            // 将 versions 的键值拼接为 bold('Vite:') cyan(versions.vite) bold('Svelte:') cyan(versions.svelte) 的形式
+            // Splice the key value of versions into the form of bold('Vite:') cyan(versions.vite) bold('Svelte:') cyan(versions.svelte)
+            let versionsString = '';
+            for (const key in versions) {
+                versionsString += bold(key) + ': ' + cyan(versions[key]) + ' ';
+            }
+
+            // 显示版本号
+            // Display version number
+            console.log(`📦 ${versionsString}
                 `);
 
-                // 显示提示信息
-                // Display prompt information
-                console.log(
-                    `👉 ${bold(lang.tgs)}
+            // 显示提示信息
+            // Display prompt information
+            console.log(
+                `👉 ${bold(lang.tgs)}
 
     ${blue(`cd ${projectName}`)}
     ${blue('pnpm i / npm i / yarn')}
     ${blue('npm run dev')}
     `
-                );
+            );
 
-                // 显示配置主题色
-                // Display configuration theme color
-                console.log(
-                    `🎨 ${grey(item.pcyt)}
+            // 显示配置主题色
+            // Display configuration theme color
+            console.log(
+                `🎨 ${grey(item.pcyt)}
     `
-                );
-            })
-            .catch(err => {
-                spinner.stop();
-                console.error(red(lang.cferror + '--' + err));
-            });
-    }
-});
+            );
+        })
+        .catch(err => {
+            spinner.stop();
+            console.error(red(lang.cferror + '--' + err));
+        });
+}

+ 2 - 0
packages/create-stdf/src/lang.js

@@ -12,6 +12,7 @@ export const en_US = {
     pcyt_vt: 'Tip: Please configure your color system in the tailwind.config.js file',
     pcyt_vu: 'Tip: Please configure your color system in the uno.config.js file',
     cferror: 'Failed to create file',
+    pectn: 'Please enter the correct template name!',
 };
 
 export const zh_CN = {
@@ -28,4 +29,5 @@ export const zh_CN = {
     pcyt_vt: '提示:请到 tailwind.config.js 文件内配置你的颜色系统',
     pcyt_vu: '提示:请到 uno.config.js 文件内配置你的颜色系统',
     cferror: '创建文件失败',
+    pectn: '请输入正确的模板名称!',
 };