@aws/dsql-lint 0.1.3
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/dsql-lint +51 -0
- package/package.json +28 -0
package/bin/dsql-lint
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const PLATFORMS = {
|
|
7
|
+
"darwin-arm64": "@aws/dsql-lint-darwin-arm64",
|
|
8
|
+
"darwin-x64": "@aws/dsql-lint-darwin-x64",
|
|
9
|
+
"linux-arm64": "@aws/dsql-lint-linux-arm64",
|
|
10
|
+
"linux-x64": "@aws/dsql-lint-linux-x64",
|
|
11
|
+
"win32-x64": "@aws/dsql-lint-win32-x64",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function getBinaryPath() {
|
|
15
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
16
|
+
const pkg = PLATFORMS[platformKey];
|
|
17
|
+
if (!pkg) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
`Unsupported platform: ${platformKey}. ` +
|
|
20
|
+
`Supported: ${Object.keys(PLATFORMS).join(", ")}`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const binaryName = process.platform === "win32" ? "dsql-lint.exe" : "dsql-lint";
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
28
|
+
return path.join(pkgDir, "bin", binaryName);
|
|
29
|
+
} catch {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`Platform package ${pkg} is not installed. ` +
|
|
32
|
+
`This usually means your package manager didn't install optional dependencies.\n` +
|
|
33
|
+
`Try: npm install @aws/dsql-lint --include=optional`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const binary = getBinaryPath();
|
|
39
|
+
const result = require("child_process").spawnSync(binary, process.argv.slice(2), {
|
|
40
|
+
stdio: "inherit",
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (result.error) {
|
|
44
|
+
if (result.error.code === "ENOENT") {
|
|
45
|
+
console.error(`dsql-lint binary not found at ${binary}`);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
throw result.error;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws/dsql-lint",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Lint SQL files for Aurora DSQL compatibility",
|
|
5
|
+
"license": "MIT-0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/awslabs/aurora-dsql-tools"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"dsql-lint": "bin/dsql-lint"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/"
|
|
15
|
+
],
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"@aws/dsql-lint-darwin-arm64": "0.1.3",
|
|
18
|
+
"@aws/dsql-lint-darwin-x64": "0.1.3",
|
|
19
|
+
"@aws/dsql-lint-linux-arm64": "0.1.3",
|
|
20
|
+
"@aws/dsql-lint-linux-x64": "0.1.3",
|
|
21
|
+
"@aws/dsql-lint-win32-x64": "0.1.3"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"registry": "https://registry.npmjs.org/",
|
|
25
|
+
"provenance": true,
|
|
26
|
+
"access": "public"
|
|
27
|
+
}
|
|
28
|
+
}
|