Skip to content

Commit f94179b

Browse files
committed
chore: properly name variables and fix path to chmod command
1 parent 3ad7e42 commit f94179b

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

plugin/builder/build-txz.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { getTxzName, pluginName, startingDir } from "./utils/consts";
66
import { setupTxzEnv, TxzEnv } from "./cli/setup-txz-environment";
77
import { cleanupTxzFiles } from "./utils/cleanup";
88

9-
109
// Recursively search for manifest files
1110
const findManifestFiles = async (dir: string): Promise<string[]> => {
1211
const entries = await readdir(dir, { withFileTypes: true });
@@ -56,23 +55,29 @@ const validateSourceDir = async (validatedEnv: TxzEnv) => {
5655
const hasUiManifest = manifestFiles.includes("ui.manifest.json");
5756

5857
if (!hasManifest || !hasUiManifest) {
59-
console.log(
60-
"Existing Manifest Files:", manifestFiles);
58+
console.log("Existing Manifest Files:", manifestFiles);
6159
throw new Error(
6260
`Webcomponents must contain both "ui.manifest.json" and "manifest.json" - be sure to have run pnpm build:wc in unraid-ui`
6361
);
64-
6562
}
6663

6764
const apiDir = join(
6865
startingDir,
69-
"source", pluginName, "usr", "local", "unraid-api", "package.json"
66+
"source",
67+
pluginName,
68+
"usr",
69+
"local",
70+
"unraid-api"
7071
);
7172
if (!existsSync(apiDir)) {
72-
throw new Error(`API package.json file ${apiDir} does not exist`);
73+
throw new Error(`API directory ${apiDir} does not exist`);
74+
}
75+
const packageJson = join(apiDir, "package.json");
76+
if (!existsSync(packageJson)) {
77+
throw new Error(`API package.json file ${packageJson} does not exist`);
7378
}
7479
// Now CHMOD the api/dist directory files to allow execution
75-
await $`chmod +x ${apiDir}/dist/*.js`
80+
await $`chmod +x ${apiDir}/dist/*.js`;
7681
};
7782

7883
const buildTxz = async (validatedEnv: TxzEnv) => {
@@ -84,7 +89,9 @@ const buildTxz = async (validatedEnv: TxzEnv) => {
8489
await cd(join(startingDir, "source", pluginName));
8590
$.verbose = true;
8691

87-
await $`${join(startingDir, "scripts/makepkg")} --chown y --compress -${validatedEnv.compress} --linkadd y ${txzPath}`;
92+
await $`${join(startingDir, "scripts/makepkg")} --chown y --compress -${
93+
validatedEnv.compress
94+
} --linkadd y ${txzPath}`;
8895
$.verbose = false;
8996
await cd(startingDir);
9097
};

0 commit comments

Comments
 (0)