Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows compatibility #226

Merged
merged 7 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/bin/link_in_test_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ fs.writeFileSync(
return {
...packageJsonParsed,
"main": packageJsonParsed["main"].replace(/^dist\//, ""),
"types": packageJsonParsed["types"].replace(/^dist\//, "")
"types": packageJsonParsed["types"].replace(/^dist\//, ""),
"bin": Object.fromEntries(Object.entries<string>(packageJsonParsed["bin"]).map(([k, v]) => [k, v.replace(/^dist\//, "")]))
lordvlad marked this conversation as resolved.
Show resolved Hide resolved
};
})(),
null,
Expand Down
15 changes: 8 additions & 7 deletions src/bin/tools/grant-exec-perms.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { getProjectRoot } from "./getProjectRoot";
import { join as pathJoin } from "path";
import * as child_process from "child_process";
import * as fs from "fs";
import { chmodSync, statSync, constants } from "fs";

Object.entries<string>(JSON.parse(fs.readFileSync(pathJoin(getProjectRoot(), "package.json")).toString("utf8"))["bin"]).forEach(([, scriptPath]) =>
child_process.execSync(`chmod +x ${scriptPath}`, {
"cwd": getProjectRoot()
})
);
import(pathJoin(getProjectRoot(), "package.json")).then(({ bin }) => {
lordvlad marked this conversation as resolved.
Show resolved Hide resolved
Object.entries<string>(bin).forEach(([, scriptPath]) => {
const fullPath = pathJoin(getProjectRoot(), scriptPath);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit more synchronous, eh? :)

const newMode = statSync(fullPath).mode | constants.S_IXUSR | constants.S_IXGRP | constants.S_IXOTH;
chmodSync(fullPath, newMode);
});
});