diff --git a/lib/default-input.js b/lib/default-input.js index f5de50b..33d2ff7 100644 --- a/lib/default-input.js +++ b/lib/default-input.js @@ -261,17 +261,7 @@ exports.license = yes ? license : prompt('license', license, (data) => { return invalid(`Sorry, ${errors.join(' and ')}.`) }) -function validateType (type) { - if (['commonjs', 'module'].includes(type)) { - return type - } - throw new Error(`${type} is not a valid package "type" (must be "commonjs" or "module")`) -} const type = package.type || getConfig('type') || 'commonjs' -exports.type = yes ? validateType(type) : prompt('type', type, (data) => { - try { - return validateType(data) - } catch (e) { - return invalid(e.message) - } +exports.type = yes ? type : prompt('type', type, (data) => { + return data }) diff --git a/lib/init-package-json.js b/lib/init-package-json.js index 51cbd21..b67ae41 100644 --- a/lib/init-package-json.js +++ b/lib/init-package-json.js @@ -139,7 +139,7 @@ async function init (dir, return } - await pkg.save() + await pkg.save({ sort: true }) return pkg.content } diff --git a/package.json b/package.json index 21021ab..cc24cbb 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "license": "ISC", "description": "A node module to get your node module started", "dependencies": { - "@npmcli/package-json": "^6.0.0", + "@npmcli/package-json": "^6.1.0", "npm-package-arg": "^12.0.0", "promzard": "^2.0.0", "read": "^4.0.0",