tombi 0.0.0-dev
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/LICENSE +21 -0
- package/README.md +51 -0
- package/package.json +52 -0
- package/scripts/postinstall.js +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 tombi-toml
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @tombi-toml/tombi
|
|
2
|
+
|
|
3
|
+
🦅 Rust binary installer for tombi TOML toolkit
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides a way to install the Rust-built tombi binary through npm. The appropriate binary for your platform is automatically downloaded during installation.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npm install -g @tombi-toml/tombi
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
After installation, the `tombi` command becomes available globally.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Format
|
|
20
|
+
|
|
21
|
+
Format TOML files:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
tombi format path/to/file.toml
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Use the `-i` option to edit files in place:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
tombi format -i path/to/file.toml
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Lint
|
|
34
|
+
|
|
35
|
+
Lint TOML files:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
tombi lint path/to/file.toml
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Use the `--fix` option to automatically fix issues when possible:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
tombi lint --fix path/to/file.toml
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Supported Platforms
|
|
48
|
+
|
|
49
|
+
- macOS (x86_64, aarch64)
|
|
50
|
+
- Linux (x86_64)
|
|
51
|
+
- Windows (x86_64)
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tombi",
|
|
3
|
+
"version": "0.0.0-dev",
|
|
4
|
+
"description": "🦅 TOML Toolkit 🦅",
|
|
5
|
+
"bin": {
|
|
6
|
+
"tombi": "bin/tombi"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/tombi",
|
|
10
|
+
"scripts/postinstall.js",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"postinstall": "node ./scripts/postinstall.js"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"toml",
|
|
19
|
+
"cli",
|
|
20
|
+
"formatter",
|
|
21
|
+
"linter"
|
|
22
|
+
],
|
|
23
|
+
"author": "tombi-toml",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"private": false,
|
|
26
|
+
"homepage": "https://tombi-toml.github.io/tombi/",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/tombi-toml/tombi.git",
|
|
30
|
+
"directory": "typescript/@tombi-toml/tombi"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/tombi-toml/tombi/issues"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=14.0.0"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public",
|
|
40
|
+
"provenance": true
|
|
41
|
+
},
|
|
42
|
+
"optionalDependencies": {
|
|
43
|
+
"@tombi-toml/cli-win32-x64": "0.0.0-dev",
|
|
44
|
+
"@tombi-toml/cli-win32-arm64": "0.0.0-dev",
|
|
45
|
+
"@tombi-toml/cli-darwin-x64": "0.0.0-dev",
|
|
46
|
+
"@tombi-toml/cli-darwin-arm64": "0.0.0-dev",
|
|
47
|
+
"@tombi-toml/cli-linux-x64": "0.0.0-dev",
|
|
48
|
+
"@tombi-toml/cli-linux-arm64": "0.0.0-dev",
|
|
49
|
+
"@tombi-toml/cli-linux-x64-musl": "0.0.0-dev",
|
|
50
|
+
"@tombi-toml/cli-linux-arm64-musl": "0.0.0-dev"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const { platform, arch } = process;
|
|
2
|
+
// tombi-ignore lint/style/useNodejsImportProtocol: would be a breaking change, consider bumping node version next major version
|
|
3
|
+
const { execSync } = require("child_process");
|
|
4
|
+
|
|
5
|
+
function isMusl() {
|
|
6
|
+
let stderr;
|
|
7
|
+
try {
|
|
8
|
+
stderr = execSync("ldd --version", {
|
|
9
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
10
|
+
});
|
|
11
|
+
} catch (err) {
|
|
12
|
+
stderr = err.stderr;
|
|
13
|
+
}
|
|
14
|
+
if (stderr.indexOf("musl") > -1) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const PLATFORMS = {
|
|
21
|
+
win32: {
|
|
22
|
+
x64: "@tombi-toml/cli-win32-x64/tombi.exe",
|
|
23
|
+
arm64: "@tombi-toml/cli-win32-arm64/tombi.exe",
|
|
24
|
+
},
|
|
25
|
+
darwin: {
|
|
26
|
+
x64: "@tombi-toml/cli-darwin-x64/tombi",
|
|
27
|
+
arm64: "@tombi-toml/cli-darwin-arm64/tombi",
|
|
28
|
+
},
|
|
29
|
+
linux: {
|
|
30
|
+
x64: "@tombi-toml/cli-linux-x64/tombi",
|
|
31
|
+
arm64: "@tombi-toml/cli-linux-arm64/tombi",
|
|
32
|
+
},
|
|
33
|
+
"linux-musl": {
|
|
34
|
+
x64: "@tombi-toml/cli-linux-x64-musl/tombi",
|
|
35
|
+
arm64: "@tombi-toml/cli-linux-arm64-musl/tombi",
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const binName =
|
|
40
|
+
platform === "linux" && isMusl()
|
|
41
|
+
? PLATFORMS?.["linux-musl"]?.[arch]
|
|
42
|
+
: PLATFORMS?.[platform]?.[arch];
|
|
43
|
+
|
|
44
|
+
if (binName) {
|
|
45
|
+
let binPath;
|
|
46
|
+
try {
|
|
47
|
+
binPath = require.resolve(binName);
|
|
48
|
+
} catch {
|
|
49
|
+
console.warn(
|
|
50
|
+
`The Tombi CLI postinstall script failed to resolve the binary file "${binName}". Running Tombi from the npm package will probably not work correctly.`,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
console.warn(
|
|
55
|
+
"The Tombi CLI package doesn't ship with prebuilt binaries for your platform yet. " +
|
|
56
|
+
"You can still use the CLI by cloning the tombi-toml/tombi repo from GitHub, " +
|
|
57
|
+
"and follow the instructions there to build the CLI for your platform.",
|
|
58
|
+
);
|
|
59
|
+
}
|