@w5s/dev 3.2.3 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,57 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- let node_fs = require("node:fs");
3
- let node_fs_promises = require("node:fs/promises");
4
- let node_child_process = require("node:child_process");
5
- //#region src/directory.ts
6
- async function exists$1(path) {
7
- try {
8
- await (0, node_fs_promises.access)(path, node_fs_promises.constants.F_OK);
9
- return true;
10
- } catch {
11
- return false;
12
- }
13
- }
14
- /**
15
- * Ensure directory is present/absent
16
- *
17
- * @example
18
- * ```ts
19
- * await directory({
20
- * path: 'foo/bar',
21
- * state: 'present',
22
- * })
23
- * ```
24
- *
25
- * @param options
26
- */
27
- async function directory(options) {
28
- const { path, state } = options;
29
- const isPresent = await exists$1(path);
30
- if (state === "present") {
31
- if (!isPresent) await (0, node_fs_promises.mkdir)(path, { recursive: true });
32
- } else if (isPresent) await (0, node_fs_promises.rm)(path, { recursive: true });
33
- }
34
- /**
35
- * Ensure directory is present/absent
36
- *
37
- * @example
38
- * ```ts
39
- * await directorySync({
40
- * path: 'foo/bar',
41
- * state: 'present',
42
- * })
43
- * ```
44
- *
45
- * @param options
46
- */
47
- function directorySync(options) {
48
- const { path, state } = options;
49
- const isPresent = (0, node_fs.existsSync)(path);
50
- if (state === "present") {
51
- if (!isPresent) (0, node_fs.mkdirSync)(path, { recursive: true });
52
- } else if (isPresent) (0, node_fs.rmSync)(path, { recursive: true });
53
- }
54
- //#endregion
55
2
  //#region src/ESLintConfig.ts
56
3
  function toArray(value) {
57
4
  if (value == null) return [];
@@ -61,213 +8,81 @@ function toArray(value) {
61
8
  function concatArray(left, right) {
62
9
  return [...toArray(left), ...toArray(right)];
63
10
  }
64
- let ESLintConfig;
65
- (function(_ESLintConfig) {
66
- function concat(...configs) {
67
- return configs.reduce((returnValue, config) => ({
68
- ...returnValue,
69
- ...config,
70
- env: {
71
- ...returnValue.env,
72
- ...config.env
73
- },
74
- extends: concatArray(returnValue.extends, config.extends),
75
- globals: {
76
- ...returnValue.globals,
77
- ...config.globals
78
- },
79
- overrides: concatArray(returnValue.overrides, config.overrides),
80
- parserOptions: {
81
- ...returnValue.parserOptions,
82
- ...config.parserOptions
83
- },
84
- plugins: concatArray(returnValue.plugins, config.plugins),
85
- rules: {
86
- ...returnValue.rules,
87
- ...config.rules
88
- },
89
- settings: {
90
- ...returnValue.settings,
91
- ...config.settings
92
- }
93
- }), {
94
- env: {},
95
- extends: [],
96
- globals: {},
97
- overrides: [],
98
- parserOptions: {},
99
- plugins: [],
100
- rules: {},
101
- settings: {}
102
- });
103
- }
104
- _ESLintConfig.concat = concat;
105
- function fixme(_status) {
106
- return "off";
107
- }
108
- _ESLintConfig.fixme = fixme;
109
- function renameRules(rules, map) {
110
- return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
111
- for (const [from, to] of Object.entries(map)) if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
112
- else if (from === "" && !key.includes("/") && to !== "") return [to + key, value];
113
- return [key, value];
114
- }));
115
- }
116
- _ESLintConfig.renameRules = renameRules;
117
- })(ESLintConfig || (ESLintConfig = {}));
118
- //#endregion
119
- //#region src/file.ts
120
- async function exists(path) {
121
- try {
122
- await (0, node_fs_promises.access)(path, node_fs.constants.F_OK);
123
- return true;
124
- } catch {
125
- return false;
126
- }
127
- }
128
- function existsSync(path) {
129
- try {
130
- (0, node_fs.accessSync)(path, node_fs.constants.F_OK);
131
- return true;
132
- } catch {
133
- return false;
134
- }
135
- }
136
11
  /**
137
- * Ensure file is present/absent with content initialized or modified with `update
138
12
  *
139
- * @example
140
- * ```ts
141
- * await file({
142
- * path: 'foo/bar',
143
- * state: 'present',
144
- * update: (content) => content + '_test', // This will append '_test' after current content
145
- * })
146
- * ```
147
- *
148
- * @param options
13
+ * @param configs
149
14
  */
150
- async function file(options) {
151
- const { path, state, update, encoding = "utf8" } = options;
152
- if (state === "present") {
153
- const previousContent = await exists(path) ? await (0, node_fs_promises.readFile)(path, encoding) : "";
154
- const newContent = update == null ? "" : update(previousContent);
155
- if (newContent != null) await (0, node_fs_promises.writeFile)(path, newContent, encoding);
156
- } else await (0, node_fs_promises.rm)(path, { force: true });
15
+ function concat(...configs) {
16
+ return configs.reduce((returnValue, config) => ({
17
+ ...returnValue,
18
+ ...config,
19
+ env: {
20
+ ...returnValue.env,
21
+ ...config.env
22
+ },
23
+ extends: concatArray(returnValue.extends, config.extends),
24
+ globals: {
25
+ ...returnValue.globals,
26
+ ...config.globals
27
+ },
28
+ overrides: concatArray(returnValue.overrides, config.overrides),
29
+ parserOptions: {
30
+ ...returnValue.parserOptions,
31
+ ...config.parserOptions
32
+ },
33
+ plugins: concatArray(returnValue.plugins, config.plugins),
34
+ rules: {
35
+ ...returnValue.rules,
36
+ ...config.rules
37
+ },
38
+ settings: {
39
+ ...returnValue.settings,
40
+ ...config.settings
41
+ }
42
+ }), {
43
+ env: {},
44
+ extends: [],
45
+ globals: {},
46
+ overrides: [],
47
+ parserOptions: {},
48
+ plugins: [],
49
+ rules: {},
50
+ settings: {}
51
+ });
157
52
  }
158
53
  /**
159
- * Ensure file is present/absent with content initialized or modified with `update
160
- *
161
- * @example
162
- * ```ts
163
- * fileSync({
164
- * path: 'foo/bar',
165
- * state: 'present',
166
- * update: (content) => content + '_test', // This will append '_test' after current content
167
- * })
168
- * ```
54
+ * Always return 'off'. `_status` is the previous rule value.
169
55
  *
170
- * @param options
56
+ * @param _status
171
57
  */
172
- function fileSync(options) {
173
- const { path, state, update, encoding = "utf8" } = options;
174
- if (state === "present") {
175
- const previousContent = existsSync(path) ? (0, node_fs.readFileSync)(path, encoding) : "";
176
- const newContent = update == null ? "" : update(previousContent);
177
- if (newContent != null) (0, node_fs.writeFileSync)(path, newContent, encoding);
178
- } else (0, node_fs.rmSync)(path, { force: true });
179
- }
180
- //#endregion
181
- //#region src/block.ts
182
- const EOF = "EndOfFile";
183
- const BOF = "BeginningOfFile";
184
- const insertAt = (str, index, toInsert) => str.slice(0, index) + toInsert + str.slice(index);
185
- const matchLast = (string, regexp) => {
186
- const matcher = new RegExp(regexp.source, `${regexp.flags}g`);
187
- let firstIndex = -1;
188
- let lastIndex = -1;
189
- let matches;
190
- while (true) {
191
- matches = matcher.exec(string);
192
- if (matches == null) break;
193
- firstIndex = matches.index;
194
- lastIndex = matcher.lastIndex;
195
- }
196
- return {
197
- firstIndex,
198
- lastIndex
199
- };
200
- };
201
- function toFileOptions(options) {
202
- const { marker = (mark) => `# ${mark.toUpperCase()} MANAGED BLOCK`, path, block: blockName, insertPosition = ["after", EOF], state = "present" } = options;
203
- const EOL = "\n";
204
- const beginBlock = marker("Begin");
205
- const endBlock = marker("End");
206
- /**
207
- * @param content
208
- */
209
- function findBlock(content) {
210
- const startIndex = content.indexOf(beginBlock);
211
- const endIndex = content.indexOf(endBlock) + endBlock.length;
212
- return {
213
- endIndex,
214
- exists: startIndex !== -1 && endIndex >= 0,
215
- startIndex
216
- };
217
- }
218
- function apply(fullContent, blockContent) {
219
- const found = findBlock(fullContent);
220
- const remove = state === "absent";
221
- const replaceBlock = remove ? "" : beginBlock + EOL + blockContent + EOL + endBlock;
222
- const [positionDirection, positionAnchor] = insertPosition;
223
- if (found.exists) return fullContent.slice(0, found.startIndex) + replaceBlock + fullContent.slice(found.endIndex);
224
- if (remove) return fullContent;
225
- switch (positionDirection) {
226
- case "before":
227
- if (positionAnchor !== BOF) {
228
- const { firstIndex } = matchLast(fullContent, positionAnchor);
229
- if (firstIndex >= 0) return insertAt(fullContent, firstIndex, replaceBlock + EOL);
230
- }
231
- return replaceBlock + EOL + fullContent;
232
- case "after":
233
- if (positionAnchor !== EOF) {
234
- const { lastIndex } = matchLast(fullContent, positionAnchor);
235
- if (lastIndex >= 0) return insertAt(fullContent, lastIndex, EOL + replaceBlock);
236
- }
237
- return fullContent + EOL + replaceBlock;
238
- default: throw new Error(`Unsupported position ${String(positionDirection)}`);
239
- }
240
- }
241
- return {
242
- path,
243
- state: "present",
244
- update: (sourceContent) => apply(sourceContent, blockName)
245
- };
58
+ function fixme(_status) {
59
+ return "off";
246
60
  }
247
61
  /**
248
- * Replace asynchronously a block in file that follows pattern :
62
+ * Renames rules in the given object according to the given map.
249
63
  *
250
- * marker(markerBegin)
251
- * ...
252
- * marker(markerEnd)
64
+ * Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object
65
+ * `{ 'old-prefix/rule-name': 'error' }`, this function will return
66
+ * `{ 'new-prefix/rule-name': 'error' }`.
253
67
  *
254
- * @param options
68
+ * @param rules The object containing the rules to rename.
69
+ * @param map The object containing the rename map.
255
70
  */
256
- function block(options) {
257
- return file(toFileOptions(options));
71
+ function renameRules(rules, map) {
72
+ return Object.fromEntries(Object.entries(rules).map(([key, value]) => {
73
+ for (const [from, to] of Object.entries(map)) if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
74
+ else if (from === "" && !key.includes("/") && to !== "") return [to + key, value];
75
+ return [key, value];
76
+ }));
258
77
  }
259
78
  /**
260
- * Replace synchronously a block in file that follows pattern :
261
- *
262
- * marker(markerBegin)
263
- * ...
264
- * marker(markerEnd)
265
- *
266
- * @param options
79
+ * @namespace
267
80
  */
268
- function blockSync(options) {
269
- return fileSync(toFileOptions(options));
270
- }
81
+ const ESLintConfig = Object.freeze({
82
+ concat,
83
+ fixme,
84
+ renameRules
85
+ });
271
86
  //#endregion
272
87
  //#region src/interopDefault.ts
273
88
  const getDefaultOrElse = (_) => _?.default ?? _;
@@ -275,37 +90,10 @@ function interopDefault(m) {
275
90
  return m != null && typeof m.then === "function" ? Promise.resolve(m).then(getDefaultOrElse) : getDefaultOrElse(m);
276
91
  }
277
92
  //#endregion
278
- //#region src/json.ts
279
- function toFileOption({ update, ...otherOptions }) {
280
- return {
281
- ...otherOptions,
282
- update: update == null ? update : (content) => {
283
- const jsonValue = content === "" ? void 0 : JSON.parse(content);
284
- return JSON.stringify(update(jsonValue));
285
- }
286
- };
287
- }
288
- /**
289
- * Ensure file is present/absent asynchronously with content value initialized or modified with `update`
290
- *
291
- * @param options
292
- */
293
- async function json(options) {
294
- return file(toFileOption(options));
295
- }
296
- /**
297
- * Ensure file is present/absent synchronously with content value initialized or modified with `update`
298
- *
299
- * @param options
300
- */
301
- function jsonSync(options) {
302
- return fileSync(toFileOption(options));
303
- }
304
- //#endregion
305
93
  //#region src/meta.ts
306
94
  const meta = Object.freeze({
307
95
  name: "@w5s/dev",
308
- version: "3.2.3",
96
+ version: "3.3.2",
309
97
  buildNumber: 1
310
98
  });
311
99
  //#endregion
@@ -313,291 +101,186 @@ const meta = Object.freeze({
313
101
  function escapeRegExp(value) {
314
102
  return value.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
315
103
  }
316
- let Project;
317
- (function(_Project) {
318
- function ecmaVersion() {
319
- return 2022;
320
- }
321
- _Project.ecmaVersion = ecmaVersion;
322
- const registry = {
323
- css: [".css"],
324
- graphql: [".gql", ".graphql"],
325
- javascript: [
326
- ".js",
327
- ".cjs",
328
- ".mjs"
329
- ],
330
- javascriptreact: [".jsx"],
331
- jpeg: [".jpg", ".jpeg"],
332
- json: [".json"],
333
- jsonc: [".jsonc"],
334
- less: [".less"],
335
- markdown: [
336
- ".markdown",
337
- ".mdown",
338
- ".mkd",
339
- ".md"
340
- ],
341
- sass: [".sass"],
342
- scss: [".scss"],
343
- typescript: [
344
- ".ts",
345
- ".cts",
346
- ".mts"
347
- ],
348
- typescriptreact: [".tsx"],
349
- vue: [".vue"],
350
- yaml: [".yaml", ".yml"]
351
- };
352
- function queryExtensions(languages) {
353
- return languages.reduce((previousValue, currentValue) => previousValue.concat(registry[currentValue] ?? []), []).sort();
354
- }
355
- _Project.queryExtensions = queryExtensions;
356
- function sourceExtensions() {
357
- return queryExtensions([
358
- "javascript",
359
- "javascriptreact",
360
- "typescript",
361
- "typescriptreact"
362
- ]);
363
- }
364
- _Project.sourceExtensions = sourceExtensions;
365
- const RESOURCE_EXTENSIONS = Object.freeze([
366
- ".gif",
367
- ".png",
368
- ".svg",
369
- ...queryExtensions([
370
- "css",
371
- "graphql",
372
- "jpeg",
373
- "less",
374
- "sass",
375
- "sass",
376
- "yaml"
377
- ])
378
- ]);
379
- function resourceExtensions() {
380
- return RESOURCE_EXTENSIONS;
381
- }
382
- _Project.resourceExtensions = resourceExtensions;
383
- const IGNORED = Object.freeze([
384
- "node_modules/",
385
- "build/",
386
- "cjs/",
387
- "coverage/",
388
- "dist/",
389
- "dts/",
390
- "esm/",
391
- "lib/",
392
- "mjs/",
393
- "umd/"
394
- ]);
395
- function ignored() {
396
- return IGNORED;
397
- }
398
- _Project.ignored = ignored;
399
- function extensionsToMatcher(extensions) {
400
- return new RegExp(`(${extensions.map(escapeRegExp).join("|")})$`);
401
- }
402
- _Project.extensionsToMatcher = extensionsToMatcher;
403
- function extensionsToGlob(extensions) {
404
- return `*.+(${extensions.map((_) => _.replace(/^\./, "")).join("|")})`;
405
- }
406
- _Project.extensionsToGlob = extensionsToGlob;
407
- })(Project || (Project = {}));
408
- //#endregion
409
- //#region src/ProjectScript.ts
410
104
  /**
411
- * Project common scripts
105
+ * Supported ECMA version
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * Project.ecmaVersion() // 2022
110
+ * ```
412
111
  */
413
- const ProjectScript = {
414
- Build: "build",
415
- Clean: "clean",
416
- CodeAnalysis: "code-analysis",
417
- Coverage: "coverage",
418
- Develop: "develop",
419
- Docs: "docs",
420
- Format: "format",
421
- Install: "install",
422
- Lint: "lint",
423
- Prepare: "prepare",
424
- Release: "release",
425
- Rescue: "rescue",
426
- Spellcheck: "spellcheck",
427
- Test: "test",
428
- Validate: "validate"
112
+ function ecmaVersion() {
113
+ return 2022;
114
+ }
115
+ const registry = {
116
+ css: [".css"],
117
+ graphql: [".gql", ".graphql"],
118
+ javascript: [
119
+ ".js",
120
+ ".cjs",
121
+ ".mjs"
122
+ ],
123
+ javascriptreact: [".jsx"],
124
+ jpeg: [".jpg", ".jpeg"],
125
+ json: [".json"],
126
+ jsonc: [".jsonc"],
127
+ less: [".less"],
128
+ markdown: [
129
+ ".markdown",
130
+ ".mdown",
131
+ ".mkd",
132
+ ".md"
133
+ ],
134
+ sass: [".sass"],
135
+ scss: [".scss"],
136
+ typescript: [
137
+ ".ts",
138
+ ".cts",
139
+ ".mts"
140
+ ],
141
+ typescriptreact: [".tsx"],
142
+ vue: [".vue"],
143
+ yaml: [".yaml", ".yml"]
429
144
  };
430
- //#endregion
431
- //#region src/exec.ts
432
145
  /**
433
- * Runs a command in a shell and returns a promise that resolves with an object
434
- * containing the stdout and stderr strings.
146
+ * Return a list of extensions
435
147
  *
436
- * @param command The command to run
437
- * @param args The arguments to pass to the command
438
- * @param options
439
- * @returns A promise that resolves with an object like `{ stdout: string, stderr: string }`
148
+ * @example
149
+ * ```ts
150
+ * Project.queryExtensions(['javascript']); // ['.js', '.cjs', ...]
151
+ * Project.queryExtensions(['typescript', 'typescriptreact']); // ['.ts', '.mts', ..., '.tsx']
152
+ * ```
153
+ *
154
+ * @param languages
440
155
  */
441
- function execSync(command, args, options) {
442
- const result = (0, node_child_process.spawnSync)(command, args, { ...options });
443
- const encoding = "utf8";
444
- return {
445
- stdout: result.stdout.toString(encoding),
446
- stderr: result.stderr.toString(encoding)
447
- };
156
+ function queryExtensions(languages) {
157
+ return languages.reduce((previousValue, currentValue) => previousValue.concat(registry[currentValue] ?? []), []).sort();
448
158
  }
449
159
  /**
450
- * Runs a command in a shell and returns a promise that resolves with an object
451
- * containing the stdout and stderr strings.
160
+ * Supported file extensions
452
161
  *
453
- * @param command The command to run
454
- * @param args The arguments to pass to the command
455
- * @param options
162
+ * @example
163
+ * ```ts
164
+ * Project.sourceExtensions() // ['.ts', '.js', ...]
165
+ * ```
456
166
  */
457
- async function exec(command, args, options) {
458
- return new Promise((resolve, reject) => {
459
- const encoding = "utf8";
460
- const child = (0, node_child_process.spawn)(command, args, { ...options });
461
- let stdout = "";
462
- let stderr = "";
463
- if (child.stdout != null) child.stdout.on("data", (data) => {
464
- stdout += data.toString(encoding);
465
- });
466
- if (child.stderr != null) child.stderr.on("data", (data) => {
467
- stderr += data.toString(encoding);
468
- });
469
- child.on("close", (_code) => {
470
- resolve({
471
- stdout,
472
- stderr
473
- });
474
- });
475
- child.on("error", reject);
476
- });
167
+ function sourceExtensions() {
168
+ return queryExtensions([
169
+ "javascript",
170
+ "javascriptreact",
171
+ "typescript",
172
+ "typescriptreact"
173
+ ]);
477
174
  }
478
- //#endregion
479
- //#region src/yarnConfig.ts
175
+ const RESOURCE_EXTENSIONS = Object.freeze([
176
+ ".gif",
177
+ ".png",
178
+ ".svg",
179
+ ...queryExtensions([
180
+ "css",
181
+ "graphql",
182
+ "jpeg",
183
+ "less",
184
+ "sass",
185
+ "sass",
186
+ "yaml"
187
+ ])
188
+ ]);
480
189
  /**
481
- * Synchronous version of {@link yarnConfig}
190
+ * Resource file extensions
482
191
  *
483
- * @param options
484
192
  * @example
485
- * yarnConfigSync({
486
- * key: 'nodeLinker',
487
- * state: 'present',
488
- * update: (content) => content.replace('node-modules', 'hoisted'),
489
- * })
193
+ * ```ts
194
+ * Project.resourceExtensions() // ['.css', '.sass', ...]
195
+ * ```
490
196
  */
491
- function yarnConfigSync(options) {
492
- const { key, state, update } = options;
493
- if (state === "present") {
494
- const { stdout } = execSync("yarn", [
495
- "config",
496
- "get",
497
- String(key)
498
- ]);
499
- execSync("yarn", [
500
- "config",
501
- "set",
502
- String(key),
503
- `${update == null ? "" : update(stdout)}`
504
- ]);
505
- } else execSync("yarn", ["config", "unset"]);
197
+ function resourceExtensions() {
198
+ return RESOURCE_EXTENSIONS;
506
199
  }
200
+ const IGNORED = Object.freeze([
201
+ "node_modules/",
202
+ "build/",
203
+ "cjs/",
204
+ "coverage/",
205
+ "dist/",
206
+ "dts/",
207
+ "esm/",
208
+ "lib/",
209
+ "mjs/",
210
+ "umd/"
211
+ ]);
507
212
  /**
508
- * Set/Unset yarn configuration value
213
+ * Files and folders to always ignore
509
214
  *
510
- * @param options
511
215
  * @example
512
- * await yarnConfig({
513
- * key: 'nodeLinker',
514
- * state: 'present',
515
- * update: (content) => content.replace('node-modules', 'hoisted'),
516
- * })
216
+ * ```ts
217
+ * IGNORED // ['node_modules/', 'build/', ...]
218
+ * ```
517
219
  */
518
- async function yarnConfig(options) {
519
- const { key, state, update } = options;
520
- if (state === "present") {
521
- const { stdout } = await exec("yarn", [
522
- "config",
523
- "get",
524
- String(key)
525
- ]);
526
- await exec("yarn", [
527
- "config",
528
- "set",
529
- String(key),
530
- `${update == null ? "" : update(stdout)}`
531
- ]);
532
- } else await exec("yarn", ["config", "unset"]);
220
+ function ignored() {
221
+ return IGNORED;
533
222
  }
534
- //#endregion
535
- //#region src/yarnVersion.ts
536
223
  /**
537
- * Synchronous version of {@link yarnVersion}
224
+ * Return a RegExp that will match any list of extensions
538
225
  *
539
- * @param options
226
+ * @param extensions
540
227
  * @example
541
- * yarnVersionSync({
542
- * state: 'present',
543
- * update: () => 'berry', // or 'classic'
544
- * })
228
+ * ```ts
229
+ * Project.extensionsToMatcher(['.js', '.ts']) // RegExp = /(\.js|\.ts)$/
230
+ * ```
545
231
  */
546
- function yarnVersionSync(options) {
547
- const { state, update } = options;
548
- if (state === "present") execSync("yarn", [
549
- "set",
550
- "version",
551
- `${update == null ? "berry" : update()}`
552
- ]);
553
- else throw new Error("Not implemented");
232
+ function extensionsToMatcher(extensions) {
233
+ return new RegExp(`(${extensions.map(escapeRegExp).join("|")})$`);
554
234
  }
555
235
  /**
556
- * Set/Unset yarn configuration value
236
+ * Return a glob matcher that will match any list of extensions
557
237
  *
558
- * @param options
238
+ * @param extensions
559
239
  * @example
560
- * await yarnVersion({
561
- * state: 'present',
562
- * update: () => 'berry', // or 'classic'
563
- * })
240
+ * ```ts
241
+ * Project.extensionsToGlob(['.js', '.ts']) // '*.+(js|ts)'
242
+ * ```
564
243
  */
565
- async function yarnVersion(options) {
566
- const { state, update } = options;
567
- if (state === "present") await exec("yarn", [
568
- "set",
569
- "version",
570
- `${update == null ? "berry" : update()}`
571
- ]);
572
- else throw new Error("Not implemented");
244
+ function extensionsToGlob(extensions) {
245
+ return `*.+(${extensions.map((_) => _.replace(/^\./, "")).join("|")})`;
573
246
  }
574
- //#endregion
575
- Object.defineProperty(exports, "ESLintConfig", {
576
- enumerable: true,
577
- get: function() {
578
- return ESLintConfig;
579
- }
580
- });
581
- Object.defineProperty(exports, "Project", {
582
- enumerable: true,
583
- get: function() {
584
- return Project;
585
- }
247
+ const Project = Object.freeze({
248
+ ecmaVersion,
249
+ extensionsToGlob,
250
+ extensionsToMatcher,
251
+ ignored,
252
+ queryExtensions,
253
+ resourceExtensions,
254
+ sourceExtensions
586
255
  });
256
+ //#endregion
257
+ //#region src/ProjectScript.ts
258
+ /**
259
+ * Project common scripts
260
+ */
261
+ const ProjectScript = {
262
+ Build: "build",
263
+ Clean: "clean",
264
+ CodeAnalysis: "code-analysis",
265
+ Coverage: "coverage",
266
+ Develop: "develop",
267
+ Docs: "docs",
268
+ Format: "format",
269
+ Install: "install",
270
+ Lint: "lint",
271
+ Prepare: "prepare",
272
+ Release: "release",
273
+ Rescue: "rescue",
274
+ Spellcheck: "spellcheck",
275
+ Test: "test",
276
+ Typecheck: "typecheck",
277
+ Validate: "validate"
278
+ };
279
+ //#endregion
280
+ exports.ESLintConfig = ESLintConfig;
281
+ exports.Project = Project;
587
282
  exports.ProjectScript = ProjectScript;
588
- exports.block = block;
589
- exports.blockSync = blockSync;
590
- exports.directory = directory;
591
- exports.directorySync = directorySync;
592
- exports.file = file;
593
- exports.fileSync = fileSync;
594
283
  exports.interopDefault = interopDefault;
595
- exports.json = json;
596
- exports.jsonSync = jsonSync;
597
284
  exports.meta = meta;
598
- exports.yarnConfig = yarnConfig;
599
- exports.yarnConfigSync = yarnConfigSync;
600
- exports.yarnVersion = yarnVersion;
601
- exports.yarnVersionSync = yarnVersionSync;
602
285
 
603
286
  //# sourceMappingURL=index.cjs.map