Skip to content

Commit

Permalink
Convert ~ to HOME in local package config
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthomas23 committed Dec 12, 2024
1 parent 8e52d97 commit b77c19a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/tools/prepare_wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,20 @@ for (const packageConfig of cockleConfig) {
? wasmPackageInfo.find((x: any) => x.name === packageName)
: Object.fromEntries(outputProps.map(prop => [prop, '']));
if (info === undefined) {
throw Error(`Do not have package info for ${packageName}`);
throw new Error(`Do not have package info for ${packageName}`);
}
if (localPackage) {
info.channel = `local_directory: ${packageConfig.local_directory}`;

// Convert ~ to HOME.
const found = packageConfig.local_directory.match(/^~(.*)$/);
if (found) {
const home = process.env.HOME;
if (home === undefined) {
throw new Error(`No HOME envvar found to replace ~ in ${packageConfig.local_directory}`);
}
packageConfig.local_directory = path.join(home, found[1]);
}
}

console.log(`Add package info to ${packageName}`);
Expand Down

0 comments on commit b77c19a

Please sign in to comment.