launchts 1.0.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/.husky/pre-commit +4 -0
- package/.prettierrc +6 -0
- package/CHANGELOG.md +56 -0
- package/CONTRIBUTING.md +280 -0
- package/LICENSE +18 -0
- package/README.md +304 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +269 -0
- package/dist/cli.js.map +1 -0
- package/dist/configs.d.ts +51 -0
- package/dist/configs.js +97 -0
- package/dist/configs.js.map +1 -0
- package/dist/generator.d.ts +3 -0
- package/dist/generator.js +302 -0
- package/dist/generator.js.map +1 -0
- package/dist/messages.d.ts +16 -0
- package/dist/messages.js +23 -0
- package/dist/messages.js.map +1 -0
- package/dist/types.d.ts +69 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/eslint.config.mjs +36 -0
- package/package.json +53 -0
- package/tsconfig.json +19 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const cac_1 = require("cac");
|
|
8
|
+
const generator_1 = require("./generator");
|
|
9
|
+
const configs_1 = require("./configs");
|
|
10
|
+
const messages_1 = require("./messages");
|
|
11
|
+
const fs_1 = __importDefault(require("fs"));
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
// import enquirer dynamically to avoid typing issues in dev env
|
|
14
|
+
const enquirer = require('enquirer');
|
|
15
|
+
const { prompt } = enquirer;
|
|
16
|
+
const cli = (0, cac_1.cac)('launchts');
|
|
17
|
+
cli
|
|
18
|
+
.command('[name]', 'Create a new TypeScript project')
|
|
19
|
+
.option('-y, --yes', 'Skip prompts and use defaults')
|
|
20
|
+
.option('--eslint', 'Add ESLint config')
|
|
21
|
+
.option('--prettier', 'Add Prettier config')
|
|
22
|
+
.option('--husky', 'Add Husky pre-commit hooks')
|
|
23
|
+
.option('--nodemon', 'Add nodemon dev script')
|
|
24
|
+
.option('--pm <pm>', 'Package manager (npm|yarn|pnpm)', { default: 'npm' })
|
|
25
|
+
.option('--git', 'Initialize a git repository')
|
|
26
|
+
.option('--install', 'Run package manager install in the created project')
|
|
27
|
+
.option('--no-git', 'Do not initialize a git repository')
|
|
28
|
+
.option('--no-install', 'Do not run package manager install')
|
|
29
|
+
.option('--verbose', 'Show verbose output during scaffold')
|
|
30
|
+
.option('--no-commit', 'Do not make initial git commit')
|
|
31
|
+
.example(" $ launchts my-app Create 'my-app' interactively")
|
|
32
|
+
.example(' $ launchts my-app --yes Create with all options enabled')
|
|
33
|
+
.example(' $ launchts my-app --default Create with sensible defaults')
|
|
34
|
+
.example(' $ launchts my-app --pm pnpm Use pnpm as package manager')
|
|
35
|
+
.action(async (name, options) => {
|
|
36
|
+
await runCreateFlow(name, options);
|
|
37
|
+
});
|
|
38
|
+
cli.help();
|
|
39
|
+
const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.resolve(__dirname, '..', 'package.json'), 'utf8'));
|
|
40
|
+
cli.version(pkg.version);
|
|
41
|
+
// lightweight argv flag parser to be used when invoking the binary without
|
|
42
|
+
// explicit command. This allows `launchts` (no args) to start the
|
|
43
|
+
// interactive create flow and still respect flags like `--yes` or `--pm`.
|
|
44
|
+
function parseFlagsFromArgv(argv) {
|
|
45
|
+
const out = {};
|
|
46
|
+
const args = argv.slice(2);
|
|
47
|
+
// Simple boolean flag mapping
|
|
48
|
+
const booleanFlags = {
|
|
49
|
+
'-y': 'yes',
|
|
50
|
+
'--yes': 'yes',
|
|
51
|
+
'-d': 'useDefaults',
|
|
52
|
+
'--default': 'useDefaults',
|
|
53
|
+
'--eslint': 'eslint',
|
|
54
|
+
'--prettier': 'prettier',
|
|
55
|
+
'--husky': 'husky',
|
|
56
|
+
'--nodemon': 'nodemon',
|
|
57
|
+
'--git': 'git',
|
|
58
|
+
'--install': 'install',
|
|
59
|
+
'--no-commit': 'noCommit',
|
|
60
|
+
'--verbose': 'verbose',
|
|
61
|
+
};
|
|
62
|
+
const knownFlags = new Set([
|
|
63
|
+
...Object.keys(booleanFlags),
|
|
64
|
+
'--no-git',
|
|
65
|
+
'--no-install',
|
|
66
|
+
'--pm',
|
|
67
|
+
'-h',
|
|
68
|
+
'--help',
|
|
69
|
+
'-v',
|
|
70
|
+
'--version',
|
|
71
|
+
]);
|
|
72
|
+
for (let i = 0; i < args.length; i++) {
|
|
73
|
+
const arg = args[i];
|
|
74
|
+
// Handle boolean flags
|
|
75
|
+
if (arg in booleanFlags) {
|
|
76
|
+
const key = booleanFlags[arg];
|
|
77
|
+
out[key] = true;
|
|
78
|
+
}
|
|
79
|
+
else if (arg === '--no-git') {
|
|
80
|
+
out.git = false;
|
|
81
|
+
}
|
|
82
|
+
else if (arg === '--no-install') {
|
|
83
|
+
out.install = false;
|
|
84
|
+
}
|
|
85
|
+
else if (arg.startsWith('--pm=')) {
|
|
86
|
+
const pmValue = arg.split('=', 2)[1];
|
|
87
|
+
if (['npm', 'yarn', 'pnpm'].includes(pmValue)) {
|
|
88
|
+
out.pm = pmValue;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.warn(messages_1.MESSAGES.unknownPackageManager(pmValue));
|
|
92
|
+
out.pm = 'npm';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else if (arg === '--pm') {
|
|
96
|
+
const pmValue = args[i + 1];
|
|
97
|
+
if (['npm', 'yarn', 'pnpm'].includes(pmValue)) {
|
|
98
|
+
out.pm = pmValue;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
console.warn(messages_1.MESSAGES.unknownPackageManager(pmValue));
|
|
102
|
+
out.pm = 'npm';
|
|
103
|
+
}
|
|
104
|
+
i++;
|
|
105
|
+
}
|
|
106
|
+
else if (arg.startsWith('-') &&
|
|
107
|
+
!knownFlags.has(arg) &&
|
|
108
|
+
!arg.startsWith('--pm=')) {
|
|
109
|
+
console.warn(messages_1.MESSAGES.unknownFlag(arg));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
113
|
+
}
|
|
114
|
+
// Parse normally to register commands/options with cac
|
|
115
|
+
cli.parse();
|
|
116
|
+
// If no command was provided, start the interactive create flow by default.
|
|
117
|
+
// We avoid blocking the non-interactive help output when the user explicitly
|
|
118
|
+
// asked for `--help` or `--version` because cac handles those earlier.
|
|
119
|
+
if (process.argv.length <= 2) {
|
|
120
|
+
(async () => {
|
|
121
|
+
const flags = parseFlagsFromArgv(process.argv);
|
|
122
|
+
try {
|
|
123
|
+
await runCreateFlow(undefined, flags);
|
|
124
|
+
}
|
|
125
|
+
catch (e) {
|
|
126
|
+
// Show error then exit non-zero
|
|
127
|
+
console.error('✖', e instanceof Error ? e.message : e);
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
})();
|
|
131
|
+
}
|
|
132
|
+
function detectPackageManager() {
|
|
133
|
+
const ua = process.env.npm_config_user_agent;
|
|
134
|
+
if (ua) {
|
|
135
|
+
if (ua.startsWith('pnpm'))
|
|
136
|
+
return 'pnpm';
|
|
137
|
+
if (ua.startsWith('yarn'))
|
|
138
|
+
return 'yarn';
|
|
139
|
+
if (ua.startsWith('npm'))
|
|
140
|
+
return 'npm';
|
|
141
|
+
}
|
|
142
|
+
// fallback: check lockfiles in cwd
|
|
143
|
+
const cwd = process.cwd();
|
|
144
|
+
if (fs_1.default.existsSync(`${cwd}/pnpm-lock.yaml`))
|
|
145
|
+
return 'pnpm';
|
|
146
|
+
if (fs_1.default.existsSync(`${cwd}/yarn.lock`))
|
|
147
|
+
return 'yarn';
|
|
148
|
+
if (fs_1.default.existsSync(`${cwd}/package-lock.json`))
|
|
149
|
+
return 'npm';
|
|
150
|
+
return 'npm';
|
|
151
|
+
}
|
|
152
|
+
async function promptForName(nameArg) {
|
|
153
|
+
if (nameArg)
|
|
154
|
+
return nameArg;
|
|
155
|
+
const nameResp = (await prompt([
|
|
156
|
+
{
|
|
157
|
+
type: 'input',
|
|
158
|
+
name: 'name',
|
|
159
|
+
message: 'Project name:',
|
|
160
|
+
initial: 'my-ts-app',
|
|
161
|
+
},
|
|
162
|
+
]));
|
|
163
|
+
return nameResp.name;
|
|
164
|
+
}
|
|
165
|
+
async function promptForTools(opts) {
|
|
166
|
+
const resp = (await prompt([
|
|
167
|
+
{
|
|
168
|
+
type: 'confirm',
|
|
169
|
+
name: 'eslint',
|
|
170
|
+
message: 'Add ESLint?',
|
|
171
|
+
initial: !!opts.eslint,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: 'confirm',
|
|
175
|
+
name: 'prettier',
|
|
176
|
+
message: 'Add Prettier?',
|
|
177
|
+
initial: !!opts.prettier,
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
type: 'confirm',
|
|
181
|
+
name: 'husky',
|
|
182
|
+
message: 'Add Husky (pre-commit hooks)?',
|
|
183
|
+
initial: !!opts.husky,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
type: 'confirm',
|
|
187
|
+
name: 'nodemon',
|
|
188
|
+
message: 'Add nodemon dev script?',
|
|
189
|
+
initial: !!opts.nodemon,
|
|
190
|
+
},
|
|
191
|
+
]));
|
|
192
|
+
return resp;
|
|
193
|
+
}
|
|
194
|
+
async function promptForGitAndInstall(gitInitial, installInitial) {
|
|
195
|
+
const g = (await prompt([
|
|
196
|
+
{
|
|
197
|
+
type: 'confirm',
|
|
198
|
+
name: 'git',
|
|
199
|
+
message: 'Initialize a git repository?',
|
|
200
|
+
initial: gitInitial,
|
|
201
|
+
},
|
|
202
|
+
]));
|
|
203
|
+
const inst = (await prompt([
|
|
204
|
+
{
|
|
205
|
+
type: 'confirm',
|
|
206
|
+
name: 'install',
|
|
207
|
+
message: 'Install dependencies now?',
|
|
208
|
+
initial: installInitial,
|
|
209
|
+
},
|
|
210
|
+
]));
|
|
211
|
+
return { git: g.git, install: inst.install };
|
|
212
|
+
}
|
|
213
|
+
async function runCreateFlow(nameArg, optionsArg) {
|
|
214
|
+
const globalYes = optionsArg?.yes === true;
|
|
215
|
+
const globalUseDefaults = optionsArg?.useDefaults === true;
|
|
216
|
+
let opts = optionsArg || {};
|
|
217
|
+
// Validate --pm option
|
|
218
|
+
const validPMs = ['npm', 'yarn', 'pnpm'];
|
|
219
|
+
if (opts.pm && !validPMs.includes(opts.pm)) {
|
|
220
|
+
console.error(messages_1.MESSAGES.invalidPackageManager(opts.pm, [...validPMs]));
|
|
221
|
+
process.exit(1);
|
|
222
|
+
}
|
|
223
|
+
// Always prompt for name if not provided
|
|
224
|
+
const name = await promptForName(nameArg);
|
|
225
|
+
// Validate project name (both in interactive and CLI mode)
|
|
226
|
+
if (!name || !(0, generator_1.isValidProjectName)(name)) {
|
|
227
|
+
console.error(messages_1.MESSAGES.invalidProjectName(name));
|
|
228
|
+
process.exit(1);
|
|
229
|
+
}
|
|
230
|
+
// Always determine package manager first
|
|
231
|
+
const detectedPM = opts.pm || detectPackageManager();
|
|
232
|
+
// If --yes, use defaults for options. Otherwise, prompt for options
|
|
233
|
+
if (globalYes) {
|
|
234
|
+
opts = { ...configs_1.YES_DEFAULTS, pm: detectedPM };
|
|
235
|
+
}
|
|
236
|
+
else if (globalUseDefaults) {
|
|
237
|
+
opts = { ...configs_1.DEFAULT_OPTIONS, pm: detectedPM };
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
const toolsResp = await promptForTools(opts);
|
|
241
|
+
opts = {
|
|
242
|
+
...opts,
|
|
243
|
+
...toolsResp,
|
|
244
|
+
pm: detectedPM,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
// Default behavior: enable git init and dependency install unless explicitly disabled
|
|
248
|
+
opts.git = opts.git !== undefined ? opts.git : true;
|
|
249
|
+
opts.install = opts.install !== undefined ? opts.install : true;
|
|
250
|
+
// If interactive (not --yes or --useDefaults), confirm git/install separately
|
|
251
|
+
if (!globalYes && !globalUseDefaults) {
|
|
252
|
+
const gitInstallResp = await promptForGitAndInstall(opts.git, opts.install);
|
|
253
|
+
opts.git = gitInstallResp.git;
|
|
254
|
+
opts.install = gitInstallResp.install;
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
await (0, generator_1.createProject)({
|
|
258
|
+
name: name,
|
|
259
|
+
options: opts,
|
|
260
|
+
});
|
|
261
|
+
console.log(messages_1.MESSAGES.projectCreated(name));
|
|
262
|
+
}
|
|
263
|
+
catch (err) {
|
|
264
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
265
|
+
console.error(messages_1.MESSAGES.failedToCreateProject(msg));
|
|
266
|
+
process.exit(1);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AACA,6BAA0B;AAC1B,2CAAgE;AAEhE,uCAA0D;AAC1D,yCAAsC;AACtC,4CAAoB;AACpB,gDAAwB;AAExB,gEAAgE;AAChE,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACrC,MAAM,EAAE,MAAM,EAAE,GAAG,QAIlB,CAAC;AAEF,MAAM,GAAG,GAAG,IAAA,SAAG,EAAC,UAAU,CAAC,CAAC;AAE5B,GAAG;KACA,OAAO,CAAC,QAAQ,EAAE,iCAAiC,CAAC;KACpD,MAAM,CAAC,WAAW,EAAE,+BAA+B,CAAC;KACpD,MAAM,CAAC,UAAU,EAAE,mBAAmB,CAAC;KACvC,MAAM,CAAC,YAAY,EAAE,qBAAqB,CAAC;KAC3C,MAAM,CAAC,SAAS,EAAE,4BAA4B,CAAC;KAC/C,MAAM,CAAC,WAAW,EAAE,wBAAwB,CAAC;K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;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ToolOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Default configuration when using --yes flag (all options enabled)
|
|
4
|
+
*/
|
|
5
|
+
export declare const YES_DEFAULTS: Omit<ToolOptions, 'yes' | 'default'>;
|
|
6
|
+
/**
|
|
7
|
+
* Default configuration when using --default flag (sensible defaults)
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_OPTIONS: Omit<ToolOptions, 'yes' | 'default'>;
|
|
10
|
+
/**
|
|
11
|
+
* Tool configurations for injection into generated projects
|
|
12
|
+
* Note: deps will be populated from rootPkg in generator.ts
|
|
13
|
+
*/
|
|
14
|
+
export declare const TOOL_CONFIGS: {
|
|
15
|
+
readonly nodemon: {
|
|
16
|
+
readonly deps: readonly ["nodemon", "ts-node"];
|
|
17
|
+
readonly scripts: {
|
|
18
|
+
readonly dev: "nodemon --watch src -e ts --exec \"ts-node src/index.ts\"";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
readonly eslint: {
|
|
22
|
+
readonly deps: readonly ["eslint", "@eslint/js", "typescript-eslint", "globals", "eslint-config-prettier"];
|
|
23
|
+
readonly scripts: {
|
|
24
|
+
readonly lint: "eslint .";
|
|
25
|
+
};
|
|
26
|
+
readonly config: "import js from '@eslint/js';\nimport tseslint from 'typescript-eslint';\nimport globals from 'globals';\n\nexport default tseslint.config(\n js.configs.recommended,\n ...tseslint.configs.recommended,\n {\n languageOptions: {\n ecmaVersion: 'latest',\n sourceType: 'module',\n globals: {\n ...globals.node,\n },\n },\n rules: {\n 'no-unused-vars': 'off',\n '@typescript-eslint/no-unused-vars': [\n 'warn',\n {\n argsIgnorePattern: '^_',\n varsIgnorePattern: '^_',\n caughtErrorsIgnorePattern: '^_',\n },\n ],\n '@typescript-eslint/explicit-module-boundary-types': 'off',\n },\n },\n);\n";
|
|
27
|
+
};
|
|
28
|
+
readonly prettier: {
|
|
29
|
+
readonly deps: readonly ["prettier"];
|
|
30
|
+
readonly scripts: {
|
|
31
|
+
readonly format: "prettier --write .";
|
|
32
|
+
};
|
|
33
|
+
readonly config: {
|
|
34
|
+
readonly semi: true;
|
|
35
|
+
readonly singleQuote: true;
|
|
36
|
+
readonly trailingComma: "all";
|
|
37
|
+
readonly printWidth: 80;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
readonly husky: {
|
|
41
|
+
readonly deps: readonly ["husky", "lint-staged"];
|
|
42
|
+
readonly scripts: {
|
|
43
|
+
readonly prepare: "husky install";
|
|
44
|
+
};
|
|
45
|
+
readonly lintStaged: {
|
|
46
|
+
readonly '*.ts': readonly ["eslint --fix", "prettier --write"];
|
|
47
|
+
readonly '*.json': readonly ["prettier --write"];
|
|
48
|
+
};
|
|
49
|
+
readonly preCommitHook: "#!/bin/sh\n. $(dirname \"$0\")/_/husky.sh\nnpx lint-staged\n";
|
|
50
|
+
};
|
|
51
|
+
};
|
package/dist/configs.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOOL_CONFIGS = exports.DEFAULT_OPTIONS = exports.YES_DEFAULTS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Default configuration when using --yes flag (all options enabled)
|
|
6
|
+
*/
|
|
7
|
+
exports.YES_DEFAULTS = {
|
|
8
|
+
eslint: true,
|
|
9
|
+
prettier: true,
|
|
10
|
+
husky: true,
|
|
11
|
+
nodemon: true,
|
|
12
|
+
git: true,
|
|
13
|
+
install: true,
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Default configuration when using --default flag (sensible defaults)
|
|
17
|
+
*/
|
|
18
|
+
exports.DEFAULT_OPTIONS = {
|
|
19
|
+
eslint: false,
|
|
20
|
+
prettier: true,
|
|
21
|
+
husky: false,
|
|
22
|
+
nodemon: false,
|
|
23
|
+
git: true,
|
|
24
|
+
install: true,
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Tool configurations for injection into generated projects
|
|
28
|
+
* Note: deps will be populated from rootPkg in generator.ts
|
|
29
|
+
*/
|
|
30
|
+
exports.TOOL_CONFIGS = {
|
|
31
|
+
nodemon: {
|
|
32
|
+
deps: ['nodemon', 'ts-node'],
|
|
33
|
+
scripts: {
|
|
34
|
+
dev: 'nodemon --watch src -e ts --exec "ts-node src/index.ts"',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
eslint: {
|
|
38
|
+
deps: [
|
|
39
|
+
'eslint',
|
|
40
|
+
'@eslint/js',
|
|
41
|
+
'typescript-eslint',
|
|
42
|
+
'globals',
|
|
43
|
+
'eslint-config-prettier',
|
|
44
|
+
],
|
|
45
|
+
scripts: { lint: 'eslint .' },
|
|
46
|
+
config: `import js from '@eslint/js';
|
|
47
|
+
import tseslint from 'typescript-eslint';
|
|
48
|
+
import globals from 'globals';
|
|
49
|
+
|
|
50
|
+
export default tseslint.config(
|
|
51
|
+
js.configs.recommended,
|
|
52
|
+
...tseslint.configs.recommended,
|
|
53
|
+
{
|
|
54
|
+
languageOptions: {
|
|
55
|
+
ecmaVersion: 'latest',
|
|
56
|
+
sourceType: 'module',
|
|
57
|
+
globals: {
|
|
58
|
+
...globals.node,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
rules: {
|
|
62
|
+
'no-unused-vars': 'off',
|
|
63
|
+
'@typescript-eslint/no-unused-vars': [
|
|
64
|
+
'warn',
|
|
65
|
+
{
|
|
66
|
+
argsIgnorePattern: '^_',
|
|
67
|
+
varsIgnorePattern: '^_',
|
|
68
|
+
caughtErrorsIgnorePattern: '^_',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
`,
|
|
76
|
+
},
|
|
77
|
+
prettier: {
|
|
78
|
+
deps: ['prettier'],
|
|
79
|
+
scripts: { format: 'prettier --write .' },
|
|
80
|
+
config: {
|
|
81
|
+
semi: true,
|
|
82
|
+
singleQuote: true,
|
|
83
|
+
trailingComma: 'all',
|
|
84
|
+
printWidth: 80,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
husky: {
|
|
88
|
+
deps: ['husky', 'lint-staged'],
|
|
89
|
+
scripts: { prepare: 'husky install' },
|
|
90
|
+
lintStaged: {
|
|
91
|
+
'*.ts': ['eslint --fix', 'prettier --write'],
|
|
92
|
+
'*.json': ['prettier --write'],
|
|
93
|
+
},
|
|
94
|
+
preCommitHook: `#!/bin/sh\n. $(dirname "$0")/_/husky.sh\nnpx lint-staged\n`,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configs.js","sourceRoot":"","sources":["../src/configs.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,YAAY,GAAyC;IAChE,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,GAAG,EAAE,IAAI;IACT,OAAO,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AACU,QAAA,eAAe,GAAyC;IACnE,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,KAAK;IACd,GAAG,EAAE,IAAI;IACT,OAAO,EAAE,IAAI;CACd,CAAC;AAEF;;;GAGG;AACU,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE;QACP,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;QAC5B,OAAO,EAAE;YACP,GAAG,EAAE,yDAAyD;SAC/D;KACF;IACD,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,QAAQ;YACR,YAAY;YACZ,mBAAmB;YACnB,SAAS;YACT,wBAA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