@w5s/configurator-core 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/index.cjs +446 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +304 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +304 -0
- package/dist/index.js +433 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
- package/src/FileMode.ts +33 -0
- package/src/__exists.ts +11 -0
- package/src/__existsSync.ts +10 -0
- package/src/__toMode.ts +19 -0
- package/src/block.ts +153 -0
- package/src/directory.ts +91 -0
- package/src/exec.ts +73 -0
- package/src/file.ts +108 -0
- package/src/index.ts +7 -0
- package/src/json.ts +43 -0
- package/src/meta.ts +8 -0
- package/src/testing/getRootPath.ts +9 -0
- package/src/testing/getTempPath.ts +6 -0
- package/src/testing/getTestPath.ts +25 -0
- package/src/testing/index.ts +1 -0
- package/src/yarnConfig.ts +61 -0
- package/src/yarnVersion.ts +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Julien Polo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=# W5S Configurator _(${name})_) -->
|
|
2
|
+
# W5S Configurator _(@w5s/configurator-core)_
|
|
3
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
4
|
+
|
|
5
|
+
[![NPM Version][package-version-svg]][package-url]
|
|
6
|
+
[![License][license-image]][license-url]
|
|
7
|
+
|
|
8
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=> ${description}&unknownTxt= ) -->
|
|
9
|
+
> Shared development constants and functions
|
|
10
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=```console\nnpm install --save-dev ${name}\n```) -->
|
|
15
|
+
```console
|
|
16
|
+
npm install --save-dev @w5s/configurator-core
|
|
17
|
+
```
|
|
18
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=```json\n"${name}"\n```) -->
|
|
23
|
+
```json
|
|
24
|
+
"@w5s/configurator-core"
|
|
25
|
+
```
|
|
26
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[${license}][license-url] © ${author}) -->
|
|
30
|
+
[MIT][license-url] © Julien Polo <julien.polo@gmail.com>
|
|
31
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
32
|
+
|
|
33
|
+
<!-- VARIABLES -->
|
|
34
|
+
|
|
35
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[package-version-svg]: https://img.shields.io/npm/v/${name}.svg?style=flat-square) -->
|
|
36
|
+
[package-version-svg]: https://img.shields.io/npm/v/@w5s/configurator-core.svg?style=flat-square
|
|
37
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
38
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[package-url]: https://www.npmjs.com/package/${name}) -->
|
|
39
|
+
[package-url]: https://www.npmjs.com/package/@w5s/configurator-core
|
|
40
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
41
|
+
<!-- AUTO-GENERATED-CONTENT:START (PKG_JSON:template=[license-image]: https://img.shields.io/badge/license-${license}-green.svg?style=flat-square) -->
|
|
42
|
+
[license-image]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square
|
|
43
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
44
|
+
[license-url]: ../../LICENSE
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
let node_fs_promises = require("node:fs/promises");
|
|
4
|
+
let node_child_process = require("node:child_process");
|
|
5
|
+
//#region src/__exists.ts
|
|
6
|
+
async function __exists(path) {
|
|
7
|
+
try {
|
|
8
|
+
await (0, node_fs_promises.access)(path, node_fs.constants.F_OK);
|
|
9
|
+
return true;
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/__toMode.ts
|
|
16
|
+
function toModeFlag(permissionSet, read, write, execute) {
|
|
17
|
+
return (permissionSet?.read === true ? read : 0) | (permissionSet?.write === true ? write : 0) | (permissionSet?.execute === true ? execute : 0);
|
|
18
|
+
}
|
|
19
|
+
function __toMode(mode) {
|
|
20
|
+
return mode == null ? mode : toModeFlag(mode.owner, 256, 128, 64) | toModeFlag(mode.group, 32, 16, 8) | toModeFlag(mode.other, 4, 2, 1);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/__existsSync.ts
|
|
24
|
+
function __existsSync(path) {
|
|
25
|
+
try {
|
|
26
|
+
(0, node_fs.accessSync)(path, node_fs.constants.F_OK);
|
|
27
|
+
return true;
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/directory.ts
|
|
34
|
+
/**
|
|
35
|
+
* Ensure directory is present/absent
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* await directory({
|
|
40
|
+
* path: 'foo/bar',
|
|
41
|
+
* state: 'present',
|
|
42
|
+
* mode: {
|
|
43
|
+
* owner: { read: true, write: true, execute: true },
|
|
44
|
+
* group: { read: true, write: true, execute: true },
|
|
45
|
+
* other: { read: true, write: true, execute: true },
|
|
46
|
+
* },
|
|
47
|
+
* })
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @param options
|
|
51
|
+
*/
|
|
52
|
+
async function directory(options) {
|
|
53
|
+
const { path, state, mode } = options;
|
|
54
|
+
const isPresent = await __exists(path);
|
|
55
|
+
if (state === "present") {
|
|
56
|
+
const newMode = __toMode(mode);
|
|
57
|
+
if (!isPresent) await (0, node_fs_promises.mkdir)(path, {
|
|
58
|
+
recursive: true,
|
|
59
|
+
mode: newMode
|
|
60
|
+
});
|
|
61
|
+
if (newMode != null && isPresent) await (0, node_fs_promises.chmod)(path, newMode);
|
|
62
|
+
} else if (isPresent) await (0, node_fs_promises.rm)(path, { recursive: true });
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Ensure directory is present/absent
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* directorySync({
|
|
70
|
+
* path: 'foo/bar',
|
|
71
|
+
* state: 'present',
|
|
72
|
+
* mode: {
|
|
73
|
+
* owner: { read: true, write: true, execute: true },
|
|
74
|
+
* group: { read: true, write: true, execute: true },
|
|
75
|
+
* other: { read: true, write: true, execute: true },
|
|
76
|
+
* },
|
|
77
|
+
* })
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @param options
|
|
81
|
+
*/
|
|
82
|
+
function directorySync(options) {
|
|
83
|
+
const { path, state, mode } = options;
|
|
84
|
+
const isPresent = __existsSync(path);
|
|
85
|
+
if (state === "present") {
|
|
86
|
+
const newMode = __toMode(mode);
|
|
87
|
+
if (!isPresent) (0, node_fs.mkdirSync)(path, {
|
|
88
|
+
recursive: true,
|
|
89
|
+
mode: newMode
|
|
90
|
+
});
|
|
91
|
+
if (newMode != null && isPresent) (0, node_fs.chmodSync)(path, newMode);
|
|
92
|
+
} else if (isPresent) (0, node_fs.rmSync)(path, { recursive: true });
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/file.ts
|
|
96
|
+
/**
|
|
97
|
+
* Ensure file is present/absent with content initialized or modified with `update
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* await file({
|
|
102
|
+
* path: 'foo/bar',
|
|
103
|
+
* state: 'present',
|
|
104
|
+
* update: (content) => content + '_test', // This will append '_test' after current content
|
|
105
|
+
* mode: {
|
|
106
|
+
* owner: { read: true, write: true, execute: true },
|
|
107
|
+
* group: { read: true, write: true, execute: true },
|
|
108
|
+
* other: { read: true, write: true, execute: true },
|
|
109
|
+
* },
|
|
110
|
+
* })
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @param options
|
|
114
|
+
*/
|
|
115
|
+
async function file(options) {
|
|
116
|
+
const { path, state, update, encoding = "utf8", mode } = options;
|
|
117
|
+
if (state === "present") {
|
|
118
|
+
const isPresent = await __exists(path);
|
|
119
|
+
const previousContent = isPresent ? await (0, node_fs_promises.readFile)(path, encoding) : "";
|
|
120
|
+
const newContent = update == null ? isPresent ? void 0 : "" : update(previousContent);
|
|
121
|
+
const newMode = __toMode(mode);
|
|
122
|
+
if (newContent != null) await (0, node_fs_promises.writeFile)(path, newContent, {
|
|
123
|
+
encoding,
|
|
124
|
+
mode: newMode
|
|
125
|
+
});
|
|
126
|
+
if (newMode != null && (isPresent || newContent != null)) await (0, node_fs_promises.chmod)(path, newMode);
|
|
127
|
+
} else await (0, node_fs_promises.rm)(path, { force: true });
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Ensure file is present/absent with content initialized or modified with `update
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* fileSync({
|
|
135
|
+
* path: 'foo/bar',
|
|
136
|
+
* state: 'present',
|
|
137
|
+
* update: (content) => content + '_test', // This will append '_test' after current content
|
|
138
|
+
* mode: {
|
|
139
|
+
* owner: { read: true, write: true, execute: true },
|
|
140
|
+
* group: { read: true, write: true, execute: true },
|
|
141
|
+
* other: { read: true, write: true, execute: true },
|
|
142
|
+
* },
|
|
143
|
+
* })
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* @param options
|
|
147
|
+
*/
|
|
148
|
+
function fileSync(options) {
|
|
149
|
+
const { path, state, update, encoding = "utf8", mode } = options;
|
|
150
|
+
if (state === "present") {
|
|
151
|
+
const isPresent = __existsSync(path);
|
|
152
|
+
const previousContent = isPresent ? (0, node_fs.readFileSync)(path, encoding) : "";
|
|
153
|
+
const newContent = update == null ? isPresent ? void 0 : "" : update(previousContent);
|
|
154
|
+
const newMode = __toMode(mode);
|
|
155
|
+
if (newContent != null) (0, node_fs.writeFileSync)(path, newContent, {
|
|
156
|
+
encoding,
|
|
157
|
+
mode: newMode
|
|
158
|
+
});
|
|
159
|
+
if (newMode != null && (isPresent || newContent != null)) (0, node_fs.chmodSync)(path, newMode);
|
|
160
|
+
} else (0, node_fs.rmSync)(path, { force: true });
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/block.ts
|
|
164
|
+
const EOF = "EndOfFile";
|
|
165
|
+
const BOF = "BeginningOfFile";
|
|
166
|
+
const insertAt = (str, index, toInsert) => str.slice(0, index) + toInsert + str.slice(index);
|
|
167
|
+
const matchLast = (string, regexp) => {
|
|
168
|
+
const matcher = new RegExp(regexp.source, `${regexp.flags}g`);
|
|
169
|
+
let firstIndex = -1;
|
|
170
|
+
let lastIndex = -1;
|
|
171
|
+
let matches;
|
|
172
|
+
while (true) {
|
|
173
|
+
matches = matcher.exec(string);
|
|
174
|
+
if (matches == null) break;
|
|
175
|
+
firstIndex = matches.index;
|
|
176
|
+
lastIndex = matcher.lastIndex;
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
firstIndex,
|
|
180
|
+
lastIndex
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
function toFileOptions(options) {
|
|
184
|
+
const { marker = (mark) => `# ${mark.toUpperCase()} MANAGED BLOCK`, path, block: blockName, insertPosition = ["after", EOF], state = "present" } = options;
|
|
185
|
+
const EOL = "\n";
|
|
186
|
+
const beginBlock = marker("Begin");
|
|
187
|
+
const endBlock = marker("End");
|
|
188
|
+
/**
|
|
189
|
+
* @param content
|
|
190
|
+
*/
|
|
191
|
+
function findBlock(content) {
|
|
192
|
+
const startIndex = content.indexOf(beginBlock);
|
|
193
|
+
const endIndex = content.indexOf(endBlock) + endBlock.length;
|
|
194
|
+
return {
|
|
195
|
+
endIndex,
|
|
196
|
+
exists: startIndex !== -1 && endIndex >= 0,
|
|
197
|
+
startIndex
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function apply(fullContent, blockContent) {
|
|
201
|
+
const found = findBlock(fullContent);
|
|
202
|
+
const remove = state === "absent";
|
|
203
|
+
const replaceBlock = remove ? "" : beginBlock + EOL + blockContent + EOL + endBlock;
|
|
204
|
+
const [positionDirection, positionAnchor] = insertPosition;
|
|
205
|
+
if (found.exists) return fullContent.slice(0, found.startIndex) + replaceBlock + fullContent.slice(found.endIndex);
|
|
206
|
+
if (remove) return fullContent;
|
|
207
|
+
switch (positionDirection) {
|
|
208
|
+
case "before":
|
|
209
|
+
if (positionAnchor !== BOF) {
|
|
210
|
+
const { firstIndex } = matchLast(fullContent, positionAnchor);
|
|
211
|
+
if (firstIndex >= 0) return insertAt(fullContent, firstIndex, replaceBlock + EOL);
|
|
212
|
+
}
|
|
213
|
+
return replaceBlock + EOL + fullContent;
|
|
214
|
+
case "after":
|
|
215
|
+
if (positionAnchor !== EOF) {
|
|
216
|
+
const { lastIndex } = matchLast(fullContent, positionAnchor);
|
|
217
|
+
if (lastIndex >= 0) return insertAt(fullContent, lastIndex, EOL + replaceBlock);
|
|
218
|
+
}
|
|
219
|
+
return fullContent + EOL + replaceBlock;
|
|
220
|
+
default: throw new Error(`Unsupported position ${String(positionDirection)}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
path,
|
|
225
|
+
state: "present",
|
|
226
|
+
update: (sourceContent) => apply(sourceContent, blockName)
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Replace asynchronously a block in file that follows pattern :
|
|
231
|
+
*
|
|
232
|
+
* marker(markerBegin)
|
|
233
|
+
* ...
|
|
234
|
+
* marker(markerEnd)
|
|
235
|
+
*
|
|
236
|
+
* @param options
|
|
237
|
+
*/
|
|
238
|
+
function block(options) {
|
|
239
|
+
return file(toFileOptions(options));
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Replace synchronously a block in file that follows pattern :
|
|
243
|
+
*
|
|
244
|
+
* marker(markerBegin)
|
|
245
|
+
* ...
|
|
246
|
+
* marker(markerEnd)
|
|
247
|
+
*
|
|
248
|
+
* @param options
|
|
249
|
+
*/
|
|
250
|
+
function blockSync(options) {
|
|
251
|
+
return fileSync(toFileOptions(options));
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/json.ts
|
|
255
|
+
function toFileOption({ update, ...otherOptions }) {
|
|
256
|
+
return {
|
|
257
|
+
...otherOptions,
|
|
258
|
+
update: update == null ? update : (content) => {
|
|
259
|
+
const jsonValue = content === "" ? void 0 : JSON.parse(content);
|
|
260
|
+
return JSON.stringify(update(jsonValue));
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Ensure file is present/absent asynchronously with content value initialized or modified with `update`
|
|
266
|
+
*
|
|
267
|
+
* @param options
|
|
268
|
+
*/
|
|
269
|
+
async function json(options) {
|
|
270
|
+
return file(toFileOption(options));
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Ensure file is present/absent synchronously with content value initialized or modified with `update`
|
|
274
|
+
*
|
|
275
|
+
* @param options
|
|
276
|
+
*/
|
|
277
|
+
function jsonSync(options) {
|
|
278
|
+
return fileSync(toFileOption(options));
|
|
279
|
+
}
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/meta.ts
|
|
282
|
+
const meta = Object.freeze({
|
|
283
|
+
name: "@w5s/configurator-core",
|
|
284
|
+
version: "1.0.0-alpha.1",
|
|
285
|
+
buildNumber: 1
|
|
286
|
+
});
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/exec.ts
|
|
289
|
+
/**
|
|
290
|
+
* Runs a command in a shell and returns a promise that resolves with an object
|
|
291
|
+
* containing the stdout and stderr strings.
|
|
292
|
+
*
|
|
293
|
+
* @param command The command to run
|
|
294
|
+
* @param args The arguments to pass to the command
|
|
295
|
+
* @param options
|
|
296
|
+
* @returns A promise that resolves with an object like `{ stdout: string, stderr: string }`
|
|
297
|
+
*/
|
|
298
|
+
function execSync(command, args, options) {
|
|
299
|
+
const result = (0, node_child_process.spawnSync)(command, args, { ...options });
|
|
300
|
+
const encoding = "utf8";
|
|
301
|
+
return {
|
|
302
|
+
stdout: result.stdout.toString(encoding),
|
|
303
|
+
stderr: result.stderr.toString(encoding)
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Runs a command in a shell and returns a promise that resolves with an object
|
|
308
|
+
* containing the stdout and stderr strings.
|
|
309
|
+
*
|
|
310
|
+
* @param command The command to run
|
|
311
|
+
* @param args The arguments to pass to the command
|
|
312
|
+
* @param options
|
|
313
|
+
*/
|
|
314
|
+
async function exec(command, args, options) {
|
|
315
|
+
return new Promise((resolve, reject) => {
|
|
316
|
+
const encoding = "utf8";
|
|
317
|
+
const child = (0, node_child_process.spawn)(command, args, { ...options });
|
|
318
|
+
let stdout = "";
|
|
319
|
+
let stderr = "";
|
|
320
|
+
if (child.stdout != null) child.stdout.on("data", (data) => {
|
|
321
|
+
stdout += data.toString(encoding);
|
|
322
|
+
});
|
|
323
|
+
if (child.stderr != null) child.stderr.on("data", (data) => {
|
|
324
|
+
stderr += data.toString(encoding);
|
|
325
|
+
});
|
|
326
|
+
child.on("close", (_code) => {
|
|
327
|
+
resolve({
|
|
328
|
+
stdout,
|
|
329
|
+
stderr
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
child.on("error", reject);
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/yarnConfig.ts
|
|
337
|
+
/**
|
|
338
|
+
* Synchronous version of {@link yarnConfig}
|
|
339
|
+
*
|
|
340
|
+
* @param options
|
|
341
|
+
* @example
|
|
342
|
+
* yarnConfigSync({
|
|
343
|
+
* key: 'nodeLinker',
|
|
344
|
+
* state: 'present',
|
|
345
|
+
* update: (content) => content.replace('node-modules', 'hoisted'),
|
|
346
|
+
* })
|
|
347
|
+
*/
|
|
348
|
+
function yarnConfigSync(options) {
|
|
349
|
+
const { key, state, update } = options;
|
|
350
|
+
if (state === "present") {
|
|
351
|
+
const { stdout } = execSync("yarn", [
|
|
352
|
+
"config",
|
|
353
|
+
"get",
|
|
354
|
+
String(key)
|
|
355
|
+
]);
|
|
356
|
+
execSync("yarn", [
|
|
357
|
+
"config",
|
|
358
|
+
"set",
|
|
359
|
+
String(key),
|
|
360
|
+
`${update == null ? "" : update(stdout)}`
|
|
361
|
+
]);
|
|
362
|
+
} else execSync("yarn", ["config", "unset"]);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Set/Unset yarn configuration value
|
|
366
|
+
*
|
|
367
|
+
* @param options
|
|
368
|
+
* @example
|
|
369
|
+
* await yarnConfig({
|
|
370
|
+
* key: 'nodeLinker',
|
|
371
|
+
* state: 'present',
|
|
372
|
+
* update: (content) => content.replace('node-modules', 'hoisted'),
|
|
373
|
+
* })
|
|
374
|
+
*/
|
|
375
|
+
async function yarnConfig(options) {
|
|
376
|
+
const { key, state, update } = options;
|
|
377
|
+
if (state === "present") {
|
|
378
|
+
const { stdout } = await exec("yarn", [
|
|
379
|
+
"config",
|
|
380
|
+
"get",
|
|
381
|
+
String(key)
|
|
382
|
+
]);
|
|
383
|
+
await exec("yarn", [
|
|
384
|
+
"config",
|
|
385
|
+
"set",
|
|
386
|
+
String(key),
|
|
387
|
+
`${update == null ? "" : update(stdout)}`
|
|
388
|
+
]);
|
|
389
|
+
} else await exec("yarn", ["config", "unset"]);
|
|
390
|
+
}
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/yarnVersion.ts
|
|
393
|
+
/**
|
|
394
|
+
* Synchronous version of {@link yarnVersion}
|
|
395
|
+
*
|
|
396
|
+
* @param options
|
|
397
|
+
* @example
|
|
398
|
+
* yarnVersionSync({
|
|
399
|
+
* state: 'present',
|
|
400
|
+
* update: () => 'berry', // or 'classic'
|
|
401
|
+
* })
|
|
402
|
+
*/
|
|
403
|
+
function yarnVersionSync(options) {
|
|
404
|
+
const { state, update } = options;
|
|
405
|
+
if (state === "present") execSync("yarn", [
|
|
406
|
+
"set",
|
|
407
|
+
"version",
|
|
408
|
+
`${update == null ? "berry" : update()}`
|
|
409
|
+
]);
|
|
410
|
+
else throw new Error("Not implemented");
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Set/Unset yarn configuration value
|
|
414
|
+
*
|
|
415
|
+
* @param options
|
|
416
|
+
* @example
|
|
417
|
+
* await yarnVersion({
|
|
418
|
+
* state: 'present',
|
|
419
|
+
* update: () => 'berry', // or 'classic'
|
|
420
|
+
* })
|
|
421
|
+
*/
|
|
422
|
+
async function yarnVersion(options) {
|
|
423
|
+
const { state, update } = options;
|
|
424
|
+
if (state === "present") await exec("yarn", [
|
|
425
|
+
"set",
|
|
426
|
+
"version",
|
|
427
|
+
`${update == null ? "berry" : update()}`
|
|
428
|
+
]);
|
|
429
|
+
else throw new Error("Not implemented");
|
|
430
|
+
}
|
|
431
|
+
//#endregion
|
|
432
|
+
exports.block = block;
|
|
433
|
+
exports.blockSync = blockSync;
|
|
434
|
+
exports.directory = directory;
|
|
435
|
+
exports.directorySync = directorySync;
|
|
436
|
+
exports.file = file;
|
|
437
|
+
exports.fileSync = fileSync;
|
|
438
|
+
exports.json = json;
|
|
439
|
+
exports.jsonSync = jsonSync;
|
|
440
|
+
exports.meta = meta;
|
|
441
|
+
exports.yarnConfig = yarnConfig;
|
|
442
|
+
exports.yarnConfigSync = yarnConfigSync;
|
|
443
|
+
exports.yarnVersion = yarnVersion;
|
|
444
|
+
exports.yarnVersionSync = yarnVersionSync;
|
|
445
|
+
|
|
446
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["constants","constants"],"sources":["../src/__exists.ts","../src/__toMode.ts","../src/__existsSync.ts","../src/directory.ts","../src/file.ts","../src/block.ts","../src/json.ts","../src/meta.ts","../src/exec.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"sourcesContent":["import { access } from 'node:fs/promises';\nimport { constants } from 'node:fs';\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 type { FileMode, FilePermissionSet } from './FileMode.js';\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\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","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 { chmodSync, mkdirSync, rmSync } from 'node:fs';\nimport { chmod, mkdir, rm } from 'node:fs/promises';\nimport { __exists } from './__exists.js';\nimport type { FileMode } from './FileMode.js';\nimport { __toMode } from './__toMode.js';\nimport { __existsSync } from './__existsSync.js';\n\nexport interface DirectoryOptions {\n /**\n * Directory path\n */\n readonly path: string;\n\n /**\n * Directory target state\n */\n readonly state: 'present' | 'absent';\n\n /**\n * File permissions\n */\n readonly mode?: FileMode;\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 { path, state, mode } = options;\n const isPresent = await __exists(path);\n if (state === 'present') {\n const newMode = __toMode(mode);\n if (!isPresent) {\n await mkdir(path, { recursive: true, mode: newMode });\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 { path, state, mode } = options;\n const isPresent = __existsSync(path);\n if (state === 'present') {\n const newMode = __toMode(mode);\n if (!isPresent) {\n mkdirSync(path, { recursive: true, mode: newMode });\n }\n if (newMode != null && isPresent) {\n chmodSync(path, newMode);\n }\n } else if (isPresent) {\n rmSync(path, { recursive: true });\n }\n}\n","import { chmod, readFile, rm, writeFile } from 'node:fs/promises';\nimport { chmodSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { __exists } from './__exists.js';\nimport { __existsSync } from './__existsSync.js';\nimport type { FileMode } from './FileMode.js';\nimport { __toMode } from './__toMode.js';\n\nexport interface FileOptions {\n /**\n * File path\n */\n readonly path: string;\n\n /**\n * File target state\n */\n readonly state: 'present' | 'absent';\n\n /**\n * File content mapping function\n *\n */\n readonly update?: ((content: string) => string | undefined) | undefined;\n\n /**\n * File encoding\n */\n readonly encoding?: BufferEncoding;\n\n /**\n * File permissions\n */\n readonly mode?: FileMode;\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 { path, state, update, encoding = 'utf8', mode } = 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 { path, state, update, encoding = 'utf8', mode } = 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 { 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 /**\n * File path\n */\n path: string;\n\n /**\n * Block content to insert\n */\n block: string;\n\n /**\n * Insert position\n */\n insertPosition?: ['before', 'BeginningOfFile' | RegExp] | ['after', 'EndOfFile' | RegExp];\n\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\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","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> extends Omit<FileOptions, 'update'> {\n /**\n * File content mapping function\n */\n readonly update?: ((content: V | undefined) => V | undefined) | undefined;\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","export const meta = Object.freeze({\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 // @ts-ignore - these variables are injected at build time\n buildNumber: 1 as number, // (typeof __PACKAGE_BUILD_NUMBER__ === 'undefined' ? 0 : __PACKAGE_BUILD_NUMBER__) as number,\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?: '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 * @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): { 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 * @param options\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 stdout += data.toString(encoding);\n });\n }\n if (child.stderr != null) {\n child.stderr.on('data', (data) => {\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 */\n readonly update?: ((content: string) => string | undefined) | undefined;\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', 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 * @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', 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 */\n readonly update?: (() => YarnVersionKind | undefined) | undefined;\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', `${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 * @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', `${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;CAC3C,IAAI;EACF,OAAA,GAAA,iBAAA,QAAa,MAAMA,QAAAA,UAAU,KAAK;EAClC,OAAO;SACD;EACN,OAAO;;;;;ACNX,SAAS,WAAW,eAA8C,MAAc,OAAe,SAAyB;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