dufu1991 пре 3 година
родитељ
комит
6c0299f87c

+ 60 - 58
packages/create-stdf/src/index.js

@@ -85,76 +85,78 @@ else if (argvProjectName && argvTemplate) {
 		createFunc(argvProjectName, item);
 	}
 } else {
-	// 选择一种语言
-	// Select a language
-	const languageType = await p.select({
-		message: bold('Please select your preferred language'),
-		options: languages,
-	});
-	if (p.isCancel(languageType)) {
-		p.cancel(red('⛔ ') + lang.oc);
-		process.exit(0);
-	}
-	lang = langAll[languageType];
-
-	//  选择一个模板
-	// 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);
-	}
-
-	// 直到选择的 template 所在项 的 finish 为 true 为止,否则一直重新选择
-	// Until the finish of the selected template is true, otherwise keep reselecting
-	while (!templateOptions.find(item => item.value === template)?.finish) {
-		if (p.isCancel(template)) {
+	(async () => {
+		// 选择一种语言
+		// Select a language
+		const languageType = await p.select({
+			message: bold('Please select your preferred language'),
+			options: languages,
+		});
+		if (p.isCancel(languageType)) {
 			p.cancel(red('⛔ ') + lang.oc);
 			process.exit(0);
 		}
+		lang = langAll[languageType];
 
-		p.intro(red(templateOptions.find(item => item.value === template).label + ' ' + lang.hnay + ' ' + lang.pca));
-		template = await p.select({
+		//  选择一个模板
+		// Select a template
+		let template = await p.select({
 			message: bold(lang.psat),
 			options: templateOptions,
 		});
-	}
 
-	// 输入项目名称
-	// 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(template)) {
+			p.cancel(red('⛔ ') + lang.oc);
+			process.exit(0);
+		}
+
+		// 直到选择的 template 所在项 的 finish 为 true 为止,否则一直重新选择
+		// Until the finish of the selected template is true, otherwise keep reselecting
+		while (!templateOptions.find(item => item.value === template)?.finish) {
+			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.hnay + ' ' + lang.pca));
+			template = await p.select({
+				message: bold(lang.psat),
+				options: templateOptions,
+			});
+		}
+
+		// 输入项目名称
+		// 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 的值,复制对应目录下的所有文件到当前目录
-	// 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);
+		if (p.isCancel(projectName)) {
+			p.cancel(red('⛔ ') + lang.oc);
+			process.exit(0);
 		}
-	});
+
+		// 根据 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);
+			}
+		});
+	})();
 }
 
 function createFunc(projectName, item) {

+ 6 - 0
packages/create-stdf/templates/sveltekit-tailwind/src/routes/+page.svelte

@@ -99,8 +99,14 @@
 <div class="mb-8">
 	<Button heightIn="0" group fill="lineTheme">
 		<div class="flex divide-x">
+			<!-- svelte-ignore a11y-click-events-have-key-events -->
+			<!-- svelte-ignore a11y-no-static-element-interactions -->
 			<div class="flex-1 py-2 active:opacity-80" on:click={reduceFunc}>-10</div>
+			<!-- svelte-ignore a11y-click-events-have-key-events -->
+			<!-- svelte-ignore a11y-no-static-element-interactions -->
 			<div class="flex-1 py-2 active:opacity-80" on:click={increaseFunc}>+10</div>
+			<!-- svelte-ignore a11y-click-events-have-key-events -->
+			<!-- svelte-ignore a11y-no-static-element-interactions -->
 			<div class="flex-1 py-2 active:opacity-80" on:click={() => (percent = 20)}>{isZh ? '重置' : 'Reset'}</div>
 		</div>
 	</Button>

+ 6 - 0
packages/create-stdf/templates/sveltekit-uno/src/routes/+page.svelte

@@ -99,8 +99,14 @@
 <div class="mb-8">
 	<Button heightIn="0" group fill="lineTheme">
 		<div class="flex divide-x">
+			<!-- svelte-ignore a11y-click-events-have-key-events -->
+			<!-- svelte-ignore a11y-no-static-element-interactions -->
 			<div class="flex-1 py-2 active:opacity-80" on:click={reduceFunc}>-10</div>
+			<!-- svelte-ignore a11y-click-events-have-key-events -->
+			<!-- svelte-ignore a11y-no-static-element-interactions -->
 			<div class="flex-1 py-2 active:opacity-80" on:click={increaseFunc}>+10</div>
+			<!-- svelte-ignore a11y-click-events-have-key-events -->
+			<!-- svelte-ignore a11y-no-static-element-interactions -->
 			<div class="flex-1 py-2 active:opacity-80" on:click={() => (percent = 20)}>{isZh ? '重置' : 'Reset'}</div>
 		</div>
 	</Button>

+ 6 - 0
packages/create-stdf/templates/vite-tailwind/src/App.svelte

@@ -91,8 +91,14 @@
 	<div class="my-8">
 		<Button heightIn="0" group fill="lineTheme">
 			<div class="flex divide-x">
+				<!-- svelte-ignore a11y-click-events-have-key-events -->
+				<!-- svelte-ignore a11y-no-static-element-interactions -->
 				<div class="flex-1 py-2 active:opacity-80" on:click={reduceFunc}>-10</div>
+				<!-- svelte-ignore a11y-click-events-have-key-events -->
+				<!-- svelte-ignore a11y-no-static-element-interactions -->
 				<div class="flex-1 py-2 active:opacity-80" on:click={increaseFunc}>+10</div>
+				<!-- svelte-ignore a11y-click-events-have-key-events -->
+				<!-- svelte-ignore a11y-no-static-element-interactions -->
 				<div class="flex-1 py-2 active:opacity-80" on:click={() => (percent = 20)}>{isZh ? '重置' : 'Reset'}</div>
 			</div>
 		</Button>

+ 6 - 0
packages/create-stdf/templates/vite-uno/src/App.svelte

@@ -91,8 +91,14 @@
 	<div class="my-8">
 		<Button heightIn="0" group fill="lineTheme">
 			<div class="flex divide-x">
+				<!-- svelte-ignore a11y-click-events-have-key-events -->
+				<!-- svelte-ignore a11y-no-static-element-interactions -->
 				<div class="flex-1 py-2 active:opacity-80" on:click={reduceFunc}>-10</div>
+				<!-- svelte-ignore a11y-click-events-have-key-events -->
+				<!-- svelte-ignore a11y-no-static-element-interactions -->
 				<div class="flex-1 py-2 active:opacity-80" on:click={increaseFunc}>+10</div>
+				<!-- svelte-ignore a11y-click-events-have-key-events -->
+				<!-- svelte-ignore a11y-no-static-element-interactions -->
 				<div class="flex-1 py-2 active:opacity-80" on:click={() => (percent = 20)}>{isZh ? '重置' : 'Reset'}</div>
 			</div>
 		</Button>

+ 1 - 1
packages/rollup-plugin-stdf-icon/README.md

@@ -47,7 +47,7 @@ Generally, you can simply place the SVG files in the default input folder withou
 
 If you need to modify the input/output folders and the filename of the combined file, or if you need to combine multiple folders, you can customize the configuration in vite.config.js or vite.config.ts:
 
-```js
+```javascript
 // ...
     svgSprite([
         { inFile: 'src/lib/svgs', outFile: 'static/fonts', fileName: 'symbol' },

+ 1 - 1
packages/rollup-plugin-stdf-icon/README_CN.md

@@ -47,7 +47,7 @@ export default defineConfig({
 
 如果需要修改输入输出文件夹以及合并的文件名,或者同时需要合并多个文件夹,可以在 vite.config.js 或 vite.config.ts 中修改配置:
 
-```js
+```javascript
 // ...
     svgSprite([
         { inFile: 'src/lib/svgs', outFile: 'static/fonts', fileName: 'symbol' },