avancement planning

This commit is contained in:
2026-05-26 11:58:39 +02:00
parent 619a2b240a
commit 150b97cd2e
4892 changed files with 99214 additions and 429382 deletions
+26 -16
View File
@@ -5,7 +5,7 @@ const parseJSON = require('json-parse-even-better-errors')
const updateDeps = require('./update-dependencies.js')
const updateScripts = require('./update-scripts.js')
const updateWorkspaces = require('./update-workspaces.js')
const normalize = require('./normalize.js')
const { normalize, syncNormalize } = require('./normalize.js')
const { read, parse } = require('./read-package.js')
const { packageSort } = require('./sort.js')
@@ -25,6 +25,18 @@ const knownKeys = new Set([
])
class PackageJson {
// npm pkg fix
static fixSteps = Object.freeze([
'binRefs',
'bundleDependencies',
'fixName',
'fixVersionField',
'fixRepositoryField',
'fixDependencies',
'devDependencies',
'scriptpath',
])
static normalizeSteps = Object.freeze([
'_id',
'_attributes',
@@ -34,20 +46,7 @@ class PackageJson {
'scripts',
'funding',
'bin',
])
// npm pkg fix
static fixSteps = Object.freeze([
'binRefs',
'bundleDependencies',
'bundleDependenciesFalse',
'fixName',
'fixNameField',
'fixVersionField',
'fixRepositoryField',
'fixDependencies',
'devDependencies',
'scriptpath',
'binDir',
])
static prepareSteps = Object.freeze([
@@ -164,7 +163,11 @@ class PackageJson {
return this
}
// Manually set data from an existing object
fromContent (data) {
if (!data || typeof data !== 'object') {
throw new Error('Content data must be an object')
}
this.#manifest = data
this.#canSave = false
return this
@@ -222,7 +225,7 @@ class PackageJson {
this.#manifest = step({ content, originalContent: this.content })
}
// unknown properties will just be overwitten
// unknown properties will just be overwritten
for (const [key, value] of Object.entries(content)) {
if (!knownKeys.has(key)) {
this.content[key] = value
@@ -259,6 +262,13 @@ class PackageJson {
}
}
// steps is NOT overrideable here because this is a legacy function that's not being used in new places
syncNormalize (opts = {}) {
opts.steps = this.constructor.normalizeSteps.filter(s => s !== '_attributes')
syncNormalize(this, opts)
return this
}
async normalize (opts = {}) {
if (!opts.steps) {
opts.steps = this.constructor.normalizeSteps