Skip to content

Commit

Permalink
fix: support bin/run.js (#895)
Browse files Browse the repository at this point in the history
* fix: compile cli before generating readme

* fix: support bin/run.js

* chore: remove compile step
  • Loading branch information
mdonnalley authored Oct 2, 2023
1 parent 77c9831 commit f832bdf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/commands/cli/release/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default class build extends SfCommand<void> {
await this.exec('npx yarn-deduplicate');
// Run an install with deduplicated dependencies (with scripts)
await this.exec('yarn install');
// Generate a new readme with the latest dependencies
// Generate a new readme with the latest dependencies.
await this.exec(
'yarn oclif readme --no-aliases --repository-prefix "<%- repo %>/blob/<%- version %>/<%- commandPath %>"'
);
Expand Down
19 changes: 18 additions & 1 deletion src/jit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,27 @@ type Options = {
manifestPath?: string;
};

async function exists(filePath: string): Promise<boolean> {
try {
await fs.promises.access(filePath);
return true;
} catch {
return false;
}
}

export async function testJITInstall(options: Options): Promise<void> {
const { jsonEnabled, jitPlugin, executable } = options;
const { jsonEnabled, jitPlugin } = options;
let { executable } = options;
const ux = new Ux({ jsonEnabled });

if (executable.endsWith('run') && !(await exists(executable))) {
// This is a workaround for the ESM branch of sf.
// If the executable is bin/run but it doesn't exist, that likely means
// that bin/run.js is the executable.
executable += '.js';
}

const tmpDir = path.join(os.tmpdir(), 'sf-jit-test');
// Clear tmp dir before test to ensure that we're starting from a clean slate
await fs.promises.rm(tmpDir, { recursive: true, force: true });
Expand Down

0 comments on commit f832bdf

Please sign in to comment.