Skip to content
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ CLI to interactively select and run package scripts using any package manager.

## Installation

1. Run the following command using **_npx_** from any directory.
**Step 1**. Run the following command using **_npx_** from any directory.

```bash
npx package-scripts
```

2. Follow the prompts to set up the command name and select your default package manager.
**Step 2**. Follow the prompts to set up the command name and select your default package manager.

3. Once the installation process is complete, add the following lines to your shell configuration file.
**Step 3**. Once the installation process is complete, add the following lines to your shell configuration file.

- For POSIX-compatible shells like bash or zsh

Expand All @@ -49,7 +49,7 @@ if (Test-Path -Path "$env:HOMEPATH\.package-scripts\bin") {

> 💡 To get the path of your PowerShell configuration file, type `$PROFILE.` and tab through the available options to choose the necessary profile.

4. Restart your shell. The command should now be available.
**Step 4**. Restart your shell. The command should now be available.

### How it works

Expand Down
6 changes: 5 additions & 1 deletion src/create-app/initialize-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CONFIG_FILE, IS_DEV, PACKAGE_NAME } from '../constants.js';
import { npmCommands, npmHooks } from '../hooks/npm.hooks.js';
import { initialTree } from '../hooks/tree.js';
import { paths } from '../paths.js';
import { getProjectInfo } from '../utils/get-project-info.js';

export async function initializeApp(): Promise<void> {
const fsHooks = new FsHooks(paths.root, initialTree);
Expand All @@ -18,7 +19,10 @@ export async function initializeApp(): Promise<void> {
}

// install package (link in development)
const version = IS_DEV ? '' : getProjectInfo().version!;
const pkg = version !== '' ? `${PACKAGE_NAME}@${version}` : PACKAGE_NAME;

const npmCommand = IS_DEV ? npmCommands.link : npmCommands.install;
const useNpm = fsHooks.useHooks(npmHooks);
await useNpm(({ lib }) => lib)[npmCommand]([PACKAGE_NAME]);
await useNpm(({ lib }) => lib)[npmCommand]([pkg]);
}
3 changes: 2 additions & 1 deletion src/utils/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';

import { getConfigData } from '../config/get-config-data.js';
import { PACKAGE_VERSION } from '../constants.js';

const desc = {
runWith(packageManager: string): string {
Expand Down Expand Up @@ -102,7 +103,7 @@ const parsed = yargs(hideBin(process.argv))
conflicts: noConflict('rename'),
})
.help()
.version()
.version(PACKAGE_VERSION)
.hide('help')
.hide('version')
.parserConfiguration({
Expand Down
Loading