Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support bin/run.js #895

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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