Skip to content

Commit 10cc940

Browse files
committed
fix: use actual options for hints
closes #72
1 parent 850a290 commit 10cc940

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

cli/synp.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ const run = require('./run')
88
program
99
.version(version)
1010
.option('-s, --source-file [source-file]', 'The path to the yarn.lock or package-lock.json to be converted')
11-
.option('-f, --force', 'Force overwrite destination file')
12-
.option('--with-workspace', 'Enable experimental npm lockfile v2 processing')
11+
.option('-f, --force', 'Force overwrite destination file', false)
12+
.option('-w, --with-workspace', 'Enable experimental npm lockfile v2 processing', false)
13+
.exitOverride((err) => {
14+
if (err.code === 'commander.unknownOption') {
15+
console.log('use --help for hints')
16+
}
17+
18+
return err
19+
})
1320
.parse(process.argv)
1421

1522
run(program)

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { convertYarnToNpmV2, convertNpmV2ToYarn } = require('./lockfileV2')
77

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

1212
return false
1313
}

test/integration.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ test('warn if `--with-workspace` flag is missed', async t => {
316316
t.plan(2)
317317
try {
318318
const path = `${fixtures}/yarn-workspace`
319-
const warning = 'Workspace (npm lockfile v2) support is experimental. Pass `--with-workspaces` flag to enable and cross your fingers. Good luck!'
319+
const warning = 'Workspace (npm lockfile v2) support is experimental. Pass `--with-workspace` flag to enable and cross your fingers. Good luck!'
320320

321321
sinon.spy(console, 'warn')
322322
npmToYarn(path)

0 commit comments

Comments
 (0)