@dbml/cli 10.3.0-alpha.2 → 10.3.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/lib/index.js +14 -9
- package/package.json +5 -5
- package/src/NodeProjectLayout.ts +12 -4
package/lib/index.js
CHANGED
|
@@ -39,7 +39,7 @@ let node_fs = require("node:fs");
|
|
|
39
39
|
var package_default = {
|
|
40
40
|
$schema: "https://json.schemastore.org/package",
|
|
41
41
|
name: "@dbml/cli",
|
|
42
|
-
version: "10.3.0
|
|
42
|
+
version: "10.3.0",
|
|
43
43
|
description: "",
|
|
44
44
|
main: "lib/index.js",
|
|
45
45
|
license: "Apache-2.0",
|
|
@@ -66,9 +66,9 @@ var package_default = {
|
|
|
66
66
|
keywords: ["dbml", "dbml-cli"],
|
|
67
67
|
dependencies: {
|
|
68
68
|
"@babel/cli": "^7.21.0",
|
|
69
|
-
"@dbml/connector": "^10.3.0
|
|
70
|
-
"@dbml/core": "^10.3.0
|
|
71
|
-
"@dbml/parse": "^10.3.0
|
|
69
|
+
"@dbml/connector": "^10.3.0",
|
|
70
|
+
"@dbml/core": "^10.3.0",
|
|
71
|
+
"@dbml/parse": "^10.3.0",
|
|
72
72
|
"bluebird": "^3.5.5",
|
|
73
73
|
"chalk": "^2.4.2",
|
|
74
74
|
"commander": "^2.20.0",
|
|
@@ -79,7 +79,7 @@ var package_default = {
|
|
|
79
79
|
"strip-ansi": "^5.2.0",
|
|
80
80
|
"winston": "^3.2.1"
|
|
81
81
|
},
|
|
82
|
-
gitHead: "
|
|
82
|
+
gitHead: "7b26e1a4849d627ecb64e5a614e50373ee60c208",
|
|
83
83
|
engines: { "node": ">=18" }
|
|
84
84
|
};
|
|
85
85
|
//#endregion
|
|
@@ -2651,20 +2651,25 @@ var NodeProjectLayout = class {
|
|
|
2651
2651
|
constructor(entryPoints) {
|
|
2652
2652
|
this.entryPoints = [...entryPoints];
|
|
2653
2653
|
}
|
|
2654
|
+
resolveFileSpecifier(currentFilepath, relativePath) {
|
|
2655
|
+
if (!_dbml_parse.Filepath.isRelative(relativePath)) return void 0;
|
|
2656
|
+
const resolved = _dbml_parse.Filepath.resolve(currentFilepath.dirname, relativePath);
|
|
2657
|
+
return resolved.absolute.endsWith(".dbml") ? resolved : _dbml_parse.Filepath.from(resolved.absolute + ".dbml");
|
|
2658
|
+
}
|
|
2654
2659
|
getSource(filePath) {
|
|
2655
|
-
return safeReadFileSync(filePath.
|
|
2660
|
+
return safeReadFileSync(filePath.fsPath, "utf-8");
|
|
2656
2661
|
}
|
|
2657
2662
|
exists(filePath) {
|
|
2658
2663
|
return this.isFile(filePath) || this.isDirectory(filePath);
|
|
2659
2664
|
}
|
|
2660
2665
|
isFile(filePath) {
|
|
2661
|
-
return safeStatSync(filePath.
|
|
2666
|
+
return safeStatSync(filePath.fsPath, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
2662
2667
|
}
|
|
2663
2668
|
isDirectory(filePath) {
|
|
2664
|
-
return safeStatSync(filePath.
|
|
2669
|
+
return safeStatSync(filePath.fsPath, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
2665
2670
|
}
|
|
2666
2671
|
listDirectory(dirPath) {
|
|
2667
|
-
const basePath = dirPath
|
|
2672
|
+
const basePath = dirPath ? dirPath.fsPath : "/";
|
|
2668
2673
|
return safeReaddirSync(basePath)?.map((entry) => basePath + entry).sort().map(_dbml_parse.Filepath.from) ?? [];
|
|
2669
2674
|
}
|
|
2670
2675
|
getEntrypoints() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@dbml/cli",
|
|
4
|
-
"version": "10.3.0
|
|
4
|
+
"version": "10.3.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/cli": "^7.21.0",
|
|
36
|
-
"@dbml/connector": "^10.3.0
|
|
37
|
-
"@dbml/core": "^10.3.0
|
|
38
|
-
"@dbml/parse": "^10.3.0
|
|
36
|
+
"@dbml/connector": "^10.3.0",
|
|
37
|
+
"@dbml/core": "^10.3.0",
|
|
38
|
+
"@dbml/parse": "^10.3.0",
|
|
39
39
|
"bluebird": "^3.5.5",
|
|
40
40
|
"chalk": "^2.4.2",
|
|
41
41
|
"commander": "^2.20.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"strip-ansi": "^5.2.0",
|
|
47
47
|
"winston": "^3.2.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "7b26e1a4849d627ecb64e5a614e50373ee60c208",
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=18"
|
|
52
52
|
}
|
package/src/NodeProjectLayout.ts
CHANGED
|
@@ -18,8 +18,16 @@ export class NodeProjectLayout implements DbmlProjectLayout {
|
|
|
18
18
|
this.entryPoints = [...entryPoints];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
// From the currentFilepath, resolve the relativePath to an absolute path
|
|
22
|
+
// Append `.dbml` if relativePath does not ends with `.dbml`
|
|
23
|
+
resolveFileSpecifier (currentFilepath: Filepath, relativePath: string): Filepath | undefined {
|
|
24
|
+
if (!Filepath.isRelative(relativePath)) return undefined;
|
|
25
|
+
const resolved = Filepath.resolve(currentFilepath.dirname, relativePath);
|
|
26
|
+
return resolved.absolute.endsWith('.dbml') ? resolved : Filepath.from(resolved.absolute + '.dbml');
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
getSource (filePath: Filepath): string | undefined {
|
|
22
|
-
return safeReadFileSync(filePath.
|
|
30
|
+
return safeReadFileSync(filePath.fsPath, 'utf-8');
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
exists (filePath: Filepath): boolean {
|
|
@@ -27,19 +35,19 @@ export class NodeProjectLayout implements DbmlProjectLayout {
|
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
isFile (filePath: Filepath): boolean {
|
|
30
|
-
return safeStatSync(filePath.
|
|
38
|
+
return safeStatSync(filePath.fsPath, {
|
|
31
39
|
throwIfNoEntry: false,
|
|
32
40
|
})?.isFile() ?? false;
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
isDirectory (filePath: Filepath): boolean {
|
|
36
|
-
return safeStatSync(filePath.
|
|
44
|
+
return safeStatSync(filePath.fsPath, {
|
|
37
45
|
throwIfNoEntry: false,
|
|
38
46
|
})?.isDirectory() ?? false;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
listDirectory (dirPath?: Filepath): Filepath[] {
|
|
42
|
-
const basePath = dirPath
|
|
50
|
+
const basePath = dirPath ? dirPath.fsPath : '/';
|
|
43
51
|
return safeReaddirSync(basePath)?.map((entry) => basePath + entry).sort().map(Filepath.from) ?? [];
|
|
44
52
|
}
|
|
45
53
|
|