wind-script-cli
Advanced tools
+1
-1
| { | ||
| "name": "wind-script-cli", | ||
| "version": "0.0.17", | ||
| "version": "0.0.18", | ||
| "description": "WindScript Command Line Tool", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
+21
-19
@@ -40,22 +40,24 @@ #!/usr/bin/env node | ||
| var dir = fs.readdirSync("./"); | ||
| if (!(dir.includes(arg_name) && fs.statSync(`./${arg_name}`).isDirectory())) fs.mkdirSync(`./${arg_name}`); | ||
| if (!(dir.includes(arg_name) && fs.statSync(`./${arg_name}`).isDirectory())) { | ||
| fs.mkdirSync(`./${arg_name}`); | ||
| lib.copyDir(path.resolve(__dirname, "./init-copy"), `./${arg_name}`); | ||
| console.log(colorText(`目录 ./${arg_name} 初始化成功`, "0;92")); | ||
| fs.readFile(`./${arg_name}/lib/helloworld.ws`, (err, data) => { | ||
| if (err) console.log(errText("init", err)); | ||
| else { | ||
| fs.writeFile(`./${arg_name}/lib/helloworld.ws`, data.toString().replace(/<name>/g, arg_name), (err) => { | ||
| if (err) console.log(errText("init", err)); | ||
| }); | ||
| } | ||
| }); | ||
| fs.readFile(`./${arg_name}/README.md`, (err, data) => { | ||
| if (err) console.log(errText("init", err)); | ||
| else { | ||
| fs.writeFile(`./${arg_name}/README.md`, data.toString().replace(/\\<name\\>/g, arg_name), (err) => { | ||
| if (err) console.log(errText("init", err)); | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| else console.log(colorText(`已包含目录 ./${arg_name}`, "0;91")); | ||
| lib.copyDir(path.resolve(__dirname, "./init-copy"), `./${arg_name}`); | ||
| console.log(colorText(`目录 ./${arg_name} 初始化成功`,"0;92")); | ||
| fs.readFile(`./${arg_name}/lib/helloworld.ws`, (err, data) => { | ||
| if (err) console.log(errText("init", err)); | ||
| else { | ||
| fs.writeFile(`./${arg_name}/lib/helloworld.ws`, data.toString().replace(/<name>/g, arg_name), (err) => { | ||
| if (err) console.log(errText("init", err)); | ||
| }); | ||
| } | ||
| }); | ||
| fs.readFile(`./${arg_name}/README.md`, (err, data) => { | ||
| if (err) console.log(errText("init", err)); | ||
| else { | ||
| fs.writeFile(`./${arg_name}/README.md`, data.toString().replace(/\\<name\\>/g, arg_name), (err) => { | ||
| if (err) console.log(errText("init", err)); | ||
| }); | ||
| } | ||
| }); | ||
| }) | ||
@@ -62,0 +64,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
11274
0.89%259
0.78%