From b1993884bc0813edcd9fc56707d01417a3e62350 Mon Sep 17 00:00:00 2001 From: fabriziofff Date: Mon, 24 Aug 2020 11:17:12 +0200 Subject: [PATCH] chore: [#174190519] Change commands for release & build (#2157) * [#173888442] update react-native-webview * [#173917003] upgrade redux saga to 1.1.3 * fix all typescript errors * fix delay * fix lint * fix lint * fix saga test * [#165057751] Migrate Typescript transpile to babel * [#174318137] upgrade saga signature * fix types for react-native-text--input-mask * fix left and right * fix flagsecure * fix cancel task * fix right * fix typescript errors * fix contentRefreshControl type * fix import for babel * fix yarn lock * remove test on message cache * [#174337387] Upgrade react-native-device-info to 5.6.4 * add script to prepare for a new cycle * write updated package.json * change command syntax * fix * remove test command * remove console log Co-authored-by: Matteo Boschi --- package.json | 7 +++++-- scripts/changelog/prepare_to_new_cycle.js | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 scripts/changelog/prepare_to_new_cycle.js diff --git a/package.json b/package.json index 6e6d83acb0d..cc14e2fc05f 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,11 @@ "start": "react-native start", "run-ios": "react-native run-ios", "run-android": "react-native run-android", - "release": "scripts/changelog/check_git_status.sh && standard-version -t \"\"", - "release:rc": "scripts/changelog/check_git_status.sh && standard-version -t \"\" --prerelease rc", + "pre-cycle": "scripts/changelog/check_git_status.sh && node scripts/changelog/prepare_to_new_cycle.js", + "release-rc": "scripts/changelog/check_git_status.sh && standard-version -t \"\" --prerelease rc", + "start-fix-cycle": "yarn pre-cycle && standard-version -t \"\" --prerelease rc --release-as patch", + "start-release-cycle": "yarn pre-cycle && standard-version -t \"\" --prerelease rc --release-as minor", + "start-breaking-cycle": "yarn pre-cycle && standard-version -t \"\" --prerelease rc --release-as major", "attach": "react-native attach", "postinstall": "patch-package && rn-nodeify --install path,buffer && chmod +x ./bin/add-ios-source-maps.sh && ./bin/add-ios-source-maps.sh && chmod +x ./bin/add-ios-env-config.sh && ./bin/add-ios-env-config.sh", "test": "jest -w 1", diff --git a/scripts/changelog/prepare_to_new_cycle.js b/scripts/changelog/prepare_to_new_cycle.js new file mode 100644 index 00000000000..715ba2093a2 --- /dev/null +++ b/scripts/changelog/prepare_to_new_cycle.js @@ -0,0 +1,19 @@ +const fs = require("fs-extra"); +const versionModule = require("./version_utility.js"); + +const packagePath = "package.json"; + +/*** + * Prepare the package.json file for a new fix|release|breaking cycle. + * In order to use the automatic functionality of standard-version, just remove the -rc.x suffix to initiate + * a new cycle. + */ +const prepareToNewCycle = () => { + // read package.json as JSON + const package = JSON.parse(fs.readFileSync(packagePath).toString("utf8")); + // replace the version, removing the rc part + package.version = versionModule.getVersion(package.version); + fs.writeFileSync(packagePath, JSON.stringify(package, undefined, 2)); +}; + +prepareToNewCycle();