@driveflux/fab 2.1.2 → 2.2.1-next.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/bin/fab.js +2 -12
- package/dist/create-package-config.d.ts +5 -0
- package/dist/create-package-config.d.ts.map +1 -0
- package/dist/create-package-config.js +15 -0
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +29 -2
- package/package.json +7 -6
- package/templates/backend/.node-version +1 -0
- package/templates/backend/biome.json +8 -0
- package/templates/backend/package.json +29 -0
- package/templates/frontend/package.json +24 -0
- package/templates/frontend/src/index.ts +1 -0
- package/templates/frontend/tsconfig.json +10 -0
package/bin/fab.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
// @ts-check
|
|
3
2
|
import { Command, Option } from 'commander'
|
|
4
3
|
import path from 'node:path'
|
|
@@ -38,14 +37,9 @@ function makeBuildCommand() {
|
|
|
38
37
|
.option('-d, --dest <destination>', 'The destination path for the package, example: dist', 'dist')
|
|
39
38
|
.option('-s, --src <source>', 'The source path for the package, example: dist', 'src')
|
|
40
39
|
.option('-r, --reset', 'Clean up everything and build again')
|
|
41
|
-
.option(
|
|
42
|
-
'--exports <exports>',
|
|
43
|
-
'The exports definition as an alternative to package.json. It must be the same structure as "exports"',
|
|
44
|
-
parseExports
|
|
45
|
-
)
|
|
46
40
|
.addOption(
|
|
47
41
|
new Option('-t, --target [...target]', 'The target export to make')
|
|
48
|
-
.choices(['all', 'esm', 'types'
|
|
42
|
+
.choices(['all', 'esm', 'types'])
|
|
49
43
|
.default('all')
|
|
50
44
|
)
|
|
51
45
|
.action(async (options) => {
|
|
@@ -92,7 +86,7 @@ function makeCreateCommand() {
|
|
|
92
86
|
.argument('-n, --name <name>', 'The name of the package without @driveflux/')
|
|
93
87
|
.option('-d, --dest <destination>', 'The destination path for the package, example: packages, shared')
|
|
94
88
|
.option('--dangerouslyRewrite [dangerouslyRewrite]', 'Delete the destination path if it exists')
|
|
95
|
-
.action(async (name, { template, cwd: providedCwd,
|
|
89
|
+
.action(async (name, { template, cwd: providedCwd, dest, dangerouslyRewrite }) => {
|
|
96
90
|
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
97
91
|
console.log('🚨 Only kebab-case names are allowed. Aborting.')
|
|
98
92
|
process.exit(1)
|
|
@@ -102,8 +96,4 @@ function makeCreateCommand() {
|
|
|
102
96
|
})
|
|
103
97
|
}
|
|
104
98
|
|
|
105
|
-
function parseExports(exports) {
|
|
106
|
-
return JSON.parse(exports)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
99
|
program.parse(process.argv)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DEV_DEPS_TO_INSTALL: {
|
|
2
|
+
readonly backend: readonly ["@driveflux/fab", "@driveflux/tsconfig", "@types/node", "typescript"];
|
|
3
|
+
readonly frontend: readonly ["@driveflux/fab", "@driveflux/tsconfig", "@types/node", "@types/react", "typescript"];
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=create-package-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-package-config.d.ts","sourceRoot":"","sources":["../src/create-package-config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;CActB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export var DEV_DEPS_TO_INSTALL = {
|
|
2
|
+
backend: [
|
|
3
|
+
'@driveflux/fab',
|
|
4
|
+
'@driveflux/tsconfig',
|
|
5
|
+
'@types/node',
|
|
6
|
+
'typescript'
|
|
7
|
+
],
|
|
8
|
+
frontend: [
|
|
9
|
+
'@driveflux/fab',
|
|
10
|
+
'@driveflux/tsconfig',
|
|
11
|
+
'@types/node',
|
|
12
|
+
'@types/react',
|
|
13
|
+
'typescript'
|
|
14
|
+
]
|
|
15
|
+
};
|
package/dist/create.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAMA,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,kBA2Cf,CAAA"}
|
package/dist/create.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,
|
|
@@ -125,6 +150,7 @@ function _ts_generator(thisArg, body) {
|
|
|
125
150
|
import fs from 'node:fs/promises';
|
|
126
151
|
import path from 'node:path';
|
|
127
152
|
import { deleteAsync } from 'del';
|
|
153
|
+
import { DEV_DEPS_TO_INSTALL } from './create-package-config.js';
|
|
128
154
|
import { ensureDir, getBaseDir, runCommand } from './utils.js';
|
|
129
155
|
export var create = function() {
|
|
130
156
|
var _ref = _async_to_generator(function(param) {
|
|
@@ -221,8 +247,9 @@ export var create = function() {
|
|
|
221
247
|
return [
|
|
222
248
|
4,
|
|
223
249
|
runCommand('pnpm', [
|
|
224
|
-
'
|
|
225
|
-
|
|
250
|
+
'add',
|
|
251
|
+
'-D'
|
|
252
|
+
].concat(_to_consumable_array(DEV_DEPS_TO_INSTALL[template])), {
|
|
226
253
|
cwd: cwd
|
|
227
254
|
})
|
|
228
255
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driveflux/fab",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.2.1-next.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -11,23 +11,24 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
13
13
|
"bin",
|
|
14
|
+
"templates",
|
|
14
15
|
"tsconfig.json"
|
|
15
16
|
],
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"@swc/cli": "^0.4.0",
|
|
18
|
-
"@swc/core": "1.7.
|
|
19
|
+
"@swc/core": "1.7.2",
|
|
19
20
|
"commander": "^12.1.0",
|
|
20
21
|
"del": "^7.1.0",
|
|
21
22
|
"lodash.merge": "^4.6.2",
|
|
22
23
|
"zod": "^3.23.8"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@driveflux/tsconfig": "1.1.
|
|
26
|
+
"@driveflux/tsconfig": "1.2.1-next.0",
|
|
26
27
|
"@types/lodash.merge": "^4.6.9",
|
|
27
|
-
"@types/node": "^20.14.
|
|
28
|
+
"@types/node": "^20.14.15",
|
|
28
29
|
"del-cli": "^5.1.0",
|
|
29
|
-
"type-fest": "^4.
|
|
30
|
-
"typescript": "^5.5.
|
|
30
|
+
"type-fest": "^4.23.0",
|
|
31
|
+
"typescript": "^5.5.4"
|
|
31
32
|
},
|
|
32
33
|
"bin": {
|
|
33
34
|
"fab": "./bin/fab.js"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v22
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@driveflux/{{name}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "fab",
|
|
16
|
+
"clean": "fab clean",
|
|
17
|
+
"prepublishOnly": "pnpm build",
|
|
18
|
+
"build:js": "fab -t esm",
|
|
19
|
+
"build:types": "fab -t types",
|
|
20
|
+
"type-check": "tsc --noEmit",
|
|
21
|
+
"check": "biome check --write ./src",
|
|
22
|
+
"lint:errors": "pnpm lint --diagnostic-level error",
|
|
23
|
+
"format": "biome format --write ./src",
|
|
24
|
+
"lint": "biome lint --write --unsafe ./src"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@driveflux/{{name}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "fab",
|
|
13
|
+
"clean": "fab clean",
|
|
14
|
+
"prepublishOnly": "pnpm build",
|
|
15
|
+
"types": "tsc --noEmit",
|
|
16
|
+
"lint": "eslint \"src/**/*.ts\""
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@driveflux/tsconfig": "workspace:*",
|
|
20
|
+
"@driveflux/fab": "workspace:*",
|
|
21
|
+
"@types/node": "^20.9.1",
|
|
22
|
+
"typescript": "^5.4.5"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// TODO: remove this file
|