@dbml/cli 2.6.1 → 3.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.
Files changed (48) hide show
  1. package/__test__/dbml2sql/filename --mysql --out-file/dbml-error.log +36 -0
  2. package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +1 -1
  3. package/__test__/dbml2sql/filename --out-file/dbml-error.log +36 -0
  4. package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +1 -1
  5. package/__test__/dbml2sql/filename --postgres --out-file/dbml-error.log +24 -0
  6. package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +1 -1
  7. package/__test__/dbml2sql/filenames --mysql --out-file/dbml-error.log +24 -0
  8. package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +1 -1
  9. package/__test__/dbml2sql/filenames --out-file/dbml-error.log +24 -0
  10. package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +1 -1
  11. package/__test__/dbml2sql/filenames --postgres --out-file/dbml-error.log +24 -0
  12. package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +1 -1
  13. package/__test__/dbml2sql/multiple_schema_mssql/dbml-error.log +24 -0
  14. package/__test__/dbml2sql/multiple_schema_mssql/expect-out-files/multiple_schema.out.sql +4 -4
  15. package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +5 -5
  16. package/__test__/dbml2sql/multiple_schema_mysql/dbml-error.log +24 -0
  17. package/__test__/dbml2sql/multiple_schema_mysql/expect-out-files/multiple_schema.out.sql +4 -4
  18. package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +5 -5
  19. package/__test__/dbml2sql/multiple_schema_pg/dbml-error.log +24 -0
  20. package/__test__/dbml2sql/multiple_schema_pg/expect-out-files/multiple_schema.out.sql +4 -4
  21. package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +5 -5
  22. package/__test__/dbml2sql/syntax-error/dbml-error.log +2069 -1066
  23. package/__test__/dbml2sql/syntax-error/stdout.txt +4 -2
  24. package/__test__/sql2dbml/filename --mssql --out-file/dbml-error.log +51 -0
  25. package/__test__/sql2dbml/filename --mysql --out-file/dbml-error.log +24 -0
  26. package/__test__/sql2dbml/filename --out-file/dbml-error.log +24 -0
  27. package/__test__/sql2dbml/filename --postgres --out-file/dbml-error.log +24 -0
  28. package/__test__/sql2dbml/filenames --mysql --out-file/dbml-error.log +24 -0
  29. package/__test__/sql2dbml/filenames --out-file/dbml-error.log +24 -0
  30. package/__test__/sql2dbml/filenames --postgres --out-file/dbml-error.log +24 -0
  31. package/__test__/sql2dbml/multiple_schema_mssql/dbml-error.log +121 -0
  32. package/__test__/sql2dbml/multiple_schema_mysql/dbml-error.log +104 -0
  33. package/__test__/sql2dbml/multiple_schema_pg/dbml-error.log +113 -34
  34. package/__test__/sql2dbml/syntax-error/dbml-error.log +2043 -1059
  35. package/__test__/sql2dbml/syntax-error/stdout.txt +1 -1
  36. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +302 -1341
  37. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/stdout.txt +1 -1
  38. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +291 -1330
  39. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/stdout.txt +1 -1
  40. package/bin/dbml2sql.js +0 -0
  41. package/bin/sql2dbml.js +0 -0
  42. package/dbml-error.log +145 -276
  43. package/lib/cli/export.js +4 -2
  44. package/lib/cli/utils.js +3 -0
  45. package/package.json +3 -3
  46. package/src/cli/export.js +2 -2
  47. package/src/cli/utils.js +3 -0
  48. package/yarn-error.log +0 -87
package/lib/cli/export.js CHANGED
@@ -28,7 +28,9 @@ async function exportHandler(program) {
28
28
  (0, _utils.generate)(inputPaths, dbml => _core.exporter.export(dbml, format), new _outputFilePlugin.default((0, _utils.resolvePaths)(opts.outFile), header));
29
29
  console.log(` ${_chalk.default.green(_figures.default.main.tick)} Generated SQL dump file (${_config.default[format].name}): ${_path.default.basename(opts.outFile)}`);
30
30
  }
31
- } catch (err) {
32
- _logger.default.error(err);
31
+ } catch (errors) {
32
+ _logger.default.error(`\n ${errors.map(({
33
+ message
34
+ }) => message).join('\n ')}`);
33
35
  }
34
36
  }
package/lib/cli/utils.js CHANGED
@@ -42,6 +42,9 @@ function generate(inputPaths, transform, outputPlugin) {
42
42
  const content = transform(source);
43
43
  outputPlugin.write(content);
44
44
  } catch (err) {
45
+ if (Array.isArray(err)) {
46
+ throw err.map(e => new _errors.SyntaxError(_path2.default.basename(_path), e));
47
+ }
45
48
  throw new _errors.SyntaxError(_path2.default.basename(_path), err);
46
49
  }
47
50
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbml/cli",
3
- "version": "2.6.1",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "license": "Apache-2.0",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@babel/cli": "^7.21.0",
28
- "@dbml/core": "^2.6.1",
28
+ "@dbml/core": "^3.0.0",
29
29
  "bluebird": "^3.5.5",
30
30
  "chalk": "^2.4.2",
31
31
  "commander": "^2.20.0",
@@ -53,5 +53,5 @@
53
53
  "^.+\\.js$": "babel-jest"
54
54
  }
55
55
  },
56
- "gitHead": "54ed18bb2232c6143992aa3d81f4a2b48c36a249"
56
+ "gitHead": "d475bdf2122e26b3b2c3bb00c67124b5e669ba10"
57
57
  }
package/src/cli/export.js CHANGED
@@ -36,7 +36,7 @@ export default async function exportHandler (program) {
36
36
 
37
37
  console.log(` ${chalk.green(figures.main.tick)} Generated SQL dump file (${config[format].name}): ${path.basename(opts.outFile)}`);
38
38
  }
39
- } catch (err) {
40
- logger.error(err);
39
+ } catch (errors) {
40
+ logger.error(`\n ${errors.map(({ message }) => message).join('\n ')}`);
41
41
  }
42
42
  }
package/src/cli/utils.js CHANGED
@@ -39,6 +39,9 @@ function generate (inputPaths, transform, outputPlugin) {
39
39
  const content = transform(source);
40
40
  outputPlugin.write(content);
41
41
  } catch (err) {
42
+ if (Array.isArray(err)) {
43
+ throw err.map((e) => new SyntaxError(path.basename(_path), e));
44
+ }
42
45
  throw new SyntaxError(path.basename(_path), err);
43
46
  }
44
47
  });
package/yarn-error.log DELETED
@@ -1,87 +0,0 @@
1
- Arguments:
2
- /usr/local/bin/node /usr/local/bin/yarn install
3
-
4
- PATH:
5
- /opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/postgresql@13/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/postgresql@13/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/nguyenhoang/.cargo/bin
6
-
7
- Yarn version:
8
- 1.22.18
9
-
10
- Node version:
11
- 16.18.0
12
-
13
- Platform:
14
- darwin arm64
15
-
16
- Trace:
17
- SyntaxError: /Users/nguyenhoang/Documents/workspace/dbx/dbml/package.json: Unexpected token } in JSON at position 130
18
- at JSON.parse (<anonymous>)
19
- at /usr/local/lib/node_modules/yarn/lib/cli.js:1625:59
20
- at Generator.next (<anonymous>)
21
- at step (/usr/local/lib/node_modules/yarn/lib/cli.js:310:30)
22
- at /usr/local/lib/node_modules/yarn/lib/cli.js:321:13
23
-
24
- npm manifest:
25
- {
26
- "name": "@dbml/cli",
27
- "version": "2.5.3",
28
- "description": "",
29
- "main": "lib/index.js",
30
- "license": "Apache-2.0",
31
- "scripts": {
32
- "test": "jest",
33
- "build": "babel src --out-dir lib --copy-files",
34
- "prepublish": "npm run build"
35
- },
36
- "publishConfig": {
37
- "access": "public"
38
- },
39
- "bin": {
40
- "dbml2sql": "bin/dbml2sql.js",
41
- "sql2dbml": "bin/sql2dbml.js"
42
- },
43
- "author": "Holistics <dev@holistics.io>",
44
- "homepage": "https://dbml.dbdiagram.io",
45
- "repository": "https://github.com/holistics/dbml/tree/master/packages/dbml-cli",
46
- "keywords": [
47
- "dbml",
48
- "dbml-cli"
49
- ],
50
- "dependencies": {
51
- "@babel/cli": "^7.21.0",
52
- "@dbml/core": "^2.5.3",
53
- "bluebird": "^3.5.5",
54
- "chalk": "^2.4.2",
55
- "commander": "^2.20.0",
56
- "esm": "^3.2.25",
57
- "figures": "^3.2.0",
58
- "lodash": "^4.17.15",
59
- "pegjs-require-import": "^0.0.2",
60
- "strip-ansi": "^5.2.0",
61
- "winston": "^3.2.1"
62
- },
63
- "devDependencies": {
64
- "@babel/core": "^7.21.4",
65
- "@babel/node": "^7.20.7",
66
- "@babel/plugin-transform-runtime": "^7.21.4",
67
- "@babel/preset-env": "^7.21.4",
68
- "@babel/runtime": "^7.21.0",
69
- "babel-jest": "^29.5.0",
70
- "jest": "^29.5.0"
71
- },
72
- "jest": {
73
- "setupFiles": [
74
- "./jestHelpers.js"
75
- ],
76
- "transform": {
77
- "^.+\\.js$": "babel-jest"
78
- }
79
- },
80
- "gitHead": "5cb80e1aa38fb9a4dbe3079e39c9ef93cd4dc556"
81
- }
82
-
83
- yarn manifest:
84
- No manifest
85
-
86
- Lockfile:
87
- No lockfile