Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(generate): add note about --integrate to package.json exists error #710

Merged
merged 1 commit into from
Mar 19, 2024
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
2 changes: 1 addition & 1 deletion generate-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function cli (args) {
process.exit(1)
}
if (!opts.integrate && existsSync(path.join(dir, 'package.json'))) {
log('error', 'a package.json file already exists in target directory')
log('error', 'a package.json file already exists in target directory. retry with the --integrate flag to proceed')
process.exit(1)
}

Expand Down
2 changes: 1 addition & 1 deletion generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function cli (args) {
process.exit(1)
}
if (!opts.integrate && existsSync(path.join(dir, 'package.json'))) {
log('error', 'a package.json file already exists in target directory')
log('error', 'a package.json file already exists in target directory. retry with the --integrate flag to proceed')
process.exit(1)
}

Expand Down
4 changes: 2 additions & 2 deletions test/generate-esm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ function define (t) {
test('errors if package.json exists when use generate . and integrate flag is not set', (t) => {
t.plan(2)
exec('node generate.js . --esm', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})

test('errors if package.json exists when use generate ./ and integrate flag is not set', (t) => {
t.plan(2)
exec('node generate.js ./ --esm', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})
Expand Down
4 changes: 2 additions & 2 deletions test/generate-plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ function define (t) {
test('errors if package.json exists when use generate .', (t) => {
t.plan(2)
exec('node generate-plugin.js .', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})

test('errors if package.json exists when use generate ./', (t) => {
t.plan(2)
exec('node generate-plugin.js ./', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})
Expand Down
4 changes: 2 additions & 2 deletions test/generate-typescript-esm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ function define (t) {
test('errors if package.json exists when use generate .', (t) => {
t.plan(2)
exec('node generate.js --lang=ts .', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})

test('errors if package.json exists when use generate ./', (t) => {
t.plan(2)
exec('node generate.js --lang=ts ./', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})
Expand Down
4 changes: 2 additions & 2 deletions test/generate-typescript.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ function define (t) {
test('errors if package.json exists when use generate .', (t) => {
t.plan(2)
exec('node generate.js --lang=ts .', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})

test('errors if package.json exists when use generate ./', (t) => {
t.plan(2)
exec('node generate.js --lang=ts ./', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})
Expand Down
4 changes: 2 additions & 2 deletions test/generate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ function define (t) {
test('errors if package.json exists when use generate . and integrate flag is not set', (t) => {
t.plan(2)
exec('node generate.js .', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})

test('errors if package.json exists when use generate ./ and integrate flag is not set', (t) => {
t.plan(2)
exec('node generate.js ./', (err, stdout) => {
t.equal('a package.json file already exists in target directory', strip(stdout.toString().trim()))
t.equal('a package.json file already exists in target directory. retry with the --integrate flag to proceed', strip(stdout.toString().trim()))
t.equal(1, err.code)
})
})
Expand Down