Skip to content

Instantly share code, notes, and snippets.

@kevinfodness
Last active July 23, 2021 10:50
Show Gist options
  • Save kevinfodness/2cc55225e572218f8c51783c1aea1c37 to your computer and use it in GitHub Desktop.
Save kevinfodness/2cc55225e572218f8c51783c1aea1c37 to your computer and use it in GitHub Desktop.
A node script for extracting @WordPress npm package versions from a git checkout of Gutenberg at a specific tag.
const metapackage = require('./gutenberg/package.json');
Object.keys(metapackage.dependencies)
.map((package) => package.replace(/^@wordpress\//, ''))
.forEach((package) => {
const packageJSON = require(`./gutenberg/packages/${package}/package.json`);
if (![
'edit-navigation',
'react-native-aztec',
'react-native-bridge',
'react-native-editor',
].includes(package)) {
console.log(`"@wordpress/${package}": "^${packageJSON.version}",`);
}
});
console.log('');
const dewp = require('./gutenberg/packages/dependency-extraction-webpack-plugin/package.json');
console.log(`"@wordpress/dependency-extraction-webpack-plugin": "^${dewp.version}",`);
console.log('');
console.log(`"react": "^${metapackage.devDependencies.react}",`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment