rustywind 0.24.3 → 0.25.0-rc.1
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/rustywind +0 -0
- package/get-exe.js +97 -0
- package/package.json +27 -21
- package/postinstall.js +63 -0
- package/README.md +0 -137
- package/lib/constants.js +0 -7
- package/lib/download-release.js +0 -54
- package/lib/download.js +0 -318
- package/lib/get.js +0 -51
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -8
- package/lib/postinstall.js +0 -84
- package/lib/release.json +0 -0
- package/lib/update-release.js +0 -33
- package/release.json +0 -427
package/bin/rustywind
CHANGED
|
Binary file
|
package/get-exe.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Detect if running on musl libc (Alpine, etc.)
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
function isMusl() {
|
|
12
|
+
// Use detect-libc if available (more reliable)
|
|
13
|
+
try {
|
|
14
|
+
const { MUSL, familySync } = require("detect-libc");
|
|
15
|
+
return familySync() === MUSL;
|
|
16
|
+
} catch {
|
|
17
|
+
// Fallback: check ldd output
|
|
18
|
+
try {
|
|
19
|
+
const { execSync } = require("child_process");
|
|
20
|
+
const output = execSync("ldd --version 2>&1 || true", { encoding: "utf8" });
|
|
21
|
+
return output.toLowerCase().includes("musl");
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get the package name for the current platform
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
function getPackageName() {
|
|
33
|
+
const platform = process.platform;
|
|
34
|
+
const arch = process.arch;
|
|
35
|
+
|
|
36
|
+
if (platform === "darwin") {
|
|
37
|
+
return arch === "arm64"
|
|
38
|
+
? "rustywind-darwin-arm64"
|
|
39
|
+
: "rustywind-darwin-x64";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (platform === "win32") {
|
|
43
|
+
return arch === "x64"
|
|
44
|
+
? "rustywind-win32-x64-msvc"
|
|
45
|
+
: "rustywind-win32-ia32-msvc";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (platform === "linux") {
|
|
49
|
+
if (arch === "x64") {
|
|
50
|
+
return "rustywind-linux-x64-musl";
|
|
51
|
+
}
|
|
52
|
+
if (arch === "arm64") {
|
|
53
|
+
return isMusl()
|
|
54
|
+
? "rustywind-linux-arm64-musl"
|
|
55
|
+
: "rustywind-linux-arm64-gnu";
|
|
56
|
+
}
|
|
57
|
+
if (arch === "arm") {
|
|
58
|
+
return "rustywind-linux-arm-gnueabihf";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
throw new Error(`Unsupported platform: ${platform} ${arch}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get the binary name for the current platform
|
|
67
|
+
* @returns {string}
|
|
68
|
+
*/
|
|
69
|
+
function getBinaryName() {
|
|
70
|
+
return process.platform === "win32" ? "rustywind.exe" : "rustywind";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get the path to the binary in the platform package
|
|
75
|
+
* @returns {string}
|
|
76
|
+
*/
|
|
77
|
+
function getExePath() {
|
|
78
|
+
const packageName = getPackageName();
|
|
79
|
+
const binaryName = getBinaryName();
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
const pkgPath = path.dirname(require.resolve(`${packageName}/package.json`));
|
|
83
|
+
return path.join(pkgPath, binaryName);
|
|
84
|
+
} catch {
|
|
85
|
+
throw new Error(
|
|
86
|
+
`Could not find package "${packageName}". ` +
|
|
87
|
+
`Make sure optional dependencies are installed.`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
module.exports = {
|
|
93
|
+
getExePath,
|
|
94
|
+
getPackageName,
|
|
95
|
+
getBinaryName,
|
|
96
|
+
isMusl,
|
|
97
|
+
};
|
package/package.json
CHANGED
|
@@ -1,39 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rustywind",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
3
|
+
"version": "0.25.0-rc.1",
|
|
4
|
+
"optionalDependencies": {
|
|
5
|
+
"rustywind-win32-x64-msvc": "0.25.0-rc.1",
|
|
6
|
+
"rustywind-linux-arm-gnueabihf": "0.25.0-rc.1",
|
|
7
|
+
"rustywind-linux-arm64-gnu": "0.25.0-rc.1",
|
|
8
|
+
"rustywind-darwin-x64": "0.25.0-rc.1",
|
|
9
|
+
"rustywind-linux-arm64-musl": "0.25.0-rc.1",
|
|
10
|
+
"rustywind-darwin-arm64": "0.25.0-rc.1",
|
|
11
|
+
"rustywind-linux-x64-musl": "0.25.0-rc.1",
|
|
12
|
+
"rustywind-win32-ia32-msvc": "0.25.0-rc.1"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/avencera/rustywind/issues"
|
|
10
16
|
},
|
|
11
17
|
"files": [
|
|
12
18
|
"bin/",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
19
|
+
"postinstall.js",
|
|
20
|
+
"get-exe.js"
|
|
15
21
|
],
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
"url": "git+https://github.com/avencera/rustywind.git"
|
|
19
|
-
},
|
|
22
|
+
"homepage": "https://github.com/avencera/rustywind#readme",
|
|
23
|
+
"license": "MIT",
|
|
20
24
|
"keywords": [
|
|
21
25
|
"tailwind",
|
|
22
26
|
"tailwind css",
|
|
23
27
|
"headwind",
|
|
24
28
|
"headwind cli"
|
|
25
29
|
],
|
|
30
|
+
"description": "CLI for organizing Tailwind CSS classes",
|
|
26
31
|
"bin": {
|
|
27
32
|
"rustywind": "bin/rustywind"
|
|
28
33
|
},
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"url": "https://github.com/avencera/rustywind/issues"
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/avencera/rustywind.git"
|
|
33
37
|
},
|
|
34
|
-
"homepage": "https://github.com/avencera/rustywind#readme",
|
|
35
38
|
"dependencies": {
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
"detect-libc": "^2.0.3"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"postinstall": "node postinstall.js"
|
|
43
|
+
},
|
|
44
|
+
"author": "Praveen Perera"
|
|
39
45
|
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const { getExePath, getBinaryName } = require("./get-exe");
|
|
8
|
+
|
|
9
|
+
const binDir = path.join(__dirname, "bin");
|
|
10
|
+
const binaryName = getBinaryName();
|
|
11
|
+
const destPath = path.join(binDir, binaryName);
|
|
12
|
+
|
|
13
|
+
// Ensure bin directory exists
|
|
14
|
+
if (!fs.existsSync(binDir)) {
|
|
15
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Skip if binary already exists
|
|
19
|
+
if (fs.existsSync(destPath)) {
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let sourcePath;
|
|
24
|
+
try {
|
|
25
|
+
sourcePath = getExePath();
|
|
26
|
+
} catch (err) {
|
|
27
|
+
// Platform package not found - this is okay, the JS wrapper will handle it
|
|
28
|
+
console.warn(`[rustywind] ${err.message}`);
|
|
29
|
+
console.warn("[rustywind] Falling back to JS wrapper.");
|
|
30
|
+
process.exit(0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Try to hard-link, fall back to copy
|
|
34
|
+
try {
|
|
35
|
+
fs.linkSync(sourcePath, destPath);
|
|
36
|
+
} catch {
|
|
37
|
+
try {
|
|
38
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.error("[rustywind] Failed to copy binary:", err.message);
|
|
41
|
+
console.warn("[rustywind] Falling back to JS wrapper.");
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Set executable permissions on non-Windows
|
|
47
|
+
if (process.platform !== "win32") {
|
|
48
|
+
try {
|
|
49
|
+
fs.chmodSync(destPath, 0o755);
|
|
50
|
+
} catch {
|
|
51
|
+
// Ignore permission errors
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Remove the placeholder wrapper if it exists and we have the real binary
|
|
56
|
+
const wrapperPath = path.join(binDir, "rustywind.js");
|
|
57
|
+
if (fs.existsSync(wrapperPath) && fs.existsSync(destPath)) {
|
|
58
|
+
try {
|
|
59
|
+
fs.unlinkSync(wrapperPath);
|
|
60
|
+
} catch {
|
|
61
|
+
// Ignore
|
|
62
|
+
}
|
|
63
|
+
}
|
package/README.md
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# RustyWind [](https://github.com/avencera/rustywind/actions?query=workflow%3A%22Mean+Bean+CI%22) [](https://badge.fury.io/js/rustywind)
|
|
2
|
-
|
|
3
|
-
## Install
|
|
4
|
-
|
|
5
|
-
Available via npm
|
|
6
|
-
|
|
7
|
-
`yarn global add rustywind`
|
|
8
|
-
|
|
9
|
-
or
|
|
10
|
-
|
|
11
|
-
`npm install -g rustywind`
|
|
12
|
-
|
|
13
|
-
or
|
|
14
|
-
|
|
15
|
-
Install from homebrew (mac and linux):
|
|
16
|
-
|
|
17
|
-
`brew install avencera/taps/rustywind`
|
|
18
|
-
|
|
19
|
-
or
|
|
20
|
-
|
|
21
|
-
Install from a github release:
|
|
22
|
-
|
|
23
|
-
`curl -LSfs https://avencera.github.io/rustywind/install.sh | sh -s -- --git avencera/rustywind`
|
|
24
|
-
|
|
25
|
-
or
|
|
26
|
-
|
|
27
|
-
Download a release directly from github: [github.com/avencera/rustywind/releases](https://github.com/avencera/rustywind/releases)
|
|
28
|
-
|
|
29
|
-
or
|
|
30
|
-
|
|
31
|
-
You can use the dockerized version
|
|
32
|
-
|
|
33
|
-
`docker run --rm -v $PWD:/app avencera/rustywind:latest <rustywind arguments>`
|
|
34
|
-
|
|
35
|
-
## Usage
|
|
36
|
-
|
|
37
|
-
Run rustywind with a path to output updated file contents to the terminal:
|
|
38
|
-
|
|
39
|
-
- `rustywind .`
|
|
40
|
-
|
|
41
|
-
If you want to reorganize all classes in place, and change the files run with the `--write` flag
|
|
42
|
-
|
|
43
|
-
- `rustywind --write .`
|
|
44
|
-
|
|
45
|
-
Run rustywind with a path and the `--dry-run` to get a list of files that will be changed:
|
|
46
|
-
|
|
47
|
-
- `rustywind --dry-run .`
|
|
48
|
-
|
|
49
|
-
Run rustywind on your STDIN:
|
|
50
|
-
|
|
51
|
-
- `echo "<FILE CONTENTS>" | rustywind --stdin`
|
|
52
|
-
|
|
53
|
-
Run in CI, exit with error if unsorted classes are found:
|
|
54
|
-
|
|
55
|
-
- `rustywind --check-formatted .`
|
|
56
|
-
|
|
57
|
-
Run RustyWind with a custom sorter. The `config_file.json` should have a top level entry of `sortOrder`
|
|
58
|
-
which is an array with the classes listed in the order you want them sorted.
|
|
59
|
-
|
|
60
|
-
- `rustywind --config-file config_file.json`
|
|
61
|
-
|
|
62
|
-
Use with tailwind prettier plugin
|
|
63
|
-
|
|
64
|
-
- `rustywind --output-css-file <path to the tailwind generated css file>`
|
|
65
|
-
|
|
66
|
-
- `rustywind --vite-css <url to the css generated by vite>`
|
|
67
|
-
|
|
68
|
-
```shell
|
|
69
|
-
Usage: rustywind [OPTIONS] [PATH]...
|
|
70
|
-
|
|
71
|
-
Run rustywind with a path to get a list of files that will be changed
|
|
72
|
-
rustywind . --dry-run
|
|
73
|
-
|
|
74
|
-
If you want to reorganize all classes in place, and change the files run with the `--write` flag
|
|
75
|
-
rustywind --write .
|
|
76
|
-
|
|
77
|
-
To print only the file names that would be changed run with the `--check-formatted` flag
|
|
78
|
-
rustywind --check-formatted .
|
|
79
|
-
|
|
80
|
-
If you want to run it on your STDIN, you can do:
|
|
81
|
-
echo "<FILE CONTENTS>" | rustywind --stdin
|
|
82
|
-
|
|
83
|
-
Arguments:
|
|
84
|
-
[PATH]...
|
|
85
|
-
A file or directory to run on
|
|
86
|
-
|
|
87
|
-
Options:
|
|
88
|
-
--stdin
|
|
89
|
-
Uses stdin instead of a file or folder
|
|
90
|
-
|
|
91
|
-
--write
|
|
92
|
-
Changes the files in place with the reorganized classes
|
|
93
|
-
|
|
94
|
-
--dry-run
|
|
95
|
-
Prints out the new file content with the sorted classes to the terminal
|
|
96
|
-
|
|
97
|
-
--check-formatted
|
|
98
|
-
Checks if the files are already formatted, exits with 1 if not formatted
|
|
99
|
-
|
|
100
|
-
--allow-duplicates
|
|
101
|
-
When set, RustyWind will not delete duplicated classes
|
|
102
|
-
|
|
103
|
-
--config-file <CONFIG_FILE>
|
|
104
|
-
When set, RustyWind will use the config file to derive configurations. The config file current only supports json with one property sortOrder, e.g. { "sortOrder": ["class1", ...] }
|
|
105
|
-
|
|
106
|
-
--output-css-file <OUTPUT_CSS_FILE>
|
|
107
|
-
When set RustyWind will determine the sort order by the order the class appear in the the given css file
|
|
108
|
-
|
|
109
|
-
--vite-css <VITE_CSS>
|
|
110
|
-
When set RustyWind will determine the sort order by the order the class appear in the CSS file that vite generates.
|
|
111
|
-
|
|
112
|
-
Please provide the full URL to the CSS file ex: `rustywind --vite-css "http://127.0.0.1:5173/src/assets/main.css" . --dry-run`
|
|
113
|
-
|
|
114
|
-
Note: This option is experimental and may be removed in the future.
|
|
115
|
-
|
|
116
|
-
--skip-ssl-verification
|
|
117
|
-
When set, RustyWind will skip SSL verification for the vite_css option
|
|
118
|
-
|
|
119
|
-
--ignored-files <IGNORED_FILES>
|
|
120
|
-
When set, RustyWind will ignore this list of files
|
|
121
|
-
|
|
122
|
-
--custom-regex <CUSTOM_REGEX>
|
|
123
|
-
Uses a custom regex instead of default one
|
|
124
|
-
|
|
125
|
-
-h, --help
|
|
126
|
-
Print help (see a summary with '-h')
|
|
127
|
-
|
|
128
|
-
-V, --version
|
|
129
|
-
Print version
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## What
|
|
133
|
-
|
|
134
|
-
Inspired by [Ryan Heybourn's](https://github.com/heybourn) [headwind](https://github.com/heybourn/headwind)
|
|
135
|
-
vscode plugin. This is a CLI tool that will look through your project and sort all [Tailwind CSS](https://tailwindcss.com) classes.
|
|
136
|
-
|
|
137
|
-
It will also delete any duplicate classes it finds.
|
package/lib/constants.js
DELETED
package/lib/download-release.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
const { REPO } = require("./constants");
|
|
5
|
-
const get = require("./get");
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @param {string} repo
|
|
9
|
-
* @param {string} tag
|
|
10
|
-
*/
|
|
11
|
-
function getApiUrl(repo, tag) {
|
|
12
|
-
return `https://api.github.com/repos/${repo}/releases/tags/${tag}`;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param {{ token?: string; version: string; }} opts
|
|
17
|
-
*/
|
|
18
|
-
async function getReleaseFromGitHubApi(opts) {
|
|
19
|
-
const downloadOpts = {
|
|
20
|
-
headers: {
|
|
21
|
-
"user-agent": "rustywind",
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
if (opts.token) {
|
|
26
|
-
downloadOpts.headers.authorization = `token ${opts.token}`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
console.log(`Finding rustywind ${opts.version} release`);
|
|
30
|
-
const release = await get(getApiUrl(REPO, opts.version), downloadOpts);
|
|
31
|
-
let jsonRelease;
|
|
32
|
-
try {
|
|
33
|
-
jsonRelease = JSON.parse(release);
|
|
34
|
-
} catch (e) {
|
|
35
|
-
throw new Error("Malformed API response: " + e.stack);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (!jsonRelease.assets) {
|
|
39
|
-
throw new Error("Bad API response: " + JSON.stringify(release));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return jsonRelease;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @param {{ token?: string; version: string; }} opts
|
|
47
|
-
*/
|
|
48
|
-
module.exports = async (opts) => {
|
|
49
|
-
if (!opts.version) {
|
|
50
|
-
return Promise.reject(new Error("Missing version"));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return getReleaseFromGitHubApi(opts);
|
|
54
|
-
};
|