Bump versions for all npm packages on release
Summary: Automatically bump versions for all local npm packages included as workspaces and fix local dependencies correspondingly. As a part of this I have also aligned versioning for all the packages by using the same version for all of them. Reviewed By: jknoxville Differential Revision: D20745632 fbshipit-source-id: 2d438c4b23ee72f7d7c068c5ce161063c7ceb9e5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
971e0f80fd
commit
eb9a2cb5e7
@@ -32,7 +32,7 @@
|
|||||||
"expand-tilde": "^2.0.2",
|
"expand-tilde": "^2.0.2",
|
||||||
"express": "^4.15.2",
|
"express": "^4.15.2",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
"flipper-doctor": "^0.7.0",
|
"flipper-doctor": "0.35.0",
|
||||||
"fs-extra": "^8.0.1",
|
"fs-extra": "^8.0.1",
|
||||||
"immer": "^6.0.0",
|
"immer": "^6.0.0",
|
||||||
"immutable": "^4.0.0-rc.12",
|
"immutable": "^4.0.0-rc.12",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flipper-babel-transformer",
|
"name": "flipper-babel-transformer",
|
||||||
"version": "0.2.0",
|
"version": "0.35.0",
|
||||||
"description": "Babel transformer for Flipper plugins",
|
"description": "Babel transformer for Flipper plugins",
|
||||||
"repository": "facebook/flipper",
|
"repository": "facebook/flipper",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flipper-doctor",
|
"name": "flipper-doctor",
|
||||||
"version": "0.7.0",
|
"version": "0.35.0",
|
||||||
"description": "Utility for checking for issues with a flipper installation",
|
"description": "Utility for checking for issues with a flipper installation",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"flipper:source": "src",
|
"flipper:source": "src",
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "headless-tests",
|
"name": "flipper-headless-tests",
|
||||||
"version": "1.0.0",
|
"version": "0.35.0",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
|
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
|
||||||
|
|||||||
@@ -168,6 +168,8 @@
|
|||||||
"jest-fetch-mock": "^3.0.0",
|
"jest-fetch-mock": "^3.0.0",
|
||||||
"metro": "^0.58.0",
|
"metro": "^0.58.0",
|
||||||
"metro-resolver": "^0.58.0",
|
"metro-resolver": "^0.58.0",
|
||||||
|
"p-filter": "^2.1.0",
|
||||||
|
"p-map": "^4.0.0",
|
||||||
"prettier": "^2.0.0",
|
"prettier": "^2.0.0",
|
||||||
"react-async": "^10.0.0",
|
"react-async": "^10.0.0",
|
||||||
"recursive-readdir": "^2.2.2",
|
"recursive-readdir": "^2.2.2",
|
||||||
@@ -209,6 +211,7 @@
|
|||||||
"lint:eslint": "eslint . --ext .js,.ts,.tsx",
|
"lint:eslint": "eslint . --ext .js,.ts,.tsx",
|
||||||
"lint:flow": "flow check",
|
"lint:flow": "flow check",
|
||||||
"lint": "yarn lint:eslint && yarn lint:flow && yarn lint:tsc",
|
"lint": "yarn lint:eslint && yarn lint:flow && yarn lint:tsc",
|
||||||
|
"bump-workspace-versions": "cross-env TS_NODE_FILES=true node --require ts-node/register scripts/bump-workspace-versions.ts",
|
||||||
"everything": "yarn reset && yarn install && yarn lint && yarn test && yarn test-electron && yarn build --mac --mac-dmg --win --linux && yarn build-headless --mac --linux && yarn start"
|
"everything": "yarn reset && yarn install && yarn lint && yarn test && yarn test-electron && yarn build --mac --mac-dmg --win --linux && yarn build-headless --mac --linux && yarn start"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flipper-pkg",
|
"name": "flipper-pkg",
|
||||||
"version": "0.0.0",
|
"version": "0.35.0",
|
||||||
"description": "Utility for building and publishing Flipper plugins",
|
"description": "Utility for building and publishing Flipper plugins",
|
||||||
"repository": "facebook/flipper",
|
"repository": "facebook/flipper",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"@types/node": "^13.7.5",
|
"@types/node": "^13.7.5",
|
||||||
"cli-ux": "^5.4.5",
|
"cli-ux": "^5.4.5",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"flipper-babel-transformer": "0.2.0",
|
"flipper-babel-transformer": "0.35.0",
|
||||||
"inquirer": "^7.0.5",
|
"inquirer": "^7.0.5",
|
||||||
"metro": "^0.58.0",
|
"metro": "^0.58.0",
|
||||||
"tslib": "^1"
|
"tslib": "^1"
|
||||||
|
|||||||
67
desktop/scripts/bump-workspace-versions.ts
Normal file
67
desktop/scripts/bump-workspace-versions.ts
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {rootDir, pluginsDir} from './paths';
|
||||||
|
import fs from 'fs-extra';
|
||||||
|
import path from 'path';
|
||||||
|
import {promisify} from 'util';
|
||||||
|
import globImport from 'glob';
|
||||||
|
import pfilter from 'p-filter';
|
||||||
|
import pmap from 'p-map';
|
||||||
|
const glob = promisify(globImport);
|
||||||
|
|
||||||
|
const lastArg = process.argv[process.argv.length - 1];
|
||||||
|
const version =
|
||||||
|
lastArg === __filename ? undefined : process.argv[process.argv.length - 1];
|
||||||
|
|
||||||
|
bump(version)
|
||||||
|
.then(() => process.exit(0))
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
async function bump(version?: string) {
|
||||||
|
const rootPackageJson = await fs.readJson(path.join(rootDir, 'package.json'));
|
||||||
|
version = version || (rootPackageJson.version as string);
|
||||||
|
const packageGlobs = rootPackageJson.workspaces.packages as string[];
|
||||||
|
const localPackages = await pmap(
|
||||||
|
await pfilter(
|
||||||
|
([] as string[]).concat(
|
||||||
|
...(await pmap(packageGlobs, (pattern) =>
|
||||||
|
glob(path.join(rootDir, pattern, '')),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
async (dir) =>
|
||||||
|
!dir.startsWith(pluginsDir) &&
|
||||||
|
(await fs.pathExists(path.join(dir, 'package.json'))),
|
||||||
|
),
|
||||||
|
async (dir) => {
|
||||||
|
const json = await fs.readJson(path.join(dir, 'package.json'));
|
||||||
|
return {
|
||||||
|
dir,
|
||||||
|
json,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const localPackageNames = localPackages.map(({json}) => json.name as string);
|
||||||
|
for (const {dir, json} of localPackages) {
|
||||||
|
json.version = version;
|
||||||
|
if (json.dependencies) {
|
||||||
|
for (const localPackageName of localPackageNames) {
|
||||||
|
if (json.dependencies[localPackageName] !== undefined) {
|
||||||
|
json.dependencies[localPackageName] = version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await fs.writeJson(path.join(dir, 'package.json'), json, {
|
||||||
|
spaces: 2,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flipper-static",
|
"name": "flipper-static",
|
||||||
"version": "1.0.0",
|
"version": "0.35.0",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
"fix-path": "^3.0.0",
|
"fix-path": "^3.0.0",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"flipper-babel-transformer": "0.2.0",
|
"flipper-babel-transformer": "0.35.0",
|
||||||
"mem": "^6.0.0",
|
"mem": "^6.0.0",
|
||||||
"metro": "^0.58.0",
|
"metro": "^0.58.0",
|
||||||
"mkdirp": "^1.0.0",
|
"mkdirp": "^1.0.0",
|
||||||
|
|||||||
@@ -2286,9 +2286,9 @@
|
|||||||
"@types/yargs-parser" "*"
|
"@types/yargs-parser" "*"
|
||||||
|
|
||||||
"@types/yargs@^15.0.0":
|
"@types/yargs@^15.0.0":
|
||||||
version "15.0.3"
|
version "15.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.3.tgz#41453a0bc7ab393e995d1f5451455638edbd2baf"
|
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.4.tgz#7e5d0f8ca25e9d5849f2ea443cf7c402decd8299"
|
||||||
integrity sha512-XCMQRK6kfpNBixHLyHUsGmXrpEmFFxzMrcnSXFMziHd8CoNJo8l16FkHyQq4x+xbM7E2XL83/O78OD8u+iZTdQ==
|
integrity sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/yargs-parser" "*"
|
"@types/yargs-parser" "*"
|
||||||
|
|
||||||
@@ -8740,6 +8740,13 @@ p-each-series@^2.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-2.1.0.tgz#961c8dd3f195ea96c747e636b262b800a6b1af48"
|
resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-2.1.0.tgz#961c8dd3f195ea96c747e636b262b800a6b1af48"
|
||||||
integrity sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==
|
integrity sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==
|
||||||
|
|
||||||
|
p-filter@^2.1.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-filter/-/p-filter-2.1.0.tgz#1b1472562ae7a0f742f0f3d3d3718ea66ff9c09c"
|
||||||
|
integrity sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==
|
||||||
|
dependencies:
|
||||||
|
p-map "^2.0.0"
|
||||||
|
|
||||||
p-finally@^1.0.0:
|
p-finally@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
|
resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"
|
||||||
@@ -8795,6 +8802,11 @@ p-locate@^4.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
p-limit "^2.2.0"
|
p-limit "^2.2.0"
|
||||||
|
|
||||||
|
p-map@^2.0.0:
|
||||||
|
version "2.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175"
|
||||||
|
integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==
|
||||||
|
|
||||||
p-map@^4.0.0:
|
p-map@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b"
|
resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b"
|
||||||
@@ -11961,9 +11973,9 @@ yargs@^14.2.0:
|
|||||||
yargs-parser "^15.0.0"
|
yargs-parser "^15.0.0"
|
||||||
|
|
||||||
yargs@^15.0.0, yargs@^15.0.1, yargs@^15.1.0:
|
yargs@^15.0.0, yargs@^15.0.1, yargs@^15.1.0:
|
||||||
version "15.1.0"
|
version "15.3.1"
|
||||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.1.0.tgz#e111381f5830e863a89550bd4b136bb6a5f37219"
|
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.3.1.tgz#9505b472763963e54afe60148ad27a330818e98b"
|
||||||
integrity sha512-T39FNN1b6hCW4SOIk1XyTOWxtXdcen0t+XYrysQmChzSipvhBO8Bj0nK1ozAasdk24dNWuMZvr4k24nz+8HHLg==
|
integrity sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==
|
||||||
dependencies:
|
dependencies:
|
||||||
cliui "^6.0.0"
|
cliui "^6.0.0"
|
||||||
decamelize "^1.2.0"
|
decamelize "^1.2.0"
|
||||||
@@ -11975,7 +11987,7 @@ yargs@^15.0.0, yargs@^15.0.1, yargs@^15.1.0:
|
|||||||
string-width "^4.2.0"
|
string-width "^4.2.0"
|
||||||
which-module "^2.0.0"
|
which-module "^2.0.0"
|
||||||
y18n "^4.0.0"
|
y18n "^4.0.0"
|
||||||
yargs-parser "^16.1.0"
|
yargs-parser "^18.1.1"
|
||||||
|
|
||||||
yauzl@2.4.1:
|
yauzl@2.4.1:
|
||||||
version "2.4.1"
|
version "2.4.1"
|
||||||
|
|||||||
@@ -52,12 +52,14 @@ FLIPPERKIT_VERSION_TAG='flipperkit_version'
|
|||||||
OLD_VERSION_POD_ARG=$(< "$FLIPPER_PODSPEC_PATH" grep "$FLIPPERKIT_VERSION_TAG =" )
|
OLD_VERSION_POD_ARG=$(< "$FLIPPER_PODSPEC_PATH" grep "$FLIPPERKIT_VERSION_TAG =" )
|
||||||
OLD_VERSION="${OLD_VERSION_POD_ARG##* }"
|
OLD_VERSION="${OLD_VERSION_POD_ARG##* }"
|
||||||
|
|
||||||
|
source "$DIR"/setup-env.sh
|
||||||
|
|
||||||
# if we got called with a rev argument, we got triggered from our automatic sandcastle job
|
# if we got called with a rev argument, we got triggered from our automatic sandcastle job
|
||||||
if [ "$SANDCASTLE_REVISION" != "" ];
|
if [ "$SANDCASTLE_REVISION" != "" ];
|
||||||
then
|
then
|
||||||
# In future, bump majors instead of minors?
|
# In future, bump majors instead of minors?
|
||||||
echo "Automatically bumping version to next minor in package.json"
|
echo "Automatically bumping version to next minor in package.json"
|
||||||
npm -C "$DESKTOP_DIR" version minor
|
yarn --cwd "$DESKTOP_DIR" version minor --no-git-tag-version
|
||||||
VERSION=$(jq -r '.version' "$DESKTOP_DIR"/package.json)
|
VERSION=$(jq -r '.version' "$DESKTOP_DIR"/package.json)
|
||||||
else
|
else
|
||||||
echo "The currently released version is $OLD_VERSION. What should the version of the next release be?"
|
echo "The currently released version is $OLD_VERSION. What should the version of the next release be?"
|
||||||
@@ -66,11 +68,11 @@ fi
|
|||||||
|
|
||||||
echo "Preparing release $VERSION..."
|
echo "Preparing release $VERSION..."
|
||||||
|
|
||||||
# Updating "flipper" npm package to the same version
|
# Update all the packages included as workspaces to the very same version
|
||||||
npm -C "$DESKTOP_DIR"app version "$VERSION"
|
yarn --cwd "$DESKTOP_DIR" bump-workspace-versions "$VERSION"
|
||||||
|
|
||||||
# Update react-native-flipper to the very same version
|
# Update react-native-flipper to the very same version
|
||||||
npm -C "$SONAR_DIR"react-native/react-native-flipper version "$VERSION"
|
yarn --cwd "$SONAR_DIR"/react-native/react-native-flipper version --new-version "$VERSION" --no-git-tag-version
|
||||||
|
|
||||||
# This could be one expression with GNU sed, but I guess we want to support the BSD crap, too.
|
# This could be one expression with GNU sed, but I guess we want to support the BSD crap, too.
|
||||||
SNAPSHOT_MINOR_VERSION=$(echo "$VERSION" | sed -Ee 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\3 + 1/' | bc)
|
SNAPSHOT_MINOR_VERSION=$(echo "$VERSION" | sed -Ee 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\3 + 1/' | bc)
|
||||||
|
|||||||
Reference in New Issue
Block a user