Skip to content

Commit

Permalink
fix: create-fuels install dependencies by default (#2779)
Browse files Browse the repository at this point in the history
* fix: install command for `create-fuels`

* chore: changeset
  • Loading branch information
petertonysmith94 committed Jul 17, 2024
1 parent 3e9bc26 commit 25587d4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .changeset/rare-ducks-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

fix: `create-fuels` install dependencies by default
2 changes: 1 addition & 1 deletion packages/create-fuels/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const runScaffoldCli = async ({

fileCopySpinner.succeed('Copied template files!');

if (opts['no-install'] === false) {
if (opts.install) {
const installDepsSpinner = ora({
text: 'Installing dependencies..',
color: 'green',
Expand Down
8 changes: 8 additions & 0 deletions packages/create-fuels/src/lib/setupProgram.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('setupProgram', () => {
expect(program.opts().pnpm).toBe(true);
expect(program.opts().npm).toBe(true);
expect(program.opts().bun).toBe(true);
expect(program.opts().install).toBe(true);
});

test('setupProgram - no args', () => {
Expand All @@ -19,5 +20,12 @@ describe('setupProgram', () => {
expect(program.opts().pnpm).toBe(undefined);
expect(program.opts().npm).toBe(undefined);
expect(program.opts().bun).toBe(undefined);
expect(program.opts().install).toBe(true);
});

test('setupProgram - `--no-install`', () => {
const program = setupProgram();
program.parse(['', '', 'test-project-name', '--no-install']);
expect(program.opts().install).toBe(false);
});
});
4 changes: 2 additions & 2 deletions packages/create-fuels/src/lib/setupProgram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface ProgramOptions {
npm?: boolean;
bun?: boolean;
verbose?: boolean;
'no-install'?: boolean;
install?: boolean;
}

export const setupProgram = () => {
Expand All @@ -21,7 +21,7 @@ export const setupProgram = () => {
.option('--npm', 'Use npm to install dependencies')
.option('--bun', 'Use bun to install dependencies')
.option('--verbose', 'Enable verbose logging')
.option('--no-install', `Do not install dependencies after scaffolding`, false)
.option('--no-install', 'Do not install dependencies')
.addHelpCommand()
.showHelpAfterError(true);
return program;
Expand Down

0 comments on commit 25587d4

Please sign in to comment.