2021-10-11 21:35:40 +02:00
|
|
|
import { join as pathJoin } from "path";
|
2023-01-26 22:00:31 +01:00
|
|
|
import { constants } from "fs";
|
|
|
|
import { chmod, stat } from "fs/promises";
|
2021-02-28 18:40:57 +01:00
|
|
|
|
2023-02-04 20:50:53 +01:00
|
|
|
(async () => {
|
2024-05-14 03:55:41 +02:00
|
|
|
const thisCodebaseRootDirPath = pathJoin(__dirname, "..");
|
2024-02-11 20:15:18 +01:00
|
|
|
|
|
|
|
const { bin } = await import(pathJoin(thisCodebaseRootDirPath, "package.json"));
|
2023-01-26 22:00:31 +01:00
|
|
|
|
2023-02-04 20:50:53 +01:00
|
|
|
const promises = Object.values<string>(bin).map(async scriptPath => {
|
2024-02-11 20:15:18 +01:00
|
|
|
const fullPath = pathJoin(thisCodebaseRootDirPath, scriptPath);
|
2023-01-26 22:00:31 +01:00
|
|
|
const oldMode = (await stat(fullPath)).mode;
|
2024-05-20 15:48:51 +02:00
|
|
|
const newMode =
|
|
|
|
oldMode | constants.S_IXUSR | constants.S_IXGRP | constants.S_IXOTH;
|
2023-01-26 22:00:31 +01:00
|
|
|
await chmod(fullPath, newMode);
|
2023-01-12 22:27:22 +01:00
|
|
|
});
|
2023-01-26 22:00:31 +01:00
|
|
|
|
|
|
|
await Promise.all(promises);
|
2023-02-04 20:50:53 +01:00
|
|
|
})();
|