We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ffc6e18 commit 27aff37Copy full SHA for 27aff37
src/cli.ts
@@ -212,15 +212,20 @@ yargs
212
JSON.stringify(pkg.files.slice().sort()) !==
213
JSON.stringify(files.slice().sort())
214
) {
215
- const { replace } = await inquirer.prompt({
+ const { update } = await inquirer.prompt({
216
type: 'confirm',
217
- name: 'replace',
218
- message: `Your package.json already has a 'files' field. Do you want to replace it?`,
+ name: 'update',
+ message: `Your package.json already has a 'files' field. Do you want to update it?`,
219
default: true,
220
});
221
222
- if (replace) {
223
- pkg.files = files;
+ if (update) {
+ pkg.files = [
224
+ ...files,
225
+ ...pkg.files.filter(
226
+ (file: string) => !files.includes(file.replace(/\/$/g, ''))
227
+ ),
228
+ ];
229
}
230
} else {
231
pkg.files = files;
0 commit comments