Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
scripts[prefix] = false
merge[key] = prefix
list.add(prefix)
}
}
}
}
// perform the alpha sort, with my: scripts first, then our: scripts, then everything else
const myScripts = Array.from(list)
.filter(key => key.startsWith('my:'))
.sort()
const ourScripts = Array.from(list)
.filter(key => key.startsWith('our:'))
.sort()
scripts = arrangekeys(scripts, myScripts.concat(ourScripts))
// use new order, to merge scripts into a set, to prevent duplicates
const sortedList = Object.keys(scripts)
for (const key of sortedList) {
const prefix = merge[key]
// check if this key is one that is to be merged
if (prefix) {
const value = scripts[prefix] || false
if (typeof value === 'string') {
// ignore, keep the user override
} else {
if (!value) scripts[prefix] = new Set()
scripts[prefix].add(`${state.answers.packageManager} run ${key}`)
}
}
}
// set travisTLD if it is com
// we don't set it explicity to org
// so that when the official migration happens, there will be no manual changes
if (
packageData.badges.list.includes('travisci') &&
state.travisTLD === 'com'
) {
packageData.badges.config.travisTLD = state.travisTLD
}
// ---------------------------------
// Arrange
// package keys
packageData = arrangekeys(
packageData,
'title name version private description homepage license keywords badges funding author sponsors maintainers contributors bugs repository engines editions bin types type main browser module jspm dependencies optionalDependencies devDependencies peerDependencies scripts now eslintConfig prettier babel'
)
// ---------------------------------
// Scripts
// scripts
let scripts = Object.assign({}, state.userScripts, state.scripts)
// merge in editions[].scripts
Object.assign(
scripts,
...activeEditions.map(edition => edition.scripts || {})
)
packageData.editions = activeEditions.map(function(edition) {
const result = arrangekeys(
edition,
'description directory entry tags engines'
)
if (result.tags) result.tags = Array.from(result.tags.values())
return result
})
} else {