Skip to content

Commit

Permalink
fix: use actual options for hints
Browse files Browse the repository at this point in the history
closes #72
  • Loading branch information
antongolub committed Feb 28, 2021
1 parent 850a290 commit 10cc940
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions cli/synp.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ const run = require('./run')
program
.version(version)
.option('-s, --source-file [source-file]', 'The path to the yarn.lock or package-lock.json to be converted')
.option('-f, --force', 'Force overwrite destination file')
.option('--with-workspace', 'Enable experimental npm lockfile v2 processing')
.option('-f, --force', 'Force overwrite destination file', false)
.option('-w, --with-workspace', 'Enable experimental npm lockfile v2 processing', false)
.exitOverride((err) => {
if (err.code === 'commander.unknownOption') {
console.log('use --help for hints')
}

return err
})
.parse(process.argv)

run(program)
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { convertYarnToNpmV2, convertNpmV2ToYarn } = require('./lockfileV2')

const checkWorkspace = (requiresWorkspace, withWorkspace) => {
if (requiresWorkspace && !withWorkspace) {
console.warn('Workspace (npm lockfile v2) support is experimental. Pass `--with-workspaces` flag to enable and cross your fingers. Good luck!')
console.warn('Workspace (npm lockfile v2) support is experimental. Pass `--with-workspace` flag to enable and cross your fingers. Good luck!')

return false
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ test('warn if `--with-workspace` flag is missed', async t => {
t.plan(2)
try {
const path = `${fixtures}/yarn-workspace`
const warning = 'Workspace (npm lockfile v2) support is experimental. Pass `--with-workspaces` flag to enable and cross your fingers. Good luck!'
const warning = 'Workspace (npm lockfile v2) support is experimental. Pass `--with-workspace` flag to enable and cross your fingers. Good luck!'

sinon.spy(console, 'warn')
npmToYarn(path)
Expand Down

0 comments on commit 10cc940

Please sign in to comment.