@w5s/configurator-core 1.22.0 → 1.23.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 +70 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -22
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +12 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -54
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/directory.ts +7 -7
- package/src/file.ts +7 -7
- package/src/index.ts +1 -0
- package/src/{__exists.ts → internal/fileExists.ts} +1 -1
- package/src/{__existsSync.ts → internal/fileExistsSync.ts} +1 -1
- package/src/internal/resolveCommentStyle.ts +1 -0
- package/src/{__toMode.ts → internal/toMode.ts} +2 -2
- package/src/isConfigPresent.ts +6 -6
- package/src/toolVersions.ts +54 -0
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,16 +20,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let node_fs = require("node:fs");
|
|
25
24
|
let node_fs_promises = require("node:fs/promises");
|
|
26
25
|
let node_path = require("node:path");
|
|
27
|
-
node_path = __toESM(node_path, 1);
|
|
28
26
|
let yaml = require("yaml");
|
|
29
|
-
yaml = __toESM(yaml, 1);
|
|
30
27
|
let node_child_process = require("node:child_process");
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
node_path = __toESM(node_path, 1);
|
|
29
|
+
yaml = __toESM(yaml, 1);
|
|
30
|
+
// src/internal/fileExists.ts
|
|
31
|
+
async function fileExists(path) {
|
|
33
32
|
try {
|
|
34
33
|
await (0, node_fs_promises.access)(path, node_fs.constants.F_OK);
|
|
35
34
|
return true;
|
|
@@ -37,9 +36,8 @@ async function __exists(path) {
|
|
|
37
36
|
return false;
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
function __existsSync(path) {
|
|
39
|
+
// src/internal/fileExistsSync.ts
|
|
40
|
+
function fileExistsSync(path) {
|
|
43
41
|
try {
|
|
44
42
|
(0, node_fs.accessSync)(path, node_fs.constants.F_OK);
|
|
45
43
|
return true;
|
|
@@ -47,16 +45,14 @@ function __existsSync(path) {
|
|
|
47
45
|
return false;
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
function __toMode(mode) {
|
|
48
|
+
// src/internal/toMode.ts
|
|
49
|
+
function toMode(mode) {
|
|
53
50
|
return mode == null ? mode : toModeFlag(mode.owner, 256, 128, 64) | toModeFlag(mode.group, 32, 16, 8) | toModeFlag(mode.other, 4, 2, 1);
|
|
54
51
|
}
|
|
55
52
|
function toModeFlag(permissionSet, read, write, execute) {
|
|
56
53
|
return (permissionSet?.read === true ? read : 0) | (permissionSet?.write === true ? write : 0) | (permissionSet?.execute === true ? execute : 0);
|
|
57
54
|
}
|
|
58
|
-
|
|
59
|
-
//#region src/file.ts
|
|
55
|
+
// src/file.ts
|
|
60
56
|
/**
|
|
61
57
|
* Ensure file is present/absent with content initialized or modified with `update
|
|
62
58
|
*
|
|
@@ -79,10 +75,10 @@ function toModeFlag(permissionSet, read, write, execute) {
|
|
|
79
75
|
async function file(options) {
|
|
80
76
|
const { encoding = "utf8", mode, path, state, update } = options;
|
|
81
77
|
if (state === "present") {
|
|
82
|
-
const isPresent = await
|
|
78
|
+
const isPresent = await fileExists(path);
|
|
83
79
|
const previousContent = isPresent ? await (0, node_fs_promises.readFile)(path, encoding) : "";
|
|
84
80
|
const newContent = update == null ? isPresent ? void 0 : "" : update(previousContent);
|
|
85
|
-
const newMode =
|
|
81
|
+
const newMode = toMode(mode);
|
|
86
82
|
if (newContent != null) await (0, node_fs_promises.writeFile)(path, newContent, {
|
|
87
83
|
encoding,
|
|
88
84
|
mode: newMode
|
|
@@ -112,10 +108,10 @@ async function file(options) {
|
|
|
112
108
|
function fileSync(options) {
|
|
113
109
|
const { encoding = "utf8", mode, path, state, update } = options;
|
|
114
110
|
if (state === "present") {
|
|
115
|
-
const isPresent =
|
|
111
|
+
const isPresent = fileExistsSync(path);
|
|
116
112
|
const previousContent = isPresent ? (0, node_fs.readFileSync)(path, encoding) : "";
|
|
117
113
|
const newContent = update == null ? isPresent ? void 0 : "" : update(previousContent);
|
|
118
|
-
const newMode =
|
|
114
|
+
const newMode = toMode(mode);
|
|
119
115
|
if (newContent != null) (0, node_fs.writeFileSync)(path, newContent, {
|
|
120
116
|
encoding,
|
|
121
117
|
mode: newMode
|
|
@@ -123,8 +119,7 @@ function fileSync(options) {
|
|
|
123
119
|
if (newMode != null && (isPresent || newContent != null)) (0, node_fs.chmodSync)(path, newMode);
|
|
124
120
|
} else (0, node_fs.rmSync)(path, { force: true });
|
|
125
121
|
}
|
|
126
|
-
|
|
127
|
-
//#region src/internal/resolveCommentStyle.ts
|
|
122
|
+
// src/internal/resolveCommentStyle.ts
|
|
128
123
|
const HASH_BASENAMES = /* @__PURE__ */ new Set([
|
|
129
124
|
"containerfile",
|
|
130
125
|
"dockerfile",
|
|
@@ -179,8 +174,7 @@ function resolveCommentStyle(path) {
|
|
|
179
174
|
if (BLOCK_EXTENSIONS.has(extension)) return "/*";
|
|
180
175
|
return "#";
|
|
181
176
|
}
|
|
182
|
-
|
|
183
|
-
//#region src/block.ts
|
|
177
|
+
// src/block.ts
|
|
184
178
|
const EOF = "EndOfFile";
|
|
185
179
|
const BOF = "BeginningOfFile";
|
|
186
180
|
const DEFAULT_TOPIC = "managed-block";
|
|
@@ -289,8 +283,7 @@ function toMarkerFn(marker, path) {
|
|
|
289
283
|
const resolvedStyle = commentStyle === "auto" ? resolveCommentStyle(path) : commentStyle;
|
|
290
284
|
return (mark) => formatMarker(resolvedStyle, mark, topic);
|
|
291
285
|
}
|
|
292
|
-
|
|
293
|
-
//#region src/directory.ts
|
|
286
|
+
// src/directory.ts
|
|
294
287
|
/**
|
|
295
288
|
* Ensure directory is present/absent
|
|
296
289
|
*
|
|
@@ -311,9 +304,9 @@ function toMarkerFn(marker, path) {
|
|
|
311
304
|
*/
|
|
312
305
|
async function directory(options) {
|
|
313
306
|
const { mode, path, state } = options;
|
|
314
|
-
const isPresent = await
|
|
307
|
+
const isPresent = await fileExists(path);
|
|
315
308
|
if (state === "present") {
|
|
316
|
-
const newMode =
|
|
309
|
+
const newMode = toMode(mode);
|
|
317
310
|
if (!isPresent) await (0, node_fs_promises.mkdir)(path, {
|
|
318
311
|
mode: newMode,
|
|
319
312
|
recursive: true
|
|
@@ -341,9 +334,9 @@ async function directory(options) {
|
|
|
341
334
|
*/
|
|
342
335
|
function directorySync(options) {
|
|
343
336
|
const { mode, path, state } = options;
|
|
344
|
-
const isPresent =
|
|
337
|
+
const isPresent = fileExistsSync(path);
|
|
345
338
|
if (state === "present") {
|
|
346
|
-
const newMode =
|
|
339
|
+
const newMode = toMode(mode);
|
|
347
340
|
if (!isPresent) (0, node_fs.mkdirSync)(path, {
|
|
348
341
|
mode: newMode,
|
|
349
342
|
recursive: true
|
|
@@ -351,8 +344,7 @@ function directorySync(options) {
|
|
|
351
344
|
if (newMode != null && isPresent) (0, node_fs.chmodSync)(path, newMode);
|
|
352
345
|
} else if (isPresent) (0, node_fs.rmSync)(path, { recursive: true });
|
|
353
346
|
}
|
|
354
|
-
|
|
355
|
-
//#region src/ignoreFile.ts
|
|
347
|
+
// src/ignoreFile.ts
|
|
356
348
|
/**
|
|
357
349
|
* Ensure file is present/absent asynchronously with content initialized or modified by line.
|
|
358
350
|
*
|
|
@@ -366,7 +358,7 @@ function directorySync(options) {
|
|
|
366
358
|
* @param options File target options.
|
|
367
359
|
*/
|
|
368
360
|
async function ignoreFile(options) {
|
|
369
|
-
return file(toFileOption$
|
|
361
|
+
return file(toFileOption$3(options));
|
|
370
362
|
}
|
|
371
363
|
/**
|
|
372
364
|
* Ensure file is present/absent synchronously with content initialized or modified by line.
|
|
@@ -381,9 +373,9 @@ async function ignoreFile(options) {
|
|
|
381
373
|
* @param options File target options.
|
|
382
374
|
*/
|
|
383
375
|
function ignoreFileSync(options) {
|
|
384
|
-
return fileSync(toFileOption$
|
|
376
|
+
return fileSync(toFileOption$3(options));
|
|
385
377
|
}
|
|
386
|
-
function toFileOption$
|
|
378
|
+
function toFileOption$3({ update, ...otherOptions }) {
|
|
387
379
|
return {
|
|
388
380
|
...otherOptions,
|
|
389
381
|
update: update == null ? update : (content) => {
|
|
@@ -393,8 +385,7 @@ function toFileOption$2({ update, ...otherOptions }) {
|
|
|
393
385
|
}
|
|
394
386
|
};
|
|
395
387
|
}
|
|
396
|
-
|
|
397
|
-
//#region src/isConfigPresent.ts
|
|
388
|
+
// src/isConfigPresent.ts
|
|
398
389
|
const defaultExtensions = [
|
|
399
390
|
".json",
|
|
400
391
|
".yaml",
|
|
@@ -421,8 +412,8 @@ async function isConfigPresent(options) {
|
|
|
421
412
|
}
|
|
422
413
|
function isConfigPresentSync(options) {
|
|
423
414
|
const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);
|
|
424
|
-
for (const candidatePath of candidatePaths) if (
|
|
425
|
-
if (
|
|
415
|
+
for (const candidatePath of candidatePaths) if (fileExistsSync(candidatePath)) return true;
|
|
416
|
+
if (fileExistsSync(packageJsonPath)) try {
|
|
426
417
|
return hasPackageConfigKey((0, node_fs.readFileSync)(packageJsonPath, "utf8"), packageConfig);
|
|
427
418
|
} catch {
|
|
428
419
|
return false;
|
|
@@ -430,10 +421,10 @@ function isConfigPresentSync(options) {
|
|
|
430
421
|
return false;
|
|
431
422
|
}
|
|
432
423
|
async function hasAnyFile(paths) {
|
|
433
|
-
return (await Promise.all(paths.map((candidatePath) =>
|
|
424
|
+
return (await Promise.all(paths.map((candidatePath) => fileExists(candidatePath)))).some(Boolean);
|
|
434
425
|
}
|
|
435
426
|
async function hasPackageConfigFile(packageJsonPath, packageConfig) {
|
|
436
|
-
if (!await
|
|
427
|
+
if (!await fileExists(packageJsonPath)) return false;
|
|
437
428
|
try {
|
|
438
429
|
return hasPackageConfigKey(await (0, node_fs_promises.readFile)(packageJsonPath, "utf8"), packageConfig);
|
|
439
430
|
} catch {
|
|
@@ -453,15 +444,14 @@ function toCandidates({ app, cwd = process.cwd(), extensions = defaultExtensions
|
|
|
453
444
|
packageJsonPath: node_path.default.join(cwd, "package.json")
|
|
454
445
|
};
|
|
455
446
|
}
|
|
456
|
-
|
|
457
|
-
//#region src/json.ts
|
|
447
|
+
// src/json.ts
|
|
458
448
|
/**
|
|
459
449
|
* Ensure file is present/absent asynchronously with content value initialized or modified with `update`
|
|
460
450
|
*
|
|
461
451
|
* @param options
|
|
462
452
|
*/
|
|
463
453
|
async function json(options) {
|
|
464
|
-
return file(toFileOption$
|
|
454
|
+
return file(toFileOption$2(options));
|
|
465
455
|
}
|
|
466
456
|
/**
|
|
467
457
|
* Ensure file is present/absent synchronously with content value initialized or modified with `update`
|
|
@@ -469,9 +459,9 @@ async function json(options) {
|
|
|
469
459
|
* @param options
|
|
470
460
|
*/
|
|
471
461
|
function jsonSync(options) {
|
|
472
|
-
return fileSync(toFileOption$
|
|
462
|
+
return fileSync(toFileOption$2(options));
|
|
473
463
|
}
|
|
474
|
-
function toFileOption$
|
|
464
|
+
function toFileOption$2({ update, ...otherOptions }) {
|
|
475
465
|
return {
|
|
476
466
|
...otherOptions,
|
|
477
467
|
update: update == null ? update : (content) => {
|
|
@@ -480,15 +470,40 @@ function toFileOption$1({ update, ...otherOptions }) {
|
|
|
480
470
|
}
|
|
481
471
|
};
|
|
482
472
|
}
|
|
483
|
-
|
|
484
|
-
//#region src/meta.ts
|
|
473
|
+
// src/meta.ts
|
|
485
474
|
const meta = Object.freeze({
|
|
486
|
-
buildNumber:
|
|
475
|
+
buildNumber: 0x6b04cca5,
|
|
487
476
|
name: "@w5s/configurator-core",
|
|
488
|
-
version: "1.
|
|
477
|
+
version: "1.23.0"
|
|
489
478
|
});
|
|
490
|
-
|
|
491
|
-
|
|
479
|
+
// src/toolVersions.ts
|
|
480
|
+
const reToolVersion = /\s+/;
|
|
481
|
+
function toolVersions(options) {
|
|
482
|
+
return file(toFileOption$1(options));
|
|
483
|
+
}
|
|
484
|
+
function toolVersionsSync(options) {
|
|
485
|
+
return fileSync(toFileOption$1(options));
|
|
486
|
+
}
|
|
487
|
+
function toFileOption$1({ update, ...otherOptions }) {
|
|
488
|
+
return {
|
|
489
|
+
...otherOptions,
|
|
490
|
+
path: otherOptions.path ?? ".tool-versions",
|
|
491
|
+
update: update == null ? update : (content) => {
|
|
492
|
+
const eol = "\n";
|
|
493
|
+
const lines = content.split(eol);
|
|
494
|
+
const parsed = Object.fromEntries(function* () {
|
|
495
|
+
for (const line of lines) {
|
|
496
|
+
const [tool, value] = line.split(reToolVersion, 2);
|
|
497
|
+
if (tool) yield [tool, value ?? ""];
|
|
498
|
+
}
|
|
499
|
+
}());
|
|
500
|
+
const updated = update ? update(parsed) : parsed;
|
|
501
|
+
if (updated === void 0) return updated;
|
|
502
|
+
return Object.entries(updated).map(([tool, value]) => `${tool} ${value}`).join(eol);
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
// src/yaml.ts
|
|
492
507
|
/**
|
|
493
508
|
* Ensure file is present/absent asynchronously with content value initialized or modified with `update`
|
|
494
509
|
*
|
|
@@ -514,8 +529,7 @@ function toFileOption({ update, ...otherOptions }) {
|
|
|
514
529
|
}
|
|
515
530
|
};
|
|
516
531
|
}
|
|
517
|
-
|
|
518
|
-
//#region src/exec.ts
|
|
532
|
+
// src/exec.ts
|
|
519
533
|
/**
|
|
520
534
|
* Runs a command in a shell and returns a promise that resolves with an object
|
|
521
535
|
* containing the stdout and stderr strings.
|
|
@@ -562,8 +576,7 @@ function execSync(command, args, options) {
|
|
|
562
576
|
stdout: result.stdout.toString(encoding)
|
|
563
577
|
};
|
|
564
578
|
}
|
|
565
|
-
|
|
566
|
-
//#region src/yarnConfig.ts
|
|
579
|
+
// src/yarnConfig.ts
|
|
567
580
|
/**
|
|
568
581
|
* Set/Unset yarn configuration value
|
|
569
582
|
*
|
|
@@ -626,8 +639,7 @@ function yarnConfigSync(options) {
|
|
|
626
639
|
key
|
|
627
640
|
]);
|
|
628
641
|
}
|
|
629
|
-
|
|
630
|
-
//#region src/yarnVersion.ts
|
|
642
|
+
// src/yarnVersion.ts
|
|
631
643
|
/**
|
|
632
644
|
* Set/Unset yarn configuration value
|
|
633
645
|
*
|
|
@@ -666,7 +678,6 @@ function yarnVersionSync(options) {
|
|
|
666
678
|
]);
|
|
667
679
|
else throw new Error("Not implemented");
|
|
668
680
|
}
|
|
669
|
-
//#endregion
|
|
670
681
|
exports.block = block;
|
|
671
682
|
exports.blockSync = blockSync;
|
|
672
683
|
exports.directory = directory;
|
|
@@ -680,6 +691,8 @@ exports.isConfigPresentSync = isConfigPresentSync;
|
|
|
680
691
|
exports.json = json;
|
|
681
692
|
exports.jsonSync = jsonSync;
|
|
682
693
|
exports.meta = meta;
|
|
694
|
+
exports.toolVersions = toolVersions;
|
|
695
|
+
exports.toolVersionsSync = toolVersionsSync;
|
|
683
696
|
exports.yaml = yaml$1;
|
|
684
697
|
exports.yamlSync = yamlSync;
|
|
685
698
|
exports.yarnConfig = yarnConfig;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["access","constants","constants","readFile","writeFile","chmod","rm","readFileSync","nodePath","mkdir","chmod","rm","toFileOption","readFileSync","readFile","path","toFileOption","yaml","YAML","spawn","spawnSync"],"sources":["../src/__exists.ts","../src/__existsSync.ts","../src/__toMode.ts","../src/file.ts","../src/internal/resolveCommentStyle.ts","../src/block.ts","../src/directory.ts","../src/ignoreFile.ts","../src/isConfigPresent.ts","../src/json.ts","../src/meta.ts","../src/yaml.ts","../src/exec.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"sourcesContent":["import { constants } from 'node:fs';\nimport { access } from 'node:fs/promises';\n\nexport async function __exists(path: string) {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import { accessSync, constants } from 'node:fs';\n\nexport function __existsSync(path: string) {\n try {\n accessSync(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import type { FileMode, FilePermissionSet } from './FileMode.js';\n\nexport function __toMode(mode: FileMode | undefined): number | undefined {\n return mode == null\n ? mode\n : (\n toModeFlag(mode.owner, 0o400, 0o200, 0o100)\n | toModeFlag(mode.group, 0o040, 0o020, 0o010)\n | toModeFlag(mode.other, 0o004, 0o002, 0o001)\n );\n}\n\nfunction toModeFlag(permissionSet: FilePermissionSet | undefined, read: number, write: number, execute: number): number {\n return (\n (permissionSet?.read === true ? read : 0)\n | (permissionSet?.write === true ? write : 0)\n | (permissionSet?.execute === true ? execute : 0)\n );\n}\n","import { chmodSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { chmod, readFile, rm, writeFile } from 'node:fs/promises';\n\nimport type { FileMode } from './FileMode.js';\n\nimport { __exists } from './__exists.js';\nimport { __existsSync } from './__existsSync.js';\nimport { __toMode } from './__toMode.js';\n\nexport interface FileOptions {\n /**\n * File encoding\n */\n readonly encoding?: BufferEncoding;\n\n /**\n * File permissions\n */\n readonly mode?: FileMode;\n\n /**\n * File path\n */\n readonly path: string;\n\n /**\n * File target state\n */\n readonly state: 'absent' | 'present';\n\n /**\n * File content mapping function\n *\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\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 * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport async function file(options: FileOptions): Promise<void> {\n const { encoding = 'utf8', mode, path, state, update } = options;\n if (state === 'present') {\n const isPresent = await __exists(path);\n const previousContent = isPresent ? await readFile(path, encoding) : '';\n const newContent = update == null ? (isPresent ? undefined : '') : update(previousContent);\n const newMode = __toMode(mode);\n if (newContent != null) {\n await writeFile(path, newContent, { encoding, mode: newMode });\n }\n if (newMode != null && (isPresent || newContent != null)) {\n await chmod(path, newMode);\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 * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport function fileSync(options: FileOptions): void {\n const { encoding = 'utf8', mode, path, state, update } = options;\n if (state === 'present') {\n const isPresent = __existsSync(path);\n const previousContent = isPresent ? readFileSync(path, encoding) : '';\n const newContent = update == null ? (isPresent ? undefined : '') : update(previousContent);\n const newMode = __toMode(mode);\n if (newContent != null) {\n writeFileSync(path, newContent, { encoding, mode: newMode });\n }\n if (newMode != null && (isPresent || newContent != null)) {\n chmodSync(path, newMode);\n }\n } else {\n rmSync(path, { force: true });\n }\n}\n","import nodePath from 'node:path';\n\nexport type ResolvedCommentStyle = '#' | '/*' | '//' | '<!--';\n\n/* cspell:ignore containerfile */\nconst HASH_BASENAMES = new Set(['containerfile', 'dockerfile', 'gemfile', 'makefile']);\n\nconst HTML_EXTENSIONS = new Set(['htm', 'html', 'md', 'mdx', 'svg', 'xml']);\nconst LINE_EXTENSIONS = new Set([\n 'c',\n 'cjs',\n 'cpp',\n 'cs',\n 'cts',\n 'go',\n 'h',\n 'java',\n 'js',\n 'jsx',\n 'kt',\n 'mjs',\n 'mts',\n 'rs',\n 'swift',\n 'ts',\n 'tsx',\n]);\nconst BLOCK_EXTENSIONS = new Set(['css', 'less', 'sass', 'scss']);\n\n/**\n * Resolve comment style from the file path when `commentStyle` is `'auto'`.\n *\n * @param path File path used to infer the comment style.\n */\nexport function resolveCommentStyle(path: string): ResolvedCommentStyle {\n const basename = nodePath.basename(path);\n const basenameLower = basename.toLowerCase();\n\n if (basename.startsWith('.') || HASH_BASENAMES.has(basenameLower)) {\n return '#';\n }\n\n const extension = nodePath.extname(basename).slice(1).toLowerCase();\n if (HTML_EXTENSIONS.has(extension)) {\n return '<!--';\n }\n if (LINE_EXTENSIONS.has(extension)) {\n return '//';\n }\n if (BLOCK_EXTENSIONS.has(extension)) {\n return '/*';\n }\n\n // py, rb, sh, toml, yaml, yml, json, no extension, and unknown → #\n return '#';\n}\n","import { file, type FileOptions, fileSync } from './file.js';\nimport { resolveCommentStyle, type ResolvedCommentStyle } from './internal/resolveCommentStyle.js';\n\nexport type BlockCommentStyle = '#' | '/*' | '//' | '<!--' | 'auto';\n\nexport interface BlockMarkerOptions {\n /**\n * Comment opener used for the marker lines: `'auto'` (from file name),\n * `'#'`, `'//'`, slash-star, or `'<!--'`.\n *\n * @default 'auto'\n */\n commentStyle?: BlockCommentStyle;\n\n /**\n * Identity after `BEGIN:` / `END:`, so multiple blocks in one file do not collide.\n *\n * @default 'managed-block'\n */\n topic?: string;\n}\n\nexport interface BlockOptions {\n /**\n * Block content to insert\n */\n block: string;\n\n /**\n * Insert position\n */\n insertPosition?: ['after', 'EndOfFile' | RegExp] | ['before', 'BeginningOfFile' | RegExp];\n\n /**\n * Marker configuration, or a function that returns the full marker line.\n *\n * @default `{ commentStyle: 'auto', topic: 'managed-block' }`\n */\n marker?: ((mark: 'Begin' | 'End') => string) | BlockMarkerOptions;\n\n /**\n * File path\n */\n path: string;\n\n /**\n * Block target state\n */\n state?: 'absent' | 'present';\n}\n\nconst EOF = 'EndOfFile';\nconst BOF = 'BeginningOfFile';\nconst DEFAULT_TOPIC = 'managed-block';\n\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\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\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\nfunction formatMarker(style: ResolvedCommentStyle, mark: 'Begin' | 'End', topic: string): string {\n const inner = `${mark.toUpperCase()}:${topic}`;\n switch (style) {\n case '#': {\n return `# ${inner}`;\n }\n case '/*': {\n return `/* ${inner} */`;\n }\n case '//': {\n return `// ${inner}`;\n }\n case '<!--': {\n return `<!-- ${inner} -->`;\n }\n default: {\n throw new Error(`Unsupported comment style ${String(style)}`);\n }\n }\n}\n\nfunction toFileOptions(options: BlockOptions): FileOptions {\n const { block: blockName, insertPosition = ['after', EOF], marker, path, state = 'present' } = options;\n\n const EOL = '\\n';\n const markerFn = toMarkerFn(marker, path);\n const beginBlock = markerFn('Begin');\n const endBlock = markerFn('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 '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 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\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\nfunction toMarkerFn(marker: BlockOptions['marker'], path: string): (mark: 'Begin' | 'End') => string {\n if (typeof marker === 'function') {\n return marker;\n }\n\n const commentStyle = marker?.commentStyle ?? 'auto';\n const topic = marker?.topic ?? DEFAULT_TOPIC;\n const resolvedStyle = commentStyle === 'auto' ? resolveCommentStyle(path) : commentStyle;\n\n return (mark) => formatMarker(resolvedStyle, mark, topic);\n}\n","import { chmodSync, mkdirSync, rmSync } from 'node:fs';\nimport { chmod, mkdir, rm } from 'node:fs/promises';\n\nimport type { FileMode } from './FileMode.js';\n\nimport { __exists } from './__exists.js';\nimport { __existsSync } from './__existsSync.js';\nimport { __toMode } from './__toMode.js';\n\nexport interface DirectoryOptions {\n /**\n * File permissions\n */\n readonly mode?: FileMode;\n\n /**\n * Directory path\n */\n readonly path: string;\n\n /**\n * Directory target state\n */\n readonly state: 'absent' | 'present';\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 * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport async function directory(options: DirectoryOptions): Promise<void> {\n const { mode, path, state } = options;\n const isPresent = await __exists(path);\n if (state === 'present') {\n const newMode = __toMode(mode);\n if (!isPresent) {\n await mkdir(path, { mode: newMode, recursive: true });\n }\n if (newMode != null && isPresent) {\n await chmod(path, newMode);\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 * directorySync({\n * path: 'foo/bar',\n * state: 'present',\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport function directorySync(options: DirectoryOptions): void {\n const { mode, path, state } = options;\n const isPresent = __existsSync(path);\n if (state === 'present') {\n const newMode = __toMode(mode);\n if (!isPresent) {\n mkdirSync(path, { mode: newMode, recursive: true });\n }\n if (newMode != null && isPresent) {\n chmodSync(path, newMode);\n }\n } else if (isPresent) {\n rmSync(path, { recursive: true });\n }\n}\n","import { file, type FileOptions, fileSync } from './file.js';\n\nexport interface IgnoreFileOptions extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function where content is represented as lines.\n * When the file does not yet exist, the callback receives `undefined`.\n */\n readonly update?: ((content: Array<string> | undefined) => Array<string> | undefined) | undefined;\n}\n\n/**\n * Ensure file is present/absent asynchronously with content initialized or modified by line.\n *\n * @example\n * ```ts\n * await ignoreFile({\n * path: '.gitignore',\n * update: (lines) => [...(lines ?? []), 'dist'],\n * });\n * ```\n * @param options File target options.\n */\nexport async function ignoreFile(options: IgnoreFileOptions): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content initialized or modified by line.\n *\n * @example\n * ```ts\n * ignoreFileSync({\n * path: '.gitignore',\n * update: (lines) => [...(lines ?? []), 'dist'],\n * });\n * ```\n * @param options File target options.\n */\nexport function ignoreFileSync(options: IgnoreFileOptions): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption({ update, ...otherOptions }: IgnoreFileOptions): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const eol = content.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const lines = content === '' ? undefined : content.split(eol);\n const updatedLines = update(lines);\n\n return updatedLines == null ? undefined : updatedLines.join(eol);\n },\n };\n}\n","import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport { __exists } from './__exists.js';\nimport { __existsSync } from './__existsSync.js';\n\nconst defaultExtensions: Array<string> = ['.json', '.yaml', '.yml', '.js', '.cjs', '.mjs', '.ts', '.cts', '.mts'];\n\nexport interface IsConfigPresentOptions {\n /**\n * The name of the application.\n */\n app: string;\n\n /**\n * The directory to look into. Defaults to `process.cwd()`.\n */\n cwd?: string | undefined;\n\n /**\n * The list of extensions to check for.\n */\n extensions?: Array<string> | undefined;\n\n /**\n * The name of the package configuration. Defaults to `app`.\n */\n packageConfig?: string | undefined;\n}\n\n/**\n * Return whether tool configuration exists at `cwd` (cosmiconfig-style).\n *\n * Looks for `.{app}rc`, `.{app}rc.{ext}`, `{app}.config.{ext}` and a matching\n * `package.json` key.\n *\n * @param options\n */\nexport async function isConfigPresent(options: IsConfigPresentOptions): Promise<boolean> {\n const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);\n\n const [hasConfigFile, hasPackageConfig] = await Promise.all([\n hasAnyFile(candidatePaths),\n hasPackageConfigFile(packageJsonPath, packageConfig),\n ]);\n\n return hasConfigFile || hasPackageConfig;\n}\n\nexport function isConfigPresentSync(options: IsConfigPresentOptions): boolean {\n const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);\n\n for (const candidatePath of candidatePaths) {\n if (__existsSync(candidatePath)) {\n return true;\n }\n }\n\n if (__existsSync(packageJsonPath)) {\n try {\n return hasPackageConfigKey(readFileSync(packageJsonPath, 'utf8'), packageConfig);\n } catch {\n return false;\n }\n }\n\n return false;\n}\n\nasync function hasAnyFile(paths: Array<string>): Promise<boolean> {\n const results = await Promise.all(paths.map((candidatePath) => __exists(candidatePath)));\n\n return results.some(Boolean);\n}\n\nasync function hasPackageConfigFile(packageJsonPath: string, packageConfig: string): Promise<boolean> {\n if (!(await __exists(packageJsonPath))) {\n return false;\n }\n\n try {\n return hasPackageConfigKey(await readFile(packageJsonPath, 'utf8'), packageConfig);\n } catch {\n return false;\n }\n}\n\nfunction hasPackageConfigKey(packageJsonContent: string, packageConfig: string): boolean {\n const packageJson = JSON.parse(packageJsonContent) as Record<string, unknown>;\n const value = packageJson[packageConfig];\n\n return value !== undefined && value !== null && value !== false;\n}\n\nfunction toCandidates({ app, cwd = process.cwd(), extensions = defaultExtensions, packageConfig = app }: IsConfigPresentOptions) {\n const candidatePaths = [path.join(cwd, `.${app}rc`)];\n for (const extension of extensions) {\n candidatePaths.push(path.join(cwd, `.${app}rc${extension}`), path.join(cwd, `${app}.config${extension}`));\n }\n\n return {\n candidatePaths,\n packageConfig,\n packageJsonPath: path.join(cwd, 'package.json'),\n };\n}\n","import { file, type FileOptions, fileSync } from './file.js';\n\nexport interface JSONOption<V = JSONValue> extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: undefined | V) => undefined | V) | undefined;\n}\n\nexport type JSONValue = Array<JSONValue> | boolean | null | number | string | { [key: string]: JSONValue };\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\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","export const meta = Object.freeze({\n // @ts-ignore - these variables are injected at build time\n buildNumber: (typeof __PACKAGE_BUILD_NUMBER__ === 'undefined' ? 0 : __PACKAGE_BUILD_NUMBER__) as number,\n // @ts-ignore - these variables are injected at build time\n name: (typeof __PACKAGE_NAME__ === 'undefined' ? '' : __PACKAGE_NAME__) as string,\n // @ts-ignore - these variables are injected at build time\n version: (typeof __PACKAGE_VERSION__ === 'undefined' ? '' : __PACKAGE_VERSION__) as string,\n});\n","import YAML from 'yaml';\n\nimport { file, type FileOptions, fileSync } from './file.js';\n\nexport interface YAMLOption<V = YAMLValue> extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: undefined | V) => undefined | V) | undefined;\n}\n\nexport type YAMLValue = Array<YAMLValue> | boolean | null | number | string | { [key: string]: YAMLValue };\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 yaml<Value>(options: YAMLOption<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 yamlSync<Value>(options: YAMLOption<Value>): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption<Value>({ update, ...otherOptions }: YAMLOption<Value>): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const yamlValue = content === '' ? undefined : (YAML.parse(content) as Value);\n\n return YAML.stringify(update(yamlValue));\n },\n };\n}\n","import { spawn, spawnSync } from 'node:child_process';\n\nexport interface ExecOptions {\n /**\n * Current working directory\n */\n cwd?: string;\n\n /**\n * Stdio options\n */\n stdio?: 'ignore' | 'inherit' | 'pipe';\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 * @param options\n */\nexport async function exec(\n command: string,\n args: ReadonlyArray<string>,\n options?: ExecOptions,\n): Promise<{ stderr: string; stdout: 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 ts/no-unsafe-call, ts/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 ts/no-unsafe-call, ts/no-unsafe-member-access\n stderr += data.toString(encoding);\n });\n }\n // Handle process exit\n child.on('close', (_code) => {\n resolve({ stderr, stdout });\n });\n\n // Handle errors\n child.on('error', reject);\n });\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 * @param options\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): { stderr: string; stdout: string } {\n const result = spawnSync(command, args, { ...options });\n const encoding = 'utf8';\n\n return { stderr: result.stderr.toString(encoding), stdout: result.stdout.toString(encoding) };\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: 'absent' | 'present';\n\n /**\n * File content mapping function\n *\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @param options\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', key]);\n await exec('yarn', ['config', 'set', key, String(update == null ? '' : update(stdout))]);\n } else {\n await exec('yarn', ['config', 'unset', key]);\n }\n}\n\n/**\n * Synchronous version of {@link yarnConfig}\n *\n * @param options\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', key]);\n execSync('yarn', ['config', 'set', key, String(update == null ? '' : update(stdout))]);\n } else {\n execSync('yarn', ['config', 'unset', key]);\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: 'absent' | 'present';\n\n /**\n * Version mapping function\n *\n */\n readonly update?: (() => undefined | YarnVersionKind) | undefined;\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @param options\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', String(update == null ? 'berry' : update())]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n\n/**\n * Synchronous version of {@link yarnVersion}\n *\n * @param options\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', String(update == null ? 'berry' : update())]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,eAAsB,SAAS,MAAc;C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;CAAG,CAAC;AAE/C;;;;;;;;;;;;AAaA,SAAgB,eAAe,SAA4B;CACzD,MAAM,EAAE,KAAK,OAAO,WAAW;CAC/B,IAAI,UAAU,WAAW;EACvB,MAAM,EAAE,WAAW,SAAS,QAAQ;GAAC;GAAU;GAAO;EAAG,CAAC;EAC1D,SAAS,QAAQ;GAAC;GAAU;GAAO;GAAK,OAAO,UAAU,OAAO,KAAK,OAAO,MAAM,CAAC;EAAC,CAAC;CACvF,OACE,SAAS,QAAQ;EAAC;EAAU;EAAS;CAAG,CAAC;AAE7C;;;;;;;;;;;;;ACjCA,eAAsB,YAAY,SAA4C;CAC5E,MAAM,EAAE,OAAO,WAAW;CAC1B,IAAI,UAAU,WACZ,MAAM,KAAK,QAAQ;EAAC;EAAO;EAAW,OAAO,UAAU,OAAO,UAAU,OAAO,CAAC;CAAC,CAAC;MAGlF,MAAM,IAAI,MAAM,iBAAiB;AAErC;;;;;;;;;;;AAYA,SAAgB,gBAAgB,SAA6B;CAC3D,MAAM,EAAE,OAAO,WAAW;CAC1B,IAAI,UAAU,WACZ,SAAS,QAAQ;EAAC;EAAO;EAAW,OAAO,UAAU,OAAO,UAAU,OAAO,CAAC;CAAC,CAAC;MAGhF,MAAM,IAAI,MAAM,iBAAiB;AAErC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["access","constants","accessSync","constants","readFile","writeFile","chmod","rm","readFileSync","writeFileSync","chmodSync","rmSync","nodePath","mkdir","chmod","rm","mkdirSync","chmodSync","rmSync","toFileOption","readFileSync","readFile","path","toFileOption","toFileOption","yaml","YAML","spawn","spawnSync"],"sources":["../src/internal/fileExists.ts","../src/internal/fileExistsSync.ts","../src/internal/toMode.ts","../src/file.ts","../src/internal/resolveCommentStyle.ts","../src/block.ts","../src/directory.ts","../src/ignoreFile.ts","../src/isConfigPresent.ts","../src/json.ts","../src/meta.ts","../src/toolVersions.ts","../src/yaml.ts","../src/exec.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"sourcesContent":["import { constants } from 'node:fs';\nimport { access } from 'node:fs/promises';\n\nexport async function fileExists(path: string) {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import { accessSync, constants } from 'node:fs';\n\nexport function fileExistsSync(path: string) {\n try {\n accessSync(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import type { FileMode, FilePermissionSet } from '../FileMode.js';\n\nexport function toMode(mode: FileMode | undefined): number | undefined {\n return mode == null\n ? mode\n : (\n toModeFlag(mode.owner, 0o400, 0o200, 0o100)\n | toModeFlag(mode.group, 0o040, 0o020, 0o010)\n | toModeFlag(mode.other, 0o004, 0o002, 0o001)\n );\n}\n\nfunction toModeFlag(permissionSet: FilePermissionSet | undefined, read: number, write: number, execute: number): number {\n return (\n (permissionSet?.read === true ? read : 0)\n | (permissionSet?.write === true ? write : 0)\n | (permissionSet?.execute === true ? execute : 0)\n );\n}\n","import { chmodSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { chmod, readFile, rm, writeFile } from 'node:fs/promises';\n\nimport type { FileMode } from './FileMode.js';\n\nimport { fileExists } from './internal/fileExists.js';\nimport { fileExistsSync } from './internal/fileExistsSync.js';\nimport { toMode } from './internal/toMode.js';\n\nexport interface FileOptions {\n /**\n * File encoding\n */\n readonly encoding?: BufferEncoding;\n\n /**\n * File permissions\n */\n readonly mode?: FileMode;\n\n /**\n * File path\n */\n readonly path: string;\n\n /**\n * File target state\n */\n readonly state: 'absent' | 'present';\n\n /**\n * File content mapping function\n *\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\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 * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport async function file(options: FileOptions): Promise<void> {\n const { encoding = 'utf8', mode, path, state, update } = options;\n if (state === 'present') {\n const isPresent = await fileExists(path);\n const previousContent = isPresent ? await readFile(path, encoding) : '';\n const newContent = update == null ? (isPresent ? undefined : '') : update(previousContent);\n const newMode = toMode(mode);\n if (newContent != null) {\n await writeFile(path, newContent, { encoding, mode: newMode });\n }\n if (newMode != null && (isPresent || newContent != null)) {\n await chmod(path, newMode);\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 * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport function fileSync(options: FileOptions): void {\n const { encoding = 'utf8', mode, path, state, update } = options;\n if (state === 'present') {\n const isPresent = fileExistsSync(path);\n const previousContent = isPresent ? readFileSync(path, encoding) : '';\n const newContent = update == null ? (isPresent ? undefined : '') : update(previousContent);\n const newMode = toMode(mode);\n if (newContent != null) {\n writeFileSync(path, newContent, { encoding, mode: newMode });\n }\n if (newMode != null && (isPresent || newContent != null)) {\n chmodSync(path, newMode);\n }\n } else {\n rmSync(path, { force: true });\n }\n}\n","import nodePath from 'node:path';\n\nexport type ResolvedCommentStyle = '#' | '/*' | '//' | '<!--';\n\n/* cspell:ignore containerfile */\nconst HASH_BASENAMES = new Set(['containerfile', 'dockerfile', 'gemfile', 'makefile']);\n\nconst HTML_EXTENSIONS = new Set(['htm', 'html', 'md', 'mdx', 'svg', 'xml']);\nconst LINE_EXTENSIONS = new Set([\n 'c',\n 'cjs',\n 'cpp',\n 'cs',\n 'cts',\n 'go',\n 'h',\n 'java',\n 'js',\n 'jsx',\n 'kt',\n 'mjs',\n 'mts',\n 'rs',\n 'swift',\n 'ts',\n 'tsx',\n]);\nconst BLOCK_EXTENSIONS = new Set(['css', 'less', 'sass', 'scss']);\n\n/**\n * Resolve comment style from the file path when `commentStyle` is `'auto'`.\n *\n * @param path File path used to infer the comment style.\n */\nexport function resolveCommentStyle(path: string): ResolvedCommentStyle {\n const basename = nodePath.basename(path);\n const basenameLower = basename.toLowerCase();\n\n if (basename.startsWith('.') || HASH_BASENAMES.has(basenameLower)) {\n return '#';\n }\n\n const extension = nodePath.extname(basename).slice(1).toLowerCase();\n if (HTML_EXTENSIONS.has(extension)) {\n return '<!--';\n }\n if (LINE_EXTENSIONS.has(extension)) {\n return '//';\n }\n\n if (BLOCK_EXTENSIONS.has(extension)) {\n return '/*';\n }\n\n // py, rb, sh, toml, yaml, yml, json, no extension, and unknown → #\n return '#';\n}\n","import { file, type FileOptions, fileSync } from './file.js';\nimport { resolveCommentStyle, type ResolvedCommentStyle } from './internal/resolveCommentStyle.js';\n\nexport type BlockCommentStyle = '#' | '/*' | '//' | '<!--' | 'auto';\n\nexport interface BlockMarkerOptions {\n /**\n * Comment opener used for the marker lines: `'auto'` (from file name),\n * `'#'`, `'//'`, slash-star, or `'<!--'`.\n *\n * @default 'auto'\n */\n commentStyle?: BlockCommentStyle;\n\n /**\n * Identity after `BEGIN:` / `END:`, so multiple blocks in one file do not collide.\n *\n * @default 'managed-block'\n */\n topic?: string;\n}\n\nexport interface BlockOptions {\n /**\n * Block content to insert\n */\n block: string;\n\n /**\n * Insert position\n */\n insertPosition?: ['after', 'EndOfFile' | RegExp] | ['before', 'BeginningOfFile' | RegExp];\n\n /**\n * Marker configuration, or a function that returns the full marker line.\n *\n * @default `{ commentStyle: 'auto', topic: 'managed-block' }`\n */\n marker?: ((mark: 'Begin' | 'End') => string) | BlockMarkerOptions;\n\n /**\n * File path\n */\n path: string;\n\n /**\n * Block target state\n */\n state?: 'absent' | 'present';\n}\n\nconst EOF = 'EndOfFile';\nconst BOF = 'BeginningOfFile';\nconst DEFAULT_TOPIC = 'managed-block';\n\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\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\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\nfunction formatMarker(style: ResolvedCommentStyle, mark: 'Begin' | 'End', topic: string): string {\n const inner = `${mark.toUpperCase()}:${topic}`;\n switch (style) {\n case '#': {\n return `# ${inner}`;\n }\n case '/*': {\n return `/* ${inner} */`;\n }\n case '//': {\n return `// ${inner}`;\n }\n case '<!--': {\n return `<!-- ${inner} -->`;\n }\n default: {\n throw new Error(`Unsupported comment style ${String(style)}`);\n }\n }\n}\n\nfunction toFileOptions(options: BlockOptions): FileOptions {\n const { block: blockName, insertPosition = ['after', EOF], marker, path, state = 'present' } = options;\n\n const EOL = '\\n';\n const markerFn = toMarkerFn(marker, path);\n const beginBlock = markerFn('Begin');\n const endBlock = markerFn('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 '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 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\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\nfunction toMarkerFn(marker: BlockOptions['marker'], path: string): (mark: 'Begin' | 'End') => string {\n if (typeof marker === 'function') {\n return marker;\n }\n\n const commentStyle = marker?.commentStyle ?? 'auto';\n const topic = marker?.topic ?? DEFAULT_TOPIC;\n const resolvedStyle = commentStyle === 'auto' ? resolveCommentStyle(path) : commentStyle;\n\n return (mark) => formatMarker(resolvedStyle, mark, topic);\n}\n","import { chmodSync, mkdirSync, rmSync } from 'node:fs';\nimport { chmod, mkdir, rm } from 'node:fs/promises';\n\nimport type { FileMode } from './FileMode.js';\n\nimport { fileExists } from './internal/fileExists.js';\nimport { fileExistsSync } from './internal/fileExistsSync.js';\nimport { toMode } from './internal/toMode.js';\n\nexport interface DirectoryOptions {\n /**\n * File permissions\n */\n readonly mode?: FileMode;\n\n /**\n * Directory path\n */\n readonly path: string;\n\n /**\n * Directory target state\n */\n readonly state: 'absent' | 'present';\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 * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport async function directory(options: DirectoryOptions): Promise<void> {\n const { mode, path, state } = options;\n const isPresent = await fileExists(path);\n if (state === 'present') {\n const newMode = toMode(mode);\n if (!isPresent) {\n await mkdir(path, { mode: newMode, recursive: true });\n }\n if (newMode != null && isPresent) {\n await chmod(path, newMode);\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 * directorySync({\n * path: 'foo/bar',\n * state: 'present',\n * mode: {\n * owner: { read: true, write: true, execute: true },\n * group: { read: true, write: true, execute: true },\n * other: { read: true, write: true, execute: true },\n * },\n * })\n * ```\n *\n * @param options\n */\nexport function directorySync(options: DirectoryOptions): void {\n const { mode, path, state } = options;\n const isPresent = fileExistsSync(path);\n if (state === 'present') {\n const newMode = toMode(mode);\n if (!isPresent) {\n mkdirSync(path, { mode: newMode, recursive: true });\n }\n if (newMode != null && isPresent) {\n chmodSync(path, newMode);\n }\n } else if (isPresent) {\n rmSync(path, { recursive: true });\n }\n}\n","import { file, type FileOptions, fileSync } from './file.js';\n\nexport interface IgnoreFileOptions extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function where content is represented as lines.\n * When the file does not yet exist, the callback receives `undefined`.\n */\n readonly update?: ((content: Array<string> | undefined) => Array<string> | undefined) | undefined;\n}\n\n/**\n * Ensure file is present/absent asynchronously with content initialized or modified by line.\n *\n * @example\n * ```ts\n * await ignoreFile({\n * path: '.gitignore',\n * update: (lines) => [...(lines ?? []), 'dist'],\n * });\n * ```\n * @param options File target options.\n */\nexport async function ignoreFile(options: IgnoreFileOptions): Promise<void> {\n return file(toFileOption(options));\n}\n\n/**\n * Ensure file is present/absent synchronously with content initialized or modified by line.\n *\n * @example\n * ```ts\n * ignoreFileSync({\n * path: '.gitignore',\n * update: (lines) => [...(lines ?? []), 'dist'],\n * });\n * ```\n * @param options File target options.\n */\nexport function ignoreFileSync(options: IgnoreFileOptions): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption({ update, ...otherOptions }: IgnoreFileOptions): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const eol = content.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const lines = content === '' ? undefined : content.split(eol);\n const updatedLines = update(lines);\n\n return updatedLines == null ? undefined : updatedLines.join(eol);\n },\n };\n}\n","import { readFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport path from 'node:path';\n\nimport { fileExists } from './internal/fileExists.js';\nimport { fileExistsSync } from './internal/fileExistsSync.js';\n\nconst defaultExtensions: Array<string> = ['.json', '.yaml', '.yml', '.js', '.cjs', '.mjs', '.ts', '.cts', '.mts'];\n\nexport interface IsConfigPresentOptions {\n /**\n * The name of the application.\n */\n app: string;\n\n /**\n * The directory to look into. Defaults to `process.cwd()`.\n */\n cwd?: string | undefined;\n\n /**\n * The list of extensions to check for.\n */\n extensions?: Array<string> | undefined;\n\n /**\n * The name of the package configuration. Defaults to `app`.\n */\n packageConfig?: string | undefined;\n}\n\n/**\n * Return whether tool configuration exists at `cwd` (cosmiconfig-style).\n *\n * Looks for `.{app}rc`, `.{app}rc.{ext}`, `{app}.config.{ext}` and a matching\n * `package.json` key.\n *\n * @param options\n */\nexport async function isConfigPresent(options: IsConfigPresentOptions): Promise<boolean> {\n const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);\n\n const [hasConfigFile, hasPackageConfig] = await Promise.all([\n hasAnyFile(candidatePaths),\n hasPackageConfigFile(packageJsonPath, packageConfig),\n ]);\n\n return hasConfigFile || hasPackageConfig;\n}\n\nexport function isConfigPresentSync(options: IsConfigPresentOptions): boolean {\n const { candidatePaths, packageConfig, packageJsonPath } = toCandidates(options);\n\n for (const candidatePath of candidatePaths) {\n if (fileExistsSync(candidatePath)) {\n return true;\n }\n }\n\n if (fileExistsSync(packageJsonPath)) {\n try {\n return hasPackageConfigKey(readFileSync(packageJsonPath, 'utf8'), packageConfig);\n } catch {\n return false;\n }\n }\n\n return false;\n}\n\nasync function hasAnyFile(paths: Array<string>): Promise<boolean> {\n const results = await Promise.all(paths.map((candidatePath) => fileExists(candidatePath)));\n\n return results.some(Boolean);\n}\n\nasync function hasPackageConfigFile(packageJsonPath: string, packageConfig: string): Promise<boolean> {\n if (!(await fileExists(packageJsonPath))) {\n return false;\n }\n\n try {\n return hasPackageConfigKey(await readFile(packageJsonPath, 'utf8'), packageConfig);\n } catch {\n return false;\n }\n}\n\nfunction hasPackageConfigKey(packageJsonContent: string, packageConfig: string): boolean {\n const packageJson = JSON.parse(packageJsonContent) as Record<string, unknown>;\n const value = packageJson[packageConfig];\n\n return value !== undefined && value !== null && value !== false;\n}\n\nfunction toCandidates({ app, cwd = process.cwd(), extensions = defaultExtensions, packageConfig = app }: IsConfigPresentOptions) {\n const candidatePaths = [path.join(cwd, `.${app}rc`)];\n for (const extension of extensions) {\n candidatePaths.push(path.join(cwd, `.${app}rc${extension}`), path.join(cwd, `${app}.config${extension}`));\n }\n\n return {\n candidatePaths,\n packageConfig,\n packageJsonPath: path.join(cwd, 'package.json'),\n };\n}\n","import { file, type FileOptions, fileSync } from './file.js';\n\nexport interface JSONOption<V = JSONValue> extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: undefined | V) => undefined | V) | undefined;\n}\n\nexport type JSONValue = Array<JSONValue> | boolean | null | number | string | { [key: string]: JSONValue };\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\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","export const meta = Object.freeze({\n // @ts-ignore - these variables are injected at build time\n buildNumber: (typeof __PACKAGE_BUILD_NUMBER__ === 'undefined' ? 0 : __PACKAGE_BUILD_NUMBER__) as number,\n // @ts-ignore - these variables are injected at build time\n name: (typeof __PACKAGE_NAME__ === 'undefined' ? '' : __PACKAGE_NAME__) as string,\n // @ts-ignore - these variables are injected at build time\n version: (typeof __PACKAGE_VERSION__ === 'undefined' ? '' : __PACKAGE_VERSION__) as string,\n});\n","import { file, type FileOptions, fileSync } from './file.js';\n\nconst reToolVersion = /\\s+/;\n\n/**\n * Regular expression to split tool and version\n */\nexport type ToolVersions = Record<string, string>;\n\nexport interface ToolVersionsOption extends Omit<FileOptions, 'path' | 'update'>, Partial<Pick<FileOptions, 'path'>> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: ToolVersions | undefined) => ToolVersions | undefined) | undefined;\n}\n\nexport function toolVersions(options: ToolVersionsOption) {\n return file(toFileOption(options));\n}\n\nexport function toolVersionsSync(options: ToolVersionsOption) {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption({ update, ...otherOptions }: ToolVersionsOption): FileOptions {\n return {\n ...otherOptions,\n path: otherOptions.path ?? '.tool-versions',\n update:\n update == null\n ? update\n : (content) => {\n const eol = '\\n';\n const lines = content.split(eol);\n const parsed = Object.fromEntries(\n (function* () {\n for (const line of lines) {\n const [tool, value] = line.split(reToolVersion, 2);\n if (tool) {\n yield [tool, value ?? ''];\n }\n }\n }()),\n );\n const updated = update ? update(parsed) : parsed;\n if (updated === undefined) return updated;\n\n const formatted = Object.entries(updated)\n .map(([tool, value]) => `${tool} ${value}`)\n .join(eol);\n return formatted;\n },\n };\n}\n","import YAML from 'yaml';\n\nimport { file, type FileOptions, fileSync } from './file.js';\n\nexport interface YAMLOption<V = YAMLValue> extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: undefined | V) => undefined | V) | undefined;\n}\n\nexport type YAMLValue = Array<YAMLValue> | boolean | null | number | string | { [key: string]: YAMLValue };\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 yaml<Value>(options: YAMLOption<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 yamlSync<Value>(options: YAMLOption<Value>): void {\n return fileSync(toFileOption(options));\n}\n\nfunction toFileOption<Value>({ update, ...otherOptions }: YAMLOption<Value>): FileOptions {\n return {\n ...otherOptions,\n\n update:\n update == null\n ? update\n : (content) => {\n const yamlValue = content === '' ? undefined : (YAML.parse(content) as Value);\n\n return YAML.stringify(update(yamlValue));\n },\n };\n}\n","import { spawn, spawnSync } from 'node:child_process';\n\nexport interface ExecOptions {\n /**\n * Current working directory\n */\n cwd?: string;\n\n /**\n * Stdio options\n */\n stdio?: 'ignore' | 'inherit' | 'pipe';\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 * @param options\n */\nexport async function exec(\n command: string,\n args: ReadonlyArray<string>,\n options?: ExecOptions,\n): Promise<{ stderr: string; stdout: 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 ts/no-unsafe-call, ts/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 ts/no-unsafe-call, ts/no-unsafe-member-access\n stderr += data.toString(encoding);\n });\n }\n // Handle process exit\n child.on('close', (_code) => {\n resolve({ stderr, stdout });\n });\n\n // Handle errors\n child.on('error', reject);\n });\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 * @param options\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): { stderr: string; stdout: string } {\n const result = spawnSync(command, args, { ...options });\n const encoding = 'utf8';\n\n return { stderr: result.stderr.toString(encoding), stdout: result.stdout.toString(encoding) };\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: 'absent' | 'present';\n\n /**\n * File content mapping function\n *\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @param options\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', key]);\n await exec('yarn', ['config', 'set', key, String(update == null ? '' : update(stdout))]);\n } else {\n await exec('yarn', ['config', 'unset', key]);\n }\n}\n\n/**\n * Synchronous version of {@link yarnConfig}\n *\n * @param options\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', key]);\n execSync('yarn', ['config', 'set', key, String(update == null ? '' : update(stdout))]);\n } else {\n execSync('yarn', ['config', 'unset', key]);\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: 'absent' | 'present';\n\n /**\n * Version mapping function\n *\n */\n readonly update?: (() => undefined | YarnVersionKind) | undefined;\n}\n\n/**\n * Set/Unset yarn configuration value\n *\n * @param options\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', String(update == null ? 'berry' : update())]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n\n/**\n * Synchronous version of {@link yarnVersion}\n *\n * @param options\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', String(update == null ? 'berry' : update())]);\n } else {\n // TODO: remove yarn.lock\n throw new Error('Not implemented');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,eAAsB,WAAW,MAAc;CAC7C,IAAI;EACF,OAAA,GAAMA,iBAAAA,OAAAA,CAAO,MAAMC,QAAAA,UAAU,IAAI;EACjC,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;ACRA,SAAgB,eAAe,MAAc;CAC3C,IAAI;EACFC,CAAAA,GAAAA,QAAAA,WAAAA,CAAW,MAAMC,QAAAA,UAAU,IAAI;EAC/B,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;ACPA,SAAgB,OAAO,MAAgD;CACrE,OAAO,QAAQ,OACX,OAEE,WAAW,KAAK,OAAO,KAAO,KAAO,EAAK,IACxC,WAAW,KAAK,OAAO,IAAO,IAAO,CAAK,IAC1C,WAAW,KAAK,OAAO,GAAO,GAAO,CAAK;AAEpD;AAEA,SAAS,WAAW,eAA8C,MAAc,OAAe,SAAyB;CACtH,QACG,eAAe,SAAS,OAAO,OAAO,MACpC,eAAe,UAAU,OAAO,QAAQ,MACxC,eAAe,YAAY,OAAO,UAAU;AAE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AU;GAAO;EAAG,CAAC;EAC5D,MAAM,KAAK,QAAQ;GAAC;GAAU;GAAO;GAAK,OAAO,UAAU,OAAO,KAAK,OAAO,MAAM,CAAC;EAAC,CAAC;CACzF,OACE,MAAM,KAAK,QAAQ;EAAC;EAAU;EAAS;CAAG,CAAC;AAE/C;;;;;;;;;;;;AAaA,SAAgB,eAAe,SAA4B;CACzD,MAAM,EAAE,KAAK,OAAO,WAAW;CAC/B,IAAI,UAAU,WAAW;EACvB,MAAM,EAAE,WAAW,SAAS,QAAQ;GAAC;GAAU;GAAO;EAAG,CAAC;EAC1D,SAAS,QAAQ;GAAC;GAAU;GAAO;GAAK,OAAO,UAAU,OAAO,KAAK,OAAO,MAAM,CAAC;EAAC,CAAC;CACvF,OACE,SAAS,QAAQ;EAAC;EAAU;EAAS;CAAG,CAAC;AAE7C;;;;;;;;;;;;ACjCA,eAAsB,YAAY,SAA4C;CAC5E,MAAM,EAAE,OAAO,WAAW;CAC1B,IAAI,UAAU,WACZ,MAAM,KAAK,QAAQ;EAAC;EAAO;EAAW,OAAO,UAAU,OAAO,UAAU,OAAO,CAAC;CAAC,CAAC;MAGlF,MAAM,IAAI,MAAM,iBAAiB;AAErC;;;;;;;;;;;AAYA,SAAgB,gBAAgB,SAA6B;CAC3D,MAAM,EAAE,OAAO,WAAW;CAC1B,IAAI,UAAU,WACZ,SAAS,QAAQ;EAAC;EAAO;EAAW,OAAO,UAAU,OAAO,UAAU,OAAO,CAAC;CAAC,CAAC;MAGhF,MAAM,IAAI,MAAM,iBAAiB;AAErC"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/block.d.ts
|
|
2
1
|
export type BlockCommentStyle = '#' | '/*' | '//' | '<!--' | 'auto';
|
|
3
2
|
export interface BlockMarkerOptions {
|
|
4
3
|
/**
|
|
@@ -59,8 +58,6 @@ export declare function block(options: BlockOptions): Promise<void>;
|
|
|
59
58
|
* @param options
|
|
60
59
|
*/
|
|
61
60
|
export declare function blockSync(options: BlockOptions): void;
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region src/FileMode.d.ts
|
|
64
61
|
interface FileMode {
|
|
65
62
|
/**
|
|
66
63
|
* Group permissions
|
|
@@ -89,8 +86,6 @@ interface FilePermissionSet {
|
|
|
89
86
|
*/
|
|
90
87
|
readonly write?: boolean;
|
|
91
88
|
}
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/directory.d.ts
|
|
94
89
|
export interface DirectoryOptions {
|
|
95
90
|
/**
|
|
96
91
|
* File permissions
|
|
@@ -143,8 +138,6 @@ export declare function directory(options: DirectoryOptions): Promise<void>;
|
|
|
143
138
|
* @param options
|
|
144
139
|
*/
|
|
145
140
|
export declare function directorySync(options: DirectoryOptions): void;
|
|
146
|
-
//#endregion
|
|
147
|
-
//#region src/file.d.ts
|
|
148
141
|
export interface FileOptions {
|
|
149
142
|
/**
|
|
150
143
|
* File encoding
|
|
@@ -208,8 +201,6 @@ export declare function file(options: FileOptions): Promise<void>;
|
|
|
208
201
|
* @param options
|
|
209
202
|
*/
|
|
210
203
|
export declare function fileSync(options: FileOptions): void;
|
|
211
|
-
//#endregion
|
|
212
|
-
//#region src/ignoreFile.d.ts
|
|
213
204
|
export interface IgnoreFileOptions extends Omit<FileOptions, 'update'> {
|
|
214
205
|
/**
|
|
215
206
|
* File content mapping function where content is represented as lines.
|
|
@@ -243,8 +234,6 @@ export declare function ignoreFile(options: IgnoreFileOptions): Promise<void>;
|
|
|
243
234
|
* @param options File target options.
|
|
244
235
|
*/
|
|
245
236
|
export declare function ignoreFileSync(options: IgnoreFileOptions): void;
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region src/isConfigPresent.d.ts
|
|
248
237
|
export interface IsConfigPresentOptions {
|
|
249
238
|
/**
|
|
250
239
|
* The name of the application.
|
|
@@ -273,8 +262,6 @@ export interface IsConfigPresentOptions {
|
|
|
273
262
|
*/
|
|
274
263
|
export declare function isConfigPresent(options: IsConfigPresentOptions): Promise<boolean>;
|
|
275
264
|
export declare function isConfigPresentSync(options: IsConfigPresentOptions): boolean;
|
|
276
|
-
//#endregion
|
|
277
|
-
//#region src/json.d.ts
|
|
278
265
|
export interface JSONOption<V = JSONValue> extends Omit<FileOptions, 'update'> {
|
|
279
266
|
/**
|
|
280
267
|
* File content mapping function
|
|
@@ -296,15 +283,23 @@ export declare function json<Value>(options: JSONOption<Value>): Promise<void>;
|
|
|
296
283
|
* @param options
|
|
297
284
|
*/
|
|
298
285
|
export declare function jsonSync<Value>(options: JSONOption<Value>): void;
|
|
299
|
-
//#endregion
|
|
300
|
-
//#region src/meta.d.ts
|
|
301
286
|
export declare const meta: Readonly<{
|
|
302
287
|
buildNumber: number;
|
|
303
288
|
name: string;
|
|
304
289
|
version: string;
|
|
305
290
|
}>;
|
|
306
|
-
|
|
307
|
-
|
|
291
|
+
/**
|
|
292
|
+
* Regular expression to split tool and version
|
|
293
|
+
*/
|
|
294
|
+
export type ToolVersions = Record<string, string>;
|
|
295
|
+
export interface ToolVersionsOption extends Omit<FileOptions, 'path' | 'update'>, Partial<Pick<FileOptions, 'path'>> {
|
|
296
|
+
/**
|
|
297
|
+
* File content mapping function
|
|
298
|
+
*/
|
|
299
|
+
readonly update?: ((content: ToolVersions | undefined) => ToolVersions | undefined) | undefined;
|
|
300
|
+
}
|
|
301
|
+
export declare function toolVersions(options: ToolVersionsOption): Promise<void>;
|
|
302
|
+
export declare function toolVersionsSync(options: ToolVersionsOption): void;
|
|
308
303
|
export interface YAMLOption<V = YAMLValue> extends Omit<FileOptions, 'update'> {
|
|
309
304
|
/**
|
|
310
305
|
* File content mapping function
|
|
@@ -326,8 +321,6 @@ export declare function yaml<Value>(options: YAMLOption<Value>): Promise<void>;
|
|
|
326
321
|
* @param options
|
|
327
322
|
*/
|
|
328
323
|
export declare function yamlSync<Value>(options: YAMLOption<Value>): void;
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region src/yarnConfig.d.ts
|
|
331
324
|
export interface YarnConfigOptions {
|
|
332
325
|
/**
|
|
333
326
|
* Configuration key
|
|
@@ -367,8 +360,6 @@ export declare function yarnConfig(options: YarnConfigOptions): Promise<void>;
|
|
|
367
360
|
* })
|
|
368
361
|
*/
|
|
369
362
|
export declare function yarnConfigSync(options: YarnConfigOptions): void;
|
|
370
|
-
//#endregion
|
|
371
|
-
//#region src/yarnVersion.d.ts
|
|
372
363
|
export type YarnVersionKind = 'berry' | 'classic';
|
|
373
364
|
export interface YarnVersionOptions {
|
|
374
365
|
/**
|
|
@@ -403,6 +394,5 @@ export declare function yarnVersion(options: YarnVersionOptions): Promise<void>;
|
|
|
403
394
|
* })
|
|
404
395
|
*/
|
|
405
396
|
export declare function yarnVersionSync(options: YarnVersionOptions): void;
|
|
406
|
-
//#endregion
|
|
407
397
|
export {};
|
|
408
398
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/block.ts","../src/FileMode.ts","../src/directory.ts","../src/file.ts","../src/ignoreFile.ts","../src/isConfigPresent.ts","../src/json.ts","../src/meta.ts","../src/yaml.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/block.ts","../src/FileMode.ts","../src/directory.ts","../src/file.ts","../src/ignoreFile.ts","../src/isConfigPresent.ts","../src/json.ts","../src/meta.ts","../src/toolVersions.ts","../src/yaml.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"mappings":"A,YAGY;iBAEK;;;;;;;EAOf,eAAe;;;;;;EAOf;;iBAGe;;;;EAIf;;;;EAKA,yCAAyC,yCAAyC;;;;;;EAOlF,WAAW,oCAAoC;;;;EAK/C;;;;EAKA;;;;;;;;;;;wBAkCc,MAAM,SAAS,eAAY;;;;;;;;;;wBAa3B,UAAU,SAAS;UC/FlB;;;;WAIN,QAAQ;;;;WAKR,QAAQ;;;;W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