UNPKG

arrange-package-json

Version:

Arrange the properties in the package.json file to a universally consistent order

74 lines (73 loc) 1.94 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.universalOrder = void 0; const arrangekeys_1 = __importDefault(require("arrangekeys")); /** The desired universally consistent order for the package.json properties */ exports.universalOrder = [ // metadata 'title', 'name', 'version', 'private', 'license', 'description', 'homepage', 'demo', // component.json 'funding', 'repository', 'bugs', 'keywords', 'badges', // people: authorship 'author', // CSV or active author 'authors', // all authors as array array 'maintainers', // all maintainers as array 'contributors', // all contributors as array // people: funding 'funders', // all funders as array 'sponsors', // all sponsors as array 'donors', // all donors as array // compatibility 'engines', 'editions', 'bin', 'types', 'type', 'moduleType', // bower.json 'main', 'node', 'cjs', 'mjs', 'test', 'exports', 'deno', 'browser', 'module', 'jspm', 'ignore', // bower.json // deps 'dependencies', 'optionalDependencies', 'devDependencies', 'dev-dependencies', // bower.json 'peerDependencies', // scripts 'scripts', // configs 'babel', 'boundation', 'eslintConfig', 'prettier', 'vercel', ]; /** * Arrange the properties of package.json data to a universally consistent order. * Known fields are arranged to their universally consistent order. Unknown fields are placed at the end with their order maintained. */ function arrangePackageData(packageData, order = exports.universalOrder) { return (0, arrangekeys_1.default)(packageData, order); } exports.default = arrangePackageData;