zixulu 1.0.0 → 1.1.0
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 +17 -39
- package/package.json +1 -1
- package/src/index.ts +21 -7
package/dist/index.js
CHANGED
|
@@ -1,49 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import { writeFileSync } from 'fs';
|
|
4
|
-
|
|
5
|
-
var name = "zixulu";
|
|
6
|
-
var version = "0.0.4";
|
|
7
|
-
var main = "index.js";
|
|
8
|
-
var license = "MIT";
|
|
9
|
-
var type = "module";
|
|
10
|
-
var bin = "./dist/index.js";
|
|
11
|
-
var scripts = {
|
|
12
|
-
build: "npx rollup -c rollup.config.js"
|
|
13
|
-
};
|
|
14
|
-
var devDependencies = {
|
|
15
|
-
"@rollup/plugin-json": "^6.0.1",
|
|
16
|
-
"@rollup/plugin-typescript": "^11.1.5",
|
|
17
|
-
"@types/inquirer": "^9.0.6",
|
|
18
|
-
"@types/node": "^20.8.9",
|
|
19
|
-
"@types/rollup": "^0.54.0",
|
|
20
|
-
rollup: "^4.1.5",
|
|
21
|
-
tslib: "^2.6.2",
|
|
22
|
-
typescript: "^5.2.2"
|
|
23
|
-
};
|
|
24
|
-
var dependencies = {
|
|
25
|
-
commander: "^11.1.0",
|
|
26
|
-
inquirer: "^9.2.11"
|
|
27
|
-
};
|
|
28
|
-
var pkg = {
|
|
29
|
-
name: name,
|
|
30
|
-
version: version,
|
|
31
|
-
main: main,
|
|
32
|
-
license: license,
|
|
33
|
-
type: type,
|
|
34
|
-
bin: bin,
|
|
35
|
-
scripts: scripts,
|
|
36
|
-
devDependencies: devDependencies,
|
|
37
|
-
dependencies: dependencies
|
|
38
|
-
};
|
|
3
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
39
4
|
|
|
40
5
|
const program = new Command();
|
|
6
|
+
const pkg = JSON.parse(readFileSync(import.meta.resolve("../package.json").slice(8), "utf-8"));
|
|
41
7
|
program.name("格数科技").version(pkg.version);
|
|
42
8
|
program.option("-v, --version").action(() => {
|
|
43
9
|
console.log(pkg.version);
|
|
44
10
|
});
|
|
45
|
-
program.parse();
|
|
46
11
|
const prettier = `module.exports = {
|
|
12
|
+
semi: false,
|
|
13
|
+
tabWidth: 4,
|
|
14
|
+
arrowParens: "avoid",
|
|
15
|
+
printWidth: 800,
|
|
16
|
+
trailingComma: "none"
|
|
17
|
+
}`;
|
|
18
|
+
const prettierWithTailwind = `module.exports = {
|
|
47
19
|
plugins: ["prettier-plugin-tailwindcss"],
|
|
48
20
|
semi: false,
|
|
49
21
|
tabWidth: 4,
|
|
@@ -51,6 +23,12 @@ const prettier = `module.exports = {
|
|
|
51
23
|
printWidth: 800,
|
|
52
24
|
trailingComma: "none"
|
|
53
25
|
}`;
|
|
54
|
-
program
|
|
55
|
-
|
|
26
|
+
program
|
|
27
|
+
.command("prettier")
|
|
28
|
+
.description("添加 prettier 配置文件")
|
|
29
|
+
.option("-t, --tailwind", "是否添加 tailwind 插件")
|
|
30
|
+
.action(options => {
|
|
31
|
+
const { tailwind } = options;
|
|
32
|
+
writeFileSync("./prettier.config.js", tailwind ? prettierWithTailwind : prettier);
|
|
56
33
|
});
|
|
34
|
+
program.parse();
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { Command } from "commander"
|
|
4
|
-
import
|
|
5
|
-
import { writeFileSync } from "fs"
|
|
4
|
+
import { readFileSync, writeFileSync } from "fs"
|
|
6
5
|
|
|
7
6
|
const program = new Command()
|
|
8
7
|
|
|
8
|
+
const pkg = JSON.parse(readFileSync(import.meta.resolve("../package.json").slice(8), "utf-8"))
|
|
9
|
+
|
|
9
10
|
program.name("格数科技").version(pkg.version)
|
|
10
11
|
|
|
11
12
|
program.option("-v, --version").action(() => {
|
|
12
13
|
console.log(pkg.version)
|
|
13
14
|
})
|
|
14
15
|
|
|
15
|
-
program.parse()
|
|
16
|
-
|
|
17
16
|
const prettier = `module.exports = {
|
|
17
|
+
semi: false,
|
|
18
|
+
tabWidth: 4,
|
|
19
|
+
arrowParens: "avoid",
|
|
20
|
+
printWidth: 800,
|
|
21
|
+
trailingComma: "none"
|
|
22
|
+
}`
|
|
23
|
+
|
|
24
|
+
const prettierWithTailwind = `module.exports = {
|
|
18
25
|
plugins: ["prettier-plugin-tailwindcss"],
|
|
19
26
|
semi: false,
|
|
20
27
|
tabWidth: 4,
|
|
@@ -23,6 +30,13 @@ const prettier = `module.exports = {
|
|
|
23
30
|
trailingComma: "none"
|
|
24
31
|
}`
|
|
25
32
|
|
|
26
|
-
program
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
program
|
|
34
|
+
.command("prettier")
|
|
35
|
+
.description("添加 prettier 配置文件")
|
|
36
|
+
.option("-t, --tailwind", "是否添加 tailwind 插件")
|
|
37
|
+
.action(options => {
|
|
38
|
+
const { tailwind } = options
|
|
39
|
+
writeFileSync("./prettier.config.js", tailwind ? prettierWithTailwind : prettier)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
program.parse()
|