@dbml/cli 5.6.0-alpha.2 → 6.0.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/.babelrc +19 -0
- package/eslint.config.ts +6 -13
- package/jest.config.ts +14 -0
- package/lib/cli/config.js +29 -0
- package/lib/cli/connector.js +38 -0
- package/lib/cli/export.js +37 -0
- package/lib/cli/import.js +36 -0
- package/lib/cli/index.js +76 -0
- package/lib/cli/outputPlugins/outputConsolePlugin.js +12 -0
- package/lib/cli/outputPlugins/outputFilePlugin.js +28 -0
- package/lib/cli/utils.js +81 -0
- package/lib/cli/validatePlugins/validatePlugins.js +14 -0
- package/lib/errors/domainError.js +15 -0
- package/lib/errors/index.js +20 -0
- package/lib/errors/syntaxError.js +23 -0
- package/lib/helpers/logger.js +74 -0
- package/lib/index.js +20 -1303
- package/package.json +27 -10
- package/src/cli/import.js +1 -4
- package/src/cli/utils.js +1 -1
- package/src/errors/syntaxError.js +2 -2
- package/tsconfig.json +1 -2
- package/vite.config.ts +0 -50
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@dbml/cli",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"test": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"build": "rm -rf ./lib && tsc --noEmit && vite build",
|
|
13
|
-
"dev": "vite build --watch",
|
|
9
|
+
"test": "jest --coverage=false",
|
|
10
|
+
"coverage": "jest --coverage",
|
|
11
|
+
"build": "babel src --out-dir lib --copy-files",
|
|
14
12
|
"prepublish": "npm run build",
|
|
15
13
|
"lint": "eslint .",
|
|
16
14
|
"lint:fix": "eslint --fix ."
|
|
@@ -31,19 +29,38 @@
|
|
|
31
29
|
"dbml-cli"
|
|
32
30
|
],
|
|
33
31
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@dbml/
|
|
32
|
+
"@babel/cli": "^7.21.0",
|
|
33
|
+
"@dbml/connector": "^6.0.0",
|
|
34
|
+
"@dbml/core": "^6.0.0",
|
|
36
35
|
"bluebird": "^3.5.5",
|
|
37
36
|
"chalk": "^2.4.2",
|
|
38
37
|
"commander": "^2.20.0",
|
|
39
38
|
"esm": "^3.2.25",
|
|
40
39
|
"figures": "^3.2.0",
|
|
41
|
-
"lodash
|
|
40
|
+
"lodash": "^4.17.15",
|
|
42
41
|
"pegjs-require-import": "^0.0.2",
|
|
43
42
|
"strip-ansi": "^5.2.0",
|
|
44
43
|
"winston": "^3.2.1"
|
|
45
44
|
},
|
|
46
|
-
"
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@babel/core": "^7.21.4",
|
|
47
|
+
"@babel/node": "^7.20.7",
|
|
48
|
+
"@babel/plugin-transform-runtime": "^7.21.4",
|
|
49
|
+
"@babel/preset-env": "^7.21.4",
|
|
50
|
+
"@babel/runtime": "^7.21.0",
|
|
51
|
+
"@stylistic/eslint-plugin": "^5.5.0",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
|
53
|
+
"@typescript-eslint/parser": "^8.46.3",
|
|
54
|
+
"babel-jest": "^29.5.0",
|
|
55
|
+
"eslint": "^9.39.1",
|
|
56
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
57
|
+
"eslint-plugin-jest": "^29.0.1",
|
|
58
|
+
"jest": "^29.5.0",
|
|
59
|
+
"ts-jest": "^29.4.5",
|
|
60
|
+
"typescript": "^5.9.3",
|
|
61
|
+
"typescript-eslint": "^8.46.3"
|
|
62
|
+
},
|
|
63
|
+
"gitHead": "75a218687814d8b1c538b26908745e0d0ee8b35a",
|
|
47
64
|
"engines": {
|
|
48
65
|
"node": ">=18"
|
|
49
66
|
}
|
package/src/cli/import.js
CHANGED
|
@@ -31,9 +31,6 @@ export default async function importHandler (program) {
|
|
|
31
31
|
console.log(` ${chalk.green(figures.main.tick)} Generated DBML file from SQL file (${config[format].name}): ${path.basename(opts.outFile)}`);
|
|
32
32
|
}
|
|
33
33
|
} catch (error) {
|
|
34
|
-
|
|
35
|
-
logger.error(`\n ${error.diags.map((diag) => new SyntaxError(diag.filepath, diag)).map(({ message }) => message).join('\n ')}`);
|
|
36
|
-
}
|
|
37
|
-
throw error;
|
|
34
|
+
logger.error(`\n ${error.diags.map((diag) => new SyntaxError(diag.filepath, diag)).map(({ message }) => message).join('\n ')}`);
|
|
38
35
|
}
|
|
39
36
|
}
|
package/src/cli/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _ from 'lodash';
|
|
2
2
|
import DomainError from './domainError';
|
|
3
3
|
|
|
4
4
|
class SyntaxError extends DomainError {
|
|
@@ -11,7 +11,7 @@ class SyntaxError extends DomainError {
|
|
|
11
11
|
|
|
12
12
|
message += '.';
|
|
13
13
|
|
|
14
|
-
if (!isEmpty(rootError)) {
|
|
14
|
+
if (!_.isEmpty(rootError)) {
|
|
15
15
|
message += ` ${rootError.message}`;
|
|
16
16
|
}
|
|
17
17
|
super(message, rootError);
|
package/tsconfig.json
CHANGED
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
"./"
|
|
7
7
|
], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
8
8
|
"baseUrl": "./src", /* Specify the base directory to resolve non-relative module names. */
|
|
9
|
-
"outDir": "./lib"
|
|
10
|
-
"types": ["vitest/globals", "node"]
|
|
9
|
+
"outDir": "./lib" /* Specify an output folder for all emitted files. */
|
|
11
10
|
},
|
|
12
11
|
"files": [
|
|
13
12
|
"package.json"
|
package/vite.config.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { defineConfig } from 'vite';
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
resolve: {
|
|
8
|
-
alias: {
|
|
9
|
-
"@": path.resolve(__dirname, "src/"),
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
build: {
|
|
13
|
-
target: 'node18',
|
|
14
|
-
outDir: 'lib',
|
|
15
|
-
minify: false,
|
|
16
|
-
lib: {
|
|
17
|
-
entry: path.resolve(__dirname, "src/index.js"),
|
|
18
|
-
fileName: 'index',
|
|
19
|
-
formats: ['cjs'],
|
|
20
|
-
},
|
|
21
|
-
rollupOptions: {
|
|
22
|
-
output: {
|
|
23
|
-
exports: 'named',
|
|
24
|
-
},
|
|
25
|
-
external: [
|
|
26
|
-
'@dbml/connector',
|
|
27
|
-
'@dbml/core',
|
|
28
|
-
'bluebird',
|
|
29
|
-
'chalk',
|
|
30
|
-
'commander',
|
|
31
|
-
'esm',
|
|
32
|
-
'figures',
|
|
33
|
-
'lodash',
|
|
34
|
-
'pegjs-require-import',
|
|
35
|
-
'strip-ansi',
|
|
36
|
-
'winston',
|
|
37
|
-
'path',
|
|
38
|
-
'fs',
|
|
39
|
-
/^node:.*/,
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
test: {
|
|
44
|
-
globals: true,
|
|
45
|
-
coverage: {
|
|
46
|
-
provider: 'v8',
|
|
47
|
-
reporter: ['json', 'json-summary', 'html', 'text'],
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
});
|