@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.
@@ -0,0 +1,304 @@
1
+ //#region src/FileMode.d.ts
2
+ interface FilePermissionSet {
3
+ /**
4
+ * Read permission
5
+ */
6
+ readonly read?: boolean;
7
+ /**
8
+ * Write permission
9
+ */
10
+ readonly write?: boolean;
11
+ /**
12
+ * Execute permission
13
+ */
14
+ readonly execute?: boolean;
15
+ }
16
+ interface FileMode {
17
+ /**
18
+ * Owner permissions
19
+ */
20
+ readonly owner?: FilePermissionSet;
21
+ /**
22
+ * Group permissions
23
+ */
24
+ readonly group?: FilePermissionSet;
25
+ /**
26
+ * Other permissions
27
+ */
28
+ readonly other?: FilePermissionSet;
29
+ }
30
+ //#endregion
31
+ //#region src/directory.d.ts
32
+ interface DirectoryOptions {
33
+ /**
34
+ * Directory path
35
+ */
36
+ readonly path: string;
37
+ /**
38
+ * Directory target state
39
+ */
40
+ readonly state: 'present' | 'absent';
41
+ /**
42
+ * File permissions
43
+ */
44
+ readonly mode?: FileMode;
45
+ }
46
+ /**
47
+ * Ensure directory is present/absent
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * await directory({
52
+ * path: 'foo/bar',
53
+ * state: 'present',
54
+ * mode: {
55
+ * owner: { read: true, write: true, execute: true },
56
+ * group: { read: true, write: true, execute: true },
57
+ * other: { read: true, write: true, execute: true },
58
+ * },
59
+ * })
60
+ * ```
61
+ *
62
+ * @param options
63
+ */
64
+ declare function directory(options: DirectoryOptions): Promise<void>;
65
+ /**
66
+ * Ensure directory is present/absent
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * directorySync({
71
+ * path: 'foo/bar',
72
+ * state: 'present',
73
+ * mode: {
74
+ * owner: { read: true, write: true, execute: true },
75
+ * group: { read: true, write: true, execute: true },
76
+ * other: { read: true, write: true, execute: true },
77
+ * },
78
+ * })
79
+ * ```
80
+ *
81
+ * @param options
82
+ */
83
+ declare function directorySync(options: DirectoryOptions): void;
84
+ //#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;
101
+ /**
102
+ * Insert position
103
+ */
104
+ insertPosition?: ['before', 'BeginningOfFile' | RegExp] | ['after', 'EndOfFile' | RegExp];
105
+ /**
106
+ * Block target state
107
+ */
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 {
133
+ /**
134
+ * File path
135
+ */
136
+ readonly path: string;
137
+ /**
138
+ * File target state
139
+ */
140
+ readonly state: 'present' | 'absent';
141
+ /**
142
+ * File content mapping function
143
+ *
144
+ */
145
+ 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
+ }
155
+ /**
156
+ * Ensure file is present/absent with content initialized or modified with `update
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * await file({
161
+ * path: 'foo/bar',
162
+ * state: 'present',
163
+ * update: (content) => content + '_test', // This will append '_test' after current content
164
+ * mode: {
165
+ * owner: { read: true, write: true, execute: true },
166
+ * group: { read: true, write: true, execute: true },
167
+ * other: { read: true, write: true, execute: true },
168
+ * },
169
+ * })
170
+ * ```
171
+ *
172
+ * @param options
173
+ */
174
+ declare function file(options: FileOptions): Promise<void>;
175
+ /**
176
+ * Ensure file is present/absent with content initialized or modified with `update
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * fileSync({
181
+ * path: 'foo/bar',
182
+ * state: 'present',
183
+ * update: (content) => content + '_test', // This will append '_test' after current content
184
+ * mode: {
185
+ * owner: { read: true, write: true, execute: true },
186
+ * group: { read: true, write: true, execute: true },
187
+ * other: { read: true, write: true, execute: true },
188
+ * },
189
+ * })
190
+ * ```
191
+ *
192
+ * @param options
193
+ */
194
+ declare function fileSync(options: FileOptions): void;
195
+ //#endregion
196
+ //#region src/json.d.ts
197
+ type JSONValue = null | number | string | boolean | JSONValue[] | {
198
+ [key: string]: JSONValue;
199
+ };
200
+ interface JSONOption<V = JSONValue> extends Omit<FileOptions, 'update'> {
201
+ /**
202
+ * File content mapping function
203
+ */
204
+ readonly update?: ((content: V | undefined) => V | undefined) | undefined;
205
+ }
206
+ /**
207
+ * Ensure file is present/absent asynchronously with content value initialized or modified with `update`
208
+ *
209
+ * @param options
210
+ */
211
+ declare function json<Value>(options: JSONOption<Value>): Promise<void>;
212
+ /**
213
+ * Ensure file is present/absent synchronously with content value initialized or modified with `update`
214
+ *
215
+ * @param options
216
+ */
217
+ declare function jsonSync<Value>(options: JSONOption<Value>): void;
218
+ //#endregion
219
+ //#region src/meta.d.ts
220
+ declare const meta: Readonly<{
221
+ name: string;
222
+ version: string;
223
+ buildNumber: number;
224
+ }>;
225
+ //#endregion
226
+ //#region src/yarnConfig.d.ts
227
+ interface YarnConfigOptions {
228
+ /**
229
+ * Configuration key
230
+ */
231
+ readonly key: string;
232
+ /**
233
+ * Option target state
234
+ */
235
+ readonly state: 'present' | 'absent';
236
+ /**
237
+ * File content mapping function
238
+ *
239
+ */
240
+ readonly update?: ((content: string) => string | undefined) | undefined;
241
+ }
242
+ /**
243
+ * Synchronous version of {@link yarnConfig}
244
+ *
245
+ * @param options
246
+ * @example
247
+ * yarnConfigSync({
248
+ * key: 'nodeLinker',
249
+ * state: 'present',
250
+ * update: (content) => content.replace('node-modules', 'hoisted'),
251
+ * })
252
+ */
253
+ declare function yarnConfigSync(options: YarnConfigOptions): void;
254
+ /**
255
+ * Set/Unset yarn configuration value
256
+ *
257
+ * @param options
258
+ * @example
259
+ * await yarnConfig({
260
+ * key: 'nodeLinker',
261
+ * state: 'present',
262
+ * update: (content) => content.replace('node-modules', 'hoisted'),
263
+ * })
264
+ */
265
+ declare function yarnConfig(options: YarnConfigOptions): Promise<void>;
266
+ //#endregion
267
+ //#region src/yarnVersion.d.ts
268
+ type YarnVersionKind = 'berry' | 'classic';
269
+ interface YarnVersionOptions {
270
+ /**
271
+ * Option target state
272
+ */
273
+ readonly state: 'present' | 'absent';
274
+ /**
275
+ * Version mapping function
276
+ *
277
+ */
278
+ readonly update?: (() => YarnVersionKind | undefined) | undefined;
279
+ }
280
+ /**
281
+ * Synchronous version of {@link yarnVersion}
282
+ *
283
+ * @param options
284
+ * @example
285
+ * yarnVersionSync({
286
+ * state: 'present',
287
+ * update: () => 'berry', // or 'classic'
288
+ * })
289
+ */
290
+ declare function yarnVersionSync(options: YarnVersionOptions): void;
291
+ /**
292
+ * Set/Unset yarn configuration value
293
+ *
294
+ * @param options
295
+ * @example
296
+ * await yarnVersion({
297
+ * state: 'present',
298
+ * update: () => 'berry', // or 'classic'
299
+ * })
300
+ */
301
+ declare function yarnVersion(options: YarnVersionOptions): Promise<void>;
302
+ //#endregion
303
+ export { BlockOptions, DirectoryOptions, FileOptions, JSONOption, JSONValue, YarnConfigOptions, YarnVersionKind, YarnVersionOptions, block, blockSync, directory, directorySync, file, fileSync, json, jsonSync, meta, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };
304
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names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;;;;;;;;AC1EA;;;;;;;iBCyFgB,QAAA,CAAS,OAAA,EAAS,WAAA;;;KCzFtB,SAAA,sCAA+C,SAAA;EAAA,CAAiB,GAAA,WAAc,SAAA;AAAA;AAAA,UAEzE,UAAA,KAAe,SAAA,UAAmB,IAAA,CAAK,WAAA;EJA7C;;;EAAA,SIIA,MAAA,KAAW,OAAA,EAAS,CAAA,iBAAkB,CAAA;AAAA;AJSjD;;;;;AAAA,iBIcsB,IAAA,OAAA,CAAY,OAAA,EAAS,UAAA,CAAW,KAAA,IAAS,OAAA;;;;;;iBAS/C,QAAA,OAAA,CAAgB,OAAA,EAAS,UAAA,CAAW,KAAA;;;cCxCvC,IAAA,EAAI,QAAA;;;;;;;UCEA,iBAAA;ENFA;;;EAAA,SMMN,GAAA;ENFA;;;EAAA,SMOA,KAAA;ENGO;AAGlB;;;EAHkB,SMGP,MAAA,KAAW,OAAA;AAAA;;;;;;;;;;;;iBAcN,cAAA,CAAe,OAAA,EAAS,iBAAA;;;ALxBxC;;;;;;;;;iBK6CsB,UAAA,CAAW,OAAA,EAAS,iBAAA,GAAoB,OAAA;;;KClDlD,eAAA;AAAA,UAEK,kBAAA;EPJiB;;;EAAA,SOQvB,KAAA;EPCA;;;;EAAA,SOKA,MAAA,UAAgB,eAAA;AAAA;;;;;;;;;;;iBAaX,eAAA,CAAgB,OAAA,EAAS,kBAAA;;;;;;;ANpBzC;;;;iBMwCsB,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAqB,OAAA"}
@@ -0,0 +1,304 @@
1
+ //#region src/FileMode.d.ts
2
+ interface FilePermissionSet {
3
+ /**
4
+ * Read permission
5
+ */
6
+ readonly read?: boolean;
7
+ /**
8
+ * Write permission
9
+ */
10
+ readonly write?: boolean;
11
+ /**
12
+ * Execute permission
13
+ */
14
+ readonly execute?: boolean;
15
+ }
16
+ interface FileMode {
17
+ /**
18
+ * Owner permissions
19
+ */
20
+ readonly owner?: FilePermissionSet;
21
+ /**
22
+ * Group permissions
23
+ */
24
+ readonly group?: FilePermissionSet;
25
+ /**
26
+ * Other permissions
27
+ */
28
+ readonly other?: FilePermissionSet;
29
+ }
30
+ //#endregion
31
+ //#region src/directory.d.ts
32
+ interface DirectoryOptions {
33
+ /**
34
+ * Directory path
35
+ */
36
+ readonly path: string;
37
+ /**
38
+ * Directory target state
39
+ */
40
+ readonly state: 'present' | 'absent';
41
+ /**
42
+ * File permissions
43
+ */
44
+ readonly mode?: FileMode;
45
+ }
46
+ /**
47
+ * Ensure directory is present/absent
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * await directory({
52
+ * path: 'foo/bar',
53
+ * state: 'present',
54
+ * mode: {
55
+ * owner: { read: true, write: true, execute: true },
56
+ * group: { read: true, write: true, execute: true },
57
+ * other: { read: true, write: true, execute: true },
58
+ * },
59
+ * })
60
+ * ```
61
+ *
62
+ * @param options
63
+ */
64
+ declare function directory(options: DirectoryOptions): Promise<void>;
65
+ /**
66
+ * Ensure directory is present/absent
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * directorySync({
71
+ * path: 'foo/bar',
72
+ * state: 'present',
73
+ * mode: {
74
+ * owner: { read: true, write: true, execute: true },
75
+ * group: { read: true, write: true, execute: true },
76
+ * other: { read: true, write: true, execute: true },
77
+ * },
78
+ * })
79
+ * ```
80
+ *
81
+ * @param options
82
+ */
83
+ declare function directorySync(options: DirectoryOptions): void;
84
+ //#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;
101
+ /**
102
+ * Insert position
103
+ */
104
+ insertPosition?: ['before', 'BeginningOfFile' | RegExp] | ['after', 'EndOfFile' | RegExp];
105
+ /**
106
+ * Block target state
107
+ */
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 {
133
+ /**
134
+ * File path
135
+ */
136
+ readonly path: string;
137
+ /**
138
+ * File target state
139
+ */
140
+ readonly state: 'present' | 'absent';
141
+ /**
142
+ * File content mapping function
143
+ *
144
+ */
145
+ 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
+ }
155
+ /**
156
+ * Ensure file is present/absent with content initialized or modified with `update
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * await file({
161
+ * path: 'foo/bar',
162
+ * state: 'present',
163
+ * update: (content) => content + '_test', // This will append '_test' after current content
164
+ * mode: {
165
+ * owner: { read: true, write: true, execute: true },
166
+ * group: { read: true, write: true, execute: true },
167
+ * other: { read: true, write: true, execute: true },
168
+ * },
169
+ * })
170
+ * ```
171
+ *
172
+ * @param options
173
+ */
174
+ declare function file(options: FileOptions): Promise<void>;
175
+ /**
176
+ * Ensure file is present/absent with content initialized or modified with `update
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * fileSync({
181
+ * path: 'foo/bar',
182
+ * state: 'present',
183
+ * update: (content) => content + '_test', // This will append '_test' after current content
184
+ * mode: {
185
+ * owner: { read: true, write: true, execute: true },
186
+ * group: { read: true, write: true, execute: true },
187
+ * other: { read: true, write: true, execute: true },
188
+ * },
189
+ * })
190
+ * ```
191
+ *
192
+ * @param options
193
+ */
194
+ declare function fileSync(options: FileOptions): void;
195
+ //#endregion
196
+ //#region src/json.d.ts
197
+ type JSONValue = null | number | string | boolean | JSONValue[] | {
198
+ [key: string]: JSONValue;
199
+ };
200
+ interface JSONOption<V = JSONValue> extends Omit<FileOptions, 'update'> {
201
+ /**
202
+ * File content mapping function
203
+ */
204
+ readonly update?: ((content: V | undefined) => V | undefined) | undefined;
205
+ }
206
+ /**
207
+ * Ensure file is present/absent asynchronously with content value initialized or modified with `update`
208
+ *
209
+ * @param options
210
+ */
211
+ declare function json<Value>(options: JSONOption<Value>): Promise<void>;
212
+ /**
213
+ * Ensure file is present/absent synchronously with content value initialized or modified with `update`
214
+ *
215
+ * @param options
216
+ */
217
+ declare function jsonSync<Value>(options: JSONOption<Value>): void;
218
+ //#endregion
219
+ //#region src/meta.d.ts
220
+ declare const meta: Readonly<{
221
+ name: string;
222
+ version: string;
223
+ buildNumber: number;
224
+ }>;
225
+ //#endregion
226
+ //#region src/yarnConfig.d.ts
227
+ interface YarnConfigOptions {
228
+ /**
229
+ * Configuration key
230
+ */
231
+ readonly key: string;
232
+ /**
233
+ * Option target state
234
+ */
235
+ readonly state: 'present' | 'absent';
236
+ /**
237
+ * File content mapping function
238
+ *
239
+ */
240
+ readonly update?: ((content: string) => string | undefined) | undefined;
241
+ }
242
+ /**
243
+ * Synchronous version of {@link yarnConfig}
244
+ *
245
+ * @param options
246
+ * @example
247
+ * yarnConfigSync({
248
+ * key: 'nodeLinker',
249
+ * state: 'present',
250
+ * update: (content) => content.replace('node-modules', 'hoisted'),
251
+ * })
252
+ */
253
+ declare function yarnConfigSync(options: YarnConfigOptions): void;
254
+ /**
255
+ * Set/Unset yarn configuration value
256
+ *
257
+ * @param options
258
+ * @example
259
+ * await yarnConfig({
260
+ * key: 'nodeLinker',
261
+ * state: 'present',
262
+ * update: (content) => content.replace('node-modules', 'hoisted'),
263
+ * })
264
+ */
265
+ declare function yarnConfig(options: YarnConfigOptions): Promise<void>;
266
+ //#endregion
267
+ //#region src/yarnVersion.d.ts
268
+ type YarnVersionKind = 'berry' | 'classic';
269
+ interface YarnVersionOptions {
270
+ /**
271
+ * Option target state
272
+ */
273
+ readonly state: 'present' | 'absent';
274
+ /**
275
+ * Version mapping function
276
+ *
277
+ */
278
+ readonly update?: (() => YarnVersionKind | undefined) | undefined;
279
+ }
280
+ /**
281
+ * Synchronous version of {@link yarnVersion}
282
+ *
283
+ * @param options
284
+ * @example
285
+ * yarnVersionSync({
286
+ * state: 'present',
287
+ * update: () => 'berry', // or 'classic'
288
+ * })
289
+ */
290
+ declare function yarnVersionSync(options: YarnVersionOptions): void;
291
+ /**
292
+ * Set/Unset yarn configuration value
293
+ *
294
+ * @param options
295
+ * @example
296
+ * await yarnVersion({
297
+ * state: 'present',
298
+ * update: () => 'berry', // or 'classic'
299
+ * })
300
+ */
301
+ declare function yarnVersion(options: YarnVersionOptions): Promise<void>;
302
+ //#endregion
303
+ export { BlockOptions, DirectoryOptions, FileOptions, JSONOption, JSONValue, YarnConfigOptions, YarnVersionKind, YarnVersionOptions, block, blockSync, directory, directorySync, file, fileSync, json, jsonSync, meta, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };
304
+ //# sourceMappingURL=index.d.ts.map