@driveflux/fab 1.0.10 → 2.1.0

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/clean.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- import { Config } from './config.js';
2
- import type { BaseOptions } from './types.js';
3
- export interface CleanOptions extends BaseOptions, Config {
4
- cleanTs?: boolean;
5
- all?: boolean;
6
- }
7
- export declare const clean: (rawOptions?: CleanOptions) => Promise<void>;
1
+ import type { CleanOptions } from './types.js';
2
+ export declare const clean: (rawOptions: CleanOptions) => Promise<void>;
8
3
  //# sourceMappingURL=clean.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../src/clean.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,WAAW,YAAa,SAAQ,WAAW,EAAE,MAAM;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;CACd;AAED,eAAO,MAAM,KAAK,gBAAsB,YAAY,kBAiCnD,CAAA"}
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,kBAgBnD,CAAA"}
package/dist/clean.js CHANGED
@@ -1,11 +1,3 @@
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
- }
9
1
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
2
  try {
11
3
  var info = gen[key](arg);
@@ -35,51 +27,6 @@ function _async_to_generator(fn) {
35
27
  });
36
28
  };
37
29
  }
38
- function _define_property(obj, key, value) {
39
- if (key in obj) {
40
- Object.defineProperty(obj, key, {
41
- value: value,
42
- enumerable: true,
43
- configurable: true,
44
- writable: true
45
- });
46
- } else {
47
- obj[key] = value;
48
- }
49
- return obj;
50
- }
51
- function _iterable_to_array(iter) {
52
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
53
- }
54
- function _non_iterable_spread() {
55
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
56
- }
57
- function _object_spread(target) {
58
- for(var i = 1; i < arguments.length; i++){
59
- var source = arguments[i] != null ? arguments[i] : {};
60
- var ownKeys = Object.keys(source);
61
- if (typeof Object.getOwnPropertySymbols === "function") {
62
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
63
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
64
- }));
65
- }
66
- ownKeys.forEach(function(key) {
67
- _define_property(target, key, source[key]);
68
- });
69
- }
70
- return target;
71
- }
72
- function _to_consumable_array(arr) {
73
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
74
- }
75
- function _unsupported_iterable_to_array(o, minLen) {
76
- if (!o) return;
77
- if (typeof o === "string") return _array_like_to_array(o, minLen);
78
- var n = Object.prototype.toString.call(o).slice(8, -1);
79
- if (n === "Object" && o.constructor) n = o.constructor.name;
80
- if (n === "Map" || n === "Set") return Array.from(n);
81
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
82
- }
83
30
  function _ts_generator(thisArg, body) {
84
31
  var f, y, t, g, _ = {
85
32
  label: 0,
@@ -176,83 +123,38 @@ function _ts_generator(thisArg, body) {
176
123
  }
177
124
  }
178
125
  import path from 'node:path';
179
- import { getDefaultOptions, runCommand, validatePackageJson } from './utils.js';
126
+ import { deleteAsync } from 'del';
127
+ import merge from 'lodash.merge';
128
+ import { getDefaultOptions } from './utils.js';
180
129
  export var clean = function() {
181
- var _ref = _async_to_generator(function() {
182
- var rawOptions, _$_object_spread, cwd, destination, cleanTs, all, rawDoNotCleanup, doNotCleanup;
183
- var _arguments = arguments;
130
+ var _ref = _async_to_generator(function(rawOptions) {
131
+ var _merge, destination, all, commandOptions;
184
132
  return _ts_generator(this, function(_state) {
185
133
  switch(_state.label){
186
134
  case 0:
187
- rawOptions = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : getDefaultOptions();
188
- _$_object_spread = _object_spread({}, getDefaultOptions(), rawOptions), cwd = _$_object_spread.cwd, destination = _$_object_spread.destination, cleanTs = _$_object_spread.cleanTs, all = _$_object_spread.all, rawDoNotCleanup = _$_object_spread.doNotCleanup;
189
- return [
190
- 4,
191
- validatePackageJson({
192
- command: 'del',
193
- cwd: cwd
194
- })
195
- ];
196
- case 1:
197
- _state.sent();
198
- doNotCleanup = (rawDoNotCleanup === null || rawDoNotCleanup === void 0 ? void 0 : rawDoNotCleanup.map(function(f) {
199
- return "!".concat(f);
200
- })) || [];
201
- if (!all) return [
202
- 3,
203
- 3
204
- ];
205
- return [
206
- 4,
207
- runCommand('pnpm', [
208
- 'del',
209
- '**/*.cjs',
210
- '**/*.d.ts',
211
- 'tsconfig.tsbuildinfo'
212
- ].concat(_to_consumable_array(doNotCleanup)), {
213
- cwd: cwd
214
- })
215
- ];
216
- case 2:
217
- _state.sent();
218
- _state.label = 3;
219
- case 3:
220
- return [
221
- 4,
222
- runCommand('pnpm', [
223
- 'del',
224
- path.resolve(destination, '**/*.js')
225
- ].concat(_to_consumable_array(doNotCleanup)), {
226
- cwd: cwd
227
- })
228
- ];
229
- case 4:
230
- _state.sent();
231
- if (!cleanTs) return [
232
- 3,
233
- 6
135
+ _merge = merge({}, getDefaultOptions(), rawOptions), destination = _merge.destination, all = _merge.cleanTs;
136
+ commandOptions = [
137
+ path.resolve(destination, '**/*.js')
234
138
  ];
139
+ if (all) {
140
+ commandOptions.push(path.resolve(destination, '**/*.d.ts'));
141
+ commandOptions.push(path.resolve(destination, 'tsconfig.tsbuildinfo'));
142
+ }
235
143
  return [
236
144
  4,
237
- runCommand('pnpm', [
238
- 'del',
239
- path.resolve(destination, '**/*.d.ts'),
240
- path.resolve(destination, 'tsconfig.tsbuildinfo')
241
- ].concat(_to_consumable_array(doNotCleanup)), {
242
- cwd: cwd
243
- })
145
+ Promise.all(commandOptions.map(function() {
146
+ return deleteAsync(path.resolve(destination, '**/*.js'));
147
+ }))
244
148
  ];
245
- case 5:
149
+ case 1:
246
150
  _state.sent();
247
- _state.label = 6;
248
- case 6:
249
151
  return [
250
152
  2
251
153
  ];
252
154
  }
253
155
  });
254
156
  });
255
- return function clean() {
157
+ return function clean(rawOptions) {
256
158
  return _ref.apply(this, arguments);
257
159
  };
258
160
  }();
package/dist/config.d.ts CHANGED
@@ -1,27 +1,31 @@
1
1
  import { z } from 'zod';
2
- export type Config = z.infer<typeof ConfigValidation>;
2
+ export type Config = Partial<FullConfig>;
3
+ export type FullConfig = z.infer<typeof ConfigValidation>;
3
4
  interface ParseConfigOptions {
4
- config?: Config;
5
+ config?: FullConfig;
5
6
  configFile?: string;
6
7
  cwd?: string;
7
8
  }
8
9
  declare const ConfigValidation: z.ZodObject<{
9
- doNotCleanup: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
- noCJS: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
11
- copyVerbatim: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
+ source: z.ZodString;
11
+ destination: z.ZodString;
12
+ noTypes: z.ZodBoolean;
13
+ /**
14
+ * The files to copy verbatim. It can be a single source path, it is moved as it is to the destination folder
15
+ * or an array of 2 paths [source, destination].
16
+ */
17
+ copyVerbatim: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, "many">;
12
18
  }, "strip", z.ZodTypeAny, {
13
- doNotCleanup?: string[] | undefined;
14
- noCJS?: boolean | undefined;
15
- copyVerbatim?: string[] | undefined;
19
+ source: string;
20
+ destination: string;
21
+ noTypes: boolean;
22
+ copyVerbatim: (string | string[])[];
16
23
  }, {
17
- doNotCleanup?: string[] | undefined;
18
- noCJS?: boolean | undefined;
19
- copyVerbatim?: string[] | undefined;
20
- }>;
21
- export declare const parseConfig: (options?: ParseConfigOptions) => Promise<{
22
- doNotCleanup?: string[] | undefined;
23
- noCJS?: boolean | undefined;
24
- copyVerbatim?: string[] | undefined;
24
+ source: string;
25
+ destination: string;
26
+ noTypes: boolean;
27
+ copyVerbatim: (string | string[])[];
25
28
  }>;
29
+ export declare const parseConfig: (options?: ParseConfigOptions) => Promise<FullConfig>;
26
30
  export {};
27
31
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAErD,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,QAAA,MAAM,gBAAgB;;;;;;;;;;;;EAMV,CAAA;AAEZ,eAAO,MAAM,WAAW,aAAoB,kBAAkB;;;;EAiB7D,CAAA"}
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;;;;;;;;;;;;EAEF,CAAA;AAEF,eAAO,MAAM,WAAW,aACb,kBAAkB,KAC1B,OAAO,CAAC,UAAU,CAmBpB,CAAA"}
package/dist/config.js CHANGED
@@ -124,15 +124,21 @@ function _ts_generator(thisArg, body) {
124
124
  }
125
125
  import fs from 'node:fs/promises';
126
126
  import path from 'node:path';
127
+ import merge from 'lodash.merge';
127
128
  import { z } from 'zod';
129
+ import { getDefaultOptions } from './utils.js';
128
130
  var ConfigValidation = z.object({
129
- doNotCleanup: z.array(z.string()),
130
- noCJS: z.boolean().optional(),
131
- copyVerbatim: z.array(z.string())
132
- }).partial();
131
+ source: z.string(),
132
+ destination: z.string(),
133
+ noTypes: z.boolean(),
134
+ /**
135
+ * The files to copy verbatim. It can be a single source path, it is moved as it is to the destination folder
136
+ * or an array of 2 paths [source, destination].
137
+ */ copyVerbatim: z.array(z.string().or(z.array(z.string()).length(2)))
138
+ });
133
139
  export var parseConfig = function() {
134
140
  var _ref = _async_to_generator(function(options) {
135
- var cwd, config;
141
+ var cwd, config, parsed;
136
142
  return _ts_generator(this, function(_state) {
137
143
  switch(_state.label){
138
144
  case 0:
@@ -173,12 +179,13 @@ export var parseConfig = function() {
173
179
  if (!config) {
174
180
  return [
175
181
  2,
176
- {}
182
+ getDefaultOptions()
177
183
  ];
178
184
  }
185
+ parsed = ConfigValidation.partial().parse(config);
179
186
  return [
180
187
  2,
181
- ConfigValidation.parse(config)
188
+ merge({}, getDefaultOptions(), parsed)
182
189
  ];
183
190
  }
184
191
  });
package/dist/create.d.ts CHANGED
@@ -5,6 +5,6 @@ interface CreateOptions {
5
5
  cwd?: string;
6
6
  dangerouslyRewrite?: boolean;
7
7
  }
8
- export declare const create: ({ template, name, destination: providedDestination, cwd: providedCwd, dangerouslyRewrite }: CreateOptions) => Promise<void>;
8
+ export declare const create: ({ template, name, destination: providedDestination, cwd: providedCwd, dangerouslyRewrite, }: CreateOptions) => Promise<void>;
9
9
  export {};
10
10
  //# sourceMappingURL=create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,QAAQ,EAAE,SAAS,GAAG,UAAU,CAAA;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,eAAO,MAAM,MAAM,+FAMhB,aAAa,kBAuCf,CAAA"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACtB,QAAQ,EAAE,SAAS,GAAG,UAAU,CAAA;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,eAAO,MAAM,MAAM,gGAMhB,aAAa,kBAyCf,CAAA"}
package/dist/create.js CHANGED
@@ -122,9 +122,9 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { deleteAsync } from 'del';
126
125
  import fs from 'node:fs/promises';
127
126
  import path from 'node:path';
127
+ import { deleteAsync } from 'del';
128
128
  import { ensureDir, getBaseDir, runCommand } from './utils.js';
129
129
  export var create = function() {
130
130
  var _ref = _async_to_generator(function(param) {
package/dist/types.d.ts CHANGED
@@ -1,5 +1,15 @@
1
+ import type { Config } from './config.js';
1
2
  export interface BaseOptions {
2
- cwd?: string;
3
- destination?: string;
3
+ cwd: string;
4
+ destination: string;
5
+ source: string;
6
+ }
7
+ export interface BuildESMOptions extends BaseOptions {
8
+ }
9
+ export interface CopyVerbatimOptions extends BaseOptions {
10
+ copyVerbatim?: Config['copyVerbatim'];
11
+ }
12
+ export interface CleanOptions extends Pick<BaseOptions, 'destination'> {
13
+ cleanTs?: boolean;
4
14
  }
5
15
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB"}
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;CACjB"}
package/dist/utils.d.ts CHANGED
@@ -1,18 +1,8 @@
1
- import { SpawnOptions } from 'node:child_process';
2
- import { Config } from './config.js';
3
- import { BaseOptions } from './types.js';
4
- interface ValidatePackageOptions extends BaseOptions {
5
- command: keyof typeof REQUIRED_DEPS;
6
- }
7
- declare const REQUIRED_DEPS: {
8
- readonly del: readonly ["del-cli"];
9
- readonly tsc: readonly ["typescript"];
10
- readonly swc: readonly ["@swc/core", "@swc/cli"];
11
- };
1
+ import { type SpawnOptions } from 'node:child_process';
2
+ import type { FullConfig } from './config.js';
12
3
  export declare const ensureDir: (dir: string) => Promise<void>;
13
- export declare const runCommand: (cmd: string, args: string[], options: SpawnOptions) => Promise<unknown>;
14
- export declare const validatePackageJson: ({ command, cwd: providedCwd }: ValidatePackageOptions) => Promise<void>;
4
+ export declare const runBin: (bin: string, args: string[], options?: SpawnOptions) => Promise<unknown>;
5
+ export declare const runCommand: (cmd: string, args: string[], options?: SpawnOptions) => Promise<unknown>;
15
6
  export declare const getBaseDir: () => string;
16
- export declare const getDefaultOptions: () => Required<BaseOptions> & Config;
17
- export {};
7
+ export declare const getDefaultOptions: () => FullConfig;
18
8
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAS,MAAM,oBAAoB,CAAA;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,UAAU,sBAAuB,SAAQ,WAAW;IAClD,OAAO,EAAE,MAAM,OAAO,aAAa,CAAA;CACpC;AAED,QAAA,MAAM,aAAa;;;;CAIT,CAAA;AAEV,eAAO,MAAM,SAAS,QAAe,MAAM,kBAS1C,CAAA;AAED,eAAO,MAAM,UAAU,QAAe,MAAM,QAAQ,MAAM,EAAE,WAAW,YAAY,qBAelF,CAAA;AAED,eAAO,MAAM,mBAAmB,kCAAyC,sBAAsB,kBA2B9F,CAAA;AAED,eAAO,MAAM,UAAU,cAGtB,CAAA;AAED,eAAO,MAAM,iBAAiB,QAAO,QAAQ,CAAC,WAAW,CAAC,GAAG,MAK3D,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAA;AAG7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,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,QAAO,UAKnC,CAAA"}
package/dist/utils.js CHANGED
@@ -153,18 +153,6 @@ function _ts_generator(thisArg, body) {
153
153
  import { spawn } from 'node:child_process';
154
154
  import fs from 'node:fs/promises';
155
155
  import path from 'node:path';
156
- var REQUIRED_DEPS = {
157
- del: [
158
- 'del-cli'
159
- ],
160
- tsc: [
161
- 'typescript'
162
- ],
163
- swc: [
164
- '@swc/core',
165
- '@swc/cli'
166
- ]
167
- };
168
156
  export var ensureDir = function() {
169
157
  var _ref = _async_to_generator(function(dir) {
170
158
  var stat, e;
@@ -215,11 +203,13 @@ export var ensureDir = function() {
215
203
  return _ref.apply(this, arguments);
216
204
  };
217
205
  }();
218
- export var runCommand = function() {
219
- var _ref = _async_to_generator(function(cmd, args, options) {
220
- var c;
206
+ export var runBin = function() {
207
+ var _ref = _async_to_generator(function(bin, args, options) {
208
+ var basePath, binPath, c;
221
209
  return _ts_generator(this, function(_state) {
222
- c = spawn(cmd, args, _object_spread({
210
+ basePath = getBaseDir();
211
+ binPath = path.resolve(basePath, 'node_modules/.bin', bin);
212
+ c = spawn(binPath, args, _object_spread({
223
213
  stdio: 'inherit'
224
214
  }, options));
225
215
  return [
@@ -240,55 +230,36 @@ export var runCommand = function() {
240
230
  ];
241
231
  });
242
232
  });
243
- return function runCommand(cmd, args, options) {
233
+ return function runBin(bin, args, options) {
244
234
  return _ref.apply(this, arguments);
245
235
  };
246
236
  }();
247
- export var validatePackageJson = function() {
248
- var _ref = _async_to_generator(function(param) {
249
- var command, providedCwd, cwd, pkg, _, packageName, notAllowedInScripts, deps, devDeps, allDeps, missingDeps;
237
+ export var runCommand = function() {
238
+ var _ref = _async_to_generator(function(cmd, args, options) {
239
+ var c;
250
240
  return _ts_generator(this, function(_state) {
251
- switch(_state.label){
252
- case 0:
253
- command = param.command, providedCwd = param.cwd;
254
- cwd = providedCwd || process.cwd();
255
- _ = JSON.parse;
256
- return [
257
- 4,
258
- fs.readFile(path.join(cwd, 'package.json'), 'utf-8')
259
- ];
260
- case 1:
261
- pkg = _.apply(JSON, [
262
- _state.sent()
263
- ]);
264
- packageName = cwd.split('/').pop();
265
- notAllowedInScripts = [
266
- 'del',
267
- 'tsc',
268
- 'swc'
269
- ];
270
- if (command in pkg.scripts && notAllowedInScripts.includes(command)) {
271
- console.log("\uD83D\uDEA8 The ".concat(command, " script is not allowed. Remove the ").concat(command, " script from ").concat(packageName, "/package.json"));
272
- process.exit(1);
273
- }
274
- // Validate dependencies. For each command we try to validate the corresponding dependencies
275
- deps = pkg.dependencies || {};
276
- devDeps = pkg.devDependencies || {};
277
- allDeps = _object_spread({}, deps, devDeps);
278
- missingDeps = REQUIRED_DEPS[command].filter(function(d) {
279
- return !(d in allDeps);
241
+ c = spawn(cmd, args, _object_spread({
242
+ stdio: 'inherit'
243
+ }, options));
244
+ return [
245
+ 2,
246
+ new Promise(function(resolve, reject) {
247
+ c.on('error', function(error) {
248
+ console.error(error);
249
+ reject(error);
280
250
  });
281
- if (missingDeps.length > 0) {
282
- console.log("\uD83D\uDEA8 The ".concat(command, " script requires the following dependencies: ").concat(missingDeps.join(', '), ". Add them to ").concat(packageName, "/package.json"));
283
- process.exit(1);
284
- }
285
- return [
286
- 2
287
- ];
288
- }
251
+ c.on('close', function(code) {
252
+ if (code !== 0) {
253
+ reject(new Error("Command exited with code ".concat(code)));
254
+ } else {
255
+ resolve(true);
256
+ }
257
+ });
258
+ })
259
+ ];
289
260
  });
290
261
  });
291
- return function validatePackageJson(_) {
262
+ return function runCommand(cmd, args, options) {
292
263
  return _ref.apply(this, arguments);
293
264
  };
294
265
  }();
@@ -298,12 +269,9 @@ export var getBaseDir = function() {
298
269
  };
299
270
  export var getDefaultOptions = function() {
300
271
  return {
301
- cwd: process.cwd(),
272
+ source: 'src',
302
273
  destination: 'dist',
303
- doNotCleanup: [
304
- 'src',
305
- 'bin'
306
- ],
307
- noCJS: false
274
+ noTypes: false,
275
+ copyVerbatim: []
308
276
  };
309
277
  };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@driveflux/fab",
3
- "version": "1.0.10",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
- "types": "./dist/index.d.ts",
6
5
  "bin": {
7
6
  "fab": "./bin/fab.js"
8
7
  },
@@ -13,30 +12,34 @@
13
12
  }
14
13
  },
15
14
  "dependencies": {
15
+ "@swc/cli": "^0.4.0",
16
+ "@swc/core": "1.6.13",
16
17
  "commander": "^12.1.0",
17
- "fast-glob": "^3.3.2",
18
- "lodash.merge": "^4.6.2"
18
+ "del": "^7.1.0",
19
+ "lodash.merge": "^4.6.2",
20
+ "zod": "^3.23.8"
19
21
  },
20
22
  "devDependencies": {
21
- "@swc-node/register": "1.9.2",
22
- "@swc/cli": "^0.3.14",
23
- "@swc/core": "1.6.5",
23
+ "@driveflux/tsconfig": "1.1.0",
24
24
  "@types/lodash.merge": "^4.6.9",
25
- "del": "^7.1.0",
25
+ "@types/node": "^20.14.10",
26
26
  "del-cli": "^5.1.0",
27
- "esbuild": "^0.21.5",
28
- "type-fest": "^4.20.1",
29
- "zod": "^3.23.8"
30
- },
31
- "peerDependencies": {
32
- "typescript": "^5.5.2"
27
+ "type-fest": "^4.21.0",
28
+ "typescript": "^5.5.3"
33
29
  },
30
+ "files": [
31
+ "dist"
32
+ ],
34
33
  "scripts": {
35
34
  "build": "pnpm build:js && pnpm build:types",
36
35
  "build:js": "swc src --strip-leading-paths -d dist",
37
36
  "build:types": "tsc --build --emitDeclarationOnly",
38
37
  "clean": "del dist/**/*.js",
39
38
  "clean:all": "del dist/**/* tsconfig.tsbuildinfo",
40
- "types": "tsc --noEmit"
39
+ "type-check": "tsc --noEmit",
40
+ "check": "biome check --write ./src",
41
+ "lint": "biome lint --write --unsafe ./src",
42
+ "lint:errors": "pnpm lint --diagnostic-level error",
43
+ "format": "biome format --write ./src"
41
44
  }
42
45
  }
@@ -1,16 +0,0 @@
1
-  WARN  Issue while reading "/Users/flux/Projects/flux-master/.npmrc". Failed to replace env in config: ${NPM_TOKEN}
2
-
3
- > @driveflux/fab@1.0.9 build /Users/flux/Projects/flux-master/packages/fab
4
- > pnpm build:js && pnpm build:types
5
-
6
-  WARN  Issue while reading "/Users/flux/Projects/flux-master/.npmrc". Failed to replace env in config: ${NPM_TOKEN}
7
-
8
- > @driveflux/fab@1.0.9 build:js /Users/flux/Projects/flux-master/packages/fab
9
- > swc src --strip-leading-paths -d dist
10
-
11
- Successfully compiled: 7 files with swc (196.55ms)
12
-  WARN  Issue while reading "/Users/flux/Projects/flux-master/.npmrc". Failed to replace env in config: ${NPM_TOKEN}
13
-
14
- > @driveflux/fab@1.0.9 build:types /Users/flux/Projects/flux-master/packages/fab
15
- > tsc --build --emitDeclarationOnly
16
-
package/CHANGELOG.md DELETED
@@ -1,92 +0,0 @@
1
- # @driveflux/fab
2
-
3
- ## 1.0.10
4
-
5
- ### Patch Changes
6
-
7
- - Versions and dependencies fixes
8
-
9
- ## 1.0.9
10
-
11
- ### Patch Changes
12
-
13
- - Minor adjustments for deps
14
- - Upgraded packages
15
-
16
- ## 1.0.8
17
-
18
- ### Patch Changes
19
-
20
- - Minor updates on build
21
-
22
- ## 1.0.7
23
-
24
- ### Patch Changes
25
-
26
- - Upgraded all packages
27
-
28
- ## 1.0.6
29
-
30
- ### Patch Changes
31
-
32
- - Minor diversion version fix
33
-
34
- ## 1.0.5
35
-
36
- ### Patch Changes
37
-
38
- - Upgraded packages again
39
-
40
- ## 1.0.4
41
-
42
- ### Patch Changes
43
-
44
- - Upgraded packages
45
-
46
- ## 1.0.3
47
-
48
- ### Patch Changes
49
-
50
- - Reverted SWC core version
51
-
52
- ## 1.0.2
53
-
54
- ### Patch Changes
55
-
56
- - Updated dependencies
57
-
58
- ## 1.0.1
59
-
60
- ### Patch Changes
61
-
62
- - Bump versions
63
-
64
- ## 1.0.0
65
-
66
- ### Major Changes
67
-
68
- - 4.5 pre-release
69
-
70
- ### Patch Changes
71
-
72
- - verion bump + minor improvements
73
- - Bump all versions
74
- - Version bump
75
-
76
- ## 1.0.0-next.2
77
-
78
- ### Patch Changes
79
-
80
- - Version bump
81
-
82
- ## 1.0.0-next.1
83
-
84
- ### Patch Changes
85
-
86
- - verion bump + minor improvements
87
-
88
- ## 1.0.0-next.0
89
-
90
- ### Major Changes
91
-
92
- - 4.5 pre-release