@driveflux/fab 1.0.3 → 1.0.4
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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +6 -0
- package/dist/build.js +56 -56
- package/dist/clean.js +15 -15
- package/dist/config.js +10 -10
- package/dist/create.js +8 -8
- package/dist/index.js +5 -5
- package/dist/utils.js +20 -20
- package/package.json +5 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
> @driveflux/fab@1.0.
|
|
2
|
+
> @driveflux/fab@1.0.4 build /Users/flux/Projects/flux/packages/fab
|
|
3
3
|
> pnpm build:js && pnpm build:types
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @driveflux/fab@1.0.
|
|
6
|
+
> @driveflux/fab@1.0.4 build:js /Users/flux/Projects/flux/packages/fab
|
|
7
7
|
> swc src --strip-leading-paths -d dist
|
|
8
8
|
|
|
9
|
-
Successfully compiled: 7 files with swc (
|
|
9
|
+
Successfully compiled: 7 files with swc (179.57ms)
|
|
10
10
|
|
|
11
|
-
> @driveflux/fab@1.0.
|
|
11
|
+
> @driveflux/fab@1.0.4 build:types /Users/flux/Projects/flux/packages/fab
|
|
12
12
|
> tsc --build --emitDeclarationOnly
|
|
13
13
|
|
package/CHANGELOG.md
CHANGED
package/dist/build.js
CHANGED
|
@@ -168,13 +168,13 @@ function _ts_generator(thisArg, body) {
|
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
import fg from
|
|
172
|
-
import merge from
|
|
173
|
-
import assert from
|
|
174
|
-
import fs from
|
|
175
|
-
import path from
|
|
176
|
-
import { clean } from
|
|
177
|
-
import { ensureDir, getDefaultOptions, runCommand, validatePackageJson } from
|
|
171
|
+
import fg from 'fast-glob';
|
|
172
|
+
import merge from 'lodash.merge';
|
|
173
|
+
import assert from 'node:assert';
|
|
174
|
+
import fs from 'node:fs/promises';
|
|
175
|
+
import path from 'node:path';
|
|
176
|
+
import { clean } from './clean.js';
|
|
177
|
+
import { ensureDir, getDefaultOptions, runCommand, validatePackageJson } from './utils.js';
|
|
178
178
|
var glob = fg.glob;
|
|
179
179
|
export var build = function() {
|
|
180
180
|
var _ref = _async_to_generator(function(rawOptions) {
|
|
@@ -251,9 +251,9 @@ export var copyVerbatim = function() {
|
|
|
251
251
|
return _ts_generator(this, function(_state) {
|
|
252
252
|
switch(_state.label){
|
|
253
253
|
case 0:
|
|
254
|
-
fileOrFolder = "src/".concat(fileOrFolderRaw.replace(/^(\/)*src/,
|
|
255
|
-
targetPath = path.resolve(destination, fileOrFolder).replace(
|
|
256
|
-
targetPathCjs = path.resolve(destination,
|
|
254
|
+
fileOrFolder = "src/".concat(fileOrFolderRaw.replace(/^(\/)*src/, ''));
|
|
255
|
+
targetPath = path.resolve(destination, fileOrFolder).replace('/src', '');
|
|
256
|
+
targetPathCjs = path.resolve(destination, 'cjs', fileOrFolder).replace('/src', '');
|
|
257
257
|
return [
|
|
258
258
|
4,
|
|
259
259
|
ensureDir(path.dirname(targetPath))
|
|
@@ -311,7 +311,7 @@ export var buildTypes = function() {
|
|
|
311
311
|
return [
|
|
312
312
|
4,
|
|
313
313
|
validatePackageJson({
|
|
314
|
-
command:
|
|
314
|
+
command: 'tsc',
|
|
315
315
|
cwd: options.cwd
|
|
316
316
|
})
|
|
317
317
|
];
|
|
@@ -319,10 +319,10 @@ export var buildTypes = function() {
|
|
|
319
319
|
_state.sent();
|
|
320
320
|
return [
|
|
321
321
|
4,
|
|
322
|
-
runCommand(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
322
|
+
runCommand('pnpm', [
|
|
323
|
+
'tsc',
|
|
324
|
+
'--emitDeclarationOnly',
|
|
325
|
+
'--declarationMap'
|
|
326
326
|
], {
|
|
327
327
|
cwd: options.cwd
|
|
328
328
|
})
|
|
@@ -348,11 +348,11 @@ export var buildCjs = function() {
|
|
|
348
348
|
options = merge({}, getDefaultOptions(), rawOptions);
|
|
349
349
|
cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
|
|
350
350
|
destination = (_options_destination = options.destination) !== null && _options_destination !== void 0 ? _options_destination : getDefaultOptions().destination;
|
|
351
|
-
cjsPath = path.resolve(destination,
|
|
351
|
+
cjsPath = path.resolve(destination, 'cjs');
|
|
352
352
|
return [
|
|
353
353
|
4,
|
|
354
354
|
validatePackageJson({
|
|
355
|
-
command:
|
|
355
|
+
command: 'swc',
|
|
356
356
|
cwd: cwd
|
|
357
357
|
})
|
|
358
358
|
];
|
|
@@ -362,12 +362,12 @@ export var buildCjs = function() {
|
|
|
362
362
|
return [
|
|
363
363
|
4,
|
|
364
364
|
runCommand("pnpm", [
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
365
|
+
'swc',
|
|
366
|
+
'src',
|
|
367
|
+
'-C',
|
|
368
|
+
'module.type=commonjs',
|
|
369
|
+
'--strip-leading-paths',
|
|
370
|
+
'-d',
|
|
371
371
|
cjsPath
|
|
372
372
|
], {
|
|
373
373
|
cwd: cwd
|
|
@@ -375,7 +375,7 @@ export var buildCjs = function() {
|
|
|
375
375
|
];
|
|
376
376
|
case 2:
|
|
377
377
|
_state.sent();
|
|
378
|
-
targetPath = path.resolve(cwd, cjsPath,
|
|
378
|
+
targetPath = path.resolve(cwd, cjsPath, 'package.json');
|
|
379
379
|
return [
|
|
380
380
|
4,
|
|
381
381
|
ensureDir(path.dirname(targetPath))
|
|
@@ -422,10 +422,10 @@ export var makeBaseExports = function() {
|
|
|
422
422
|
exp = _tmp;
|
|
423
423
|
// Let's validate the exports
|
|
424
424
|
if (!exp) {
|
|
425
|
-
throw new Error(
|
|
425
|
+
throw new Error('No exports found');
|
|
426
426
|
}
|
|
427
|
-
if (typeof exp !==
|
|
428
|
-
throw new Error(
|
|
427
|
+
if (typeof exp !== 'object' && Array.isArray(exp)) {
|
|
428
|
+
throw new Error('Exports must be an object');
|
|
429
429
|
}
|
|
430
430
|
return [
|
|
431
431
|
4,
|
|
@@ -492,11 +492,11 @@ var processEntry = function() {
|
|
|
492
492
|
case 0:
|
|
493
493
|
cjsExportsPromise = Promise.resolve([]);
|
|
494
494
|
if (!options.noCJS) {
|
|
495
|
-
cjsExportsPromise = extractBaseExportsFromEntry(entry,
|
|
495
|
+
cjsExportsPromise = extractBaseExportsFromEntry(entry, 'cjs', options);
|
|
496
496
|
}
|
|
497
497
|
typesExportsPromise = Promise.resolve([]);
|
|
498
498
|
if (!options.noTypes) {
|
|
499
|
-
typesExportsPromise = extractBaseExportsFromEntry(entry,
|
|
499
|
+
typesExportsPromise = extractBaseExportsFromEntry(entry, 'types', options);
|
|
500
500
|
}
|
|
501
501
|
return [
|
|
502
502
|
4,
|
|
@@ -526,16 +526,16 @@ var extractBaseExportsFromEntry = function() {
|
|
|
526
526
|
_param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
527
527
|
cwd = (_options_cwd = options.cwd) !== null && _options_cwd !== void 0 ? _options_cwd : process.cwd();
|
|
528
528
|
assert([
|
|
529
|
-
|
|
530
|
-
|
|
529
|
+
'cjs',
|
|
530
|
+
'types'
|
|
531
531
|
].includes(type), "The type of the entry ".concat(key, ' must be "cjs" | "types". ').concat(type, " given"));
|
|
532
532
|
// We need to make sure the * is ONLY once at most and is at the end of the key
|
|
533
533
|
hasWildcard = /^[^*]*\*$/.test(key);
|
|
534
|
-
if (key.includes(
|
|
534
|
+
if (key.includes('*') && !hasWildcard) {
|
|
535
535
|
throw new Error("Only 1 wildcard at the end of the export path is allowed. Provided ".concat(key));
|
|
536
536
|
}
|
|
537
|
-
exportTypeKey = type ===
|
|
538
|
-
if (typeof value !==
|
|
537
|
+
exportTypeKey = type === 'cjs' ? 'require' : 'types';
|
|
538
|
+
if (typeof value !== 'object' || !value || Array.isArray(value) || !(exportTypeKey in value) || typeof value[exportTypeKey] === 'undefined') {
|
|
539
539
|
throw new Error("Missing key ".concat(exportTypeKey, " from the exports map of ").concat(key, ". If this is desired, then set it to null."));
|
|
540
540
|
}
|
|
541
541
|
exportKeyValue = value[exportTypeKey];
|
|
@@ -545,11 +545,11 @@ var extractBaseExportsFromEntry = function() {
|
|
|
545
545
|
[]
|
|
546
546
|
];
|
|
547
547
|
}
|
|
548
|
-
if (typeof exportKeyValue !==
|
|
548
|
+
if (typeof exportKeyValue !== 'string') {
|
|
549
549
|
throw new Error('Only strings are allowed in the "'.concat(exportTypeKey, '" field'));
|
|
550
550
|
}
|
|
551
|
-
asteriskPosition = exportKeyValue.replace(
|
|
552
|
-
return p.startsWith(
|
|
551
|
+
asteriskPosition = exportKeyValue.replace('./', '').split('/').findIndex(function(p) {
|
|
552
|
+
return p.startsWith('*');
|
|
553
553
|
});
|
|
554
554
|
return [
|
|
555
555
|
4,
|
|
@@ -565,13 +565,13 @@ var extractBaseExportsFromEntry = function() {
|
|
|
565
565
|
case 0:
|
|
566
566
|
finalKey = key;
|
|
567
567
|
if (hasWildcard) {
|
|
568
|
-
finalKey = key.replace(
|
|
568
|
+
finalKey = key.replace('*', p.split('/').slice(asteriskPosition, asteriskPosition + 1).join('/'));
|
|
569
569
|
}
|
|
570
|
-
if (finalKey ===
|
|
571
|
-
finalKey =
|
|
570
|
+
if (finalKey === '.' || finalKey === './') {
|
|
571
|
+
finalKey = 'index';
|
|
572
572
|
}
|
|
573
|
-
content =
|
|
574
|
-
targetFile =
|
|
573
|
+
content = '';
|
|
574
|
+
targetFile = '';
|
|
575
575
|
geImportPaths = function(importPath) {
|
|
576
576
|
var targetFile = path.resolve(cwd, importPath);
|
|
577
577
|
var importFromPath = path.dirname(targetFile);
|
|
@@ -583,13 +583,13 @@ var extractBaseExportsFromEntry = function() {
|
|
|
583
583
|
targetFile: targetFile
|
|
584
584
|
};
|
|
585
585
|
};
|
|
586
|
-
if (!(type ===
|
|
586
|
+
if (!(type === 'cjs')) return [
|
|
587
587
|
3,
|
|
588
588
|
2
|
|
589
589
|
];
|
|
590
590
|
return [
|
|
591
591
|
4,
|
|
592
|
-
resolvePathWithExtension(finalKey,
|
|
592
|
+
resolvePathWithExtension(finalKey, 'cjs')
|
|
593
593
|
];
|
|
594
594
|
case 1:
|
|
595
595
|
finalKey = _state.sent();
|
|
@@ -599,13 +599,13 @@ var extractBaseExportsFromEntry = function() {
|
|
|
599
599
|
content = "module.exports = require('".concat(formatImportPath(relativeImportPath), "')");
|
|
600
600
|
_state.label = 2;
|
|
601
601
|
case 2:
|
|
602
|
-
if (!(type ===
|
|
602
|
+
if (!(type === 'types')) return [
|
|
603
603
|
3,
|
|
604
604
|
5
|
|
605
605
|
];
|
|
606
606
|
return [
|
|
607
607
|
4,
|
|
608
|
-
resolvePathWithExtension(finalKey,
|
|
608
|
+
resolvePathWithExtension(finalKey, 'd.ts')
|
|
609
609
|
];
|
|
610
610
|
case 3:
|
|
611
611
|
finalKey = _state.sent();
|
|
@@ -613,10 +613,10 @@ var extractBaseExportsFromEntry = function() {
|
|
|
613
613
|
relativeImportPath1 = importPaths1.relativeImportPath;
|
|
614
614
|
targetFile = importPaths1.targetFile;
|
|
615
615
|
// Typescript will complain about exprting .d.ts, so we just omt that
|
|
616
|
-
content = "export * from '".concat(formatImportPath(relativeImportPath1).replace(
|
|
616
|
+
content = "export * from '".concat(formatImportPath(relativeImportPath1).replace('.d.ts', ''), "'");
|
|
617
617
|
return [
|
|
618
618
|
4,
|
|
619
|
-
fs.readFile(importPaths1.fullImportPath,
|
|
619
|
+
fs.readFile(importPaths1.fullImportPath, 'utf-8')
|
|
620
620
|
];
|
|
621
621
|
case 4:
|
|
622
622
|
fileContent = _state.sent();
|
|
@@ -716,7 +716,7 @@ var resolvePathWithExtension = function() {
|
|
|
716
716
|
};
|
|
717
717
|
}();
|
|
718
718
|
var formatImportPath = function(exportPath) {
|
|
719
|
-
return exportPath.startsWith(
|
|
719
|
+
return exportPath.startsWith('.') ? exportPath : "./".concat(exportPath);
|
|
720
720
|
};
|
|
721
721
|
var parseExportPath = function() {
|
|
722
722
|
var _ref = _async_to_generator(function(exportPath) {
|
|
@@ -726,7 +726,7 @@ var parseExportPath = function() {
|
|
|
726
726
|
switch(_state.label){
|
|
727
727
|
case 0:
|
|
728
728
|
cwd = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : process.cwd();
|
|
729
|
-
split = exportPath.split(
|
|
729
|
+
split = exportPath.split('*');
|
|
730
730
|
if (split.length === 1) {
|
|
731
731
|
return [
|
|
732
732
|
2,
|
|
@@ -737,7 +737,7 @@ var parseExportPath = function() {
|
|
|
737
737
|
}
|
|
738
738
|
// Allow only 1 * in the path
|
|
739
739
|
if (split.length > 2) {
|
|
740
|
-
throw new Error(
|
|
740
|
+
throw new Error('Invalid export path. Only one * is allowed');
|
|
741
741
|
}
|
|
742
742
|
return [
|
|
743
743
|
4,
|
|
@@ -768,10 +768,10 @@ export var buildEsm = function() {
|
|
|
768
768
|
return [
|
|
769
769
|
4,
|
|
770
770
|
runCommand("pnpm", [
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
771
|
+
'swc',
|
|
772
|
+
'src',
|
|
773
|
+
'--strip-leading-paths',
|
|
774
|
+
'-d',
|
|
775
775
|
(_options_destination = options.destination) !== null && _options_destination !== void 0 ? _options_destination : getDefaultOptions().destination
|
|
776
776
|
], {
|
|
777
777
|
cwd: options.cwd
|
|
@@ -800,7 +800,7 @@ var parseExports = function() {
|
|
|
800
800
|
_ = JSON.parse;
|
|
801
801
|
return [
|
|
802
802
|
4,
|
|
803
|
-
fs.readFile(path.join(cwd,
|
|
803
|
+
fs.readFile(path.join(cwd, 'package.json'), 'utf-8')
|
|
804
804
|
];
|
|
805
805
|
case 1:
|
|
806
806
|
pkg = _.apply(JSON, [
|
package/dist/clean.js
CHANGED
|
@@ -175,8 +175,8 @@ function _ts_generator(thisArg, body) {
|
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
import path from
|
|
179
|
-
import { getDefaultOptions, runCommand, validatePackageJson } from
|
|
178
|
+
import path from 'node:path';
|
|
179
|
+
import { getDefaultOptions, runCommand, validatePackageJson } from './utils.js';
|
|
180
180
|
export var clean = function() {
|
|
181
181
|
var _ref = _async_to_generator(function() {
|
|
182
182
|
var rawOptions, _$_object_spread, cwd, destination, cleanTs, all, rawDoNotCleanup, doNotCleanup;
|
|
@@ -189,7 +189,7 @@ export var clean = function() {
|
|
|
189
189
|
return [
|
|
190
190
|
4,
|
|
191
191
|
validatePackageJson({
|
|
192
|
-
command:
|
|
192
|
+
command: 'del',
|
|
193
193
|
cwd: cwd
|
|
194
194
|
})
|
|
195
195
|
];
|
|
@@ -204,11 +204,11 @@ export var clean = function() {
|
|
|
204
204
|
];
|
|
205
205
|
return [
|
|
206
206
|
4,
|
|
207
|
-
runCommand(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
207
|
+
runCommand('pnpm', [
|
|
208
|
+
'del',
|
|
209
|
+
'**/*.cjs',
|
|
210
|
+
'**/*.d.ts',
|
|
211
|
+
'tsconfig.tsbuildinfo'
|
|
212
212
|
].concat(_to_consumable_array(doNotCleanup)), {
|
|
213
213
|
cwd: cwd
|
|
214
214
|
})
|
|
@@ -219,9 +219,9 @@ export var clean = function() {
|
|
|
219
219
|
case 3:
|
|
220
220
|
return [
|
|
221
221
|
4,
|
|
222
|
-
runCommand(
|
|
223
|
-
|
|
224
|
-
path.resolve(destination,
|
|
222
|
+
runCommand('pnpm', [
|
|
223
|
+
'del',
|
|
224
|
+
path.resolve(destination, '**/*.js')
|
|
225
225
|
].concat(_to_consumable_array(doNotCleanup)), {
|
|
226
226
|
cwd: cwd
|
|
227
227
|
})
|
|
@@ -234,10 +234,10 @@ export var clean = function() {
|
|
|
234
234
|
];
|
|
235
235
|
return [
|
|
236
236
|
4,
|
|
237
|
-
runCommand(
|
|
238
|
-
|
|
239
|
-
path.resolve(destination,
|
|
240
|
-
path.resolve(destination,
|
|
237
|
+
runCommand('pnpm', [
|
|
238
|
+
'del',
|
|
239
|
+
path.resolve(destination, '**/*.d.ts'),
|
|
240
|
+
path.resolve(destination, 'tsconfig.tsbuildinfo')
|
|
241
241
|
].concat(_to_consumable_array(doNotCleanup)), {
|
|
242
242
|
cwd: cwd
|
|
243
243
|
})
|
package/dist/config.js
CHANGED
|
@@ -122,9 +122,9 @@ function _ts_generator(thisArg, body) {
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
import fs from
|
|
126
|
-
import path from
|
|
127
|
-
import { z } from
|
|
125
|
+
import fs from 'node:fs/promises';
|
|
126
|
+
import path from 'node:path';
|
|
127
|
+
import { z } from 'zod';
|
|
128
128
|
var ConfigValidation = z.object({
|
|
129
129
|
doNotCleanup: z.array(z.string()),
|
|
130
130
|
noCJS: z.boolean().optional(),
|
|
@@ -203,11 +203,11 @@ var findConfigFile = function() {
|
|
|
203
203
|
files = _state.sent();
|
|
204
204
|
configFile = files.find(function(f) {
|
|
205
205
|
return [
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
206
|
+
'fab.config.js',
|
|
207
|
+
'fab.config.cjs',
|
|
208
|
+
'fab.config.mjs',
|
|
209
|
+
'fabrc.json',
|
|
210
|
+
'.fabrc'
|
|
211
211
|
].includes(f);
|
|
212
212
|
});
|
|
213
213
|
_tmp = configFile;
|
|
@@ -254,14 +254,14 @@ var readConfigFile = function() {
|
|
|
254
254
|
_state.sent().default
|
|
255
255
|
];
|
|
256
256
|
case 2:
|
|
257
|
-
if (!(configPath.endsWith(
|
|
257
|
+
if (!(configPath.endsWith('.json') || configPath.split('/').pop() === '.fabrc')) return [
|
|
258
258
|
3,
|
|
259
259
|
4
|
|
260
260
|
];
|
|
261
261
|
_ = JSON.parse;
|
|
262
262
|
return [
|
|
263
263
|
4,
|
|
264
|
-
fs.readFile(configPath,
|
|
264
|
+
fs.readFile(configPath, 'utf-8')
|
|
265
265
|
];
|
|
266
266
|
case 3:
|
|
267
267
|
return [
|
package/dist/create.js
CHANGED
|
@@ -122,10 +122,10 @@ function _ts_generator(thisArg, body) {
|
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
import { deleteAsync } from
|
|
126
|
-
import fs from
|
|
127
|
-
import path from
|
|
128
|
-
import { ensureDir, getBaseDir, runCommand } from
|
|
125
|
+
import { deleteAsync } from 'del';
|
|
126
|
+
import fs from 'node:fs/promises';
|
|
127
|
+
import path from 'node:path';
|
|
128
|
+
import { ensureDir, getBaseDir, runCommand } from './utils.js';
|
|
129
129
|
export var create = function() {
|
|
130
130
|
var _ref = _async_to_generator(function(param) {
|
|
131
131
|
var template, name, providedDestination, providedCwd, dangerouslyRewrite, cwd, destination, finalDestination, e, templatePath;
|
|
@@ -220,8 +220,8 @@ export var create = function() {
|
|
|
220
220
|
_state.sent();
|
|
221
221
|
return [
|
|
222
222
|
4,
|
|
223
|
-
runCommand(
|
|
224
|
-
|
|
223
|
+
runCommand('pnpm', [
|
|
224
|
+
'i'
|
|
225
225
|
], {
|
|
226
226
|
cwd: cwd
|
|
227
227
|
})
|
|
@@ -246,12 +246,12 @@ var replaceInFile = function() {
|
|
|
246
246
|
case 0:
|
|
247
247
|
return [
|
|
248
248
|
4,
|
|
249
|
-
fs.readFile(filePath,
|
|
249
|
+
fs.readFile(filePath, 'utf-8')
|
|
250
250
|
];
|
|
251
251
|
case 1:
|
|
252
252
|
content = _state.sent();
|
|
253
253
|
// No time to build the regex and replace logic, that's for later, we just replace the name now
|
|
254
|
-
newContent = content.replace(
|
|
254
|
+
newContent = content.replace('{{name}}', replacements.name);
|
|
255
255
|
return [
|
|
256
256
|
4,
|
|
257
257
|
fs.writeFile(filePath, newContent)
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './build.js';
|
|
2
|
+
export * from './clean.js';
|
|
3
|
+
export * from './config.js';
|
|
4
|
+
export * from './create.js';
|
|
5
|
+
export * from './types.js';
|
package/dist/utils.js
CHANGED
|
@@ -150,19 +150,19 @@ function _ts_generator(thisArg, body) {
|
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
import { spawn } from
|
|
154
|
-
import fs from
|
|
155
|
-
import path from
|
|
153
|
+
import { spawn } from 'node:child_process';
|
|
154
|
+
import fs from 'node:fs/promises';
|
|
155
|
+
import path from 'node:path';
|
|
156
156
|
var REQUIRED_DEPS = {
|
|
157
157
|
del: [
|
|
158
|
-
|
|
158
|
+
'del-cli'
|
|
159
159
|
],
|
|
160
160
|
tsc: [
|
|
161
|
-
|
|
161
|
+
'typescript'
|
|
162
162
|
],
|
|
163
163
|
swc: [
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
'@swc/core',
|
|
165
|
+
'@swc/cli'
|
|
166
166
|
]
|
|
167
167
|
};
|
|
168
168
|
export var ensureDir = function() {
|
|
@@ -220,16 +220,16 @@ export var runCommand = function() {
|
|
|
220
220
|
var c;
|
|
221
221
|
return _ts_generator(this, function(_state) {
|
|
222
222
|
c = spawn(cmd, args, _object_spread({
|
|
223
|
-
stdio:
|
|
223
|
+
stdio: 'inherit'
|
|
224
224
|
}, options));
|
|
225
225
|
return [
|
|
226
226
|
2,
|
|
227
227
|
new Promise(function(resolve, reject) {
|
|
228
|
-
c.on(
|
|
228
|
+
c.on('error', function(error) {
|
|
229
229
|
console.error(error);
|
|
230
230
|
reject(error);
|
|
231
231
|
});
|
|
232
|
-
c.on(
|
|
232
|
+
c.on('close', function(code) {
|
|
233
233
|
if (code !== 0) {
|
|
234
234
|
reject(new Error("Command exited with code ".concat(code)));
|
|
235
235
|
} else {
|
|
@@ -255,17 +255,17 @@ export var validatePackageJson = function() {
|
|
|
255
255
|
_ = JSON.parse;
|
|
256
256
|
return [
|
|
257
257
|
4,
|
|
258
|
-
fs.readFile(path.join(cwd,
|
|
258
|
+
fs.readFile(path.join(cwd, 'package.json'), 'utf-8')
|
|
259
259
|
];
|
|
260
260
|
case 1:
|
|
261
261
|
pkg = _.apply(JSON, [
|
|
262
262
|
_state.sent()
|
|
263
263
|
]);
|
|
264
|
-
packageName = cwd.split(
|
|
264
|
+
packageName = cwd.split('/').pop();
|
|
265
265
|
notAllowedInScripts = [
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
'del',
|
|
267
|
+
'tsc',
|
|
268
|
+
'swc'
|
|
269
269
|
];
|
|
270
270
|
if (command in pkg.scripts && notAllowedInScripts.includes(command)) {
|
|
271
271
|
console.log("\uD83D\uDEA8 The ".concat(command, " script is not allowed. Remove the ").concat(command, " script from ").concat(packageName, "/package.json"));
|
|
@@ -279,7 +279,7 @@ export var validatePackageJson = function() {
|
|
|
279
279
|
return !(d in allDeps);
|
|
280
280
|
});
|
|
281
281
|
if (missingDeps.length > 0) {
|
|
282
|
-
console.log("\uD83D\uDEA8 The ".concat(command, " script requires the following dependencies: ").concat(missingDeps.join(
|
|
282
|
+
console.log("\uD83D\uDEA8 The ".concat(command, " script requires the following dependencies: ").concat(missingDeps.join(', '), ". Add them to ").concat(packageName, "/package.json"));
|
|
283
283
|
process.exit(1);
|
|
284
284
|
}
|
|
285
285
|
return [
|
|
@@ -294,15 +294,15 @@ export var validatePackageJson = function() {
|
|
|
294
294
|
}();
|
|
295
295
|
export var getBaseDir = function() {
|
|
296
296
|
// This file will end up in ./dist, so we need to remove the dist from the path
|
|
297
|
-
return path.resolve(path.dirname(decodeURIComponent(new URL(import.meta.url).pathname)),
|
|
297
|
+
return path.resolve(path.dirname(decodeURIComponent(new URL(import.meta.url).pathname)), '..');
|
|
298
298
|
};
|
|
299
299
|
export var getDefaultOptions = function() {
|
|
300
300
|
return {
|
|
301
301
|
cwd: process.cwd(),
|
|
302
|
-
destination:
|
|
302
|
+
destination: 'dist',
|
|
303
303
|
doNotCleanup: [
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
'src',
|
|
305
|
+
'bin'
|
|
306
306
|
],
|
|
307
307
|
noCJS: false
|
|
308
308
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driveflux/fab",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"lodash.merge": "^4.6.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@swc-node/register": "^1.9.
|
|
21
|
+
"@swc-node/register": "^1.9.1",
|
|
22
22
|
"@swc/cli": "^0.3.12",
|
|
23
|
-
"@swc/core": "1.
|
|
23
|
+
"@swc/core": "1.4.17",
|
|
24
24
|
"@types/lodash.merge": "^4.6.9",
|
|
25
25
|
"del": "^7.1.0",
|
|
26
26
|
"del-cli": "^5.1.0",
|
|
27
27
|
"esbuild": "^0.20.2",
|
|
28
|
-
"type-fest": "^4.
|
|
29
|
-
"zod": "^3.
|
|
28
|
+
"type-fest": "^4.18.1",
|
|
29
|
+
"zod": "^3.23.6"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"typescript": "^5.4.5"
|