-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ensure npm script * version and changelog
- Loading branch information
Showing
4 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import readline from 'node:readline/promises' | ||
import { stdin as input, stdout as output } from 'node:process' | ||
|
||
const agent = process.env.npm_config_user_agent | ||
|
||
// word boundary + "npm/" + a digit | ||
const npmVersionRegEx = /\bnpm\/\d/ | ||
|
||
if (!agent?.match(npmVersionRegEx)) { | ||
console.log('You do not appear to be using `npm` as your Node package manager. Are you using `yarn`? Try the same command with `npm`.') | ||
process.exit(1) | ||
} | ||
|
||
(async () => { | ||
|
||
const rl = readline.createInterface({ input, output }) | ||
|
||
const answer = await rl.question('Are you running "npm publish" or did you pack using "npm"? That\'s "npm" instead of "yarn". Very important!!! [Yy]') | ||
rl.close() | ||
|
||
if (answer?.toLowerCase() !== 'y') { | ||
console.log('You must use `npm` (and not `yarn`) for this command.') | ||
process.exit() | ||
} | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters