@yunarch/config-web 0.1.4 → 0.2.1
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 +1 -0
- package/dist/cli/bun-run-all/index.js +143 -0
- package/dist/cli/chunk-ARUHQWVA.js +47 -0
- package/dist/cli/openapi-sync/index.js +207 -13
- package/dist/cli/turbo-select/index.js +59 -5
- package/dist/linters/eslint.config.js +1 -1
- package/dist/linters/oxlint.config.json +1 -1
- package/package.json +8 -5
- package/dist/cli/chunk-PWSW557X.js +0 -1
package/README.md
CHANGED
|
@@ -312,6 +312,7 @@ Learn more from [Typescript docs here](https://www.typescriptlang.org/tsconfig/#
|
|
|
312
312
|
|
|
313
313
|
This package ships with useful command-line tools to streamline your workflow.
|
|
314
314
|
|
|
315
|
+
- **`bun-run-all`**: CLI tool for running npm package scripts in parallel or sequential by using bun.
|
|
315
316
|
- **`openapi-sync`**: CLI tool designed to convert OpenAPI 3.0/3.1 schemas to TypeScript types and create type-safe fetching based on a openapi schema file and keep them in sync.
|
|
316
317
|
- **`turbo-select`**: CLI tool for filtering and selecting a single package from your Turborepo package list and executing a script command. Additionally, it can prompt you to select an environment mode (development, staging, production) — useful for adjusting settings based on the environment (e.g., when using Vite).
|
|
317
318
|
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBaseProgram
|
|
3
|
+
} from "../chunk-ARUHQWVA.js";
|
|
4
|
+
|
|
5
|
+
// src/cli/bun-run-all/index.ts
|
|
6
|
+
import { styleText as styleText2 } from "util";
|
|
7
|
+
|
|
8
|
+
// src/cli/bun-run-all/utils.ts
|
|
9
|
+
import { styleText } from "util";
|
|
10
|
+
var COLORS = ["blue", "green", "yellow", "grey", "white", "cyan"];
|
|
11
|
+
var getExecutionTime = (start) => {
|
|
12
|
+
const durationMs = Number(Bun.nanoseconds() - start) / 1e6;
|
|
13
|
+
return `${(durationMs / 1e3).toFixed(2)}s`;
|
|
14
|
+
};
|
|
15
|
+
function reportExecutionLog({
|
|
16
|
+
start,
|
|
17
|
+
tasks,
|
|
18
|
+
failedTasks
|
|
19
|
+
}) {
|
|
20
|
+
const successTasks = tasks - failedTasks;
|
|
21
|
+
const executionTime = getExecutionTime(start);
|
|
22
|
+
const failedTasksText = failedTasks > 0 ? styleText("red", `${failedTasks} failed`) : "";
|
|
23
|
+
const successTasksText = successTasks > 0 ? styleText("green", `${successTasks} successful`) : "";
|
|
24
|
+
console.log("");
|
|
25
|
+
console.log(
|
|
26
|
+
styleText("bold", "Tasks: "),
|
|
27
|
+
`${failedTasksText}${successTasksText}`,
|
|
28
|
+
styleText("gray", `-- ${tasks} total`)
|
|
29
|
+
);
|
|
30
|
+
console.log(
|
|
31
|
+
styleText(["white", "bold"], "Time: "),
|
|
32
|
+
styleText("gray", executionTime)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function spawnProc({
|
|
36
|
+
index,
|
|
37
|
+
script,
|
|
38
|
+
continueOnError,
|
|
39
|
+
reportTime
|
|
40
|
+
}) {
|
|
41
|
+
const color = COLORS[index % COLORS.length];
|
|
42
|
+
const start = Bun.nanoseconds();
|
|
43
|
+
const proc = Bun.spawn(["bun", "run", script], {
|
|
44
|
+
stdout: "pipe",
|
|
45
|
+
stderr: "pipe",
|
|
46
|
+
env: {
|
|
47
|
+
...Bun.env,
|
|
48
|
+
FORCE_COLOR: "1"
|
|
49
|
+
},
|
|
50
|
+
onExit(_, exitCode) {
|
|
51
|
+
if (exitCode === 1 && !continueOnError) process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
proc.stdout.pipeTo(
|
|
55
|
+
new WritableStream({
|
|
56
|
+
write(chunk) {
|
|
57
|
+
const lines = new TextDecoder().decode(chunk).split("\n");
|
|
58
|
+
for (const line of lines) {
|
|
59
|
+
console.log(styleText([color, "bold"], `${script}:`), line);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
proc.stderr.pipeTo(
|
|
65
|
+
new WritableStream({
|
|
66
|
+
write(chunk) {
|
|
67
|
+
const lines = new TextDecoder().decode(chunk).split("\n");
|
|
68
|
+
for (const line of lines) {
|
|
69
|
+
console.log(styleText([color, "bold"], `${script}:`), line);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
proc.exited.then((code) => {
|
|
75
|
+
if (code === 0 && reportTime) {
|
|
76
|
+
console.log(
|
|
77
|
+
styleText([color, "bold"], `${script}:`),
|
|
78
|
+
styleText(["gray"], "Finished in"),
|
|
79
|
+
styleText(["white", "bold"], getExecutionTime(start))
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return proc;
|
|
84
|
+
}
|
|
85
|
+
async function runParallel(scripts, options) {
|
|
86
|
+
const { continueOnError, reportTime } = options;
|
|
87
|
+
const start = Bun.nanoseconds();
|
|
88
|
+
const procs = scripts.map(
|
|
89
|
+
(script, index) => spawnProc({ index, script, continueOnError, reportTime })
|
|
90
|
+
);
|
|
91
|
+
const promises = await Promise.allSettled(procs.map((proc) => proc.exited));
|
|
92
|
+
reportExecutionLog({
|
|
93
|
+
start,
|
|
94
|
+
tasks: scripts.length,
|
|
95
|
+
failedTasks: promises.filter(
|
|
96
|
+
(promise) => promise.status === "rejected" || promise.value !== 0
|
|
97
|
+
).length
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async function runSequential(scripts, options) {
|
|
101
|
+
const { continueOnError, reportTime } = options;
|
|
102
|
+
const start = Bun.nanoseconds();
|
|
103
|
+
let failedTasks = 0;
|
|
104
|
+
for (const [index, script] of scripts.entries()) {
|
|
105
|
+
const proc = spawnProc({ index, script, continueOnError, reportTime });
|
|
106
|
+
const exitCode = await proc.exited;
|
|
107
|
+
if (exitCode !== 0) failedTasks++;
|
|
108
|
+
}
|
|
109
|
+
reportExecutionLog({ start, tasks: scripts.length, failedTasks });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/cli/bun-run-all/index.ts
|
|
113
|
+
createBaseProgram().name("bun-run-all").description(
|
|
114
|
+
"Run given package scripts in parallel or sequential by using bun."
|
|
115
|
+
).argument("<scripts...>", "A list of package scripts' names.").option(
|
|
116
|
+
"-c, --continue-on-error",
|
|
117
|
+
"Continue executing other/subsequent tasks even if a task threw an error"
|
|
118
|
+
).option("-p, --parallel", "Run a group of tasks in parallel.").option("-s, --sequential", "Run a group of tasks sequentially.").option("-t, --time", "Report execution time for each task.").action(
|
|
119
|
+
async (scripts, options) => {
|
|
120
|
+
try {
|
|
121
|
+
console.log(styleText2("magenta", "\n\u{1F680} bun-run-all\n"));
|
|
122
|
+
const sequential = options.sequential ?? false;
|
|
123
|
+
const parallel = options.parallel ?? !sequential;
|
|
124
|
+
const continueOnError = options.continueOnError ?? false;
|
|
125
|
+
const reportTime = options.time ?? false;
|
|
126
|
+
if (parallel === sequential) {
|
|
127
|
+
console.error(
|
|
128
|
+
"You cannot use both --parallel and --sequential options at the same time."
|
|
129
|
+
);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
if (sequential) {
|
|
133
|
+
await runSequential(scripts, { continueOnError, reportTime });
|
|
134
|
+
process.exit(0);
|
|
135
|
+
}
|
|
136
|
+
await runParallel(scripts, { continueOnError, reportTime });
|
|
137
|
+
process.exit(0);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.error(error);
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
).parseAsync(process.argv);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/cli/utils.ts
|
|
2
|
+
import { exec } from "child_process";
|
|
3
|
+
import { promisify, styleText, types } from "util";
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import ora from "ora";
|
|
6
|
+
var asyncExec = promisify(exec);
|
|
7
|
+
async function runTask(task) {
|
|
8
|
+
const { command, name } = task;
|
|
9
|
+
const spinner = ora(name);
|
|
10
|
+
spinner.spinner = "aesthetic";
|
|
11
|
+
spinner.start();
|
|
12
|
+
try {
|
|
13
|
+
const result = typeof command === "string" ? await asyncExec(command) : types.isPromise(command) ? await command : await command();
|
|
14
|
+
spinner.succeed();
|
|
15
|
+
await new Promise((resolve) => {
|
|
16
|
+
setTimeout(resolve, 0);
|
|
17
|
+
});
|
|
18
|
+
return typeof result === "object" && result && "stdout" in result ? result.stdout : result;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
const e = error;
|
|
21
|
+
spinner.fail(styleText("red", e.stderr ?? e.message ?? ""));
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function createBaseProgram() {
|
|
26
|
+
const program = new Command();
|
|
27
|
+
program.configureHelp({
|
|
28
|
+
styleTitle: (str) => styleText("bold", str),
|
|
29
|
+
styleCommandText: (str) => styleText("cyan", str),
|
|
30
|
+
styleCommandDescription: (str) => styleText("magenta", str),
|
|
31
|
+
styleDescriptionText: (str) => styleText("italic", str),
|
|
32
|
+
styleOptionText: (str) => styleText("green", str),
|
|
33
|
+
styleArgumentText: (str) => styleText("yellow", str),
|
|
34
|
+
styleSubcommandText: (str) => styleText("blue", str)
|
|
35
|
+
}).configureOutput({
|
|
36
|
+
outputError: (str, write) => {
|
|
37
|
+
write(styleText("red", str));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return program;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
asyncExec,
|
|
45
|
+
runTask,
|
|
46
|
+
createBaseProgram
|
|
47
|
+
};
|
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
asyncExec,
|
|
3
|
+
createBaseProgram,
|
|
4
|
+
runTask
|
|
5
|
+
} from "../chunk-ARUHQWVA.js";
|
|
6
|
+
|
|
7
|
+
// src/cli/openapi-sync/index.ts
|
|
8
|
+
import { writeFile as writeFile3 } from "fs/promises";
|
|
9
|
+
import { styleText } from "util";
|
|
10
|
+
import confirm from "@inquirer/confirm";
|
|
11
|
+
|
|
12
|
+
// src/cli/openapi-sync/codegen-models/index.ts
|
|
13
|
+
async function run(input, outputDirectory) {
|
|
14
|
+
await runTask({
|
|
15
|
+
name: "Generating models",
|
|
16
|
+
command: `npx openapi-typescript-codegen --input ${input} --output ${outputDirectory} --client fetch`
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/cli/openapi-sync/codegen-msw-utils/index.ts
|
|
21
|
+
import { writeFile } from "fs/promises";
|
|
22
|
+
|
|
23
|
+
// src/cli/openapi-sync/codegen-msw-utils/openapi-msw-http.ts
|
|
24
|
+
var TEMPLATE = `
|
|
2
25
|
import {
|
|
3
26
|
http as mswHttp,
|
|
4
27
|
type DefaultBodyType,
|
|
@@ -120,15 +143,186 @@ export function http<P extends keyof paths, M extends Methods<P>>(
|
|
|
120
143
|
}
|
|
121
144
|
return handlers[method as keyof typeof handlers];
|
|
122
145
|
}
|
|
123
|
-
`;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
146
|
+
`;
|
|
147
|
+
|
|
148
|
+
// src/cli/openapi-sync/codegen-msw-utils/index.ts
|
|
149
|
+
async function run2(outputDirectory) {
|
|
150
|
+
await runTask({
|
|
151
|
+
name: "Generating openapi MSW utils",
|
|
152
|
+
command: async () => {
|
|
153
|
+
await writeFile(`${outputDirectory}/openapi-msw-http.ts`, TEMPLATE);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// src/cli/openapi-sync/codegen-schema-typedef/index.ts
|
|
159
|
+
import { readFile, writeFile as writeFile2 } from "fs/promises";
|
|
160
|
+
async function run3(input, output) {
|
|
161
|
+
await runTask({
|
|
162
|
+
name: "Generating schema types",
|
|
163
|
+
command: async () => {
|
|
164
|
+
await asyncExec(`npx openapi-typescript ${input} -o ${output}`);
|
|
165
|
+
const content = await readFile(output, "utf8");
|
|
166
|
+
await writeFile2(
|
|
167
|
+
output,
|
|
168
|
+
`/* eslint-disable -- Autogenerated file */
|
|
169
|
+
${content}`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// src/cli/openapi-sync/utils.ts
|
|
176
|
+
import { existsSync } from "fs";
|
|
177
|
+
import { mkdir, readFile as readFile2 } from "fs/promises";
|
|
178
|
+
import path from "path";
|
|
179
|
+
async function prepareOutputDirectory(output) {
|
|
180
|
+
if (path.extname(output) !== "") {
|
|
181
|
+
throw new Error("Output must be a directory.");
|
|
182
|
+
}
|
|
183
|
+
const cwdPath = process.cwd();
|
|
184
|
+
const absolutePath = path.resolve(output);
|
|
185
|
+
const isInsideCwd = absolutePath.startsWith(cwdPath);
|
|
186
|
+
const dir = isInsideCwd ? absolutePath : path.resolve(cwdPath, path.relative(path.parse(output).root, output));
|
|
187
|
+
if (!existsSync(dir)) {
|
|
188
|
+
await runTask({
|
|
189
|
+
name: "Generating output directory",
|
|
190
|
+
command: async () => {
|
|
191
|
+
await mkdir(dir, { recursive: true });
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return dir;
|
|
196
|
+
}
|
|
197
|
+
async function readOpenapiSchemas(inputSchemaPath, outputSchemaPath) {
|
|
198
|
+
const [inputSchema, outputSchema] = await Promise.all([
|
|
199
|
+
runTask({
|
|
200
|
+
name: "Reading input openapi schema",
|
|
201
|
+
command: async () => {
|
|
202
|
+
if (!inputSchemaPath.endsWith(".json")) {
|
|
203
|
+
throw new Error(`Input file must be a JSON file: ${inputSchemaPath}`);
|
|
204
|
+
}
|
|
205
|
+
if (inputSchemaPath.startsWith("http")) {
|
|
206
|
+
try {
|
|
207
|
+
const { stdout } = await asyncExec(
|
|
208
|
+
`curl -s ${inputSchemaPath} --fail`
|
|
209
|
+
);
|
|
210
|
+
return stdout;
|
|
211
|
+
} catch {
|
|
212
|
+
throw new Error(
|
|
213
|
+
`Failed to fetch remote OpenAPI file: ${inputSchemaPath}`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (!existsSync(inputSchemaPath)) {
|
|
218
|
+
throw new Error(`Input file does not exist: ${inputSchemaPath}`);
|
|
219
|
+
}
|
|
220
|
+
return await readFile2(inputSchemaPath, "utf8");
|
|
221
|
+
}
|
|
222
|
+
}),
|
|
223
|
+
runTask({
|
|
224
|
+
name: "Reading output openapi schema",
|
|
225
|
+
command: async () => {
|
|
226
|
+
if (!outputSchemaPath.endsWith(".json")) {
|
|
227
|
+
throw new Error(
|
|
228
|
+
`Output file must be a JSON file: ${outputSchemaPath}`
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
if (!existsSync(outputSchemaPath)) return false;
|
|
232
|
+
return await readFile2(outputSchemaPath, "utf8");
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
]);
|
|
236
|
+
return [
|
|
237
|
+
JSON.stringify(JSON.parse(inputSchema)),
|
|
238
|
+
outputSchema ? JSON.stringify(JSON.parse(outputSchema)) : false
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// src/cli/openapi-sync/index.ts
|
|
243
|
+
createBaseProgram().name("openapi-sync").description(
|
|
244
|
+
"A CLI tool to convert OpenAPI 3.0/3.1 schemas to TypeScript types and create type-safe fetching based on a openapi file and keep them in sync."
|
|
245
|
+
).requiredOption(
|
|
246
|
+
"-i, --input <path>",
|
|
247
|
+
"The input (local or remote) openapi schema (JSON)."
|
|
248
|
+
).requiredOption(
|
|
249
|
+
"-o, --output <folder>",
|
|
250
|
+
"The output folder to save the generated models and openapi schema and type definitions."
|
|
251
|
+
).option(
|
|
252
|
+
"-f, --force-gen",
|
|
253
|
+
"Force generation of typescript schemas and fetching code even if the input and output schemas are identical."
|
|
254
|
+
).option(
|
|
255
|
+
"--include-msw-utils",
|
|
256
|
+
"Include MSW mocking utilities based on the generated typescript types."
|
|
257
|
+
).option(
|
|
258
|
+
"--post-script <script>",
|
|
259
|
+
"A package.json script to run after the code generation."
|
|
260
|
+
).action(
|
|
261
|
+
async ({
|
|
262
|
+
input,
|
|
263
|
+
output,
|
|
264
|
+
forceGen,
|
|
265
|
+
includeMswUtils,
|
|
266
|
+
postScript
|
|
267
|
+
}) => {
|
|
268
|
+
try {
|
|
269
|
+
console.log(styleText("magenta", "\n\u{1F680} openapi-sync\n"));
|
|
270
|
+
const outputDirectory = await prepareOutputDirectory(output);
|
|
271
|
+
const outputSchemaPath = `${outputDirectory}/openapi.json`;
|
|
272
|
+
const outputSchemaTypeDefs = `${outputDirectory}/schema.d.ts`;
|
|
273
|
+
const [inputSchema, outputSchema] = await readOpenapiSchemas(
|
|
274
|
+
input,
|
|
275
|
+
outputSchemaPath
|
|
276
|
+
);
|
|
277
|
+
if (outputSchema && inputSchema === outputSchema && !forceGen) {
|
|
278
|
+
console.log(styleText("blue", "\nNo updates required.\n"));
|
|
279
|
+
process.exit(0);
|
|
280
|
+
} else if (!outputSchema) {
|
|
281
|
+
await runTask({
|
|
282
|
+
name: "Creating local schema",
|
|
283
|
+
command: writeFile3(outputSchemaPath, inputSchema)
|
|
284
|
+
});
|
|
285
|
+
} else if (outputSchema && inputSchema !== outputSchema) {
|
|
286
|
+
console.log(
|
|
287
|
+
styleText(
|
|
288
|
+
"yellow",
|
|
289
|
+
"\n\u26A0\uFE0F Local and remote schemas does not match!\n"
|
|
290
|
+
)
|
|
291
|
+
);
|
|
292
|
+
const confirmed = await confirm({
|
|
293
|
+
message: "Do you want to use the remote schema? (y/n)?"
|
|
294
|
+
});
|
|
295
|
+
if (confirmed) {
|
|
296
|
+
await runTask({
|
|
297
|
+
name: "Replacing local schema with input schema",
|
|
298
|
+
command: writeFile3(outputSchemaPath, inputSchema)
|
|
299
|
+
});
|
|
300
|
+
} else {
|
|
301
|
+
console.log(
|
|
302
|
+
styleText("yellow", "\n\u26A0\uFE0F Sync remote schemas skipped.\n")
|
|
303
|
+
);
|
|
304
|
+
if (!forceGen) process.exit(0);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
await Promise.all([
|
|
308
|
+
run3(outputSchemaPath, outputSchemaTypeDefs),
|
|
309
|
+
run(outputSchemaPath, outputDirectory)
|
|
310
|
+
]);
|
|
311
|
+
if (includeMswUtils) {
|
|
312
|
+
await run2(outputDirectory);
|
|
313
|
+
}
|
|
314
|
+
if (postScript) {
|
|
315
|
+
await runTask({
|
|
316
|
+
name: "Running post script",
|
|
317
|
+
command: `node --run ${postScript}`
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
console.log(
|
|
321
|
+
styleText("green", "\n\u2705 openapi-sync process completed!\n")
|
|
322
|
+
);
|
|
323
|
+
} catch (error) {
|
|
324
|
+
console.error(error);
|
|
325
|
+
process.exit(1);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
).parseAsync(process.argv);
|
|
@@ -1,5 +1,59 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
createBaseProgram
|
|
3
|
+
} from "../chunk-ARUHQWVA.js";
|
|
4
|
+
|
|
5
|
+
// src/cli/turbo-select/index.ts
|
|
6
|
+
import { execSync as execSync2 } from "child_process";
|
|
7
|
+
import { styleText } from "util";
|
|
8
|
+
|
|
9
|
+
// src/cli/turbo-select/utils.ts
|
|
10
|
+
import { execSync } from "child_process";
|
|
11
|
+
import select from "@inquirer/select";
|
|
12
|
+
async function selectTurboPackages() {
|
|
13
|
+
const packages = execSync("npx turbo ls", {
|
|
14
|
+
encoding: "utf8",
|
|
15
|
+
stdio: "pipe"
|
|
16
|
+
});
|
|
17
|
+
const packageList = packages.split("\n").slice(1).map((line) => line.trim()).filter(Boolean).map((line) => line.split(" ")[0]);
|
|
18
|
+
return await select({
|
|
19
|
+
message: "Select a package to run the script:",
|
|
20
|
+
choices: packageList.map((opt) => ({ name: opt, value: opt }))
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async function selectEnvironmentMode() {
|
|
24
|
+
return await select({
|
|
25
|
+
message: "Select a mode to load different env files:",
|
|
26
|
+
choices: [
|
|
27
|
+
{ name: "development", value: "development" },
|
|
28
|
+
{ name: "staging", value: "staging" },
|
|
29
|
+
{ name: "production", value: "production" }
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/cli/turbo-select/index.ts
|
|
35
|
+
createBaseProgram().name("turbo-select").description(
|
|
36
|
+
"A CLI tool to filter and select a single package from the Turborepo package list and run a script command.\nAdditionally, allow to prompt environment mode (development, staging, production), for example, when using Vite."
|
|
37
|
+
).requiredOption(
|
|
38
|
+
"--run <script>",
|
|
39
|
+
"The package script command to execute (e.g., --run=dev)."
|
|
40
|
+
).option(
|
|
41
|
+
"--select-env",
|
|
42
|
+
"An environment mode (development, staging, production) If using for example vite."
|
|
43
|
+
).action(async ({ run, selectEnv }) => {
|
|
44
|
+
try {
|
|
45
|
+
console.log(styleText("magenta", "\n\u{1F680} Turbo-Select\n"));
|
|
46
|
+
const filter = await selectTurboPackages();
|
|
47
|
+
const environment = selectEnv ? await selectEnvironmentMode() : void 0;
|
|
48
|
+
execSync2(
|
|
49
|
+
`turbo run ${run} --ui stream ${filter ? `--filter=${filter}` : ""} ${environment ? `-- --mode ${environment}` : ""}`,
|
|
50
|
+
{
|
|
51
|
+
encoding: "utf8",
|
|
52
|
+
stdio: "inherit"
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error(error);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}).parseAsync(process.argv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FlatConfigComposer as M}from"eslint-flat-config-utils";import C from"globals";import{default as v}from"@eslint/js";import{default as d}from"@vitest/eslint-plugin";import{default as j}from"eslint-config-prettier";import{default as b}from"eslint-plugin-import-x";import{default as f}from"eslint-plugin-jsdoc";import{default as k}from"eslint-plugin-oxlint";import{default as I}from"eslint-plugin-perfectionist";import{default as w}from"eslint-plugin-unicorn";import{default as S}from"eslint-plugin-unused-imports";import{default as m}from"typescript-eslint";function _(e={},r,t){let o=e.linterOptions??{};return[{name:"yunarch/base/ignores",ignores:["**/node_modules/","**/dist/","**/out/","**/output","**/.output","**/build/","**/*.min.*","**/.yarn/","**/.yarnrc.yml","**/package-lock.json","**/yarn.lock","**/bun.lock","**/bun.lockb","**/pnpm-lock.yaml","**/.vite-inspect","**/.vitepress/cache","**/vite.config.*.timestamp-*","**/*.log","**/npm-debug.log*","**/yarn-debug.log*","**/yarn-error.log*",".pnp.*","**/.pnp","**/.pnp.js","**/.pnp.cjs","**/coverage/","**/.nyc_output/","**/__snapshots__","**/.vscode/","**/.idea/","**/.cache","**/.nuxt","**/.next","**/.svelte-kit","**/.vercel","**/.changeset","**/.turbo/","**/.DS_Store","**/Thumbs.db","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/mockServiceWorker.js","**/CHANGELOG*.md","**/LICENSE*",...r??[]]},{name:"yunarch/base/setup",languageOptions:{ecmaVersion:2022,globals:{...C.browser,...C.es2021,...C.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{...o,reportUnusedDisableDirectives:t?!1:o.reportUnusedDisableDirectives??!0}},{name:"yunarch/base/rules",plugins:{"unused-imports":S},rules:{...v.configs.recommended.rules,"array-callback-return":["error",{allowImplicit:!0}],"block-scoped-var":"error",camelcase:["error",{allow:["^UNSAFE_"],ignoreDestructuring:!1,properties:"never"}],curly:["error","multi-line","consistent"],"default-case-last":"error",eqeqeq:"error","func-names":["error","as-needed"],"grouped-accessor-pairs":"error","max-lines":["warn",300],"max-params":["warn",4],"new-cap":["error",{capIsNew:!1}],"no-alert":"error","no-array-constructor":"error","no-bitwise":"error","no-caller":"error","no-console":"error","no-constant-binary-expression":"error","no-constructor-return":"error","no-else-return":"warn","no-eval":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-label":"error","no-implicit-coercion":["error",{allow:["!!","+"]}],"no-implied-eval":"error","no-iterator":"error","no-label-var":"error","no-labels":"error","no-lone-blocks":"error","no-lonely-if":"warn","no-multi-assign":"error","no-nested-ternary":"error","no-new":"error","no-new-func":"error","no-new-wrappers":"error","no-octal-escape":"error","no-param-reassign":"error","no-promise-executor-return":"error","no-proto":"error","no-return-assign":"error","no-script-url":"error","no-self-compare":"error","no-sequences":"error","no-template-curly-in-string":"error","no-undef-init":"warn","no-unneeded-ternary":"error","no-unreachable-loop":"error","no-unused-expressions":"error","no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:!0,vars:"all"}],"no-useless-call":"error","no-useless-computed-key":"warn","no-useless-concat":"error","no-useless-rename":"warn","no-useless-return":"warn","no-var":"error","no-void":["error",{allowAsStatement:!0}],"object-shorthand":"warn","prefer-const":"warn","prefer-named-capture-group":"error","prefer-numeric-literals":"error","prefer-object-has-own":"error","prefer-object-spread":"warn","prefer-promise-reject-errors":["error",{allowEmptyReject:!0}],"prefer-regex-literals":"error","prefer-rest-params":"error","prefer-spread":"error","prefer-template":"warn","symbol-description":"error","unused-imports/no-unused-imports":"error","unused-imports/no-unused-vars":["error",{args:"after-used",argsIgnorePattern:"^_",ignoreRestSiblings:!0,vars:"all",varsIgnorePattern:"^_"}],yoda:"warn"}}]}var y="**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}",p="{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}",F="**/*.d.{ts,cts,mts}",c="**/*.{ts,cts,mts}",u="**/*.{tsx,ctsx,mtsx}",x="**/*.astro/*.ts",h="**/*.md",P=[`**/__tests__/**/*.${p}`,`**/*.spec.${p}`,`**/*.test.${p}`,`**/*.bench.${p}`,`**/*.benchmark.${p}`];function G(e){let{oxlint:r}=e;return[{name:"yunarch/disables/cli",files:[`**/scripts/${y}`,`**/tasks/${y}`,`**/bin/${y}`,`**/bin.${p}`,`**/cli/${y}`,`**/cli.${p}`],rules:{"@typescript-eslint/no-floating-promises":"off","no-console":"off","unicorn/no-process-exit":"off"}},{name:"yunarch/disables/dts",files:[F],rules:{"@typescript-eslint/consistent-indexed-object-style":"off","import/no-duplicates":"off","no-restricted-syntax":"off","unused-imports/no-unused-vars":"off"}},{name:"yunarch/disables/config-files",files:[`**/*.config.${p}`,`**/*.config.*.${p}`],rules:{"no-console":"off","@typescript-eslint/explicit-function-return-type":"off"}},{name:"yunarch/disables/prettier",rules:{...j.rules}},...r?.oxlintConfigPath?k.buildFromOxlintConfigFile(r.oxlintConfigPath):[]]}import{createTypeScriptImportResolver as J}from"eslint-import-resolver-typescript";import{createNodeResolver as K}from"eslint-plugin-import-x";function E(){return[{name:"yunarch/import/setup",settings:{"import-x/resolver-next":[K()]}},{name:"yunarch/import/rules",plugins:{import:b},rules:{...b.flatConfigs.recommended.rules,"import/first":"error","import/newline-after-import":["error",{count:1}],"import/no-absolute-path":"error","import/no-amd":"error","import/no-cycle":["error",{ignoreExternal:!1,maxDepth:3}],"import/no-duplicates":["error",{"prefer-inline":!0}],"import/no-dynamic-require":"error","import/no-mutable-exports":"error","import/no-relative-packages":"error","import/no-self-import":"error","import/no-useless-path-segments":"error"}},{name:"yunarch/import/typescript/rules",files:[c,u],rules:{...b.flatConfigs.typescript.rules},settings:{"import-x/resolver-next":[J()]}}]}function L(){return[{name:"yunarch/jsdoc/rules",plugins:{jsdoc:f},rules:{...f.configs["flat/recommended-error"].rules,"jsdoc/check-param-names":["error",{checkDestructured:!1}],"jsdoc/lines-before-block":["error",{lines:0}],"jsdoc/require-hyphen-before-param-description":["error","always"],"jsdoc/require-param":["error",{checkDestructured:!1,enableRestElementFixer:!1}],"jsdoc/require-throws":"error","jsdoc/tag-lines":["error","any",{startLines:1}]}},{name:"yunarch/jsdoc/typescript/rules",files:[c,u],rules:{...f.configs["flat/recommended-typescript-error"].rules,...f.configs["flat/contents-typescript-error"].rules,...f.configs["flat/logical-typescript-error"].rules,...f.configs["flat/stylistic-typescript-error"].rules,"jsdoc/require-hyphen-before-param-description":["error","always"],"jsdoc/require-throws":"error"}}]}function A(){return[{name:"yunarch/perfectionist/rules",plugins:{perfectionist:I},rules:{"perfectionist/sort-exports":["error",{order:"asc",type:"natural"}],"perfectionist/sort-imports":["error",{groups:["builtin","external","internal",["parent","sibling","index"],"side-effect","object","unknown"],newlinesBetween:"never",order:"asc",type:"natural"}],"perfectionist/sort-named-exports":["error",{order:"asc",type:"natural"}],"perfectionist/sort-named-imports":["error",{groupKind:"values-first",order:"asc",type:"natural"}],"import/order":"off","import-x/order":"off","sort-imports":"off"}}]}async function l(e){let r=await e;return typeof r=="object"&&r&&"default"in r?r.default:r}async function R(e){let[r,t,o]=await Promise.all([l(import("@eslint-react/eslint-plugin")),l(import("eslint-plugin-react-hooks")),l(import("eslint-plugin-react-refresh"))]),s=r.configs.all.plugins;return[{name:"yunarch/react/setup",plugins:{"@eslint-react":s["@eslint-react"],"@eslint-react/dom":s["@eslint-react/dom"],"@eslint-react/hooks-extra":s["@eslint-react/hooks-extra"],"@eslint-react/naming-convention":s["@eslint-react/naming-convention"],"@eslint-react/web-api":s["@eslint-react/web-api"],"react-hooks":t,"react-refresh":o}},{name:"yunarch/react/rules",files:[y],languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}},sourceType:"module"},rules:{...r.configs.recommended.rules,...t.configs.recommended.rules,...o.configs.recommended.rules}},...e.isTypescriptEnabled?[{name:"yunarch/react/typescript/rules",files:[c,u],ignores:[`${h}/**`,x],languageOptions:{parserOptions:{projectService:!0}},rules:{...r.configs["recommended-typescript"].rules,...e.isTypeAware?{...r.configs["recommended-type-checked"].rules}:{}}}]:[]]}async function B(e){let r=e===!0||e.enableQuery,t=e===!0||e.enableRouter,o=[];if(r){let s=await l(import("@tanstack/eslint-plugin-query"));o.push({name:"yunarch/tanstack/query/rules",plugins:{"@tanstack/query":s},rules:{...s.configs["flat/recommended"].at(0)?.rules}})}if(t){let s=await l(import("@tanstack/eslint-plugin-router"));o.push({name:"yunarch/tanstack/router/rules",plugins:{"@tanstack/router":s},rules:{...s.configs["flat/recommended"].at(0)?.rules}})}return o}function D(e){let{enableTypeTesting:r}=e;return[{name:"yunarch/test/setup",plugins:{vitest:d},...r?{settings:{vitest:{typecheck:!0}},languageOptions:{globals:{...d.environments.env.globals}}}:{}},{name:"yunarch/test/rules",files:[...P],rules:{...d.configs.recommended.rules,"vitest/consistent-test-it":["error",{fn:"it",withinDescribe:"it"}],"vitest/prefer-hooks-in-order":"error","vitest/prefer-lowercase-title":"error"}}]}function N(e,r,t){return{name:e,files:r,...t.ignores?{ignores:t.ignores}:{},languageOptions:{parser:m.parser,parserOptions:{extraFileExtensions:t.extraFileExtensions?.map(o=>`.${o}`),sourceType:"module",...t.tsconfigPath?{projectService:{allowDefaultProject:["./*.js"],defaultProject:t.tsconfigPath},tsconfigRootDir:process.cwd()}:{},...t.parserOptions}}}}function $(e,r=[]){let t=[c,u],o=e.filesTypeAware??[c,u],s=e.ignoresTypeAware??[`${h}/**`,x];return[{name:"yunarch/typescript/setup",plugins:{"@typescript-eslint":m.plugin}},N("yunarch/typescript/parser",t,{ignores:void 0,extraFileExtensions:r,parserOptions:e.parserOptions}),...e.tsconfigPath?[N("yunarch/typescript/parser/type-aware",o,{ignores:s,extraFileExtensions:r,parserOptions:e.parserOptions,tsconfigPath:e.tsconfigPath})]:[],{name:"yunarch/typescript/rules",files:t,rules:{...m.configs.eslintRecommended.rules,...m.configs.strict.at(-1)?.rules,...m.configs.stylistic.at(-1)?.rules,"@typescript-eslint/ban-ts-comment":["error",{"ts-expect-error":"allow-with-description"}],"@typescript-eslint/consistent-type-definitions":"off","@typescript-eslint/consistent-type-imports":["error",{disallowTypeAnnotations:!1,fixStyle:"separate-type-imports",prefer:"type-imports"}],"@typescript-eslint/default-param-last":"error","@typescript-eslint/explicit-function-return-type":"off","@typescript-eslint/method-signature-style":["error","property"],"@typescript-eslint/naming-convention":["error",{format:["PascalCase"],selector:["typeLike"]},{format:["UPPER_CASE"],selector:["enumMember"]},{custom:{match:!1,regex:"^I[A-Z]|^(Interface|Props|State)$"},format:["PascalCase"],selector:"interface"}],"@typescript-eslint/no-dupe-class-members":"error","@typescript-eslint/no-empty-object-type":["error",{allowInterfaces:"always"}],"@typescript-eslint/no-import-type-side-effects":"error","@typescript-eslint/no-loop-func":"error","@typescript-eslint/no-redeclare":["error",{builtinGlobals:!1}],"@typescript-eslint/no-shadow":"error","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/no-use-before-define":["error",{classes:!1,functions:!1,variables:!0}],"@typescript-eslint/no-useless-empty-export":"warn","@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0,allowBoolean:!0}],"@typescript-eslint/unified-signatures":["error",{ignoreDifferentlyNamedParameters:!0,ignoreOverloadsWithDifferentJSDoc:!0}]}},...e.tsconfigPath&&!e.disableTypeAware?[{name:"yunarch/typescript/rules/type-aware",files:o,ignores:s,rules:{...m.configs.strictTypeCheckedOnly.at(-1)?.rules,...m.configs.stylisticTypeCheckedOnly.at(-1)?.rules,"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}],"@typescript-eslint/require-array-sort-compare":["error",{ignoreStringArrays:!0}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0,allowBoolean:!0}],"@typescript-eslint/switch-exhaustiveness-check":"warn"}}]:[]]}function U(){return[{name:"yunarch/unicorn/rules",plugins:{unicorn:w},rules:{...w.configs.recommended.rules,"unicorn/filename-case":["error",{cases:{camelCase:!0,kebabCase:!0,pascalCase:!0}}],"unicorn/no-array-reduce":"off","unicorn/prefer-number-properties":["error",{checkInfinity:!0,checkNaN:!0}],"unicorn/prefer-top-level-await":"warn","unicorn/prevent-abbreviations":"off"}}]}function Q(e={},...r){let{gitignore:t=!0,ignores:o,extraFileExtensions:s,import:q=!0,jsdoc:X=!0,unicorn:V=!0,oxlint:O}=e,W=!!O,a=[];t&&(typeof t=="boolean"?a.push(l(import("eslint-config-flat-gitignore")).then(T=>[T({name:"yunarch/gitignore",strict:!1})])):a.push(l(import("eslint-config-flat-gitignore")).then(T=>[T({name:"yunarch/gitignore",...t})]))),a.push(_(e.base,o,W)),e.typescript&&a.push($(e.typescript===!0?{}:e.typescript,s)),q&&a.push(E()),X&&a.push(L()),V&&a.push(U()),e.test&&a.push(D(e.test===!0?{}:e.test)),e.tanstack&&a.push(B(e.tanstack)),e.react&&a.push(R({isTypescriptEnabled:!!e.typescript,isTypeAware:typeof e.typescript=="object"&&!!e.typescript.tsconfigPath&&!e.typescript.disableTypeAware})),a.push(A(),G({oxlint:O}));let g=new M;return g=g.append(...a,...r),g=g.renamePlugins({"import-x":"import"}),g}export{Q as config};
|
|
1
|
+
import{FlatConfigComposer as M}from"eslint-flat-config-utils";import C from"globals";import{default as v}from"@eslint/js";import{default as d}from"@vitest/eslint-plugin";import{default as j}from"eslint-config-prettier";import{default as b}from"eslint-plugin-import-x";import{default as f}from"eslint-plugin-jsdoc";import{default as k}from"eslint-plugin-oxlint";import{default as I}from"eslint-plugin-perfectionist";import{default as w}from"eslint-plugin-unicorn";import{default as S}from"eslint-plugin-unused-imports";import{default as m}from"typescript-eslint";function F(e={},r,t){let o=e.linterOptions??{};return[{name:"yunarch/base/ignores",ignores:["**/node_modules/","**/dist/","**/out/","**/output","**/.output","**/build/","**/*.min.*","**/.yarn/","**/.yarnrc.yml","**/package-lock.json","**/yarn.lock","**/bun.lock","**/bun.lockb","**/pnpm-lock.yaml","**/.vite-inspect","**/.vitepress/cache","**/vite.config.*.timestamp-*","**/*.log","**/npm-debug.log*","**/yarn-debug.log*","**/yarn-error.log*",".pnp.*","**/.pnp","**/.pnp.js","**/.pnp.cjs","**/coverage/","**/.nyc_output/","**/__snapshots__","**/.vscode/","**/.idea/","**/.cache","**/.nuxt","**/.next","**/.svelte-kit","**/.vercel","**/.changeset","**/.turbo/","**/.DS_Store","**/Thumbs.db","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/mockServiceWorker.js","**/CHANGELOG*.md","**/LICENSE*",...r??[]]},{name:"yunarch/base/setup",languageOptions:{ecmaVersion:2022,globals:{...C.browser,...C.es2021,...C.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{...o,reportUnusedDisableDirectives:t?!1:o.reportUnusedDisableDirectives??!0}},{name:"yunarch/base/rules",plugins:{"unused-imports":S},rules:{...v.configs.recommended.rules,"array-callback-return":["error",{allowImplicit:!0}],"block-scoped-var":"error",camelcase:["error",{allow:["^UNSAFE_"],ignoreDestructuring:!1,properties:"never"}],curly:["error","multi-line","consistent"],"default-case-last":"error",eqeqeq:"error","func-names":["error","as-needed"],"grouped-accessor-pairs":"error","max-lines":["warn",300],"max-params":["warn",4],"new-cap":["error",{capIsNew:!1}],"no-alert":"error","no-array-constructor":"error","no-bitwise":"error","no-caller":"error","no-console":"error","no-constant-binary-expression":"error","no-constructor-return":"error","no-else-return":"warn","no-eval":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-label":"error","no-implicit-coercion":["error",{allow:["!!","+"]}],"no-implied-eval":"error","no-iterator":"error","no-label-var":"error","no-labels":"error","no-lone-blocks":"error","no-lonely-if":"warn","no-multi-assign":"error","no-nested-ternary":"error","no-new":"error","no-new-func":"error","no-new-wrappers":"error","no-octal-escape":"error","no-param-reassign":"error","no-promise-executor-return":"error","no-proto":"error","no-return-assign":"error","no-script-url":"error","no-self-compare":"error","no-sequences":"error","no-template-curly-in-string":"error","no-undef-init":"warn","no-unneeded-ternary":"error","no-unreachable-loop":"error","no-unused-expressions":"error","no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:!0,vars:"all"}],"no-useless-call":"error","no-useless-computed-key":"warn","no-useless-concat":"error","no-useless-rename":"warn","no-useless-return":"warn","no-var":"error","no-void":["error",{allowAsStatement:!0}],"object-shorthand":"warn","prefer-const":"warn","prefer-named-capture-group":"error","prefer-numeric-literals":"error","prefer-object-has-own":"error","prefer-object-spread":"warn","prefer-promise-reject-errors":["error",{allowEmptyReject:!0}],"prefer-regex-literals":"error","prefer-rest-params":"error","prefer-spread":"error","prefer-template":"warn","symbol-description":"error","unused-imports/no-unused-imports":"error","unused-imports/no-unused-vars":["error",{args:"after-used",argsIgnorePattern:"^_",ignoreRestSiblings:!0,vars:"all",varsIgnorePattern:"^_"}],yoda:"warn"}}]}var y="**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}",p="{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}",_="**/*.d.{ts,cts,mts}",c="**/*.{ts,cts,mts}",u="**/*.{tsx,ctsx,mtsx}",x="**/*.astro/*.ts",h="**/*.md",P=[`**/__tests__/**/*.${p}`,`**/*.spec.${p}`,`**/*.test.${p}`,`**/*.bench.${p}`,`**/*.benchmark.${p}`];function E(e){let{oxlint:r}=e;return[{name:"yunarch/disables/cli",files:[`**/scripts/${y}`,`**/tasks/${y}`,`**/bin/${y}`,`**/bin.${p}`,`**/cli/${y}`,`**/cli.${p}`],rules:{"@typescript-eslint/no-floating-promises":"off","no-console":"off","unicorn/no-process-exit":"off"}},{name:"yunarch/disables/dts",files:[_],rules:{"@typescript-eslint/consistent-indexed-object-style":"off","import/no-duplicates":"off","no-restricted-syntax":"off","unused-imports/no-unused-vars":"off"}},{name:"yunarch/disables/config-files",files:[`**/*.config.${p}`,`**/*.config.*.${p}`],rules:{"no-console":"off","@typescript-eslint/explicit-function-return-type":"off"}},{name:"yunarch/disables/prettier",rules:{...j.rules}},...r?.oxlintConfigPath?k.buildFromOxlintConfigFile(r.oxlintConfigPath):[]]}import{createTypeScriptImportResolver as J}from"eslint-import-resolver-typescript";import{createNodeResolver as K}from"eslint-plugin-import-x";function G(){return[{name:"yunarch/import/setup",settings:{"import-x/resolver-next":[K()]}},{name:"yunarch/import/rules",plugins:{import:b},rules:{...b.flatConfigs.recommended.rules,"import/first":"error","import/newline-after-import":["error",{count:1}],"import/no-absolute-path":"error","import/no-amd":"error","import/no-cycle":["error",{ignoreExternal:!1,maxDepth:3}],"import/no-duplicates":["error",{"prefer-inline":!0}],"import/no-dynamic-require":"error","import/no-mutable-exports":"error","import/no-relative-packages":"error","import/no-self-import":"error","import/no-useless-path-segments":"error"}},{name:"yunarch/import/typescript/rules",files:[c,u],rules:{...b.flatConfigs.typescript.rules},settings:{"import-x/resolver-next":[J()]}}]}function L(){return[{name:"yunarch/jsdoc/rules",plugins:{jsdoc:f},rules:{...f.configs["flat/recommended-error"].rules,"jsdoc/check-param-names":["error",{checkDestructured:!1}],"jsdoc/lines-before-block":["error",{lines:0}],"jsdoc/require-hyphen-before-param-description":["error","always"],"jsdoc/require-param":["error",{checkDestructured:!1,enableRestElementFixer:!1}],"jsdoc/require-throws":"error","jsdoc/tag-lines":["error","any",{startLines:1}]}},{name:"yunarch/jsdoc/typescript/rules",files:[c,u],rules:{...f.configs["flat/recommended-typescript-error"].rules,...f.configs["flat/contents-typescript-error"].rules,...f.configs["flat/logical-typescript-error"].rules,...f.configs["flat/stylistic-typescript-error"].rules,"jsdoc/require-hyphen-before-param-description":["error","always"],"jsdoc/require-param":["error",{checkDestructured:!1,enableRestElementFixer:!1}],"jsdoc/require-throws":"error"}}]}function R(){return[{name:"yunarch/perfectionist/rules",plugins:{perfectionist:I},rules:{"perfectionist/sort-exports":["error",{order:"asc",type:"natural"}],"perfectionist/sort-imports":["error",{groups:["builtin","external","internal",["parent","sibling","index"],"side-effect","object","unknown"],newlinesBetween:"never",order:"asc",type:"natural"}],"perfectionist/sort-named-exports":["error",{order:"asc",type:"natural"}],"perfectionist/sort-named-imports":["error",{groupKind:"values-first",order:"asc",type:"natural"}],"import/order":"off","import-x/order":"off","sort-imports":"off"}}]}async function l(e){let r=await e;return typeof r=="object"&&r&&"default"in r?r.default:r}async function A(e){let[r,t,o]=await Promise.all([l(import("@eslint-react/eslint-plugin")),l(import("eslint-plugin-react-hooks")),l(import("eslint-plugin-react-refresh"))]),s=r.configs.all.plugins;return[{name:"yunarch/react/setup",plugins:{"@eslint-react":s["@eslint-react"],"@eslint-react/dom":s["@eslint-react/dom"],"@eslint-react/hooks-extra":s["@eslint-react/hooks-extra"],"@eslint-react/naming-convention":s["@eslint-react/naming-convention"],"@eslint-react/web-api":s["@eslint-react/web-api"],"react-hooks":t,"react-refresh":o}},{name:"yunarch/react/rules",files:[y],languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}},sourceType:"module"},rules:{...r.configs.recommended.rules,...t.configs.recommended.rules,...o.configs.recommended.rules}},...e.isTypescriptEnabled?[{name:"yunarch/react/typescript/rules",files:[c,u],ignores:[`${h}/**`,x],languageOptions:{parserOptions:{projectService:!0}},rules:{...r.configs["recommended-typescript"].rules,...e.isTypeAware?{...r.configs["recommended-type-checked"].rules}:{}}}]:[]]}async function B(e){let r=e===!0||e.enableQuery,t=e===!0||e.enableRouter,o=[];if(r){let s=await l(import("@tanstack/eslint-plugin-query"));o.push({name:"yunarch/tanstack/query/rules",plugins:{"@tanstack/query":s},rules:{...s.configs["flat/recommended"].at(0)?.rules}})}if(t){let s=await l(import("@tanstack/eslint-plugin-router"));o.push({name:"yunarch/tanstack/router/rules",plugins:{"@tanstack/router":s},rules:{...s.configs["flat/recommended"].at(0)?.rules}})}return o}function D(e){let{enableTypeTesting:r}=e;return[{name:"yunarch/test/setup",plugins:{vitest:d},...r?{settings:{vitest:{typecheck:!0}},languageOptions:{globals:{...d.environments.env.globals}}}:{}},{name:"yunarch/test/rules",files:[...P],rules:{...d.configs.recommended.rules,"vitest/consistent-test-it":["error",{fn:"it",withinDescribe:"it"}],"vitest/prefer-hooks-in-order":"error","vitest/prefer-lowercase-title":"error"}}]}function N(e,r,t){return{name:e,files:r,...t.ignores?{ignores:t.ignores}:{},languageOptions:{parser:m.parser,parserOptions:{extraFileExtensions:t.extraFileExtensions?.map(o=>`.${o}`),sourceType:"module",...t.tsconfigPath?{projectService:{allowDefaultProject:["./*.js"],defaultProject:t.tsconfigPath},tsconfigRootDir:process.cwd()}:{},...t.parserOptions}}}}function $(e,r=[]){let t=[c,u],o=e.filesTypeAware??[c,u],s=e.ignoresTypeAware??[`${h}/**`,x];return[{name:"yunarch/typescript/setup",plugins:{"@typescript-eslint":m.plugin}},N("yunarch/typescript/parser",t,{ignores:void 0,extraFileExtensions:r,parserOptions:e.parserOptions}),...e.tsconfigPath?[N("yunarch/typescript/parser/type-aware",o,{ignores:s,extraFileExtensions:r,parserOptions:e.parserOptions,tsconfigPath:e.tsconfigPath})]:[],{name:"yunarch/typescript/rules",files:t,rules:{...m.configs.eslintRecommended.rules,...m.configs.strict.at(-1)?.rules,...m.configs.stylistic.at(-1)?.rules,"@typescript-eslint/ban-ts-comment":["error",{"ts-expect-error":"allow-with-description"}],"@typescript-eslint/consistent-type-definitions":"off","@typescript-eslint/consistent-type-imports":["error",{disallowTypeAnnotations:!1,fixStyle:"separate-type-imports",prefer:"type-imports"}],"@typescript-eslint/default-param-last":"error","@typescript-eslint/explicit-function-return-type":"off","@typescript-eslint/method-signature-style":["error","property"],"@typescript-eslint/naming-convention":["error",{format:["PascalCase"],selector:["typeLike"]},{format:["UPPER_CASE"],selector:["enumMember"]},{custom:{match:!1,regex:"^I[A-Z]|^(Interface|Props|State)$"},format:["PascalCase"],selector:"interface"}],"@typescript-eslint/no-dupe-class-members":"error","@typescript-eslint/no-empty-object-type":["error",{allowInterfaces:"always"}],"@typescript-eslint/no-import-type-side-effects":"error","@typescript-eslint/no-loop-func":"error","@typescript-eslint/no-redeclare":["error",{builtinGlobals:!1}],"@typescript-eslint/no-shadow":"error","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/no-use-before-define":["error",{classes:!1,functions:!1,variables:!0}],"@typescript-eslint/no-useless-empty-export":"warn","@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0,allowBoolean:!0}],"@typescript-eslint/unified-signatures":["error",{ignoreDifferentlyNamedParameters:!0,ignoreOverloadsWithDifferentJSDoc:!0}]}},...e.tsconfigPath&&!e.disableTypeAware?[{name:"yunarch/typescript/rules/type-aware",files:o,ignores:s,rules:{...m.configs.strictTypeCheckedOnly.at(-1)?.rules,...m.configs.stylisticTypeCheckedOnly.at(-1)?.rules,"@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}],"@typescript-eslint/require-array-sort-compare":["error",{ignoreStringArrays:!0}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0,allowBoolean:!0}],"@typescript-eslint/switch-exhaustiveness-check":"warn"}}]:[]]}function q(){return[{name:"yunarch/unicorn/rules",plugins:{unicorn:w},rules:{...w.configs.recommended.rules,"unicorn/filename-case":["error",{cases:{camelCase:!0,kebabCase:!0,pascalCase:!0}}],"unicorn/no-array-reduce":"off","unicorn/prefer-number-properties":["error",{checkInfinity:!0,checkNaN:!0}],"unicorn/prefer-top-level-await":"warn","unicorn/prevent-abbreviations":"off"}}]}function Q(e={},...r){let{gitignore:t=!0,ignores:o,extraFileExtensions:s,import:U=!0,jsdoc:X=!0,unicorn:V=!0,oxlint:O}=e,W=!!O,a=[];t&&(typeof t=="boolean"?a.push(l(import("eslint-config-flat-gitignore")).then(T=>[T({name:"yunarch/gitignore",strict:!1})])):a.push(l(import("eslint-config-flat-gitignore")).then(T=>[T({name:"yunarch/gitignore",...t})]))),a.push(F(e.base,o,W)),e.typescript&&a.push($(e.typescript===!0?{}:e.typescript,s)),U&&a.push(G()),X&&a.push(L()),V&&a.push(q()),e.test&&a.push(D(e.test===!0?{}:e.test)),e.tanstack&&a.push(B(e.tanstack)),e.react&&a.push(A({isTypescriptEnabled:!!e.typescript,isTypeAware:typeof e.typescript=="object"&&!!e.typescript.tsconfigPath&&!e.typescript.disableTypeAware})),a.push(R(),E({oxlint:O}));let g=new M;return g=g.append(...a,...r),g=g.renamePlugins({"import-x":"import"}),g}export{Q as config};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"ignorePatterns":["**/node_modules/","**/dist/","**/out/","**/output","**/.output","**/build/","**/*.min.*","**/.yarn/","**/.yarnrc.yml","**/package-lock.json","**/yarn.lock","**/bun.lock","**/bun.lockb","**/pnpm-lock.yaml","**/.vite-inspect","**/.vitepress/cache","**/vite.config.*.timestamp-*","**/*.log","**/npm-debug.log*","**/yarn-debug.log*","**/yarn-error.log*",".pnp.*","**/.pnp","**/.pnp.js","**/.pnp.cjs","**/coverage/","**/.nyc_output/","**/__snapshots__","**/.vscode/","**/.idea/","**/.cache","**/.nuxt","**/.next","**/.svelte-kit","**/.vercel","**/.changeset","**/.turbo/","**/.DS_Store","**/Thumbs.db","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/mockServiceWorker.js","**/CHANGELOG*.md","**/LICENSE*"],"plugins":["import","jsdoc","unicorn","vitest","react","react-hooks"],"rules":{"for-direction":"error","no-async-promise-executor":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":"error","no-const-assign":"error","no-constant-binary-expression":"error","no-constant-condition":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-class-members":"error","no-dupe-else-if":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":"error","no-empty-character-class":"error","no-empty-pattern":"error","no-empty-static-block":"error","no-ex-assign":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-loss-of-precision":"error","no-new-native-nonconstructor":"error","no-nonoctal-decimal-escape":"error","no-obj-calls":"error","no-prototype-builtins":"error","no-redeclare":"error","no-regex-spaces":"error","no-self-assign":"error","no-setter-return":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-this-before-super":"error","no-unexpected-multiline":0,"no-unsafe-finally":"error","no-unsafe-negation":"error","no-unsafe-optional-chaining":"error","no-unused-labels":"error","no-unused-private-class-members":"error","no-unused-vars":["error",{"args":"none","caughtErrors":"none","ignoreRestSiblings":true,"vars":"all"}],"no-useless-backreference":"error","no-useless-catch":"error","no-useless-escape":"error","no-with":"error","require-yield":"error","use-isnan":"error","valid-typeof":"error","array-callback-return":["error",{"allowImplicit":true}],"block-scoped-var":"error","curly":0,"default-case-last":"error","eqeqeq":"error","func-names":["error","as-needed"],"grouped-accessor-pairs":"error","max-lines":["warn",300],"max-params":["warn",4],"new-cap":["error",{"capIsNew":false}],"no-alert":"error","no-array-constructor":"error","no-bitwise":"error","no-caller":"error","no-console":"error","no-constructor-return":"error","no-else-return":"warn","no-eval":"error","no-extend-native":"error","no-extra-label":"error","no-iterator":"error","no-label-var":"error","no-labels":"error","no-lone-blocks":"error","no-lonely-if":"warn","no-multi-assign":"error","no-nested-ternary":"off","no-new":"error","no-new-func":"error","no-new-wrappers":"error","no-proto":"error","no-return-assign":"error","no-script-url":"error","no-self-compare":"error","no-template-curly-in-string":"error","no-unneeded-ternary":"error","no-unused-expressions":"error","no-useless-call":"error","no-useless-concat":"error","no-useless-rename":"warn","no-var":"error","no-void":["error",{"allowAsStatement":true}],"prefer-numeric-literals":"error","prefer-object-has-own":"error","prefer-object-spread":"warn","prefer-promise-reject-errors":["error",{"allowEmptyReject":true}],"prefer-rest-params":"error","prefer-spread":"error","symbol-description":"error","yoda":"warn","import/namespace":"error","import/default":"error","import/no-named-as-default":"warn","import/no-named-as-default-member":"warn","import/no-duplicates":["error",{"prefer-inline":true}],"import/first":"error","import/no-absolute-path":"error","import/no-amd":"error","import/no-cycle":["error",{"ignoreExternal":false,"maxDepth":3}],"import/no-dynamic-require":"error","import/no-mutable-exports":"error","import/no-self-import":"error","jsdoc/check-access":"error","jsdoc/check-property-names":"error","jsdoc/check-tag-names":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/require-param":["error",{"checkDestructured":false,"enableRestElementFixer":false}],"jsdoc/require-param-description":"error","jsdoc/require-param-name":"error","jsdoc/require-param-type":"error","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-property-type":"error","jsdoc/require-returns":"error","jsdoc/require-returns-description":"error","jsdoc/require-returns-type":"error","jsdoc/require-yields":"error","no-negated-condition":"off","unicorn/catch-error-name":"error","unicorn/consistent-assert":"error","unicorn/consistent-date-clone":"error","unicorn/consistent-empty-array-spread":"error","unicorn/consistent-existence-index-check":"error","unicorn/consistent-function-scoping":"error","unicorn/empty-brace-spaces":"off","unicorn/error-message":"error","unicorn/escape-case":"error","unicorn/explicit-length-check":"error","unicorn/filename-case":["error",{"cases":{"camelCase":true,"kebabCase":true,"pascalCase":true}}],"unicorn/new-for-builtins":"error","unicorn/no-abusive-eslint-disable":"error","unicorn/no-accessor-recursion":"error","unicorn/no-anonymous-default-export":"error","unicorn/no-array-for-each":"error","unicorn/no-array-reduce":"off","unicorn/no-await-expression-member":"error","unicorn/no-await-in-promise-methods":"error","unicorn/no-console-spaces":"error","unicorn/no-document-cookie":"error","unicorn/no-empty-file":"error","unicorn/no-hex-escape":"error","unicorn/no-invalid-fetch-options":"error","unicorn/no-invalid-remove-event-listener":"error","unicorn/no-lonely-if":"error","unicorn/no-magic-array-flat-depth":"error","unicorn/no-negated-condition":"error","unicorn/no-negation-in-equality-check":"error","unicorn/no-nested-ternary":"off","unicorn/no-new-array":"error","unicorn/no-new-buffer":"error","unicorn/no-null":"error","unicorn/no-object-as-default-parameter":"error","unicorn/no-process-exit":"error","unicorn/no-single-promise-in-promise-methods":"error","unicorn/no-static-only-class":"error","unicorn/no-thenable":"error","unicorn/no-this-assignment":"error","unicorn/no-typeof-undefined":"error","unicorn/no-unnecessary-await":"error","unicorn/no-unnecessary-slice-end":"error","unicorn/no-unreadable-array-destructuring":"error","unicorn/no-unreadable-iife":"error","unicorn/no-useless-fallback-in-spread":"error","unicorn/no-useless-length-check":"error","unicorn/no-useless-promise-resolve-reject":"error","unicorn/no-useless-spread":"error","unicorn/no-useless-switch-case":"error","unicorn/no-useless-undefined":"error","unicorn/no-zero-fractions":"error","unicorn/number-literal-case":"off","unicorn/numeric-separators-style":"error","unicorn/prefer-add-event-listener":"error","unicorn/prefer-array-flat-map":"error","unicorn/prefer-array-flat":"error","unicorn/prefer-array-some":"error","unicorn/prefer-blob-reading-methods":"error","unicorn/prefer-code-point":"error","unicorn/prefer-date-now":"error","unicorn/prefer-dom-node-append":"error","unicorn/prefer-dom-node-dataset":"error","unicorn/prefer-dom-node-remove":"error","unicorn/prefer-dom-node-text-content":"error","unicorn/prefer-event-target":"error","unicorn/prefer-includes":"error","unicorn/prefer-logical-operator-over-ternary":"error","unicorn/prefer-math-min-max":"error","unicorn/prefer-math-trunc":"error","unicorn/prefer-modern-dom-apis":"error","unicorn/prefer-modern-math-apis":"error","unicorn/prefer-native-coercion-functions":"error","unicorn/prefer-negative-index":"error","unicorn/prefer-node-protocol":"error","unicorn/prefer-number-properties":["error",{"checkInfinity":true,"checkNaN":true}],"unicorn/prefer-optional-catch-binding":"error","unicorn/prefer-prototype-methods":"error","unicorn/prefer-query-selector":"error","unicorn/prefer-reflect-apply":"error","unicorn/prefer-regexp-test":"error","unicorn/prefer-set-has":"error","unicorn/prefer-set-size":"error","unicorn/prefer-spread":"error","unicorn/prefer-string-raw":"error","unicorn/prefer-string-replace-all":"error","unicorn/prefer-string-slice":"error","unicorn/prefer-string-starts-ends-with":"error","unicorn/prefer-string-trim-start-end":"error","unicorn/prefer-structured-clone":"error","unicorn/prefer-type-error":"error","unicorn/require-array-join-separator":"error","unicorn/require-number-to-fixed-digits-argument":"error","unicorn/require-post-message-target-origin":"off","unicorn/switch-case-braces":"error","unicorn/text-encoding-identifier-case":"error","unicorn/throw-new-error":"error","sort-imports":"off"},"overrides":[{"files":["**/*.{ts,cts,mts}","**/*.{tsx,ctsx,mtsx}"],"rules":{"no-class-assign":"off","no-const-assign":"off","no-dupe-class-members":"off","no-dupe-keys":"off","no-func-assign":"off","no-import-assign":"off","no-new-native-nonconstructor":"off","no-obj-calls":"off","no-redeclare":"off","no-setter-return":"off","no-this-before-super":"off","no-unsafe-negation":"off","no-var":"error","no-with":"off","prefer-rest-params":"error","prefer-spread":"error","@typescript-eslint/ban-ts-comment":["error",{"ts-expect-error":"allow-with-description"}],"no-array-constructor":"off","@typescript-eslint/no-array-constructor":"error","@typescript-eslint/no-duplicate-enum-values":"error","@typescript-eslint/no-dynamic-delete":"error","@typescript-eslint/no-empty-object-type":["error",{"allowInterfaces":"always"}],"@typescript-eslint/no-explicit-any":"error","@typescript-eslint/no-extra-non-null-assertion":"error","@typescript-eslint/no-extraneous-class":"error","@typescript-eslint/no-misused-new":"error","@typescript-eslint/no-namespace":"error","@typescript-eslint/no-non-null-asserted-nullish-coalescing":"error","@typescript-eslint/no-non-null-asserted-optional-chain":"error","@typescript-eslint/no-non-null-assertion":"error","@typescript-eslint/no-require-imports":"error","@typescript-eslint/no-this-alias":"error","@typescript-eslint/no-unnecessary-type-constraint":"error","@typescript-eslint/no-unsafe-declaration-merging":"error","@typescript-eslint/no-unsafe-function-type":"error","no-unused-expressions":"off","@typescript-eslint/no-unused-expressions":"error","no-unused-vars":"off","@typescript-eslint/no-unused-vars":"off","no-useless-constructor":"off","@typescript-eslint/no-useless-constructor":"error","@typescript-eslint/no-wrapper-object-types":"error","@typescript-eslint/prefer-as-const":"error","@typescript-eslint/prefer-literal-enum-member":"error","@typescript-eslint/prefer-namespace-keyword":"error","@typescript-eslint/triple-slash-reference":"error","@typescript-eslint/adjacent-overload-signatures":"error","@typescript-eslint/array-type":"error","@typescript-eslint/ban-tslint-comment":"error","@typescript-eslint/consistent-generic-constructors":"error","@typescript-eslint/consistent-indexed-object-style":"error","@typescript-eslint/consistent-type-definitions":"off","@typescript-eslint/no-confusing-non-null-assertion":"error","no-empty-function":"off","@typescript-eslint/no-empty-function":"error","@typescript-eslint/no-inferrable-types":"error","@typescript-eslint/prefer-for-of":"error","@typescript-eslint/prefer-function-type":"error","@typescript-eslint/consistent-type-imports":["error",{"disallowTypeAnnotations":false,"fixStyle":"separate-type-imports","prefer":"type-imports"}],"@typescript-eslint/default-param-last":"error","@typescript-eslint/explicit-function-return-type":"off","@typescript-eslint/no-dupe-class-members":"error","@typescript-eslint/no-import-type-side-effects":"error","@typescript-eslint/no-redeclare":["error",{"builtinGlobals":false}],"@typescript-eslint/no-useless-empty-export":"warn"}},{"files":["**/*.{ts,cts,mts}","**/*.{tsx,ctsx,mtsx}"],"rules":{"no-throw-literal":"off","prefer-promise-reject-errors":"off","require-await":"off"}},{"files":["**/*.{ts,cts,mts}","**/*.{tsx,ctsx,mtsx}"],"rules":{"jsdoc/check-access":"error","jsdoc/check-property-names":"error","jsdoc/check-tag-names":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/require-param":"error","jsdoc/require-param-description":"error","jsdoc/require-param-name":"error","jsdoc/require-param-type":"off","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-property-type":"off","jsdoc/require-returns":"error","jsdoc/require-returns-description":"error","jsdoc/require-returns-type":"off","jsdoc/require-yields":"error"}},{"files":["**/__tests__/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.spec.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.test.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.bench.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.benchmark.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}"],"rules":{"vitest/expect-expect":"error","vitest/no-identical-title":"error","vitest/no-commented-out-tests":"error","vitest/valid-expect":"error","vitest/valid-describe-callback":"error","vitest/require-local-test-context-for-concurrent-snapshots":"error","vitest/no-import-node-test":"error","vitest/consistent-test-it":["error",{"fn":"it","withinDescribe":"it"}],"vitest/prefer-hooks-in-order":"error","vitest/prefer-lowercase-title":"error"}},{"files":["**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}"],"rules":{"react/jsx-no-duplicate-props":"warn","react/no-array-index-key":"warn","react/no-direct-mutation-state":"error","react/no-string-refs":"error","react-hooks/rules-of-hooks":"error"}},{"files":["**/*.{ts,cts,mts}","**/*.{tsx,ctsx,mtsx}"],"rules":{"react/jsx-no-duplicate-props":"off","react/no-array-index-key":"warn","react/no-direct-mutation-state":"error","react/no-string-refs":"error"}},{"files":["**/scripts/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/tasks/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/bin/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/bin.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/cli/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/cli.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}"],"rules":{"no-console":"off","unicorn/no-process-exit":"off"}},{"files":["**/*.d.{ts,cts,mts}"],"rules":{"@typescript-eslint/consistent-indexed-object-style":"off","import/no-duplicates":"off"}},{"files":["**/*.config.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.config.*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}"],"rules":{"no-console":"off","@typescript-eslint/explicit-function-return-type":"off"}}]}
|
|
1
|
+
{"ignorePatterns":["**/node_modules/","**/dist/","**/out/","**/output","**/.output","**/build/","**/*.min.*","**/.yarn/","**/.yarnrc.yml","**/package-lock.json","**/yarn.lock","**/bun.lock","**/bun.lockb","**/pnpm-lock.yaml","**/.vite-inspect","**/.vitepress/cache","**/vite.config.*.timestamp-*","**/*.log","**/npm-debug.log*","**/yarn-debug.log*","**/yarn-error.log*",".pnp.*","**/.pnp","**/.pnp.js","**/.pnp.cjs","**/coverage/","**/.nyc_output/","**/__snapshots__","**/.vscode/","**/.idea/","**/.cache","**/.nuxt","**/.next","**/.svelte-kit","**/.vercel","**/.changeset","**/.turbo/","**/.DS_Store","**/Thumbs.db","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/mockServiceWorker.js","**/CHANGELOG*.md","**/LICENSE*"],"plugins":["import","jsdoc","unicorn","vitest","react","react-hooks"],"rules":{"for-direction":"error","no-async-promise-executor":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":"error","no-const-assign":"error","no-constant-binary-expression":"error","no-constant-condition":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-class-members":"error","no-dupe-else-if":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":"error","no-empty-character-class":"error","no-empty-pattern":"error","no-empty-static-block":"error","no-ex-assign":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-loss-of-precision":"error","no-new-native-nonconstructor":"error","no-nonoctal-decimal-escape":"error","no-obj-calls":"error","no-prototype-builtins":"error","no-redeclare":"error","no-regex-spaces":"error","no-self-assign":"error","no-setter-return":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-this-before-super":"error","no-unexpected-multiline":0,"no-unsafe-finally":"error","no-unsafe-negation":"error","no-unsafe-optional-chaining":"error","no-unused-labels":"error","no-unused-private-class-members":"error","no-unused-vars":["error",{"args":"none","caughtErrors":"none","ignoreRestSiblings":true,"vars":"all"}],"no-useless-backreference":"error","no-useless-catch":"error","no-useless-escape":"error","no-with":"error","require-yield":"error","use-isnan":"error","valid-typeof":"error","array-callback-return":["error",{"allowImplicit":true}],"block-scoped-var":"error","curly":0,"default-case-last":"error","eqeqeq":"error","func-names":["error","as-needed"],"grouped-accessor-pairs":"error","max-lines":["warn",300],"max-params":["warn",4],"new-cap":["error",{"capIsNew":false}],"no-alert":"error","no-array-constructor":"error","no-bitwise":"error","no-caller":"error","no-console":"error","no-constructor-return":"error","no-else-return":"warn","no-eval":"error","no-extend-native":"error","no-extra-label":"error","no-iterator":"error","no-label-var":"error","no-labels":"error","no-lone-blocks":"error","no-lonely-if":"warn","no-multi-assign":"error","no-nested-ternary":"off","no-new":"error","no-new-func":"error","no-new-wrappers":"error","no-proto":"error","no-return-assign":"error","no-script-url":"error","no-self-compare":"error","no-template-curly-in-string":"error","no-unneeded-ternary":"error","no-unused-expressions":"error","no-useless-call":"error","no-useless-concat":"error","no-useless-rename":"warn","no-var":"error","no-void":["error",{"allowAsStatement":true}],"prefer-numeric-literals":"error","prefer-object-has-own":"error","prefer-object-spread":"warn","prefer-promise-reject-errors":["error",{"allowEmptyReject":true}],"prefer-rest-params":"error","prefer-spread":"error","symbol-description":"error","yoda":"warn","import/namespace":"error","import/default":"error","import/no-named-as-default":"warn","import/no-named-as-default-member":"warn","import/no-duplicates":["error",{"prefer-inline":true}],"import/first":"error","import/no-absolute-path":"error","import/no-amd":"error","import/no-cycle":["error",{"ignoreExternal":false,"maxDepth":3}],"import/no-dynamic-require":"error","import/no-mutable-exports":"error","import/no-self-import":"error","jsdoc/check-access":"error","jsdoc/check-property-names":"error","jsdoc/check-tag-names":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/require-param":["error",{"checkDestructured":false,"enableRestElementFixer":false}],"jsdoc/require-param-description":"error","jsdoc/require-param-name":"error","jsdoc/require-param-type":"error","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-property-type":"error","jsdoc/require-returns":"error","jsdoc/require-returns-description":"error","jsdoc/require-returns-type":"error","jsdoc/require-yields":"error","no-negated-condition":"off","unicorn/catch-error-name":"error","unicorn/consistent-assert":"error","unicorn/consistent-date-clone":"error","unicorn/consistent-empty-array-spread":"error","unicorn/consistent-existence-index-check":"error","unicorn/consistent-function-scoping":"error","unicorn/empty-brace-spaces":"off","unicorn/error-message":"error","unicorn/escape-case":"error","unicorn/explicit-length-check":"error","unicorn/filename-case":["error",{"cases":{"camelCase":true,"kebabCase":true,"pascalCase":true}}],"unicorn/new-for-builtins":"error","unicorn/no-abusive-eslint-disable":"error","unicorn/no-accessor-recursion":"error","unicorn/no-anonymous-default-export":"error","unicorn/no-array-for-each":"error","unicorn/no-array-reduce":"off","unicorn/no-await-expression-member":"error","unicorn/no-await-in-promise-methods":"error","unicorn/no-console-spaces":"error","unicorn/no-document-cookie":"error","unicorn/no-empty-file":"error","unicorn/no-hex-escape":"error","unicorn/no-invalid-fetch-options":"error","unicorn/no-invalid-remove-event-listener":"error","unicorn/no-lonely-if":"error","unicorn/no-magic-array-flat-depth":"error","unicorn/no-negated-condition":"error","unicorn/no-negation-in-equality-check":"error","unicorn/no-nested-ternary":"off","unicorn/no-new-array":"error","unicorn/no-new-buffer":"error","unicorn/no-null":"error","unicorn/no-object-as-default-parameter":"error","unicorn/no-process-exit":"error","unicorn/no-single-promise-in-promise-methods":"error","unicorn/no-static-only-class":"error","unicorn/no-thenable":"error","unicorn/no-this-assignment":"error","unicorn/no-typeof-undefined":"error","unicorn/no-unnecessary-await":"error","unicorn/no-unnecessary-slice-end":"error","unicorn/no-unreadable-array-destructuring":"error","unicorn/no-unreadable-iife":"error","unicorn/no-useless-fallback-in-spread":"error","unicorn/no-useless-length-check":"error","unicorn/no-useless-promise-resolve-reject":"error","unicorn/no-useless-spread":"error","unicorn/no-useless-switch-case":"error","unicorn/no-useless-undefined":"error","unicorn/no-zero-fractions":"error","unicorn/number-literal-case":"off","unicorn/numeric-separators-style":"error","unicorn/prefer-add-event-listener":"error","unicorn/prefer-array-flat-map":"error","unicorn/prefer-array-flat":"error","unicorn/prefer-array-some":"error","unicorn/prefer-blob-reading-methods":"error","unicorn/prefer-code-point":"error","unicorn/prefer-date-now":"error","unicorn/prefer-dom-node-append":"error","unicorn/prefer-dom-node-dataset":"error","unicorn/prefer-dom-node-remove":"error","unicorn/prefer-dom-node-text-content":"error","unicorn/prefer-event-target":"error","unicorn/prefer-includes":"error","unicorn/prefer-logical-operator-over-ternary":"error","unicorn/prefer-math-min-max":"error","unicorn/prefer-math-trunc":"error","unicorn/prefer-modern-dom-apis":"error","unicorn/prefer-modern-math-apis":"error","unicorn/prefer-native-coercion-functions":"error","unicorn/prefer-negative-index":"error","unicorn/prefer-node-protocol":"error","unicorn/prefer-number-properties":["error",{"checkInfinity":true,"checkNaN":true}],"unicorn/prefer-optional-catch-binding":"error","unicorn/prefer-prototype-methods":"error","unicorn/prefer-query-selector":"error","unicorn/prefer-reflect-apply":"error","unicorn/prefer-regexp-test":"error","unicorn/prefer-set-has":"error","unicorn/prefer-set-size":"error","unicorn/prefer-spread":"error","unicorn/prefer-string-raw":"error","unicorn/prefer-string-replace-all":"error","unicorn/prefer-string-slice":"error","unicorn/prefer-string-starts-ends-with":"error","unicorn/prefer-string-trim-start-end":"error","unicorn/prefer-structured-clone":"error","unicorn/prefer-type-error":"error","unicorn/require-array-join-separator":"error","unicorn/require-number-to-fixed-digits-argument":"error","unicorn/require-post-message-target-origin":"off","unicorn/switch-case-braces":"error","unicorn/text-encoding-identifier-case":"error","unicorn/throw-new-error":"error","sort-imports":"off"},"overrides":[{"files":["**/*.{ts,cts,mts}","**/*.{tsx,ctsx,mtsx}"],"rules":{"no-class-assign":"off","no-const-assign":"off","no-dupe-class-members":"off","no-dupe-keys":"off","no-func-assign":"off","no-import-assign":"off","no-new-native-nonconstructor":"off","no-obj-calls":"off","no-redeclare":"off","no-setter-return":"off","no-this-before-super":"off","no-unsafe-negation":"off","no-var":"error","no-with":"off","prefer-rest-params":"error","prefer-spread":"error","@typescript-eslint/ban-ts-comment":["error",{"ts-expect-error":"allow-with-description"}],"no-array-constructor":"off","@typescript-eslint/no-array-constructor":"error","@typescript-eslint/no-duplicate-enum-values":"error","@typescript-eslint/no-dynamic-delete":"error","@typescript-eslint/no-empty-object-type":["error",{"allowInterfaces":"always"}],"@typescript-eslint/no-explicit-any":"error","@typescript-eslint/no-extra-non-null-assertion":"error","@typescript-eslint/no-extraneous-class":"error","@typescript-eslint/no-misused-new":"error","@typescript-eslint/no-namespace":"error","@typescript-eslint/no-non-null-asserted-nullish-coalescing":"error","@typescript-eslint/no-non-null-asserted-optional-chain":"error","@typescript-eslint/no-non-null-assertion":"error","@typescript-eslint/no-require-imports":"error","@typescript-eslint/no-this-alias":"error","@typescript-eslint/no-unnecessary-type-constraint":"error","@typescript-eslint/no-unsafe-declaration-merging":"error","@typescript-eslint/no-unsafe-function-type":"error","no-unused-expressions":"off","@typescript-eslint/no-unused-expressions":"error","no-unused-vars":"off","@typescript-eslint/no-unused-vars":"off","no-useless-constructor":"off","@typescript-eslint/no-useless-constructor":"error","@typescript-eslint/no-wrapper-object-types":"error","@typescript-eslint/prefer-as-const":"error","@typescript-eslint/prefer-literal-enum-member":"error","@typescript-eslint/prefer-namespace-keyword":"error","@typescript-eslint/triple-slash-reference":"error","@typescript-eslint/adjacent-overload-signatures":"error","@typescript-eslint/array-type":"error","@typescript-eslint/ban-tslint-comment":"error","@typescript-eslint/consistent-generic-constructors":"error","@typescript-eslint/consistent-indexed-object-style":"error","@typescript-eslint/consistent-type-definitions":"off","@typescript-eslint/no-confusing-non-null-assertion":"error","no-empty-function":"off","@typescript-eslint/no-empty-function":"error","@typescript-eslint/no-inferrable-types":"error","@typescript-eslint/prefer-for-of":"error","@typescript-eslint/prefer-function-type":"error","@typescript-eslint/consistent-type-imports":["error",{"disallowTypeAnnotations":false,"fixStyle":"separate-type-imports","prefer":"type-imports"}],"@typescript-eslint/default-param-last":"error","@typescript-eslint/explicit-function-return-type":"off","@typescript-eslint/no-dupe-class-members":"error","@typescript-eslint/no-import-type-side-effects":"error","@typescript-eslint/no-redeclare":["error",{"builtinGlobals":false}],"@typescript-eslint/no-useless-empty-export":"warn"}},{"files":["**/*.{ts,cts,mts}","**/*.{tsx,ctsx,mtsx}"],"rules":{"no-throw-literal":"off","prefer-promise-reject-errors":"off","require-await":"off"}},{"files":["**/*.{ts,cts,mts}","**/*.{tsx,ctsx,mtsx}"],"rules":{"jsdoc/check-access":"error","jsdoc/check-property-names":"error","jsdoc/check-tag-names":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/require-param":["error",{"checkDestructured":false,"enableRestElementFixer":false}],"jsdoc/require-param-description":"error","jsdoc/require-param-name":"error","jsdoc/require-param-type":"off","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-property-type":"off","jsdoc/require-returns":"error","jsdoc/require-returns-description":"error","jsdoc/require-returns-type":"off","jsdoc/require-yields":"error"}},{"files":["**/__tests__/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.spec.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.test.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.bench.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.benchmark.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}"],"rules":{"vitest/expect-expect":"error","vitest/no-identical-title":"error","vitest/no-commented-out-tests":"error","vitest/valid-expect":"error","vitest/valid-describe-callback":"error","vitest/require-local-test-context-for-concurrent-snapshots":"error","vitest/no-import-node-test":"error","vitest/consistent-test-it":["error",{"fn":"it","withinDescribe":"it"}],"vitest/prefer-hooks-in-order":"error","vitest/prefer-lowercase-title":"error"}},{"files":["**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}"],"rules":{"react/jsx-no-duplicate-props":"warn","react/no-array-index-key":"warn","react/no-direct-mutation-state":"error","react/no-string-refs":"error","react-hooks/rules-of-hooks":"error"}},{"files":["**/*.{ts,cts,mts}","**/*.{tsx,ctsx,mtsx}"],"rules":{"react/jsx-no-duplicate-props":"off","react/no-array-index-key":"warn","react/no-direct-mutation-state":"error","react/no-string-refs":"error"}},{"files":["**/scripts/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/tasks/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/bin/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/bin.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/cli/**/*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/cli.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}"],"rules":{"no-console":"off","unicorn/no-process-exit":"off"}},{"files":["**/*.d.{ts,cts,mts}"],"rules":{"@typescript-eslint/consistent-indexed-object-style":"off","import/no-duplicates":"off"}},{"files":["**/*.config.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}","**/*.config.*.{js,jsx,cjs,cjsx,mjs,mjsx,ts,tsx,cts,ctsx,mts,mtjsx}"],"rules":{"no-console":"off","@typescript-eslint/explicit-function-return-type":"off"}}]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"name": "@yunarch/config-web",
|
|
5
5
|
"description": "Shared configurations for web projects.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"sideEffects": false,
|
|
32
32
|
"files": ["README.md", "LICENSE.md", "dist"],
|
|
33
33
|
"bin": {
|
|
34
|
+
"bun-run-all": "./dist/cli/bun-run-all/index.js",
|
|
34
35
|
"openapi-sync": "./dist/cli/openapi-sync/index.js",
|
|
35
36
|
"turbo-select": "./dist/cli/turbo-select/index.js"
|
|
36
37
|
},
|
|
@@ -46,10 +47,11 @@
|
|
|
46
47
|
"type": "module",
|
|
47
48
|
"scripts": {
|
|
48
49
|
"postinstall": "husky && bun run gen",
|
|
49
|
-
"
|
|
50
|
+
"bun-run-all": "bun ./src/cli/bun-run-all/index.ts",
|
|
51
|
+
"gen": "bun bun-run-all gen:eslint-typegen gen:oxlint-compatgen",
|
|
50
52
|
"gen:eslint-typegen": "bun run ./scripts/eslint-typegen.ts",
|
|
51
53
|
"gen:oxlint-compatgen": "bun run ./scripts/oxlint-compatgen.ts && biome format --write ./src/linters/oxlint.config.jsonc",
|
|
52
|
-
"lint": "bun run lint:code
|
|
54
|
+
"lint": "bun bun-run-all lint:code lint:ts -t",
|
|
53
55
|
"lint:code": "oxlint && eslint .",
|
|
54
56
|
"lint:ts": "tsc --noEmit",
|
|
55
57
|
"lint:inspect": "bunx @eslint/config-inspector --config eslint.config.ts",
|
|
@@ -88,7 +90,7 @@
|
|
|
88
90
|
"@inquirer/select": "4.2.1",
|
|
89
91
|
"@total-typescript/ts-reset": "0.6.1",
|
|
90
92
|
"globals": "16.1.0",
|
|
91
|
-
"eslint-flat-config-utils": "2.0
|
|
93
|
+
"eslint-flat-config-utils": "2.1.0",
|
|
92
94
|
"eslint-config-flat-gitignore": "2.1.0",
|
|
93
95
|
"eslint-import-resolver-typescript": "4.3.5",
|
|
94
96
|
"@eslint/js": "9.27.0",
|
|
@@ -121,7 +123,8 @@
|
|
|
121
123
|
"tsup": "8.5.0",
|
|
122
124
|
"typescript": "5.8.3",
|
|
123
125
|
"vitest": "3.1.4",
|
|
124
|
-
"@types/node": "22.15.
|
|
126
|
+
"@types/node": "22.15.21",
|
|
127
|
+
"@types/bun": "1.2.13"
|
|
125
128
|
},
|
|
126
129
|
"publishConfig": {
|
|
127
130
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{exec as a}from"child_process";import{promisify as m,styleText as e,types as c}from"util";import{Command as p}from"commander";import u from"ora";var l=m(a);async function w(o){let{command:t,name:i}=o,s=u(i);s.spinner="aesthetic",s.start();try{let r=typeof t=="string"?await l(t):c.isPromise(t)?await t:await t();return s.succeed(),await new Promise(n=>{setTimeout(n,0)}),typeof r=="object"&&r&&"stdout"in r?r.stdout:r}catch(r){let n=r;throw s.fail(e("red",n.stderr??n.message??"")),r}}function P(){let o=new p;return o.configureHelp({styleTitle:t=>e("bold",t),styleCommandText:t=>e("cyan",t),styleCommandDescription:t=>e("magenta",t),styleDescriptionText:t=>e("italic",t),styleOptionText:t=>e("green",t),styleArgumentText:t=>e("yellow",t),styleSubcommandText:t=>e("blue",t)}).configureOutput({outputError:(t,i)=>{i(e("red",t))}}),o}export{l as a,w as b,P as c};
|