@driveflux/fab 2.2.2 → 2.3.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/bin/fab.js +7 -4
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +4 -1
- package/dist/clean.d.ts.map +1 -1
- package/dist/clean.js +43 -10
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +6 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +4 -4
package/bin/fab.js
CHANGED
|
@@ -17,6 +17,7 @@ function makeCleanCommand() {
|
|
|
17
17
|
.option('-c, --cwd <cwd>', 'The current working directory', process.cwd())
|
|
18
18
|
.option('-d, --dest <destination>', 'The destination path for the package, example: dist', 'dist')
|
|
19
19
|
.option('--clean-ts', 'Clean typescript files')
|
|
20
|
+
.option('--dry', 'Dry run')
|
|
20
21
|
.option('-a, --all', 'Removes everything built by fab')
|
|
21
22
|
.action(async (options) => {
|
|
22
23
|
const cwd = path.resolve(process.cwd(), options.cwd)
|
|
@@ -34,7 +35,7 @@ function makeBuildCommand() {
|
|
|
34
35
|
return new Command('build')
|
|
35
36
|
.description('Build the package')
|
|
36
37
|
.option('-c, --cwd <cwd>', 'The current working directory', process.cwd())
|
|
37
|
-
.option('-d, --dest <destination>', 'The destination path for the package, example: dist'
|
|
38
|
+
.option('-d, --dest <destination>', 'The destination path for the package, example: dist')
|
|
38
39
|
.option('-s, --src <source>', 'The source path for the package, example: dist', 'src')
|
|
39
40
|
.option('-r, --reset', 'Clean up everything and build again')
|
|
40
41
|
.addOption(
|
|
@@ -43,7 +44,7 @@ function makeBuildCommand() {
|
|
|
43
44
|
.default('all')
|
|
44
45
|
)
|
|
45
46
|
.action(async (options) => {
|
|
46
|
-
const { target } = options
|
|
47
|
+
const { target, dest: destination, src, ...rest } = options
|
|
47
48
|
const cwd = path.resolve(process.cwd(), options.cwd)
|
|
48
49
|
|
|
49
50
|
const config = await parseConfig({ cwd })
|
|
@@ -53,9 +54,11 @@ function makeBuildCommand() {
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
const finalOptions = {
|
|
56
|
-
...
|
|
57
|
+
...rest,
|
|
57
58
|
cwd,
|
|
58
|
-
...config
|
|
59
|
+
...config,
|
|
60
|
+
source: src || config.source,
|
|
61
|
+
destination: destination || config.destination,
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
switch (target) {
|
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EACX,WAAW,EACX,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,MAAM,YAAY,CAAA;AAGnB,eAAO,MAAM,KAAK,gBACJ,UAAU,GAAG,YAAY,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,kBAiBxD,CAAA;AAED,eAAO,MAAM,YAAY,gBAAuB,mBAAmB,kBAmClE,CAAA;AAED,eAAO,MAAM,UAAU,gBAAuB,WAAW,kBAaxD,CAAA;AAED,eAAO,MAAM,QAAQ,gBAAuB,eAAe,kBA4B1D,CAAA"}
|
package/dist/build.js
CHANGED
|
@@ -182,6 +182,7 @@ function _ts_generator(thisArg, body) {
|
|
|
182
182
|
}
|
|
183
183
|
import fs from 'node:fs/promises';
|
|
184
184
|
import path from 'node:path';
|
|
185
|
+
import { performance } from 'node:perf_hooks';
|
|
185
186
|
import merge from 'lodash.merge';
|
|
186
187
|
import { clean } from './clean.js';
|
|
187
188
|
import { ensureDir, getDefaultOptions, runBin, runCommand } from './utils.js';
|
|
@@ -294,12 +295,13 @@ export var copyVerbatim = /*#__PURE__*/ function() {
|
|
|
294
295
|
}();
|
|
295
296
|
export var buildTypes = /*#__PURE__*/ function() {
|
|
296
297
|
var _ref = _async_to_generator(function(rawOptions) {
|
|
297
|
-
var options, tsProject;
|
|
298
|
+
var options, tsProject, now;
|
|
298
299
|
return _ts_generator(this, function(_state) {
|
|
299
300
|
switch(_state.label){
|
|
300
301
|
case 0:
|
|
301
302
|
options = merge({}, getDefaultOptions(), rawOptions);
|
|
302
303
|
tsProject = path.resolve(options.cwd, 'tsconfig.json');
|
|
304
|
+
now = performance.now();
|
|
303
305
|
return [
|
|
304
306
|
4,
|
|
305
307
|
runCommand('pnpm', [
|
|
@@ -312,6 +314,7 @@ export var buildTypes = /*#__PURE__*/ function() {
|
|
|
312
314
|
];
|
|
313
315
|
case 1:
|
|
314
316
|
_state.sent();
|
|
317
|
+
console.log("Types built in ".concat((performance.now() - now).toFixed(2), "ms"));
|
|
315
318
|
return [
|
|
316
319
|
2
|
|
317
320
|
];
|
package/dist/clean.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../src/clean.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAG9C,eAAO,MAAM,KAAK,eAAsB,YAAY,
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../src/clean.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAG9C,eAAO,MAAM,KAAK,eAAsB,YAAY,kBAyBnD,CAAA"}
|
package/dist/clean.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
+
}
|
|
1
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
10
|
try {
|
|
3
11
|
var info = gen[key](arg);
|
|
@@ -27,6 +35,23 @@ function _async_to_generator(fn) {
|
|
|
27
35
|
});
|
|
28
36
|
};
|
|
29
37
|
}
|
|
38
|
+
function _iterable_to_array(iter) {
|
|
39
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
40
|
+
}
|
|
41
|
+
function _non_iterable_spread() {
|
|
42
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
43
|
+
}
|
|
44
|
+
function _to_consumable_array(arr) {
|
|
45
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
46
|
+
}
|
|
47
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
48
|
+
if (!o) return;
|
|
49
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
50
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
51
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
52
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
53
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
54
|
+
}
|
|
30
55
|
function _ts_generator(thisArg, body) {
|
|
31
56
|
var f, y, t, g, _ = {
|
|
32
57
|
label: 0,
|
|
@@ -128,26 +153,34 @@ import merge from 'lodash.merge';
|
|
|
128
153
|
import { getDefaultOptions } from './utils.js';
|
|
129
154
|
export var clean = /*#__PURE__*/ function() {
|
|
130
155
|
var _ref = _async_to_generator(function(rawOptions) {
|
|
131
|
-
var _merge, destination, all,
|
|
156
|
+
var _merge, destination, cleanTs, all, cleanJsGlobs, cleanTsGlobs, cwd, dry, globs, _globs, result;
|
|
132
157
|
return _ts_generator(this, function(_state) {
|
|
133
158
|
switch(_state.label){
|
|
134
159
|
case 0:
|
|
135
|
-
_merge = merge({}, getDefaultOptions(), rawOptions), destination = _merge.destination, all = _merge.
|
|
136
|
-
|
|
160
|
+
_merge = merge({}, getDefaultOptions(), rawOptions), destination = _merge.destination, cleanTs = _merge.cleanTs, all = _merge.all, cleanJsGlobs = _merge.cleanJsGlobs, cleanTsGlobs = _merge.cleanTsGlobs, cwd = _merge.cwd, dry = _merge.dry;
|
|
161
|
+
globs = cleanJsGlobs ? cleanJsGlobs : [
|
|
137
162
|
path.resolve(destination, '**/*.js')
|
|
138
163
|
];
|
|
139
|
-
if (all) {
|
|
140
|
-
|
|
141
|
-
|
|
164
|
+
if (cleanTs || all) {
|
|
165
|
+
if (cleanTsGlobs) {
|
|
166
|
+
;
|
|
167
|
+
(_globs = globs).push.apply(_globs, _to_consumable_array(cleanTsGlobs));
|
|
168
|
+
} else {
|
|
169
|
+
globs.push(path.resolve(destination, '**/*.d.ts'));
|
|
170
|
+
}
|
|
142
171
|
}
|
|
172
|
+
globs.push(path.resolve(cwd || '.', 'tsconfig.tsbuildinfo'));
|
|
143
173
|
return [
|
|
144
174
|
4,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
})
|
|
175
|
+
deleteAsync(globs, {
|
|
176
|
+
dryRun: dry
|
|
177
|
+
})
|
|
148
178
|
];
|
|
149
179
|
case 1:
|
|
150
|
-
_state.sent();
|
|
180
|
+
result = _state.sent();
|
|
181
|
+
if (dry) {
|
|
182
|
+
console.log('Files and directories that would be deleted:\n', result.join('\n'));
|
|
183
|
+
}
|
|
151
184
|
return [
|
|
152
185
|
2
|
|
153
186
|
];
|
package/dist/config.d.ts
CHANGED
|
@@ -15,16 +15,22 @@ declare const ConfigValidation: z.ZodObject<{
|
|
|
15
15
|
* or an array of 2 paths [source, destination].
|
|
16
16
|
*/
|
|
17
17
|
copyVerbatim: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, "many">;
|
|
18
|
+
cleanJsGlobs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
19
|
+
cleanTsGlobs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
18
20
|
}, "strip", z.ZodTypeAny, {
|
|
19
21
|
source: string;
|
|
20
22
|
destination: string;
|
|
21
23
|
noTypes: boolean;
|
|
22
24
|
copyVerbatim: (string | string[])[];
|
|
25
|
+
cleanJsGlobs?: string[] | undefined;
|
|
26
|
+
cleanTsGlobs?: string[] | undefined;
|
|
23
27
|
}, {
|
|
24
28
|
source: string;
|
|
25
29
|
destination: string;
|
|
26
30
|
noTypes: boolean;
|
|
27
31
|
copyVerbatim: (string | string[])[];
|
|
32
|
+
cleanJsGlobs?: string[] | undefined;
|
|
33
|
+
cleanTsGlobs?: string[] | undefined;
|
|
28
34
|
}>;
|
|
29
35
|
export declare const parseConfig: (options?: ParseConfigOptions) => Promise<FullConfig>;
|
|
30
36
|
export {};
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AACxC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,UAAU,kBAAkB;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,QAAA,MAAM,gBAAgB;;;;IAIrB;;;OAGG
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AACxC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,UAAU,kBAAkB;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,QAAA,MAAM,gBAAgB;;;;IAIrB;;;OAGG;;;;;;;;;;;;;;;;;;EAIF,CAAA;AAEF,eAAO,MAAM,WAAW,aACb,kBAAkB,KAC1B,OAAO,CAAC,UAAU,CAmBpB,CAAA"}
|
package/dist/config.js
CHANGED
|
@@ -134,7 +134,9 @@ var ConfigValidation = z.object({
|
|
|
134
134
|
/**
|
|
135
135
|
* The files to copy verbatim. It can be a single source path, it is moved as it is to the destination folder
|
|
136
136
|
* or an array of 2 paths [source, destination].
|
|
137
|
-
*/ copyVerbatim: z.array(z.string().or(z.array(z.string()).length(2)))
|
|
137
|
+
*/ copyVerbatim: z.array(z.string().or(z.array(z.string()).length(2))),
|
|
138
|
+
cleanJsGlobs: z.array(z.string()).optional(),
|
|
139
|
+
cleanTsGlobs: z.array(z.string()).optional()
|
|
138
140
|
});
|
|
139
141
|
export var parseConfig = /*#__PURE__*/ function() {
|
|
140
142
|
var _ref = _async_to_generator(function(options) {
|
package/dist/types.d.ts
CHANGED
|
@@ -11,5 +11,10 @@ export interface CopyVerbatimOptions extends BaseOptions {
|
|
|
11
11
|
}
|
|
12
12
|
export interface CleanOptions extends Pick<BaseOptions, 'destination'> {
|
|
13
13
|
cleanTs?: boolean;
|
|
14
|
+
cwd?: string;
|
|
15
|
+
all?: boolean;
|
|
16
|
+
cleanJsGlobs?: Config['cleanJsGlobs'];
|
|
17
|
+
cleanTsGlobs?: Config['cleanTsGlobs'];
|
|
18
|
+
dry?: boolean;
|
|
14
19
|
}
|
|
15
20
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,WAAW,WAAW;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,eAAgB,SAAQ,WAAW;CAAG;AAEvD,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,CAAA;CACrC;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,WAAW,WAAW;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,eAAgB,SAAQ,WAAW;CAAG;AAEvD,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,CAAA;CACrC;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,CAAA;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,CAAA;IACrC,GAAG,CAAC,EAAE,OAAO,CAAA;CACb"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { type SpawnOptions } from 'node:child_process';
|
|
2
|
-
import type { FullConfig } from './config.js';
|
|
3
2
|
export declare const ensureDir: (dir: string) => Promise<void>;
|
|
4
3
|
export declare const runBin: (bin: string, args: string[], options?: SpawnOptions) => Promise<unknown>;
|
|
5
4
|
export declare const runCommand: (cmd: string, args: string[], options?: SpawnOptions) => Promise<unknown>;
|
|
6
5
|
export declare const getBaseDir: () => string;
|
|
7
|
-
export declare const getDefaultOptions: () =>
|
|
6
|
+
export declare const getDefaultOptions: () => {
|
|
7
|
+
source: string;
|
|
8
|
+
destination: string;
|
|
9
|
+
noTypes: boolean;
|
|
10
|
+
copyVerbatim: never[];
|
|
11
|
+
};
|
|
8
12
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAA;AAI7D,eAAO,MAAM,SAAS,QAAe,MAAM,kBAS1C,CAAA;AAED,eAAO,MAAM,MAAM,QACb,MAAM,QACL,MAAM,EAAE,YACJ,YAAY,qBAmBtB,CAAA;AAED,eAAO,MAAM,UAAU,QACjB,MAAM,QACL,MAAM,EAAE,YACJ,YAAY,qBAiBtB,CAAA;AAED,eAAO,MAAM,UAAU,cAMtB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;CAK5B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driveflux/fab",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@swc/cli": "0.4.1-nightly.20240914",
|
|
19
|
-
"@swc/core": "1.7.
|
|
19
|
+
"@swc/core": "1.7.39",
|
|
20
20
|
"commander": "^12.1.0",
|
|
21
21
|
"del": "^8.0.0",
|
|
22
22
|
"lodash.merge": "^4.6.2",
|
|
23
23
|
"zod": "^3.23.8"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@driveflux/tsconfig": "1.
|
|
26
|
+
"@driveflux/tsconfig": "1.3.0",
|
|
27
27
|
"@types/lodash.merge": "^4.6.9",
|
|
28
|
-
"@types/node": "^22.7.
|
|
28
|
+
"@types/node": "^22.7.8",
|
|
29
29
|
"del-cli": "^6.0.0",
|
|
30
30
|
"type-fest": "^4.26.1",
|
|
31
31
|
"typescript": "^5.6.3"
|