@w5s/configurator-core 1.0.0-alpha.8 → 1.0.0-alpha.9

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.d.ts CHANGED
@@ -1,23 +1,51 @@
1
- //#region src/FileMode.d.ts
2
- interface FilePermissionSet {
1
+ //#region src/block.d.ts
2
+ interface BlockOptions {
3
3
  /**
4
- * Read permission
4
+ * Block content to insert
5
5
  */
6
- readonly read?: boolean;
6
+ block: string;
7
7
  /**
8
- * Write permission
8
+ * Insert position
9
9
  */
10
- readonly write?: boolean;
10
+ insertPosition?: ['after', 'EndOfFile' | RegExp] | ['before', 'BeginningOfFile' | RegExp];
11
11
  /**
12
- * Execute permission
12
+ * The marker builder function that will take either `markerBegin` or `markerEnd`
13
+ *
14
+ * @default '# ${mark} MANAGED BLOCK'
13
15
  */
14
- readonly execute?: boolean;
15
- }
16
- interface FileMode {
16
+ marker?: (mark: 'Begin' | 'End') => string;
17
17
  /**
18
- * Owner permissions
18
+ * File path
19
19
  */
20
- readonly owner?: FilePermissionSet;
20
+ path: string;
21
+ /**
22
+ * Block target state
23
+ */
24
+ state?: 'absent' | 'present';
25
+ }
26
+ /**
27
+ * Replace asynchronously a block in file that follows pattern :
28
+ *
29
+ * marker(markerBegin)
30
+ * ...
31
+ * marker(markerEnd)
32
+ *
33
+ * @param options
34
+ */
35
+ declare function block(options: BlockOptions): Promise<void>;
36
+ /**
37
+ * Replace synchronously a block in file that follows pattern :
38
+ *
39
+ * marker(markerBegin)
40
+ * ...
41
+ * marker(markerEnd)
42
+ *
43
+ * @param options
44
+ */
45
+ declare function blockSync(options: BlockOptions): void;
46
+ //#endregion
47
+ //#region src/FileMode.d.ts
48
+ interface FileMode {
21
49
  /**
22
50
  * Group permissions
23
51
  */
@@ -26,10 +54,32 @@ interface FileMode {
26
54
  * Other permissions
27
55
  */
28
56
  readonly other?: FilePermissionSet;
57
+ /**
58
+ * Owner permissions
59
+ */
60
+ readonly owner?: FilePermissionSet;
61
+ }
62
+ interface FilePermissionSet {
63
+ /**
64
+ * Execute permission
65
+ */
66
+ readonly execute?: boolean;
67
+ /**
68
+ * Read permission
69
+ */
70
+ readonly read?: boolean;
71
+ /**
72
+ * Write permission
73
+ */
74
+ readonly write?: boolean;
29
75
  }
30
76
  //#endregion
31
77
  //#region src/directory.d.ts
32
78
  interface DirectoryOptions {
79
+ /**
80
+ * File permissions
81
+ */
82
+ readonly mode?: FileMode;
33
83
  /**
34
84
  * Directory path
35
85
  */
@@ -37,11 +87,7 @@ interface DirectoryOptions {
37
87
  /**
38
88
  * Directory target state
39
89
  */
40
- readonly state: 'present' | 'absent';
41
- /**
42
- * File permissions
43
- */
44
- readonly mode?: FileMode;
90
+ readonly state: 'absent' | 'present';
45
91
  }
46
92
  /**
47
93
  * Ensure directory is present/absent
@@ -82,54 +128,16 @@ declare function directory(options: DirectoryOptions): Promise<void>;
82
128
  */
83
129
  declare function directorySync(options: DirectoryOptions): void;
84
130
  //#endregion
85
- //#region src/block.d.ts
86
- interface BlockOptions {
87
- /**
88
- * The marker builder function that will take either `markerBegin` or `markerEnd`
89
- *
90
- * @default '# ${mark} MANAGED BLOCK'
91
- */
92
- marker?: (mark: 'Begin' | 'End') => string;
93
- /**
94
- * File path
95
- */
96
- path: string;
97
- /**
98
- * Block content to insert
99
- */
100
- block: string;
131
+ //#region src/file.d.ts
132
+ interface FileOptions {
101
133
  /**
102
- * Insert position
134
+ * File encoding
103
135
  */
104
- insertPosition?: ['before', 'BeginningOfFile' | RegExp] | ['after', 'EndOfFile' | RegExp];
136
+ readonly encoding?: BufferEncoding;
105
137
  /**
106
- * Block target state
138
+ * File permissions
107
139
  */
108
- state?: 'present' | 'absent';
109
- }
110
- /**
111
- * Replace asynchronously a block in file that follows pattern :
112
- *
113
- * marker(markerBegin)
114
- * ...
115
- * marker(markerEnd)
116
- *
117
- * @param options
118
- */
119
- declare function block(options: BlockOptions): Promise<void>;
120
- /**
121
- * Replace synchronously a block in file that follows pattern :
122
- *
123
- * marker(markerBegin)
124
- * ...
125
- * marker(markerEnd)
126
- *
127
- * @param options
128
- */
129
- declare function blockSync(options: BlockOptions): void;
130
- //#endregion
131
- //#region src/file.d.ts
132
- interface FileOptions {
140
+ readonly mode?: FileMode;
133
141
  /**
134
142
  * File path
135
143
  */
@@ -137,20 +145,12 @@ interface FileOptions {
137
145
  /**
138
146
  * File target state
139
147
  */
140
- readonly state: 'present' | 'absent';
148
+ readonly state: 'absent' | 'present';
141
149
  /**
142
150
  * File content mapping function
143
151
  *
144
152
  */
145
153
  readonly update?: ((content: string) => string | undefined) | undefined;
146
- /**
147
- * File encoding
148
- */
149
- readonly encoding?: BufferEncoding;
150
- /**
151
- * File permissions
152
- */
153
- readonly mode?: FileMode;
154
154
  }
155
155
  /**
156
156
  * Ensure file is present/absent with content initialized or modified with `update
@@ -229,15 +229,15 @@ declare function ignoreFile(options: IgnoreFileOptions): Promise<void>;
229
229
  declare function ignoreFileSync(options: IgnoreFileOptions): void;
230
230
  //#endregion
231
231
  //#region src/json.d.ts
232
- type JSONValue = null | number | string | boolean | JSONValue[] | {
233
- [key: string]: JSONValue;
234
- };
235
232
  interface JSONOption<V = JSONValue> extends Omit<FileOptions, 'update'> {
236
233
  /**
237
234
  * File content mapping function
238
235
  */
239
- readonly update?: ((content: V | undefined) => V | undefined) | undefined;
236
+ readonly update?: ((content: undefined | V) => undefined | V) | undefined;
240
237
  }
238
+ type JSONValue = boolean | JSONValue[] | null | number | string | {
239
+ [key: string]: JSONValue;
240
+ };
241
241
  /**
242
242
  * Ensure file is present/absent asynchronously with content value initialized or modified with `update`
243
243
  *
@@ -253,11 +253,34 @@ declare function jsonSync<Value>(options: JSONOption<Value>): void;
253
253
  //#endregion
254
254
  //#region src/meta.d.ts
255
255
  declare const meta: Readonly<{
256
+ buildNumber: number;
256
257
  name: string;
257
258
  version: string;
258
- buildNumber: number;
259
259
  }>;
260
260
  //#endregion
261
+ //#region src/yaml.d.ts
262
+ interface YAMLOption<V = YAMLValue> extends Omit<FileOptions, 'update'> {
263
+ /**
264
+ * File content mapping function
265
+ */
266
+ readonly update?: ((content: undefined | V) => undefined | V) | undefined;
267
+ }
268
+ type YAMLValue = boolean | null | number | string | YAMLValue[] | {
269
+ [key: string]: YAMLValue;
270
+ };
271
+ /**
272
+ * Ensure file is present/absent asynchronously with content value initialized or modified with `update`
273
+ *
274
+ * @param options
275
+ */
276
+ declare function yaml<Value>(options: YAMLOption<Value>): Promise<void>;
277
+ /**
278
+ * Ensure file is present/absent synchronously with content value initialized or modified with `update`
279
+ *
280
+ * @param options
281
+ */
282
+ declare function yamlSync<Value>(options: YAMLOption<Value>): void;
283
+ //#endregion
261
284
  //#region src/yarnConfig.d.ts
262
285
  interface YarnConfigOptions {
263
286
  /**
@@ -267,7 +290,7 @@ interface YarnConfigOptions {
267
290
  /**
268
291
  * Option target state
269
292
  */
270
- readonly state: 'present' | 'absent';
293
+ readonly state: 'absent' | 'present';
271
294
  /**
272
295
  * File content mapping function
273
296
  *
@@ -275,29 +298,29 @@ interface YarnConfigOptions {
275
298
  readonly update?: ((content: string) => string | undefined) | undefined;
276
299
  }
277
300
  /**
278
- * Synchronous version of {@link yarnConfig}
301
+ * Set/Unset yarn configuration value
279
302
  *
280
303
  * @param options
281
304
  * @example
282
- * yarnConfigSync({
305
+ * await yarnConfig({
283
306
  * key: 'nodeLinker',
284
307
  * state: 'present',
285
308
  * update: (content) => content.replace('node-modules', 'hoisted'),
286
309
  * })
287
310
  */
288
- declare function yarnConfigSync(options: YarnConfigOptions): void;
311
+ declare function yarnConfig(options: YarnConfigOptions): Promise<void>;
289
312
  /**
290
- * Set/Unset yarn configuration value
313
+ * Synchronous version of {@link yarnConfig}
291
314
  *
292
315
  * @param options
293
316
  * @example
294
- * await yarnConfig({
317
+ * yarnConfigSync({
295
318
  * key: 'nodeLinker',
296
319
  * state: 'present',
297
320
  * update: (content) => content.replace('node-modules', 'hoisted'),
298
321
  * })
299
322
  */
300
- declare function yarnConfig(options: YarnConfigOptions): Promise<void>;
323
+ declare function yarnConfigSync(options: YarnConfigOptions): void;
301
324
  //#endregion
302
325
  //#region src/yarnVersion.d.ts
303
326
  type YarnVersionKind = 'berry' | 'classic';
@@ -305,35 +328,35 @@ interface YarnVersionOptions {
305
328
  /**
306
329
  * Option target state
307
330
  */
308
- readonly state: 'present' | 'absent';
331
+ readonly state: 'absent' | 'present';
309
332
  /**
310
333
  * Version mapping function
311
334
  *
312
335
  */
313
- readonly update?: (() => YarnVersionKind | undefined) | undefined;
336
+ readonly update?: (() => undefined | YarnVersionKind) | undefined;
314
337
  }
315
338
  /**
316
- * Synchronous version of {@link yarnVersion}
339
+ * Set/Unset yarn configuration value
317
340
  *
318
341
  * @param options
319
342
  * @example
320
- * yarnVersionSync({
343
+ * await yarnVersion({
321
344
  * state: 'present',
322
345
  * update: () => 'berry', // or 'classic'
323
346
  * })
324
347
  */
325
- declare function yarnVersionSync(options: YarnVersionOptions): void;
348
+ declare function yarnVersion(options: YarnVersionOptions): Promise<void>;
326
349
  /**
327
- * Set/Unset yarn configuration value
350
+ * Synchronous version of {@link yarnVersion}
328
351
  *
329
352
  * @param options
330
353
  * @example
331
- * await yarnVersion({
354
+ * yarnVersionSync({
332
355
  * state: 'present',
333
356
  * update: () => 'berry', // or 'classic'
334
357
  * })
335
358
  */
336
- declare function yarnVersion(options: YarnVersionOptions): Promise<void>;
359
+ declare function yarnVersionSync(options: YarnVersionOptions): void;
337
360
  //#endregion
338
- export { BlockOptions, DirectoryOptions, FileOptions, IgnoreFileOptions, JSONOption, JSONValue, YarnConfigOptions, YarnVersionKind, YarnVersionOptions, block, blockSync, directory, directorySync, file, fileSync, ignoreFile, ignoreFileSync, json, jsonSync, meta, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };
361
+ export { BlockOptions, DirectoryOptions, FileOptions, IgnoreFileOptions, JSONOption, JSONValue, YAMLOption, YAMLValue, YarnConfigOptions, YarnVersionKind, YarnVersionOptions, block, blockSync, directory, directorySync, file, fileSync, ignoreFile, ignoreFileSync, json, jsonSync, meta, yaml, yamlSync, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };
339
362
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/FileMode.ts","../src/directory.ts","../src/block.ts","../src/file.ts","../src/ignoreFile.ts","../src/json.ts","../src/meta.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"mappings":";UAAiB,iBAAA;EAAA;;;EAAA,SAIN,IAAA;EAAA;;;EAAA,SAKA,KAAA;EAKO;AAGlB;;EAHkB,SAAP,OAAA;AAAA;AAAA,UAGM,QAAA;EAcE;;;EAAA,SAVR,KAAA,GAAQ,iBAAA;EAAA;;;EAAA,SAKR,KAAA,GAAQ,iBAAA;EAKA;;AAAiB;EAAjB,SAAR,KAAA,GAAQ,iBAAA;AAAA;;;UCxBF,gBAAA;EDPiB;;;EAAA,SCWvB,IAAA;EDFA;;;EAAA,SCOA,KAAA;EDCM;;;EAAA,SCIN,IAAA,GAAO,QAAQ;AAAA;;;;;;;;;;;ADUU;;;;ACxBpC;;;;iBAmCsB,SAAA,CAAU,OAAA,EAAS,gBAAA,GAAmB,OAAO;;;;;AArBzC;AAqB1B;;;;;;;;AAAmE;AAkCnE;;;;iBAAgB,aAAA,CAAc,OAAyB,EAAhB,gBAAgB;;;UC1EtC,YAAA;EFFA;;;;;EEQf,MAAA,IAAU,IAAA;EFMD;;AAAO;EEDhB,IAAA;EFIuB;;;EECvB,KAAA;EFaiB;;;EERjB,cAAA,kCAAgD,MAAA,4BAAkC,MAAM;EFFvE;;;EEOjB,KAAA;AAAA;;AFGkC;;;;ACxBpC;;;;iBCkIgB,KAAA,CAAM,OAAA,EAAS,YAAA,GAAY,OAAA;;;;;ADpHjB;AAqB1B;;;;iBC4GgB,SAAA,CAAU,OAAqB,EAAZ,YAAY;;;UC/I9B,WAAA;EHPiB;;;EAAA,SGWvB,IAAA;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kBAAA;ERJiB;;;EAAA,SQQvB,KAAA;ERCA;;;AAKO;EALP,SQKA,MAAA,UAAgB,eAAe;AAAA;;;;;;;;;;;iBAa1B,eAAA,CAAgB,OAA2B,EAAlB,kBAAkB;;;ARIvB;;;;ACxBpC;;;;iBOwCsB,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAqB,OAAO"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/block.ts","../src/FileMode.ts","../src/directory.ts","../src/file.ts","../src/ignoreFile.ts","../src/json.ts","../src/meta.ts","../src/yaml.ts","../src/yarnConfig.ts","../src/yarnVersion.ts"],"mappings":";UAEiB,YAAA;EAAA;;;EAIf,KAAA;EAAA;;;EAKA,cAAA,2BAAyC,MAAA,mCAAyC,MAAM;EAOxF;;;;;EAAA,MAAA,IAAU,IAAA;EA0CI;;;EArCd,IAAA;EAqC6B;;;EAhC7B,KAAA;AAAA;AA6CF;;;;AAA+C;;;;ACzE/C;ADyEA,iBAbgB,KAAA,CAAM,OAAA,EAAS,YAAA,GAAY,OAAA;;;;;;;;;;iBAa3B,SAAA,CAAU,OAAqB,EAAZ,YAAY;;;UCzE9B,QAAA;EDEA;;;EAAA,SCEN,KAAA,GAAQ,iBAAA;EDEjB;;;EAAA,SCGS,KAAA,GAAQ,iBAAA;EDSjB;;;EAAA,SCJS,KAAA,GAAQ,iBAAA;AAAA;AAAA,UAGF,iBAAA;ED2CD;;;EAAA,SCvCL,OAAA;EDuCoB;;;EAAA,SClCpB,IAAA;EDkCgC;AAa3C;;EAb2C,SC7BhC,KAAA;AAAA;;;UCtBM,gBAAA;EFPY;;;EAAA,SEWlB,IAAA,GAAO,QAAQ;EFFxB;;;EAAA,SEOS,IAAA;EFAC;;;EAAA,SEKD,KAAA;AAAA;AFqCX;;;;;;;;AAA2C;AAa3C;;;;AAA+C;;;;ACzE/C;AD4DA,iBEhBsB,SAAA,CAAU,OAAA,EAAS,gBAAA,GAAmB,OAAO;;;;;;;;;;;;;;AD9B/B;A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