You could also copy your dependecies to a typescript or javascript playground and use Object.entries(obj).reduce((xs, x) =>
${xs} ${x[0] }, "yarn add")
to generate the command containing all of the packages inside your package.json
.
Example
let obj = {
"@types/react": "^16.3.18",
"@types/react-dom": "^16.0.6",
"awesome-typescript-loader": "^5.1.0",
"babel-polyfill": "^6.26.0",
"del": "2.2.2",
"es-cookie": "^1.2.0",
"es6-promise": "4.1.1",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^3.1.1",
"gulp-clean-css": "^3.0.2",
"gulp-concat": "^2.6.1",
"gulp-if": "^2.0.2",
"gulp-jshint": "^2.0.4",
"gulp-merge-media-queries": "0.2.1",
"gulp-rename": "^1.2.2",
"gulp-rev-all": "^0.9.7",
"gulp-sass": "^3.1.0",
"gulp-uglify": "^2.0.1",
"jshint": "^2.9.4",
"node-promise": "^0.5.12",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"require-dir": "^0.3.2",
"run-sequence": "1.2.2",
"source-map-loader": "^0.2.3",
"typescript": "^2.9.2",
"webpack": "^4.12.0",
"webpack-cli": "^3.0.8",
"webpack-log": "^1.2.0"
}
let res = Object.entries(obj).reduce((xs, x) => `${xs} ${x[0] }`, "yarn add")
console.log(res)
Output:
yarn add @types/react @types/react-dom awesome-typescript-loader babel-polyfill del es-cookie es6-promise gulp gulp-autoprefixer gulp-clean-css gulp-concat gulp-if gulp-jshint gulp-merge-media-queries gulp-rename gulp-rev-all gulp-sass gulp-uglify jshint node-promise react react-dom require-dir run-sequence source-map-loader typescript webpack webpack-cli webpack-log
I use this playground to quickly generate the command. It is also usefull to quickly generate code from json objects.
https://www.typescriptlang.org/play?ssl=35&ssc=19&pln=1&pc=1#code/DYUwLgBA9gRgVhAvBA3gKApiAiAAmATwAcQBnAegCcQBDAYzGwC4cA9ARgDYA6AZm-YAObABoMWPIRIVq9MAFoAJlAC2zNl24AGbp1HjM2GgHcyqkPKlk6lAJZEFwKDUUhK67KwCsA7fqw4MDQwIMDyRFDABABmtsDAHqw8AEw8Wv4Srgks2MnceckZhmTydFBQANa2IIns+X5iAdhknOGUqrakNTkALL7sRTgA5gCuwESJfTqFjRKj4-I0I2BQRNSxAB5uifx1A7OG80SloDQAdqWkpDva+YPYR6VQZ3Q0jDmseTz7BsNjx7Zook8tN7o84KQABa2M7vNgg7g9MH-eQqNxDCxoxS2GjyACOIzc1WuOWmAmRC2oZxoaNq9RmvweKOoADdFvFEjoAJzcADsFOOpBoVxudXSBz+CxGQ2AgIIwNuPyaEOhsIVPKREuwZygrjaHS6nO4PnYDKasgYtR4fSVEgtCmUag+mht92oBNs1CUnqN-DNdpGFy6BJAL26ODqBXupCgI0odExNGOThc2w+ZN49yspBs9jhnjyPP9hlMMCI9AqkwEIPupfLdAqJ1sNx0wi1dYr8icQzpNfEAF80OJQJBqKQkBAAPLwEAMbihsB2MgAClgcAAlNxqIoRgnl8uNqQRBANuukAA+CAAAwAJChD-2IHeNgBtLQAXQg-avx+wBBolBnBALiKNg65DpgZRnDGoDcN2y5juuQA
package.json
andyarn outdated
shows no difference before and after a full run ofyarn upgrade
. What am I missing? – Aerodyne