Skip to content

Commit

Permalink
throw if rootDir is not absolute dir
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Aug 29, 2024
1 parent 0a883ef commit abf8ccb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/store/ts/codegen/tablegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export type TablegenOptions = {
};

export async function tablegen({ rootDir, config }: TablegenOptions) {
if (!path.isAbsolute(rootDir)) {
throw new Error(`Expected \`rootDir\` to be an absolute path but got "${rootDir}"`);
}

console.log("tablegen rootDir", rootDir);
const userTypes = getUserTypes({ config });

Expand Down
4 changes: 4 additions & 0 deletions packages/world/ts/node/buildSystemsManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export const SystemsManifest = type({
});

export async function buildSystemsManifest(opts: { rootDir: string; config: World }): Promise<void> {
if (!path.isAbsolute(opts.rootDir)) {
throw new Error(`Expected \`rootDir\` to be an absolute path but got "${opts.rootDir}"`);
}

// we have to import these at runtime because they may not yet exist at build time
const { default: IBaseWorldAbi } = await import("../../out/IBaseWorld.sol/IBaseWorld.abi.json");
const { default: SystemAbi } = await import("../../out/System.sol/System.abi.json");
Expand Down
4 changes: 4 additions & 0 deletions packages/world/ts/node/render-solidity/worldgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export async function worldgen({
config: WorldConfig;
clean?: boolean;
}) {
if (!path.isAbsolute(rootDir)) {
throw new Error(`Expected \`rootDir\` to be an absolute path but got "${rootDir}"`);
}

const outDir = path.join(
rootDir,
config.sourceDirectory,
Expand Down

0 comments on commit abf8ccb

Please sign in to comment.