zixulu 1.3.4 → 1.4.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/README.md +23 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -107
- package/dist/utils/index.d.ts +35 -0
- package/dist/utils/index.js +304 -0
- package/package.json +33 -29
- package/postcss.config.js +0 -6
- package/rollup.config.js +0 -12
- package/src/index.ts +0 -108
- package/src/utils/index.ts +0 -45
- package/tailwind.config.js +0 -9
- package/tsconfig.json +0 -101
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.org/package/)
|
|
4
|
+
[](https://npmjs.org/package/)
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
$ yarn install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
$ npm run dev
|
|
14
|
+
$ npm run build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Options
|
|
18
|
+
|
|
19
|
+
TODO
|
|
20
|
+
|
|
21
|
+
## LICENSE
|
|
22
|
+
|
|
23
|
+
MIT
|
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
|
@@ -1,112 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { readFileSync, writeFileSync, unlinkSync } from 'fs';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return data.version;
|
|
11
|
-
}
|
|
12
|
-
/** 读取 package.json */
|
|
13
|
-
function readPackageJson() {
|
|
14
|
-
return JSON.parse(readFileSync("./package.json", "utf-8"));
|
|
15
|
-
}
|
|
16
|
-
/** 写入开发依赖 */
|
|
17
|
-
async function addDevDependencies(packageJson, packageName, version) {
|
|
18
|
-
var _a;
|
|
19
|
-
packageJson.devDependencies ?? (packageJson.devDependencies = {});
|
|
20
|
-
(_a = packageJson.devDependencies)[packageName] ?? (_a[packageName] = version?.trim() || `^${await getPackageLatestVersion(packageName)}`);
|
|
21
|
-
const keys = Object.keys(packageJson.devDependencies);
|
|
22
|
-
keys.sort();
|
|
23
|
-
const sortedDevDependencies = {};
|
|
24
|
-
for (const key of keys) {
|
|
25
|
-
sortedDevDependencies[key] = packageJson.devDependencies[key];
|
|
26
|
-
}
|
|
27
|
-
packageJson.devDependencies = sortedDevDependencies;
|
|
28
|
-
}
|
|
29
|
-
/** 写回 package.json */
|
|
30
|
-
function writePackageJson(packageJson) {
|
|
31
|
-
writeFileSync("./package.json", JSON.stringify(packageJson, undefined, 4), "utf-8");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const program = new Command();
|
|
35
|
-
const pkg = JSON.parse(readFileSync(import.meta.resolve("../package.json").slice(8), "utf-8"));
|
|
3
|
+
// src/index.ts
|
|
4
|
+
var import_commander = require("commander");
|
|
5
|
+
var import_utils = require("./utils");
|
|
6
|
+
var program = new import_commander.Command();
|
|
7
|
+
var pkg = (0, import_utils.readPackageJson)("./");
|
|
36
8
|
program.name("格数科技").version(pkg.version);
|
|
37
|
-
program.
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
semi: false,
|
|
42
|
-
tabWidth: 4,
|
|
43
|
-
arrowParens: "avoid",
|
|
44
|
-
printWidth: 800,
|
|
45
|
-
trailingComma: "none"
|
|
46
|
-
};
|
|
47
|
-
const prettier = `module.exports = ${JSON.stringify(prettierConfig, undefined, 4)}`;
|
|
48
|
-
const prettierWithTailwind = `module.exports = ${JSON.stringify({ plugins: ["prettier-plugin-tailwindcss"], ...prettierConfig }, undefined, 4)}`;
|
|
49
|
-
program
|
|
50
|
-
.command("prettier")
|
|
51
|
-
.description("添加 prettier 配置文件")
|
|
52
|
-
.option("-t, --tailwind", "是否添加 tailwind 插件")
|
|
53
|
-
.action(options => {
|
|
54
|
-
const { tailwind } = options;
|
|
55
|
-
writeFileSync("./prettier.config.cjs", tailwind ? prettierWithTailwind : prettier);
|
|
56
|
-
});
|
|
57
|
-
program
|
|
58
|
-
.command("vite")
|
|
59
|
-
.description("删除 vite 模板中的某些配置")
|
|
60
|
-
.action(options => {
|
|
61
|
-
try {
|
|
62
|
-
unlinkSync("./.eslintrc.cjs");
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
console.log("删除 .eslintrc.cjs 文件失败");
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
const text = readFileSync("./tsconfig.json", "utf-8");
|
|
69
|
-
const newText = text.replace(/^ +?"noUnusedLocals": true,$\n/m, "").replace(/^ +?"noUnusedParameters": true,$\n/m, "");
|
|
70
|
-
writeFileSync("./tsconfig.json", newText, "utf-8");
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
console.log("修改 tsconfig.json 配置失败");
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
program
|
|
77
|
-
.command("tailwind")
|
|
78
|
-
.description("添加 tailwind 配置文件")
|
|
79
|
-
.action(async () => {
|
|
80
|
-
const packageJson = readPackageJson();
|
|
81
|
-
await addDevDependencies(packageJson, "tailwindcss");
|
|
82
|
-
await addDevDependencies(packageJson, "autoprefixer");
|
|
83
|
-
await addDevDependencies(packageJson, "postcss");
|
|
84
|
-
await addDevDependencies(packageJson, "prettier");
|
|
85
|
-
await addDevDependencies(packageJson, "prettier-plugin-tailwindcss");
|
|
86
|
-
writePackageJson(packageJson);
|
|
87
|
-
writeFileSync("./tailwind.config.js", `/** @type {import('tailwindcss').Config} */
|
|
88
|
-
export default {
|
|
89
|
-
content: [
|
|
90
|
-
"./index.html",
|
|
91
|
-
"./src/**/*.{js,ts,jsx,tsx}",
|
|
92
|
-
],
|
|
93
|
-
theme: {
|
|
94
|
-
extend: {},
|
|
95
|
-
},
|
|
96
|
-
plugins: [],
|
|
97
|
-
}`, "utf-8");
|
|
98
|
-
writeFileSync("./postcss.config.js", `export default {
|
|
99
|
-
plugins: {
|
|
100
|
-
tailwindcss: {},
|
|
101
|
-
autoprefixer: {}
|
|
102
|
-
}
|
|
103
|
-
}`, "utf-8");
|
|
104
|
-
const css = readFileSync("./src/index.css", "utf-8");
|
|
105
|
-
writeFileSync("./src/index.css", `@tailwind base;
|
|
106
|
-
@tailwind components;
|
|
107
|
-
@tailwind utilities;
|
|
108
|
-
|
|
109
|
-
${css}`, "utf-8");
|
|
110
|
-
writeFileSync("./prettier.config.cjs", prettierWithTailwind);
|
|
9
|
+
program.command("eslint").description("删除 ESLint 配置文件").action(import_utils.removeESLint);
|
|
10
|
+
program.command("prettier").description("添加 prettier 配置文件").option("-t, --tailwind", "是否添加 tailwind 插件").action((options) => {
|
|
11
|
+
const { tailwind: tailwind2 } = options;
|
|
12
|
+
(0, import_utils.addPrettierConfig)(tailwind2);
|
|
111
13
|
});
|
|
14
|
+
program.command("vite").description("删除 vite 模板中的某些配置").action(import_utils.vite);
|
|
15
|
+
program.command("tailwind").description("添加 tailwind 配置文件").action(import_utils.tailwind);
|
|
16
|
+
program.command("remove-comment").description("删除所有注释").addArgument(new import_commander.Argument("path")).action(import_utils.removeComment);
|
|
112
17
|
program.parse();
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Stats } from "fs";
|
|
4
|
+
import { ParsedPath } from "path";
|
|
5
|
+
import { Config } from "prettier";
|
|
6
|
+
export declare function resolve(...paths: string[]): string;
|
|
7
|
+
export declare function getPackageJsonPath(path?: string): string;
|
|
8
|
+
/** 获取包的最新版本 */
|
|
9
|
+
export declare function getPackageLatestVersion(packageName: string): Promise<string>;
|
|
10
|
+
/** 读取 package.json */
|
|
11
|
+
export declare function readPackageJson(path?: string): Record<string, any>;
|
|
12
|
+
/** 写入依赖 */
|
|
13
|
+
export declare function addDependencies(packageJson: Record<string, any>, packageName: string, version?: string): Promise<void>;
|
|
14
|
+
/** 写入开发依赖 */
|
|
15
|
+
export declare function addDevDependencies(packageJson: Record<string, any>, packageName: string, version?: string): Promise<void>;
|
|
16
|
+
/** 写回 package.json */
|
|
17
|
+
export declare function writePackageJson(packageJson: Record<string, any>, path?: string): void;
|
|
18
|
+
export declare function getFiles(path: string, judge: (path: ParsedPath, stats: Stats) => boolean, depth?: number): string[];
|
|
19
|
+
/** 删除 ESLint 配置文件 */
|
|
20
|
+
export declare function removeESLint(): void;
|
|
21
|
+
export declare function vite(): void;
|
|
22
|
+
/** 添加 tailwind.config.js 配置成功 */
|
|
23
|
+
export declare function addTailwindConfig(): void;
|
|
24
|
+
/** 添加 postcss.config.js 配置成功 */
|
|
25
|
+
export declare function addPostCSSConfig(): void;
|
|
26
|
+
/** 添加 tailwind 至 index.css 成功 */
|
|
27
|
+
export declare function addTailwindToCSS(): void;
|
|
28
|
+
export declare const prettierConfig: Config;
|
|
29
|
+
export declare const prettierConfigText: string;
|
|
30
|
+
export declare const prettierConfigTextWithTailwind: string;
|
|
31
|
+
/** 添加 prettier 配置成功 */
|
|
32
|
+
export declare function addPrettierConfig(tailwind?: boolean): void;
|
|
33
|
+
/** 配置 tailwind */
|
|
34
|
+
export declare function tailwind(): Promise<void>;
|
|
35
|
+
export declare function removeComment(path: string): void;
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/utils/index.ts
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
addDependencies: () => addDependencies,
|
|
33
|
+
addDevDependencies: () => addDevDependencies,
|
|
34
|
+
addPostCSSConfig: () => addPostCSSConfig,
|
|
35
|
+
addPrettierConfig: () => addPrettierConfig,
|
|
36
|
+
addTailwindConfig: () => addTailwindConfig,
|
|
37
|
+
addTailwindToCSS: () => addTailwindToCSS,
|
|
38
|
+
getFiles: () => getFiles,
|
|
39
|
+
getPackageJsonPath: () => getPackageJsonPath,
|
|
40
|
+
getPackageLatestVersion: () => getPackageLatestVersion,
|
|
41
|
+
prettierConfig: () => prettierConfig,
|
|
42
|
+
prettierConfigText: () => prettierConfigText,
|
|
43
|
+
prettierConfigTextWithTailwind: () => prettierConfigTextWithTailwind,
|
|
44
|
+
readPackageJson: () => readPackageJson,
|
|
45
|
+
removeComment: () => removeComment,
|
|
46
|
+
removeESLint: () => removeESLint,
|
|
47
|
+
resolve: () => resolve,
|
|
48
|
+
tailwind: () => tailwind,
|
|
49
|
+
vite: () => vite,
|
|
50
|
+
writePackageJson: () => writePackageJson
|
|
51
|
+
});
|
|
52
|
+
module.exports = __toCommonJS(utils_exports);
|
|
53
|
+
var import_consola = __toESM(require("consola"));
|
|
54
|
+
var import_fs = require("fs");
|
|
55
|
+
var import_path = require("path");
|
|
56
|
+
var import_process = require("process");
|
|
57
|
+
function resolve(...paths) {
|
|
58
|
+
return (0, import_path.join)((0, import_process.cwd)(), ...paths);
|
|
59
|
+
}
|
|
60
|
+
function getPackageJsonPath(path) {
|
|
61
|
+
return resolve(path ?? (0, import_process.cwd)(), "package.json");
|
|
62
|
+
}
|
|
63
|
+
async function getPackageLatestVersion(packageName) {
|
|
64
|
+
try {
|
|
65
|
+
import_consola.default.start(`开始获取 ${packageName} 最新版本号...`);
|
|
66
|
+
const url = `https://registry.npmjs.org/${packageName}/latest`;
|
|
67
|
+
const response = await fetch(url);
|
|
68
|
+
const data = await response.json();
|
|
69
|
+
import_consola.default.success(`获取 ${packageName} 最新版本号成功`);
|
|
70
|
+
return data.version;
|
|
71
|
+
} catch (error) {
|
|
72
|
+
import_consola.default.fail(`获取 ${packageName} 最新版本号失败`);
|
|
73
|
+
(0, import_process.exit)();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function readPackageJson(path) {
|
|
77
|
+
try {
|
|
78
|
+
const result = JSON.parse((0, import_fs.readFileSync)(getPackageJsonPath(path), "utf-8"));
|
|
79
|
+
import_consola.default.success("读取 package.json 成功");
|
|
80
|
+
return result;
|
|
81
|
+
} catch (error) {
|
|
82
|
+
import_consola.default.fail("读取 package.json 失败");
|
|
83
|
+
(0, import_process.exit)();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function addDependencies(packageJson, packageName, version) {
|
|
87
|
+
var _a;
|
|
88
|
+
try {
|
|
89
|
+
packageJson.dependencies ?? (packageJson.dependencies = {});
|
|
90
|
+
(_a = packageJson.dependencies)[packageName] ?? (_a[packageName] = (version == null ? void 0 : version.trim()) || `^${await getPackageLatestVersion(packageName)}`);
|
|
91
|
+
const keys = Object.keys(packageJson.dependencies);
|
|
92
|
+
keys.sort();
|
|
93
|
+
const sortedDependencies = {};
|
|
94
|
+
for (const key of keys) {
|
|
95
|
+
sortedDependencies[key] = packageJson.dependencies[key];
|
|
96
|
+
}
|
|
97
|
+
packageJson.dependencies = sortedDependencies;
|
|
98
|
+
import_consola.default.success(`添加 ${packageName} 至依赖成功`);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
import_consola.default.fail(`添加 ${packageName} 至依赖失败`);
|
|
101
|
+
(0, import_process.exit)();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function addDevDependencies(packageJson, packageName, version) {
|
|
105
|
+
var _a;
|
|
106
|
+
try {
|
|
107
|
+
packageJson.devDependencies ?? (packageJson.devDependencies = {});
|
|
108
|
+
(_a = packageJson.devDependencies)[packageName] ?? (_a[packageName] = (version == null ? void 0 : version.trim()) || `^${await getPackageLatestVersion(packageName)}`);
|
|
109
|
+
const keys = Object.keys(packageJson.devDependencies);
|
|
110
|
+
keys.sort();
|
|
111
|
+
const sortedDevDependencies = {};
|
|
112
|
+
for (const key of keys) {
|
|
113
|
+
sortedDevDependencies[key] = packageJson.devDependencies[key];
|
|
114
|
+
}
|
|
115
|
+
packageJson.devDependencies = sortedDevDependencies;
|
|
116
|
+
import_consola.default.success(`添加 ${packageName} 至开发依赖成功`);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
import_consola.default.fail(`添加 ${packageName} 至开发依赖失败`);
|
|
119
|
+
(0, import_process.exit)();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function writePackageJson(packageJson, path) {
|
|
123
|
+
try {
|
|
124
|
+
(0, import_fs.writeFileSync)(getPackageJsonPath(path), JSON.stringify(packageJson, void 0, 4), "utf-8");
|
|
125
|
+
import_consola.default.success("修改 package.json 成功");
|
|
126
|
+
} catch (error) {
|
|
127
|
+
import_consola.default.fail("修改 package.json 失败");
|
|
128
|
+
(0, import_process.exit)();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function getFiles(path, judge, depth) {
|
|
132
|
+
const result = [];
|
|
133
|
+
const files = (0, import_fs.readdirSync)(path);
|
|
134
|
+
for (const file of files) {
|
|
135
|
+
const filePath = resolve(path, file);
|
|
136
|
+
const parsedPath = (0, import_path.parse)(filePath);
|
|
137
|
+
const stat = (0, import_fs.statSync)(filePath);
|
|
138
|
+
if (judge(parsedPath, stat)) {
|
|
139
|
+
result.push(filePath);
|
|
140
|
+
}
|
|
141
|
+
if (stat.isDirectory() && (depth === void 0 || depth > 0)) {
|
|
142
|
+
result.push(...getFiles(filePath, judge, depth === void 0 ? void 0 : depth - 1));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
function removeESLint() {
|
|
148
|
+
try {
|
|
149
|
+
const files = getFiles((0, import_process.cwd)(), (path, stats) => /\.eslintrc\.[cm]?js/.test(path.base) && stats.isFile());
|
|
150
|
+
files.forEach((file) => {
|
|
151
|
+
try {
|
|
152
|
+
(0, import_fs.unlinkSync)(file);
|
|
153
|
+
} catch (error) {
|
|
154
|
+
import_consola.default.fail(`删除 ${file} 失败`);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
import_consola.default.success("删除 ESLint 配置文件成功");
|
|
158
|
+
} catch (error) {
|
|
159
|
+
import_consola.default.fail("获取 ESLint 配置文件列表失败");
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
const pkg = readPackageJson();
|
|
163
|
+
Object.keys(pkg.dependencies).forEach((key) => {
|
|
164
|
+
if (key.includes("eslint"))
|
|
165
|
+
delete pkg.dependencies[key];
|
|
166
|
+
});
|
|
167
|
+
Object.keys(pkg.devDependencies).forEach((key) => {
|
|
168
|
+
if (key.includes("eslint"))
|
|
169
|
+
delete pkg.devDependencies[key];
|
|
170
|
+
});
|
|
171
|
+
writePackageJson(pkg);
|
|
172
|
+
import_consola.default.success("删除 eslintrc 依赖成功");
|
|
173
|
+
} catch (error) {
|
|
174
|
+
import_consola.default.fail("删除 eslintrc 依赖失败");
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function vite() {
|
|
178
|
+
try {
|
|
179
|
+
const text = (0, import_fs.readFileSync)(resolve("tsconfig.json"), "utf-8");
|
|
180
|
+
const newText = text.replace(/^ +?"noUnusedLocals": true,$\n/m, "").replace(/^ +?"noUnusedParameters": true,$\n/m, "");
|
|
181
|
+
(0, import_fs.writeFileSync)(resolve("tsconfig.json"), newText, "utf-8");
|
|
182
|
+
import_consola.default.success("修改 tsconfig.json 配置成功");
|
|
183
|
+
} catch (error) {
|
|
184
|
+
import_consola.default.fail("修改 tsconfig.json 配置失败");
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function addTailwindConfig() {
|
|
188
|
+
try {
|
|
189
|
+
(0, import_fs.writeFileSync)(
|
|
190
|
+
resolve("tailwind.config.js"),
|
|
191
|
+
`/** @type {import('tailwindcss').Config} */
|
|
192
|
+
export default {
|
|
193
|
+
content: [
|
|
194
|
+
"./index.html",
|
|
195
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
196
|
+
],
|
|
197
|
+
theme: {
|
|
198
|
+
extend: {},
|
|
199
|
+
},
|
|
200
|
+
plugins: [],
|
|
201
|
+
}`,
|
|
202
|
+
"utf-8"
|
|
203
|
+
);
|
|
204
|
+
import_consola.default.success("添加 tailwind.config.js 配置成功");
|
|
205
|
+
} catch (error) {
|
|
206
|
+
import_consola.default.fail("添加 tailwind.config.js 配置失败");
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function addPostCSSConfig() {
|
|
210
|
+
try {
|
|
211
|
+
(0, import_fs.writeFileSync)(
|
|
212
|
+
resolve("postcss.config.js"),
|
|
213
|
+
`export default {
|
|
214
|
+
plugins: {
|
|
215
|
+
tailwindcss: {},
|
|
216
|
+
autoprefixer: {}
|
|
217
|
+
}
|
|
218
|
+
}`,
|
|
219
|
+
"utf-8"
|
|
220
|
+
);
|
|
221
|
+
import_consola.default.success("添加 postcss.config.js 配置成功");
|
|
222
|
+
} catch (error) {
|
|
223
|
+
import_consola.default.fail("添加 postcss.config.js 配置失败");
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function addTailwindToCSS() {
|
|
227
|
+
try {
|
|
228
|
+
const css = (0, import_fs.readFileSync)(resolve("./src/index.css"), "utf-8");
|
|
229
|
+
(0, import_fs.writeFileSync)(
|
|
230
|
+
resolve("./src/index.css"),
|
|
231
|
+
`@tailwind base;
|
|
232
|
+
@tailwind components;
|
|
233
|
+
@tailwind utilities;
|
|
234
|
+
|
|
235
|
+
${css}`,
|
|
236
|
+
"utf-8"
|
|
237
|
+
);
|
|
238
|
+
import_consola.default.success("添加 tailwind 至 index.css 成功");
|
|
239
|
+
} catch (error) {
|
|
240
|
+
import_consola.default.fail("添加 tailwind 至 index.css 失败");
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
var prettierConfig = {
|
|
244
|
+
semi: false,
|
|
245
|
+
tabWidth: 4,
|
|
246
|
+
arrowParens: "avoid",
|
|
247
|
+
printWidth: 800,
|
|
248
|
+
trailingComma: "none"
|
|
249
|
+
};
|
|
250
|
+
var prettierConfigText = `module.exports = ${JSON.stringify(prettierConfig, void 0, 4)}`;
|
|
251
|
+
var prettierConfigTextWithTailwind = `module.exports = ${JSON.stringify({ plugins: ["prettier-plugin-tailwindcss"], ...prettierConfig }, void 0, 4)}`;
|
|
252
|
+
function addPrettierConfig(tailwind2) {
|
|
253
|
+
try {
|
|
254
|
+
(0, import_fs.writeFileSync)(resolve("./prettier.config.cjs"), tailwind2 ? prettierConfigTextWithTailwind : prettierConfigText);
|
|
255
|
+
import_consola.default.success("添加 prettier 配置成功");
|
|
256
|
+
} catch (error) {
|
|
257
|
+
import_consola.default.fail("添加 prettier 配置失败");
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
async function tailwind() {
|
|
261
|
+
const pkg = readPackageJson();
|
|
262
|
+
await addDevDependencies(pkg, "tailwindcss");
|
|
263
|
+
await addDevDependencies(pkg, "autoprefixer");
|
|
264
|
+
await addDevDependencies(pkg, "postcss");
|
|
265
|
+
await addDevDependencies(pkg, "prettier");
|
|
266
|
+
await addDevDependencies(pkg, "prettier-plugin-tailwindcss");
|
|
267
|
+
writePackageJson(pkg);
|
|
268
|
+
addTailwindConfig();
|
|
269
|
+
addPostCSSConfig();
|
|
270
|
+
addTailwindToCSS();
|
|
271
|
+
addPrettierConfig(true);
|
|
272
|
+
}
|
|
273
|
+
function removeComment(path) {
|
|
274
|
+
try {
|
|
275
|
+
const text = (0, import_fs.readFileSync)(resolve(path), "utf-8");
|
|
276
|
+
const newText = text.replace(/^ *?\/\/.*?$/gm, "");
|
|
277
|
+
(0, import_fs.writeFileSync)(resolve(path), newText, "utf-8");
|
|
278
|
+
import_consola.default.success("删除注释成功");
|
|
279
|
+
} catch (error) {
|
|
280
|
+
import_consola.default.fail("删除注释失败");
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
284
|
+
0 && (module.exports = {
|
|
285
|
+
addDependencies,
|
|
286
|
+
addDevDependencies,
|
|
287
|
+
addPostCSSConfig,
|
|
288
|
+
addPrettierConfig,
|
|
289
|
+
addTailwindConfig,
|
|
290
|
+
addTailwindToCSS,
|
|
291
|
+
getFiles,
|
|
292
|
+
getPackageJsonPath,
|
|
293
|
+
getPackageLatestVersion,
|
|
294
|
+
prettierConfig,
|
|
295
|
+
prettierConfigText,
|
|
296
|
+
prettierConfigTextWithTailwind,
|
|
297
|
+
readPackageJson,
|
|
298
|
+
removeComment,
|
|
299
|
+
removeESLint,
|
|
300
|
+
resolve,
|
|
301
|
+
tailwind,
|
|
302
|
+
vite,
|
|
303
|
+
writePackageJson
|
|
304
|
+
});
|
package/package.json
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "zixulu",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"main": "index.js",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"build": "
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"inquirer": "^9.2.12",
|
|
27
|
-
"prettier": "^3.1.
|
|
28
|
-
}
|
|
29
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "zixulu",
|
|
3
|
+
"version": "1.4.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"bin": "dist/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "father dev",
|
|
9
|
+
"build": "father build",
|
|
10
|
+
"build:deps": "father prebundle",
|
|
11
|
+
"prepublishOnly": "father doctor && npm run build"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"authors": [],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"compiled"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"commander": "^11.1.0",
|
|
25
|
+
"consola": "^3.2.3",
|
|
26
|
+
"inquirer": "^9.2.12",
|
|
27
|
+
"prettier": "^3.1.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^20.10.5",
|
|
31
|
+
"father": "^4.3.8"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/postcss.config.js
DELETED
package/rollup.config.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "rollup"
|
|
2
|
-
import typescript from "@rollup/plugin-typescript"
|
|
3
|
-
import json from "@rollup/plugin-json"
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
input: "./src/index.ts",
|
|
7
|
-
output: {
|
|
8
|
-
file: "./dist/index.js",
|
|
9
|
-
format: "esm"
|
|
10
|
-
},
|
|
11
|
-
plugins: [typescript(), json()]
|
|
12
|
-
})
|
package/src/index.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { exec, execSync } from "child_process"
|
|
4
|
-
import { Command } from "commander"
|
|
5
|
-
import { readFileSync, unlinkSync, writeFileSync } from "fs"
|
|
6
|
-
import inquirer from "inquirer"
|
|
7
|
-
import type { Config } from "prettier"
|
|
8
|
-
import { addDevDependencies, readPackageJson, writePackageJson } from "./utils/index.js"
|
|
9
|
-
|
|
10
|
-
const program = new Command()
|
|
11
|
-
|
|
12
|
-
const pkg = JSON.parse(readFileSync(import.meta.resolve("../package.json").slice(8), "utf-8"))
|
|
13
|
-
|
|
14
|
-
program.name("格数科技").version(pkg.version)
|
|
15
|
-
|
|
16
|
-
program.option("-v, --version").action(() => {
|
|
17
|
-
console.log(pkg.version)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const prettierConfig: Config = {
|
|
21
|
-
semi: false,
|
|
22
|
-
tabWidth: 4,
|
|
23
|
-
arrowParens: "avoid",
|
|
24
|
-
printWidth: 800,
|
|
25
|
-
trailingComma: "none"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const prettier = `module.exports = ${JSON.stringify(prettierConfig, undefined, 4)}`
|
|
29
|
-
|
|
30
|
-
const prettierWithTailwind = `module.exports = ${JSON.stringify({ plugins: ["prettier-plugin-tailwindcss"], ...prettierConfig }, undefined, 4)}`
|
|
31
|
-
|
|
32
|
-
program
|
|
33
|
-
.command("prettier")
|
|
34
|
-
.description("添加 prettier 配置文件")
|
|
35
|
-
.option("-t, --tailwind", "是否添加 tailwind 插件")
|
|
36
|
-
.action(options => {
|
|
37
|
-
const { tailwind } = options
|
|
38
|
-
writeFileSync("./prettier.config.cjs", tailwind ? prettierWithTailwind : prettier)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
program
|
|
42
|
-
.command("vite")
|
|
43
|
-
.description("删除 vite 模板中的某些配置")
|
|
44
|
-
.action(options => {
|
|
45
|
-
try {
|
|
46
|
-
unlinkSync("./.eslintrc.cjs")
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.log("删除 .eslintrc.cjs 文件失败")
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
const text = readFileSync("./tsconfig.json", "utf-8")
|
|
52
|
-
const newText = text.replace(/^ +?"noUnusedLocals": true,$\n/m, "").replace(/^ +?"noUnusedParameters": true,$\n/m, "")
|
|
53
|
-
writeFileSync("./tsconfig.json", newText, "utf-8")
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.log("修改 tsconfig.json 配置失败")
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
program
|
|
60
|
-
.command("tailwind")
|
|
61
|
-
.description("添加 tailwind 配置文件")
|
|
62
|
-
.action(async () => {
|
|
63
|
-
const packageJson = readPackageJson()
|
|
64
|
-
await addDevDependencies(packageJson, "tailwindcss")
|
|
65
|
-
await addDevDependencies(packageJson, "autoprefixer")
|
|
66
|
-
await addDevDependencies(packageJson, "postcss")
|
|
67
|
-
await addDevDependencies(packageJson, "prettier")
|
|
68
|
-
await addDevDependencies(packageJson, "prettier-plugin-tailwindcss")
|
|
69
|
-
writePackageJson(packageJson)
|
|
70
|
-
writeFileSync(
|
|
71
|
-
"./tailwind.config.js",
|
|
72
|
-
`/** @type {import('tailwindcss').Config} */
|
|
73
|
-
export default {
|
|
74
|
-
content: [
|
|
75
|
-
"./index.html",
|
|
76
|
-
"./src/**/*.{js,ts,jsx,tsx}",
|
|
77
|
-
],
|
|
78
|
-
theme: {
|
|
79
|
-
extend: {},
|
|
80
|
-
},
|
|
81
|
-
plugins: [],
|
|
82
|
-
}`,
|
|
83
|
-
"utf-8"
|
|
84
|
-
)
|
|
85
|
-
writeFileSync(
|
|
86
|
-
"./postcss.config.js",
|
|
87
|
-
`export default {
|
|
88
|
-
plugins: {
|
|
89
|
-
tailwindcss: {},
|
|
90
|
-
autoprefixer: {}
|
|
91
|
-
}
|
|
92
|
-
}`,
|
|
93
|
-
"utf-8"
|
|
94
|
-
)
|
|
95
|
-
const css = readFileSync("./src/index.css", "utf-8")
|
|
96
|
-
writeFileSync(
|
|
97
|
-
"./src/index.css",
|
|
98
|
-
`@tailwind base;
|
|
99
|
-
@tailwind components;
|
|
100
|
-
@tailwind utilities;
|
|
101
|
-
|
|
102
|
-
${css}`,
|
|
103
|
-
"utf-8"
|
|
104
|
-
)
|
|
105
|
-
writeFileSync("./prettier.config.cjs", prettierWithTailwind)
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
program.parse()
|
package/src/utils/index.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from "fs"
|
|
2
|
-
|
|
3
|
-
/** 获取包的最新版本 */
|
|
4
|
-
export async function getPackageLatestVersion(packageName: string) {
|
|
5
|
-
const url = `https://registry.npmjs.org/${packageName}/latest`
|
|
6
|
-
const response = await fetch(url)
|
|
7
|
-
const data = await response.json()
|
|
8
|
-
return data.version as string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/** 读取 package.json */
|
|
12
|
-
export function readPackageJson(): Record<string, any> {
|
|
13
|
-
return JSON.parse(readFileSync("./package.json", "utf-8"))
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** 写入依赖 */
|
|
17
|
-
export async function addDependencies(packageJson: Record<string, any>, packageName: string, version?: string) {
|
|
18
|
-
packageJson.dependencies ??= {}
|
|
19
|
-
packageJson.dependencies[packageName] ??= version?.trim() || `^${await getPackageLatestVersion(packageName)}`
|
|
20
|
-
const keys = Object.keys(packageJson.dependencies)
|
|
21
|
-
keys.sort()
|
|
22
|
-
const sortedDependencies: Record<string, string> = {}
|
|
23
|
-
for (const key of keys) {
|
|
24
|
-
sortedDependencies[key] = packageJson.dependencies[key]
|
|
25
|
-
}
|
|
26
|
-
packageJson.dependencies = sortedDependencies
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** 写入开发依赖 */
|
|
30
|
-
export async function addDevDependencies(packageJson: Record<string, any>, packageName: string, version?: string) {
|
|
31
|
-
packageJson.devDependencies ??= {}
|
|
32
|
-
packageJson.devDependencies[packageName] ??= version?.trim() || `^${await getPackageLatestVersion(packageName)}`
|
|
33
|
-
const keys = Object.keys(packageJson.devDependencies)
|
|
34
|
-
keys.sort()
|
|
35
|
-
const sortedDevDependencies: Record<string, string> = {}
|
|
36
|
-
for (const key of keys) {
|
|
37
|
-
sortedDevDependencies[key] = packageJson.devDependencies[key]
|
|
38
|
-
}
|
|
39
|
-
packageJson.devDependencies = sortedDevDependencies
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** 写回 package.json */
|
|
43
|
-
export function writePackageJson(packageJson: Record<string, any>) {
|
|
44
|
-
writeFileSync("./package.json", JSON.stringify(packageJson, undefined, 4), "utf-8")
|
|
45
|
-
}
|
package/tailwind.config.js
DELETED
package/tsconfig.json
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
/* Projects */
|
|
5
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
6
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
7
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
8
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
9
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
10
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
11
|
-
/* Language and Environment */
|
|
12
|
-
"target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
13
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
14
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
15
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
16
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
17
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
18
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
19
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
20
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
21
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
22
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
23
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
24
|
-
/* Modules */
|
|
25
|
-
"module": "NodeNext", /* Specify what module code is generated. */
|
|
26
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
27
|
-
"moduleResolution": "NodeNext", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
28
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
29
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
30
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
31
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
32
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
33
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
34
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
35
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
36
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
37
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
38
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
39
|
-
"resolveJsonModule": true, /* Enable importing .json files. */
|
|
40
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
41
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
42
|
-
/* JavaScript Support */
|
|
43
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
44
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
45
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
46
|
-
/* Emit */
|
|
47
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
48
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
49
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
50
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
51
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
52
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
53
|
-
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
54
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
55
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
56
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
57
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
58
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
59
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
60
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
61
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
62
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
63
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
64
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
65
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
66
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
67
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
68
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
69
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
70
|
-
/* Interop Constraints */
|
|
71
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
72
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
73
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
74
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
75
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
76
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
77
|
-
/* Type Checking */
|
|
78
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
79
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
80
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
81
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
82
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
83
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
84
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
85
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
86
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
87
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
88
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
89
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
90
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
91
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
92
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
93
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
94
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
95
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
96
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
97
|
-
/* Completeness */
|
|
98
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
-
}
|
|
101
|
-
}
|