@w5s/dev 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var fs = require('fs');
4
4
  var promises = require('fs/promises');
5
+ var child_process = require('child_process');
5
6
 
6
7
  // src/directory.ts
7
8
  async function exists(path) {
@@ -35,7 +36,7 @@ function directorySync(options) {
35
36
  }
36
37
  }
37
38
 
38
- // src/eslint.ts
39
+ // src/ESLintConfig.ts
39
40
  function toArray(value) {
40
41
  if (value == null) {
41
42
  return [];
@@ -81,6 +82,17 @@ exports.ESLintConfig = void 0;
81
82
  return "off";
82
83
  }
83
84
  ESLintConfig2.fixme = fixme;
85
+ function renameRules(rules, map) {
86
+ return Object.fromEntries(
87
+ Object.entries(rules).map(([key, value]) => {
88
+ for (const [from, to] of Object.entries(map)) {
89
+ if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];
90
+ }
91
+ return [key, value];
92
+ })
93
+ );
94
+ }
95
+ ESLintConfig2.renameRules = renameRules;
84
96
  })(exports.ESLintConfig || (exports.ESLintConfig = {}));
85
97
  async function exists2(path) {
86
98
  try {
@@ -235,7 +247,7 @@ function jsonSync(options) {
235
247
  return fileSync(toFileOption(options));
236
248
  }
237
249
 
238
- // src/project.ts
250
+ // src/Project.ts
239
251
  function escapeRegExp(value) {
240
252
  return value.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
241
253
  }
@@ -246,20 +258,24 @@ exports.Project = void 0;
246
258
  }
247
259
  Project2.ecmaVersion = ecmaVersion;
248
260
  const registry = {
261
+ css: [".css"],
249
262
  graphql: [".gql", ".graphql"],
250
- jpeg: [".jpg", ".jpeg"],
251
263
  javascript: [".js", ".cjs", ".mjs"],
252
264
  javascriptreact: [".jsx"],
265
+ jpeg: [".jpg", ".jpeg"],
266
+ json: [".json"],
267
+ jsonc: [".jsonc"],
268
+ less: [".less"],
269
+ markdown: [".markdown", ".mdown", ".mkd", ".md"],
270
+ sass: [".sass"],
271
+ scss: [".scss"],
253
272
  typescript: [".ts", ".cts", ".mts"],
254
273
  typescriptreact: [".tsx"],
274
+ vue: [".vue"],
255
275
  yaml: [".yaml", ".yml"]
256
276
  };
257
277
  function queryExtensions(languages) {
258
- return languages.reduce(
259
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
260
- (previousValue, currentValue) => previousValue.concat(registry[currentValue] ?? []),
261
- []
262
- ).sort();
278
+ return languages.reduce((previousValue, currentValue) => previousValue.concat(registry[currentValue] ?? []), []).sort();
263
279
  }
264
280
  Project2.queryExtensions = queryExtensions;
265
281
  function sourceExtensions() {
@@ -267,14 +283,10 @@ exports.Project = void 0;
267
283
  }
268
284
  Project2.sourceExtensions = sourceExtensions;
269
285
  const RESOURCE_EXTENSIONS = Object.freeze([
270
- ".css",
271
- ".sass",
272
- ".scss",
273
- ".less",
274
286
  ".gif",
275
287
  ".png",
276
288
  ".svg",
277
- ...queryExtensions(["graphql", "jpeg", "yaml"])
289
+ ...queryExtensions(["css", "graphql", "jpeg", "less", "sass", "sass", "yaml"])
278
290
  ]);
279
291
  function resourceExtensions() {
280
292
  return RESOURCE_EXTENSIONS;
@@ -306,7 +318,7 @@ exports.Project = void 0;
306
318
  Project2.extensionsToGlob = extensionsToGlob;
307
319
  })(exports.Project || (exports.Project = {}));
308
320
 
309
- // src/projectScript.ts
321
+ // src/ProjectScript.ts
310
322
  var ProjectScript = {
311
323
  Build: "build",
312
324
  Clean: "clean",
@@ -324,6 +336,71 @@ var ProjectScript = {
324
336
  Test: "test",
325
337
  Validate: "validate"
326
338
  };
339
+ function execSync(command, args, options) {
340
+ const result = child_process.spawnSync(command, args, { ...options });
341
+ const encoding = "utf8";
342
+ return { stdout: result.stdout.toString(encoding), stderr: result.stderr.toString(encoding) };
343
+ }
344
+ async function exec(command, args, options) {
345
+ return new Promise((resolve, reject) => {
346
+ const encoding = "utf8";
347
+ const child = child_process.spawn(command, args, { ...options });
348
+ let stdout = "";
349
+ let stderr = "";
350
+ if (child.stdout != null) {
351
+ child.stdout.on("data", (data) => {
352
+ stdout += data.toString(encoding);
353
+ });
354
+ }
355
+ if (child.stderr != null) {
356
+ child.stderr.on("data", (data) => {
357
+ stderr += data.toString(encoding);
358
+ });
359
+ }
360
+ child.on("close", (_code) => {
361
+ resolve({ stdout, stderr });
362
+ });
363
+ child.on("error", reject);
364
+ });
365
+ }
366
+
367
+ // src/yarnConfig.ts
368
+ function yarnConfigSync(options) {
369
+ const { key, state, update } = options;
370
+ if (state === "present") {
371
+ const { stdout } = execSync("yarn", ["config", "get", String(key)]);
372
+ execSync("yarn", ["config", "set", String(key), `${update == null ? "" : update(stdout)}`]);
373
+ } else {
374
+ execSync("yarn", ["config", "unset"]);
375
+ }
376
+ }
377
+ async function yarnConfig(options) {
378
+ const { key, state, update } = options;
379
+ if (state === "present") {
380
+ const { stdout } = await exec("yarn", ["config", "get", String(key)]);
381
+ await exec("yarn", ["config", "set", String(key), `${update == null ? "" : update(stdout)}`]);
382
+ } else {
383
+ await exec("yarn", ["config", "unset"]);
384
+ }
385
+ }
386
+
387
+ // src/yarnVersion.ts
388
+ function yarnVersionSync(options) {
389
+ const { state, update } = options;
390
+ if (state === "present") {
391
+ execSync("yarn", ["set", "version", `${update == null ? "berry" : update()}`]);
392
+ } else {
393
+ throw new Error("Not implemented");
394
+ }
395
+ }
396
+ async function yarnVersion(options) {
397
+ const { state, update } = options;
398
+ if (state === "present") {
399
+ await exec("yarn", ["set", "version", `${update == null ? "berry" : update()}`]);
400
+ } else {
401
+ throw new Error("Not implemented");
402
+ }
403
+ }
327
404
 
328
405
  exports.ProjectScript = ProjectScript;
329
406
  exports.block = block;
@@ -335,5 +412,9 @@ exports.fileSync = fileSync;
335
412
  exports.interopDefault = interopDefault;
336
413
  exports.json = json;
337
414
  exports.jsonSync = jsonSync;
415
+ exports.yarnConfig = yarnConfig;
416
+ exports.yarnConfigSync = yarnConfigSync;
417
+ exports.yarnVersion = yarnVersion;
418
+ exports.yarnVersionSync = yarnVersionSync;
338
419
  //# sourceMappingURL=index.cjs.map
339
420
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/directory.ts","../src/eslint.ts","../src/file.ts","../src/block.ts","../src/interopDefault.ts","../src/json.ts","../src/project.ts","../src/projectScript.ts"],"names":["access","constants","mkdir","rm","existsSync","mkdirSync","rmSync","ESLintConfig","exists","accessSync","readFile","writeFile","readFileSync","writeFileSync","Project"],"mappings":";;;;;;AAGA,eAAe,OAAO,IAAc,EAAA;AAClC,EAAI,IAAA;AACF,IAAM,MAAAA,eAAA,CAAO,IAAM,EAAAC,kBAAA,CAAU,IAAI,CAAA;AACjC,IAAO,OAAA,IAAA;AAAA,GACD,CAAA,MAAA;AACN,IAAO,OAAA,KAAA;AAAA;AAEX;AA0BA,eAAsB,UAAU,OAA0C,EAAA;AACxE,EAAM,MAAA,EAAE,IAAM,EAAA,KAAA,EAAU,GAAA,OAAA;AACxB,EAAM,MAAA,SAAA,GAAY,MAAM,MAAA,CAAO,IAAI,CAAA;AACnC,EAAA,IAAI,UAAU,SAAW,EAAA;AACvB,IAAA,IAAI,CAAC,SAAW,EAAA;AACd,MAAA,MAAMC,cAAM,CAAA,IAAA,EAAM,EAAE,SAAA,EAAW,MAAM,CAAA;AAAA;AACvC,aACS,SAAW,EAAA;AACpB,IAAA,MAAMC,WAAG,CAAA,IAAA,EAAM,EAAE,SAAA,EAAW,MAAM,CAAA;AAAA;AAEtC;AAeO,SAAS,cAAc,OAAiC,EAAA;AAC7D,EAAM,MAAA,EAAE,IAAM,EAAA,KAAA,EAAU,GAAA,OAAA;AACxB,EAAM,MAAA,SAAA,GAAYC,cAAW,IAAI,CAAA;AACjC,EAAA,IAAI,UAAU,SAAW,EAAA;AACvB,IAAA,IAAI,CAAC,SAAW,EAAA;AACd,MAAAC,YAAA,CAAU,IAAM,EAAA,EAAE,SAAW,EAAA,IAAA,E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,EAAA,SAAA;AAAA,EACT,IAAM,EAAA,MAAA;AAAA,EACN,MAAQ,EAAA,QAAA;AAAA,EACR,OAAS,EAAA,SAAA;AAAA,EACT,IAAM,EAAA,MAAA;AAAA,EACN,OAAS,EAAA,SAAA;AAAA,EACT,OAAS,EAAA,SAAA;AAAA,EACT,MAAQ,EAAA,QAAA;AAAA,EACR,UAAY,EAAA,YAAA;AAAA,EACZ,IAAM,EAAA,MAAA;AAAA,EACN,QAAU,EAAA;AACZ","file":"index.cjs","sourcesContent":["import { existsSync, mkdirSync, rmSync } from 'node:fs';\nimport { access, constants, mkdir, rm } from 'node:fs/promises';\n\nasync function exists(path: string) {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nexport interface DirectoryOptions {\n /**\n * Directory path\n */\n readonly path: string;\n /**\n * Directory target state\n */\n readonly state: 'present' | 'absent';\n}\n\n/**\n * Ensure directory is present/absent\n *\n * @example\n * ```ts\n * await directory({\n * path: 'foo/bar',\n * state: 'present',\n * })\n * ```\n *\n * @param options\n */\nexport async function directory(options: DirectoryOptions): Promise<void> {\n const { path, state } = options;\n const isPresent = await exists(path);\n if (state === 'present') {\n if (!isPresent) {\n await mkdir(path, { recursive: true });\n }\n } else if (isPresent) {\n await rm(path, { recursive: true });\n }\n}\n\n/**\n * Ensure directory is present/absent\n *\n * @example\n * ```ts\n * await directorySync({\n * path: 'foo/bar',\n * state: 'present',\n * })\n * ```\n *\n * @param options\n */\nexport function directorySync(options: DirectoryOptions): void {\n const { path, state } = options;\n const isPresent = existsSync(path);\n if (state === 'present') {\n if (!isPresent) {\n mkdirSync(path, { recursive: true });\n }\n } else if (isPresent) {\n rmSync(path, { recursive: true });\n }\n}\n","import type { ESLint, Linter } from 'eslint';\n\nfunction toArray<T>(value: T[] | T | undefined): T[] {\n if (value == null) {\n return [];\n }\n if (Array.isArray(value)) {\n return value;\n }\n return [value];\n}\n\nfunction concatArray<T>(left: T[] | T | undefined, right: T[] | T | undefined): T[] {\n return toArray(left).concat(toArray(right));\n}\n\nexport namespace ESLintConfig {\n /**\n *\n * @param configs\n */\n export function concat(...configs: ESLint.ConfigData[]): ESLint.ConfigData {\n return configs.reduce(\n (returnValue, config) => ({\n ...returnValue,\n ...config,\n env: { ...returnValue.env, ...config.env },\n extends: concatArray(returnValue.extends, config.extends),\n globals: { ...returnValue.globals, ...config.globals },\n overrides: concatArray(returnValue.overrides, config.overrides),\n parserOptions: { ...returnValue.parserOptions, ...config.parserOptions },\n plugins: concatArray(returnValue.plugins, config.plugins),\n rules: { ...returnValue.rules, ...config.rules },\n settings: { ...returnValue.settings, ...config.settings },\n }),\n {\n env: {},\n extends: [],\n globals: {},\n overrides: [],\n parserOptions: {},\n plugins: [],\n rules: {},\n settings: {},\n },\n );\n }\n\n /**\n * Always return 'off'. `_status` is the previous rule value.\n *\n * @param _status\n */\n export function fixme(_status: Linter.RuleLevel | [Linter.RuleLevel, ...any[]] | undefined) {\n return 'off' as const;\n }\n}\n","import { readFile, rm, writeFile, access } from 'node:fs/promises';\nimport { accessSync, constants, readFileSync, rmSync, writeFileSync } from 'node:fs';\n\nasync function exists(path: string) {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction existsSync(path: string) {\n try {\n accessSync(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nexport interface FileOptions {\n /**\n * File path\n */\n readonly path: string;\n /**\n * File target state\n */\n readonly state: 'present' | 'absent';\n /**\n * File content mapping function\n *\n * @param content\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n /**\n * File encoding\n */\n readonly encoding?: BufferEncoding;\n}\n\n/**\n * Ensure file is present/absent with content initialized or modified with `update\n *\n * @example\n * ```ts\n * await file({\n * path: 'foo/bar',\n * state: 'present',\n * update: (content) => content + '_test', // This will append '_test' after current content\n * })\n * ```\n *\n * @param options\n */\nexport async function file(options: FileOptions): Promise<void> {\n const { path, state, update, encoding = 'utf8' } = options;\n if (state === 'present') {\n const isPresent = await exists(path);\n const previousContent = isPresent ? await readFile(path, encoding) : '';\n const newContent = update == null ? '' : update(previousContent);\n if (newContent != null) {\n await writeFile(path, newContent, encoding);\n }\n } else {\n await rm(path, { force: true });\n }\n}\n\n/**\n * Ensure file is present/absent with content initialized or modified with `update\n *\n * @example\n * ```ts\n * fileSync({\n * path: 'foo/bar',\n * state: 'present',\n * update: (content) => content + '_test', // This will append '_test' after current content\n * })\n * ```\n *\n * @param options\n */\nexport function fileSync(options: FileOptions): void {\n const { path, state, update, encoding = 'utf8' } = options;\n if (state === 'present') {\n const isPresent = existsSync(path);\n const previousContent = isPresent ? readFileSync(path, encoding) : '';\n const newContent = update == null ? '' : update(previousContent);\n if (newContent != null) {\n writeFileSync(path, newContent, encoding);\n }\n } else {\n rmSync(path, { force: true });\n }\n}\n","import { type FileOptions, file, fileSync } from './file.js';\n\nexport interface BlockOptions {\n /**\n * The marker builder function that will take either `markerBegin` or `markerEnd`\n *\n * @default '# ${mark} MANAGED BLOCK'\n */\n marker?: (mark: 'Begin' | 'End') => string;\n /**\n * File path\n */\n path: string;\n /**\n * Block content to insert\n */\n block: string;\n /**\n * Insert position\n */\n insertPosition?: ['before', 'BeginningOfFile' | RegExp] | ['after', 'EndOfFile' | RegExp];\n /**\n * Block target state\n */\n state?: 'present' | 'absent';\n}\n\nconst EOF = 'EndOfFile';\nconst BOF = 'BeginningOfFile';\nconst insertAt = (str: string, index: number, toInsert: string) => str.slice(0, index) + toInsert + str.slice(index);\nconst matchLast = (string: string, regexp: RegExp) => {\n const matcher = new RegExp(regexp.source, `${regexp.flags}g`);\n let firstIndex = -1;\n let lastIndex = -1;\n let matches;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-constant-condition\n while (true) {\n matches = matcher.exec(string);\n if (matches == null) {\n break;\n }\n firstIndex = matches.index;\n lastIndex = matcher.lastIndex;\n }\n return { firstIndex, lastIndex };\n};\n\nfunction toFileOptions(options: BlockOptions): FileOptions {\n const {\n marker = (mark) => `# ${mark.toUpperCase()} MANAGED BLOCK`,\n path,\n block: blockName,\n insertPosition = ['after', EOF],\n state = 'present',\n } = options;\n\n const EOL = '\\n';\n const beginBlock = marker('Begin');\n const endBlock = marker('End');\n\n /**\n * @param content\n */\n function findBlock(content: string) {\n const startIndex = content.indexOf(beginBlock);\n const endIndex = content.indexOf(endBlock) + endBlock.length;\n\n return {\n endIndex,\n exists: startIndex !== -1 && endIndex >= 0,\n startIndex,\n };\n }\n\n function apply(fullContent: string, blockContent: string) {\n const found = findBlock(fullContent);\n const remove = state === 'absent';\n const replaceBlock = remove ? '' : beginBlock + EOL + blockContent + EOL + endBlock;\n const [positionDirection, positionAnchor] = insertPosition;\n\n if (found.exists) {\n return fullContent.slice(0, found.startIndex) + replaceBlock + fullContent.slice(found.endIndex);\n }\n if (remove) {\n return fullContent;\n }\n switch (positionDirection) {\n case 'before': {\n if (positionAnchor !== BOF) {\n const { firstIndex } = matchLast(fullContent, positionAnchor);\n if (firstIndex >= 0) {\n return insertAt(fullContent, firstIndex, replaceBlock + EOL);\n }\n }\n\n // Beginning of file\n return replaceBlock + EOL + fullContent;\n }\n case 'after': {\n // insert\n if (positionAnchor !== EOF) {\n const { lastIndex } = matchLast(fullContent, positionAnchor);\n if (lastIndex >= 0) {\n return insertAt(fullContent, lastIndex, EOL + replaceBlock);\n }\n }\n\n // end of file\n return fullContent + EOL + replaceBlock;\n }\n\n default: {\n throw new Error(`Unsupported position ${String(positionDirection)}`);\n }\n }\n }\n\n return {\n path,\n state: 'present',\n update: (sourceContent) => apply(sourceContent, blockName),\n };\n}\n\n/**\n * Replace asynchronously a block in file that follows pattern :\n *\n * marker(markerBegin)\n * ...\n * marker(markerEnd)\n *\n * @param options\n */\nexport function block(options: BlockOptions) {\n return file(toFileOptions(options));\n}\n\n/**\n * Replace synchronously a block in file that follows pattern :\n *\n * marker(markerBegin)\n * ...\n * marker(markerEnd)\n *\n * @param options\n */\nexport function blockSync(options: BlockOptions) {\n return fileSync(toFileOptions(options));\n}\n","/**\n * Resolves a module or promise-like object, returning the default export if available.\n *\n * @example\n * ```ts\n * await interopDefault(import('./module'));// Can be a commonjs or esm module\n * ```\n *\n * @template T - The type of the module or promise-like object.\n * @param {T | PromiseLike<T>} m - The module or promise-like object to resolve.\n * @returns {Promise<T extends { default: infer U } ? U : T>} A promise resolving to the default export if present, otherwise the module itself.\n */\n\nexport async function interopDefault<T>(m: T | PromiseLike<T>): Promise<T extends { default: infer U } ? U : T> {\n const resolved = await m;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n return (resolved as any).default ?? resolved;\n}\n","import { type FileOptions, file, fileSync } from './file.js';\n\nexport type JSONValue = null | number | string | boolean | JSONValue[] | { [key: string]: JSONValue };\n\nexport interface JSONOption<V = JSONValue> {\n /**\n * File path\n */\n readonly path: string;\n /**\n * File target state\n */\n readonly state: 'present' | 'absent';\n /**\n * File content mapping function\n *\n * @param content\n */\n readonly update?: ((content: V | undefined) => V | undefined) | undefined;\n /**\n * File encoding\n */\n readonly encoding?: BufferEncoding;\n}\n\nfunction toFileOption<Value>({ update, ...otherOptions }: JSONOption<Value>): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const jsonValue = content === '' ? undefined : (JSON.parse(content) as Value);\n\n return JSON.stringify(update(jsonValue));\n },\n };\n}\n\n/**\n * Ensure file is present/absent asynchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport async function json<Value>(options: JSONOption<Value>): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport function jsonSync<Value>(options: JSONOption<Value>): void {\n return fileSync(toFileOption(options));\n}\n","function escapeRegExp(value: string) {\n // eslint-disable-next-line unicorn/prefer-string-raw\n return value.replaceAll(/[$()*+.?[\\\\\\]^{|}]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nexport namespace Project {\n /**\n * A type of a file extension\n */\n export type Extension = `.${string}`;\n\n /**\n * Object hash of all well-known file extension category to file extensions mapping\n */\n export interface ExtensionRegistry {\n graphql: readonly Extension[];\n jpeg: readonly Extension[];\n javascript: readonly Extension[];\n javascriptreact: readonly Extension[];\n typescript: readonly Extension[];\n typescriptreact: readonly Extension[];\n yaml: readonly Extension[];\n }\n\n /**\n * A list of \"vscode-like\" language identifiers (i.e. \"javascript\", \"javascriptreact\")\n */\n export type LanguageId = keyof ExtensionRegistry;\n\n /**\n * Supported ECMA version\n *\n * @example\n * ```ts\n * Project.ecmaVersion() // 2022\n * ```\n */\n export function ecmaVersion() {\n return 2022 as const;\n }\n\n const registry: ExtensionRegistry = {\n graphql: ['.gql', '.graphql'],\n jpeg: ['.jpg', '.jpeg'],\n javascript: ['.js', '.cjs', '.mjs'],\n javascriptreact: ['.jsx'],\n typescript: ['.ts', '.cts', '.mts'],\n typescriptreact: ['.tsx'],\n yaml: ['.yaml', '.yml'],\n };\n\n /**\n * Return a list of extensions\n *\n * @example\n * ```ts\n * Project.queryExtensions(['javascript']); // ['.js', '.cjs', ...]\n * Project.queryExtensions(['typescript', 'typescriptreact']); // ['.ts', '.mts', ..., '.tsx']\n * ```\n *\n * @param languages\n */\n export function queryExtensions(languages: LanguageId[]): readonly Extension[] {\n return languages\n .reduce<Extension[]>(\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n (previousValue, currentValue) => previousValue.concat(registry[currentValue] ?? ([] as Extension[])),\n [],\n )\n .sort();\n }\n\n /**\n * Supported file extensions\n *\n * @example\n * ```ts\n * Project.sourceExtensions() // ['.ts', '.js', ...]\n * ```\n */\n export function sourceExtensions() {\n return queryExtensions(['javascript', 'javascriptreact', 'typescript', 'typescriptreact']);\n }\n\n const RESOURCE_EXTENSIONS: readonly Extension[] = Object.freeze([\n '.css',\n '.sass',\n '.scss',\n '.less',\n '.gif',\n '.png',\n '.svg',\n ...queryExtensions(['graphql', 'jpeg', 'yaml']),\n ]);\n\n /**\n * Resource file extensions\n *\n * @example\n * ```ts\n * Project.resourceExtensions() // ['.css', '.sass', ...]\n * ```\n */\n export function resourceExtensions() {\n return RESOURCE_EXTENSIONS;\n }\n\n const IGNORED = Object.freeze([\n 'node_modules/',\n 'build/',\n 'cjs/',\n 'coverage/',\n 'dist/',\n 'dts/',\n 'esm/',\n 'lib/',\n 'mjs/',\n 'umd/',\n ]);\n\n /**\n * Files and folders to always ignore\n *\n * @example\n * ```ts\n * IGNORED // ['node_modules/', 'build/', ...]\n * ```\n */\n export function ignored() {\n return IGNORED;\n }\n\n /**\n * Return a RegExp that will match any list of extensions\n *\n * @example\n * ```ts\n * Project.extensionsToMatcher(['.js', '.ts']) // RegExp = /(\\.js|\\.ts)$/\n * ```\n */\n export function extensionsToMatcher(extensions: readonly Extension[]): RegExp {\n return new RegExp(`(${extensions.map(escapeRegExp).join('|')})$`);\n }\n\n /**\n * Return a glob matcher that will match any list of extensions\n *\n * @example\n * ```ts\n * Project.extensionsToGlob(['.js', '.ts']) // '*.+(js|ts)'\n * ```\n */\n export function extensionsToGlob(extensions: readonly Extension[]): string {\n return `*.+(${extensions.map((_) => _.replace(/^\\./, '')).join('|')})`;\n }\n}\n","/**\n * Project common scripts\n */\nexport const ProjectScript = {\n Build: 'build',\n Clean: 'clean',\n CodeAnalysis: 'code-analysis',\n Coverage: 'coverage',\n Develop: 'develop',\n Docs: 'docs',\n Format: 'format',\n Install: 'install',\n Lint: 'lint',\n Prepare: 'prepare',\n Release: 'release',\n Rescue: 'rescue',\n Spellcheck: 'spellcheck',\n Test: 'test',\n Validate: 'validate',\n} as const;\nexport type ProjectScript = (typeof ProjectScript)[keyof typeof ProjectScript];\n"]}
1
+ {"version":3,"sources":["../src/directory.ts","../src/ESLintConfig.ts","../src/file.ts","../src/block.ts","../src/interopDefault.ts","../src/json.ts","../src/Project.ts","../src/ProjectScript.ts","../src/exec.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"names":["access","constants","mkdir","rm","existsSync","mkdirSync","rmSync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A,eAAsB,YAAY,OAA4C,EAAA;AAC5E,EAAM,MAAA,EAAE,KAAO,EAAA,MAAA,EAAW,GAAA,OAAA;AAC1B,EAAA,IAAI,UAAU,SAAW,EAAA;AACvB,IAAA,MAAM,IAAK,CAAA,MAAA,EAAQ,CAAC,KAAA,EAAO,SAAW,EAAA,CAAA,EAAG,MAAU,IAAA,IAAA,GAAO,OAAU,GAAA,MAAA,EAAQ,CAAA,CAAE,CAAC,CAAA;AAAA,GAC1E,MAAA;AAEL,IAAM,MAAA,IAAI,MAAM,iBAAiB,CAAA;AAAA;AAErC","file":"index.cjs","sourcesContent":["import { existsSync, mkdirSync, rmSync } from 'node:fs';\nimport { access, constants, mkdir, rm } from 'node:fs/promises';\n\nasync function exists(path: string) {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nexport interface DirectoryOptions {\n /**\n * Directory path\n */\n readonly path: string;\n /**\n * Directory target state\n */\n readonly state: 'present' | 'absent';\n}\n\n/**\n * Ensure directory is present/absent\n *\n * @example\n * ```ts\n * await directory({\n * path: 'foo/bar',\n * state: 'present',\n * })\n * ```\n *\n * @param options\n */\nexport async function directory(options: DirectoryOptions): Promise<void> {\n const { path, state } = options;\n const isPresent = await exists(path);\n if (state === 'present') {\n if (!isPresent) {\n await mkdir(path, { recursive: true });\n }\n } else if (isPresent) {\n await rm(path, { recursive: true });\n }\n}\n\n/**\n * Ensure directory is present/absent\n *\n * @example\n * ```ts\n * await directorySync({\n * path: 'foo/bar',\n * state: 'present',\n * })\n * ```\n *\n * @param options\n */\nexport function directorySync(options: DirectoryOptions): void {\n const { path, state } = options;\n const isPresent = existsSync(path);\n if (state === 'present') {\n if (!isPresent) {\n mkdirSync(path, { recursive: true });\n }\n } else if (isPresent) {\n rmSync(path, { recursive: true });\n }\n}\n","import type { ESLint } from 'eslint';\n\nfunction toArray<T>(value: T[] | T | undefined): T[] {\n if (value == null) {\n return [];\n }\n if (Array.isArray(value)) {\n return value;\n }\n return [value];\n}\n\nfunction concatArray<T>(left: T[] | T | undefined, right: T[] | T | undefined): T[] {\n return toArray(left).concat(toArray(right));\n}\n\nexport namespace ESLintConfig {\n /**\n *\n * @param configs\n */\n export function concat(...configs: ESLint.ConfigData[]): ESLint.ConfigData {\n return configs.reduce(\n (returnValue, config) => ({\n ...returnValue,\n ...config,\n env: { ...returnValue.env, ...config.env },\n extends: concatArray(returnValue.extends, config.extends),\n globals: { ...returnValue.globals, ...config.globals },\n overrides: concatArray(returnValue.overrides, config.overrides),\n parserOptions: { ...returnValue.parserOptions, ...config.parserOptions },\n plugins: concatArray(returnValue.plugins, config.plugins),\n rules: { ...returnValue.rules, ...config.rules },\n settings: { ...returnValue.settings, ...config.settings },\n }),\n {\n env: {},\n extends: [],\n globals: {},\n overrides: [],\n parserOptions: {},\n plugins: [],\n rules: {},\n settings: {},\n },\n );\n }\n\n /**\n * Always return 'off'. `_status` is the previous rule value.\n *\n * @param _status\n */\n export function fixme(_status: string | number | [string | number, ...any[]] | undefined) {\n return 'off' as const;\n }\n\n /**\n * Renames rules in the given object according to the given map.\n *\n * Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object\n * `{ 'old-prefix/rule-name': 'error' }`, this function will return\n * `{ 'new-prefix/rule-name': 'error' }`.\n *\n * @param rules - The object containing the rules to rename.\n * @param map - The object containing the rename map.\n * @returns The object with the renamed rules.\n */\n export function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any> {\n return Object.fromEntries(\n Object.entries(rules).map(([key, value]) => {\n for (const [from, to] of Object.entries(map)) {\n if (key.startsWith(`${from}/`)) return [to + key.slice(from.length), value];\n }\n return [key, value];\n }),\n );\n }\n}\n","import { readFile, rm, writeFile, access } from 'node:fs/promises';\nimport { accessSync, constants, readFileSync, rmSync, writeFileSync } from 'node:fs';\n\nasync function exists(path: string) {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction existsSync(path: string) {\n try {\n accessSync(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nexport interface FileOptions {\n /**\n * File path\n */\n readonly path: string;\n /**\n * File target state\n */\n readonly state: 'present' | 'absent';\n /**\n * File content mapping function\n *\n * @param content\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n /**\n * File encoding\n */\n readonly encoding?: BufferEncoding;\n}\n\n/**\n * Ensure file is present/absent with content initialized or modified with `update\n *\n * @example\n * ```ts\n * await file({\n * path: 'foo/bar',\n * state: 'present',\n * update: (content) => content + '_test', // This will append '_test' after current content\n * })\n * ```\n *\n * @param options\n */\nexport async function file(options: FileOptions): Promise<void> {\n const { path, state, update, encoding = 'utf8' } = options;\n if (state === 'present') {\n const isPresent = await exists(path);\n const previousContent = isPresent ? await readFile(path, encoding) : '';\n const newContent = update == null ? '' : update(previousContent);\n if (newContent != null) {\n await writeFile(path, newContent, encoding);\n }\n } else {\n await rm(path, { force: true });\n }\n}\n\n/**\n * Ensure file is present/absent with content initialized or modified with `update\n *\n * @example\n * ```ts\n * fileSync({\n * path: 'foo/bar',\n * state: 'present',\n * update: (content) => content + '_test', // This will append '_test' after current content\n * })\n * ```\n *\n * @param options\n */\nexport function fileSync(options: FileOptions): void {\n const { path, state, update, encoding = 'utf8' } = options;\n if (state === 'present') {\n const isPresent = existsSync(path);\n const previousContent = isPresent ? readFileSync(path, encoding) : '';\n const newContent = update == null ? '' : update(previousContent);\n if (newContent != null) {\n writeFileSync(path, newContent, encoding);\n }\n } else {\n rmSync(path, { force: true });\n }\n}\n","import { type FileOptions, file, fileSync } from './file.js';\n\nexport interface BlockOptions {\n /**\n * The marker builder function that will take either `markerBegin` or `markerEnd`\n *\n * @default '# ${mark} MANAGED BLOCK'\n */\n marker?: (mark: 'Begin' | 'End') => string;\n /**\n * File path\n */\n path: string;\n /**\n * Block content to insert\n */\n block: string;\n /**\n * Insert position\n */\n insertPosition?: ['before', 'BeginningOfFile' | RegExp] | ['after', 'EndOfFile' | RegExp];\n /**\n * Block target state\n */\n state?: 'present' | 'absent';\n}\n\nconst EOF = 'EndOfFile';\nconst BOF = 'BeginningOfFile';\nconst insertAt = (str: string, index: number, toInsert: string) => str.slice(0, index) + toInsert + str.slice(index);\nconst matchLast = (string: string, regexp: RegExp) => {\n const matcher = new RegExp(regexp.source, `${regexp.flags}g`);\n let firstIndex = -1;\n let lastIndex = -1;\n let matches;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-constant-condition\n while (true) {\n matches = matcher.exec(string);\n if (matches == null) {\n break;\n }\n firstIndex = matches.index;\n lastIndex = matcher.lastIndex;\n }\n return { firstIndex, lastIndex };\n};\n\nfunction toFileOptions(options: BlockOptions): FileOptions {\n const {\n marker = (mark) => `# ${mark.toUpperCase()} MANAGED BLOCK`,\n path,\n block: blockName,\n insertPosition = ['after', EOF],\n state = 'present',\n } = options;\n\n const EOL = '\\n';\n const beginBlock = marker('Begin');\n const endBlock = marker('End');\n\n /**\n * @param content\n */\n function findBlock(content: string) {\n const startIndex = content.indexOf(beginBlock);\n const endIndex = content.indexOf(endBlock) + endBlock.length;\n\n return {\n endIndex,\n exists: startIndex !== -1 && endIndex >= 0,\n startIndex,\n };\n }\n\n function apply(fullContent: string, blockContent: string) {\n const found = findBlock(fullContent);\n const remove = state === 'absent';\n const replaceBlock = remove ? '' : beginBlock + EOL + blockContent + EOL + endBlock;\n const [positionDirection, positionAnchor] = insertPosition;\n\n if (found.exists) {\n return fullContent.slice(0, found.startIndex) + replaceBlock + fullContent.slice(found.endIndex);\n }\n if (remove) {\n return fullContent;\n }\n switch (positionDirection) {\n case 'before': {\n if (positionAnchor !== BOF) {\n const { firstIndex } = matchLast(fullContent, positionAnchor);\n if (firstIndex >= 0) {\n return insertAt(fullContent, firstIndex, replaceBlock + EOL);\n }\n }\n\n // Beginning of file\n return replaceBlock + EOL + fullContent;\n }\n case 'after': {\n // insert\n if (positionAnchor !== EOF) {\n const { lastIndex } = matchLast(fullContent, positionAnchor);\n if (lastIndex >= 0) {\n return insertAt(fullContent, lastIndex, EOL + replaceBlock);\n }\n }\n\n // end of file\n return fullContent + EOL + replaceBlock;\n }\n\n default: {\n throw new Error(`Unsupported position ${String(positionDirection)}`);\n }\n }\n }\n\n return {\n path,\n state: 'present',\n update: (sourceContent) => apply(sourceContent, blockName),\n };\n}\n\n/**\n * Replace asynchronously a block in file that follows pattern :\n *\n * marker(markerBegin)\n * ...\n * marker(markerEnd)\n *\n * @param options\n */\nexport function block(options: BlockOptions) {\n return file(toFileOptions(options));\n}\n\n/**\n * Replace synchronously a block in file that follows pattern :\n *\n * marker(markerBegin)\n * ...\n * marker(markerEnd)\n *\n * @param options\n */\nexport function blockSync(options: BlockOptions) {\n return fileSync(toFileOptions(options));\n}\n","/**\n * Resolves a module or promise-like object, returning the default export if available.\n *\n * @example\n * ```ts\n * await interopDefault(import('./module'));// Can be a commonjs or esm module\n * ```\n *\n * @template T - The type of the module or promise-like object.\n * @param {T | PromiseLike<T>} m - The module or promise-like object to resolve.\n * @returns {Promise<T extends { default: infer U } ? U : T>} A promise resolving to the default export if present, otherwise the module itself.\n */\n\nexport async function interopDefault<T>(m: T | PromiseLike<T>): Promise<T extends { default: infer U } ? U : T> {\n const resolved = await m;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access\n return (resolved as any).default ?? resolved;\n}\n","import { type FileOptions, file, fileSync } from './file.js';\n\nexport type JSONValue = null | number | string | boolean | JSONValue[] | { [key: string]: JSONValue };\n\nexport interface JSONOption<V = JSONValue> {\n /**\n * File path\n */\n readonly path: string;\n /**\n * File target state\n */\n readonly state: 'present' | 'absent';\n /**\n * File content mapping function\n *\n * @param content\n */\n readonly update?: ((content: V | undefined) => V | undefined) | undefined;\n /**\n * File encoding\n */\n readonly encoding?: BufferEncoding;\n}\n\nfunction toFileOption<Value>({ update, ...otherOptions }: JSONOption<Value>): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const jsonValue = content === '' ? undefined : (JSON.parse(content) as Value);\n\n return JSON.stringify(update(jsonValue));\n },\n };\n}\n\n/**\n * Ensure file is present/absent asynchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport async function json<Value>(options: JSONOption<Value>): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content value initialized or modified with `update`\n *\n * @param options\n */\nexport function jsonSync<Value>(options: JSONOption<Value>): void {\n return fileSync(toFileOption(options));\n}\n","import type { LanguageId } from './LanguageId.js';\n\nfunction escapeRegExp(value: string) {\n // eslint-disable-next-line unicorn/prefer-string-raw\n return value.replaceAll(/[$()*+.?[\\\\\\]^{|}]/g, '\\\\$&'); // $& means the whole matched string\n}\n\nexport namespace Project {\n /**\n * A type of a file extension\n */\n export type Extension = `.${string}`;\n\n /**\n * Object hash of all well-known file extension category to file extensions mapping\n */\n export type ExtensionRegistry = { [K in LanguageId]: readonly Extension[] };\n\n /**\n * Supported ECMA version\n *\n * @example\n * ```ts\n * Project.ecmaVersion() // 2022\n * ```\n */\n export function ecmaVersion() {\n return 2022 as const;\n }\n\n const registry: ExtensionRegistry = {\n css: ['.css'],\n graphql: ['.gql', '.graphql'],\n javascript: ['.js', '.cjs', '.mjs'],\n javascriptreact: ['.jsx'],\n jpeg: ['.jpg', '.jpeg'],\n json: ['.json'],\n jsonc: ['.jsonc'],\n less: ['.less'],\n markdown: ['.markdown', '.mdown', '.mkd', '.md'],\n sass: ['.sass'],\n scss: ['.scss'],\n typescript: ['.ts', '.cts', '.mts'],\n typescriptreact: ['.tsx'],\n vue: ['.vue'],\n yaml: ['.yaml', '.yml'],\n };\n\n /**\n * Return a list of extensions\n *\n * @example\n * ```ts\n * Project.queryExtensions(['javascript']); // ['.js', '.cjs', ...]\n * Project.queryExtensions(['typescript', 'typescriptreact']); // ['.ts', '.mts', ..., '.tsx']\n * ```\n *\n * @param languages\n */\n export function queryExtensions(languages: LanguageId[]): readonly Extension[] {\n return languages\n .reduce<\n Extension[]\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n >((previousValue, currentValue) => previousValue.concat(registry[currentValue] ?? ([] as Extension[])), [])\n .sort();\n }\n\n /**\n * Supported file extensions\n *\n * @example\n * ```ts\n * Project.sourceExtensions() // ['.ts', '.js', ...]\n * ```\n */\n export function sourceExtensions() {\n return queryExtensions(['javascript', 'javascriptreact', 'typescript', 'typescriptreact']);\n }\n\n const RESOURCE_EXTENSIONS: readonly Extension[] = Object.freeze([\n '.gif',\n '.png',\n '.svg',\n ...queryExtensions(['css', 'graphql', 'jpeg', 'less', 'sass', 'sass', 'yaml']),\n ]);\n\n /**\n * Resource file extensions\n *\n * @example\n * ```ts\n * Project.resourceExtensions() // ['.css', '.sass', ...]\n * ```\n */\n export function resourceExtensions() {\n return RESOURCE_EXTENSIONS;\n }\n\n const IGNORED = Object.freeze([\n 'node_modules/',\n 'build/',\n 'cjs/',\n 'coverage/',\n 'dist/',\n 'dts/',\n 'esm/',\n 'lib/',\n 'mjs/',\n 'umd/',\n ]);\n\n /**\n * Files and folders to always ignore\n *\n * @example\n * ```ts\n * IGNORED // ['node_modules/', 'build/', ...]\n * ```\n */\n export function ignored() {\n return IGNORED;\n }\n\n /**\n * Return a RegExp that will match any list of extensions\n *\n * @example\n * ```ts\n * Project.extensionsToMatcher(['.js', '.ts']) // RegExp = /(\\.js|\\.ts)$/\n * ```\n */\n export function extensionsToMatcher(extensions: readonly Extension[]): RegExp {\n return new RegExp(`(${extensions.map(escapeRegExp).join('|')})$`);\n }\n\n /**\n * Return a glob matcher that will match any list of extensions\n *\n * @example\n * ```ts\n * Project.extensionsToGlob(['.js', '.ts']) // '*.+(js|ts)'\n * ```\n */\n export function extensionsToGlob(extensions: readonly Extension[]): string {\n return `*.+(${extensions.map((_) => _.replace(/^\\./, '')).join('|')})`;\n }\n}\n","/**\n * Project common scripts\n */\nexport const ProjectScript = {\n Build: 'build',\n Clean: 'clean',\n CodeAnalysis: 'code-analysis',\n Coverage: 'coverage',\n Develop: 'develop',\n Docs: 'docs',\n Format: 'format',\n Install: 'install',\n Lint: 'lint',\n Prepare: 'prepare',\n Release: 'release',\n Rescue: 'rescue',\n Spellcheck: 'spellcheck',\n Test: 'test',\n Validate: 'validate',\n} as const;\nexport type ProjectScript = (typeof ProjectScript)[keyof typeof ProjectScript];\n","import { spawn, spawnSync } from 'node:child_process';\n\nexport interface ExecOptions {\n /**\n * Current working directory\n */\n cwd?: string;\n /**\n * Stdio options\n */\n stdio?: 'inherit' | 'pipe' | 'ignore';\n}\n\n/**\n * Runs a command in a shell and returns a promise that resolves with an object\n * containing the stdout and stderr strings.\n *\n * @param command - The command to run\n * @param args - The arguments to pass to the command\n * @returns A promise that resolves with an object like `{ stdout: string, stderr: string }`\n */\nexport function execSync(\n command: string,\n args: ReadonlyArray<string>,\n options?: ExecOptions,\n): { stdout: string; stderr: string } {\n const result = spawnSync(command, args, { ...options });\n const encoding = 'utf8';\n\n return { stdout: result.stdout.toString(encoding), stderr: result.stderr.toString(encoding) };\n}\n\n/**\n * Runs a command in a shell and returns a promise that resolves with an object\n * containing the stdout and stderr strings.\n *\n * @param command - The command to run\n * @param args - The arguments to pass to the command\n * @returns A promise that resolves with an object containing the stdout and stderr strings\n */\nexport async function exec(\n command: string,\n args: ReadonlyArray<string>,\n options?: ExecOptions,\n): Promise<{ stdout: string; stderr: string }> {\n return new Promise((resolve, reject) => {\n const encoding = 'utf8';\n const child = spawn(command, args, { ...options });\n let stdout = '';\n let stderr = '';\n\n // Capture the stdout and stderr streams\n if (child.stdout != null) {\n child.stdout.on('data', (data) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n stdout += data.toString(encoding);\n });\n }\n if (child.stderr != null) {\n child.stderr.on('data', (data) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n stderr += data.toString(encoding);\n });\n }\n // Handle process exit\n child.on('close', (_code) => {\n resolve({ stdout, stderr });\n });\n\n // Handle errors\n child.on('error', reject);\n });\n}\n","import { exec, execSync } from './exec.js';\n\nexport interface YarnConfigOptions {\n /**\n * Configuration key\n */\n readonly key: string;\n\n /**\n * Option target state\n */\n readonly state: 'present' | 'absent';\n\n /**\n * File content mapping function\n *\n * @param content\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n}\n\n/**\n * Synchronous version of {@link yarnConfig}\n *\n * @example\n * yarnConfigSync({\n * key: 'nodeLinker',\n * state: 'present',\n * update: (content) => content.replace('node-modules', 'hoisted'),\n * })\n */\nexport function yarnConfigSync(options: YarnConfigOptions) {\n const { key, state, update } = options;\n if (state === 'present') {\n const { stdout } = execSync('yarn', ['config', 'get', String(key)]);\n execSync('yarn', ['config', 'set', String(key), `${update == null ? '' : update(stdout)}`]);\n } else {\n execSync('yarn', ['config', 'unset']);\n }\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @example\n * await yarnConfig({\n * key: 'nodeLinker',\n * state: 'present',\n * update: (content) => content.replace('node-modules', 'hoisted'),\n * })\n */\nexport async function yarnConfig(options: YarnConfigOptions): Promise<void> {\n const { key, state, update } = options;\n if (state === 'present') {\n const { stdout } = await exec('yarn', ['config', 'get', String(key)]);\n await exec('yarn', ['config', 'set', String(key), `${update == null ? '' : update(stdout)}`]);\n } else {\n await exec('yarn', ['config', 'unset']);\n }\n}\n","import { exec, execSync } from './exec.js';\n\nexport type YarnVersionKind = 'berry' | 'classic';\n\nexport interface YarnVersionOptions {\n /**\n * Option target state\n */\n readonly state: 'present' | 'absent';\n\n /**\n * Version mapping function\n *\n * @param content\n */\n readonly update?: (() => YarnVersionKind | undefined) | undefined;\n}\n\n/**\n * Synchronous version of {@link yarnVersion}\n *\n * @example\n * yarnVersionSync({\n * state: 'present',\n * update: () => 'berry', // or 'classic'\n * })\n */\nexport function yarnVersionSync(options: YarnVersionOptions) {\n const { state, update } = options;\n if (state === 'present') {\n execSync('yarn', ['set', 'version', `${update == null ? 'berry' : update()}`]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @example\n * await yarnVersion({\n * state: 'present',\n * update: () => 'berry', // or 'classic'\n * })\n */\nexport async function yarnVersion(options: YarnVersionOptions): Promise<void> {\n const { state, update } = options;\n if (state === 'present') {\n await exec('yarn', ['set', 'version', `${update == null ? 'berry' : update()}`]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ESLint, Linter } from 'eslint';
1
+ import { ESLint } from 'eslint';
2
2
 
3
3
  interface DirectoryOptions {
4
4
  /**
@@ -50,7 +50,19 @@ declare namespace ESLintConfig {
50
50
  *
51
51
  * @param _status
52
52
  */
53
- function fixme(_status: Linter.RuleLevel | [Linter.RuleLevel, ...any[]] | undefined): "off";
53
+ function fixme(_status: string | number | [string | number, ...any[]] | undefined): "off";
54
+ /**
55
+ * Renames rules in the given object according to the given map.
56
+ *
57
+ * Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object
58
+ * `{ 'old-prefix/rule-name': 'error' }`, this function will return
59
+ * `{ 'new-prefix/rule-name': 'error' }`.
60
+ *
61
+ * @param rules - The object containing the rules to rename.
62
+ * @param map - The object containing the rename map.
63
+ * @returns The object with the renamed rules.
64
+ */
65
+ function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
54
66
  }
55
67
 
56
68
  interface BlockOptions {
@@ -165,6 +177,28 @@ declare function interopDefault<T>(m: T | PromiseLike<T>): Promise<T extends {
165
177
  default: infer U;
166
178
  } ? U : T>;
167
179
 
180
+ interface LanguageIdMap {
181
+ css: true;
182
+ graphql: true;
183
+ javascript: true;
184
+ javascriptreact: true;
185
+ jpeg: true;
186
+ json: true;
187
+ jsonc: true;
188
+ less: true;
189
+ markdown: true;
190
+ sass: true;
191
+ scss: true;
192
+ typescript: true;
193
+ typescriptreact: true;
194
+ vue: true;
195
+ yaml: true;
196
+ }
197
+ /**
198
+ * A list of "vscode-like" language identifiers (i.e. "javascript", "javascriptreact")
199
+ */
200
+ type LanguageId = keyof LanguageIdMap;
201
+
168
202
  type JSONValue = null | number | string | boolean | JSONValue[] | {
169
203
  [key: string]: JSONValue;
170
204
  };
@@ -209,19 +243,9 @@ declare namespace Project {
209
243
  /**
210
244
  * Object hash of all well-known file extension category to file extensions mapping
211
245
  */
212
- interface ExtensionRegistry {
213
- graphql: readonly Extension[];
214
- jpeg: readonly Extension[];
215
- javascript: readonly Extension[];
216
- javascriptreact: readonly Extension[];
217
- typescript: readonly Extension[];
218
- typescriptreact: readonly Extension[];
219
- yaml: readonly Extension[];
220
- }
221
- /**
222
- * A list of "vscode-like" language identifiers (i.e. "javascript", "javascriptreact")
223
- */
224
- type LanguageId = keyof ExtensionRegistry;
246
+ type ExtensionRegistry = {
247
+ [K in LanguageId]: readonly Extension[];
248
+ };
225
249
  /**
226
250
  * Supported ECMA version
227
251
  *
@@ -312,4 +336,77 @@ declare const ProjectScript: {
312
336
  };
313
337
  type ProjectScript = (typeof ProjectScript)[keyof typeof ProjectScript];
314
338
 
315
- export { type BlockOptions, type DirectoryOptions, ESLintConfig, type FileOptions, type JSONOption, type JSONValue, Project, ProjectScript, block, blockSync, directory, directorySync, file, fileSync, interopDefault, json, jsonSync };
339
+ interface YarnConfigOptions {
340
+ /**
341
+ * Configuration key
342
+ */
343
+ readonly key: string;
344
+ /**
345
+ * Option target state
346
+ */
347
+ readonly state: 'present' | 'absent';
348
+ /**
349
+ * File content mapping function
350
+ *
351
+ * @param content
352
+ */
353
+ readonly update?: ((content: string) => string | undefined) | undefined;
354
+ }
355
+ /**
356
+ * Synchronous version of {@link yarnConfig}
357
+ *
358
+ * @example
359
+ * yarnConfigSync({
360
+ * key: 'nodeLinker',
361
+ * state: 'present',
362
+ * update: (content) => content.replace('node-modules', 'hoisted'),
363
+ * })
364
+ */
365
+ declare function yarnConfigSync(options: YarnConfigOptions): void;
366
+ /**
367
+ * Set/Unset yarn configuration value
368
+ *
369
+ * @example
370
+ * await yarnConfig({
371
+ * key: 'nodeLinker',
372
+ * state: 'present',
373
+ * update: (content) => content.replace('node-modules', 'hoisted'),
374
+ * })
375
+ */
376
+ declare function yarnConfig(options: YarnConfigOptions): Promise<void>;
377
+
378
+ type YarnVersionKind = 'berry' | 'classic';
379
+ interface YarnVersionOptions {
380
+ /**
381
+ * Option target state
382
+ */
383
+ readonly state: 'present' | 'absent';
384
+ /**
385
+ * Version mapping function
386
+ *
387
+ * @param content
388
+ */
389
+ readonly update?: (() => YarnVersionKind | undefined) | undefined;
390
+ }
391
+ /**
392
+ * Synchronous version of {@link yarnVersion}
393
+ *
394
+ * @example
395
+ * yarnVersionSync({
396
+ * state: 'present',
397
+ * update: () => 'berry', // or 'classic'
398
+ * })
399
+ */
400
+ declare function yarnVersionSync(options: YarnVersionOptions): void;
401
+ /**
402
+ * Set/Unset yarn configuration value
403
+ *
404
+ * @example
405
+ * await yarnVersion({
406
+ * state: 'present',
407
+ * update: () => 'berry', // or 'classic'
408
+ * })
409
+ */
410
+ declare function yarnVersion(options: YarnVersionOptions): Promise<void>;
411
+
412
+ export { type BlockOptions, type DirectoryOptions, ESLintConfig, type FileOptions, type JSONOption, type JSONValue, type LanguageId, type LanguageIdMap, Project, ProjectScript, type YarnConfigOptions, type YarnVersionKind, type YarnVersionOptions, block, blockSync, directory, directorySync, file, fileSync, interopDefault, json, jsonSync, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ESLint, Linter } from 'eslint';
1
+ import { ESLint } from 'eslint';
2
2
 
3
3
  interface DirectoryOptions {
4
4
  /**
@@ -50,7 +50,19 @@ declare namespace ESLintConfig {
50
50
  *
51
51
  * @param _status
52
52
  */
53
- function fixme(_status: Linter.RuleLevel | [Linter.RuleLevel, ...any[]] | undefined): "off";
53
+ function fixme(_status: string | number | [string | number, ...any[]] | undefined): "off";
54
+ /**
55
+ * Renames rules in the given object according to the given map.
56
+ *
57
+ * Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object
58
+ * `{ 'old-prefix/rule-name': 'error' }`, this function will return
59
+ * `{ 'new-prefix/rule-name': 'error' }`.
60
+ *
61
+ * @param rules - The object containing the rules to rename.
62
+ * @param map - The object containing the rename map.
63
+ * @returns The object with the renamed rules.
64
+ */
65
+ function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
54
66
  }
55
67
 
56
68
  interface BlockOptions {
@@ -165,6 +177,28 @@ declare function interopDefault<T>(m: T | PromiseLike<T>): Promise<T extends {
165
177
  default: infer U;
166
178
  } ? U : T>;
167
179
 
180
+ interface LanguageIdMap {
181
+ css: true;
182
+ graphql: true;
183
+ javascript: true;
184
+ javascriptreact: true;
185
+ jpeg: true;
186
+ json: true;
187
+ jsonc: true;
188
+ less: true;
189
+ markdown: true;
190
+ sass: true;
191
+ scss: true;
192
+ typescript: true;
193
+ typescriptreact: true;
194
+ vue: true;
195
+ yaml: true;
196
+ }
197
+ /**
198
+ * A list of "vscode-like" language identifiers (i.e. "javascript", "javascriptreact")
199
+ */
200
+ type LanguageId = keyof LanguageIdMap;
201
+
168
202
  type JSONValue = null | number | string | boolean | JSONValue[] | {
169
203
  [key: string]: JSONValue;
170
204
  };
@@ -209,19 +243,9 @@ declare namespace Project {
209
243
  /**
210
244
  * Object hash of all well-known file extension category to file extensions mapping
211
245
  */
212
- interface ExtensionRegistry {
213
- graphql: readonly Extension[];
214
- jpeg: readonly Extension[];
215
- javascript: readonly Extension[];
216
- javascriptreact: readonly Extension[];
217
- typescript: readonly Extension[];
218
- typescriptreact: readonly Extension[];
219
- yaml: readonly Extension[];
220
- }
221
- /**
222
- * A list of "vscode-like" language identifiers (i.e. "javascript", "javascriptreact")
223
- */
224
- type LanguageId = keyof ExtensionRegistry;
246
+ type ExtensionRegistry = {
247
+ [K in LanguageId]: readonly Extension[];
248
+ };
225
249
  /**
226
250
  * Supported ECMA version
227
251
  *
@@ -312,4 +336,77 @@ declare const ProjectScript: {
312
336
  };
313
337
  type ProjectScript = (typeof ProjectScript)[keyof typeof ProjectScript];
314
338
 
315
- export { type BlockOptions, type DirectoryOptions, ESLintConfig, type FileOptions, type JSONOption, type JSONValue, Project, ProjectScript, block, blockSync, directory, directorySync, file, fileSync, interopDefault, json, jsonSync };
339
+ interface YarnConfigOptions {
340
+ /**
341
+ * Configuration key
342
+ */
343
+ readonly key: string;
344
+ /**
345
+ * Option target state
346
+ */
347
+ readonly state: 'present' | 'absent';
348
+ /**
349
+ * File content mapping function
350
+ *
351
+ * @param content
352
+ */
353
+ readonly update?: ((content: string) => string | undefined) | undefined;
354
+ }
355
+ /**
356
+ * Synchronous version of {@link yarnConfig}
357
+ *
358
+ * @example
359
+ * yarnConfigSync({
360
+ * key: 'nodeLinker',
361
+ * state: 'present',
362
+ * update: (content) => content.replace('node-modules', 'hoisted'),
363
+ * })
364
+ */
365
+ declare function yarnConfigSync(options: YarnConfigOptions): void;
366
+ /**
367
+ * Set/Unset yarn configuration value
368
+ *
369
+ * @example
370
+ * await yarnConfig({
371
+ * key: 'nodeLinker',
372
+ * state: 'present',
373
+ * update: (content) => content.replace('node-modules', 'hoisted'),
374
+ * })
375
+ */
376
+ declare function yarnConfig(options: YarnConfigOptions): Promise<void>;
377
+
378
+ type YarnVersionKind = 'berry' | 'classic';
379
+ interface YarnVersionOptions {
380
+ /**
381
+ * Option target state
382
+ */
383
+ readonly state: 'present' | 'absent';
384
+ /**
385
+ * Version mapping function
386
+ *
387
+ * @param content
388
+ */
389
+ readonly update?: (() => YarnVersionKind | undefined) | undefined;
390
+ }
391
+ /**
392
+ * Synchronous version of {@link yarnVersion}
393
+ *
394
+ * @example
395
+ * yarnVersionSync({
396
+ * state: 'present',
397
+ * update: () => 'berry', // or 'classic'
398
+ * })
399
+ */
400
+ declare function yarnVersionSync(options: YarnVersionOptions): void;
401
+ /**
402
+ * Set/Unset yarn configuration value
403
+ *
404
+ * @example
405
+ * await yarnVersion({
406
+ * state: 'present',
407
+ * update: () => 'berry', // or 'classic'
408
+ * })
409
+ */
410
+ declare function yarnVersion(options: YarnVersionOptions): Promise<void>;
411
+
412
+ export { type BlockOptions, type DirectoryOptions, ESLintConfig, type FileOptions, type JSONOption, type JSONValue, type LanguageId, type LanguageIdMap, Project, ProjectScript, type YarnConfigOptions, type YarnVersionKind, type YarnVersionOptions, block, blockSync, directory, directorySync, file, fileSync, interopDefault, json, jsonSync, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };