keycloak_theme/scripts/grant-exec-perms.ts

19 lines
662 B
TypeScript
Raw Normal View History

import { join as pathJoin } from "path";
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, "..");
const { bin } = await import(pathJoin(thisCodebaseRootDirPath, "package.json"));
2023-02-04 20:50:53 +01:00
const promises = Object.values<string>(bin).map(async scriptPath => {
const fullPath = pathJoin(thisCodebaseRootDirPath, scriptPath);
const oldMode = (await stat(fullPath)).mode;
const newMode = oldMode | constants.S_IXUSR | constants.S_IXGRP | constants.S_IXOTH;
await chmod(fullPath, newMode);
});
await Promise.all(promises);
2023-02-04 20:50:53 +01:00
})();