Skip to content

Commit a172c15

Browse files
authored
Merge pull request #553 from GetStream/version-jest-bug-fix
CRNS-277: create version json file and point Chat.tsx to that and add a post version script for bumping the version of the json with npm version
2 parents ecfab4a + 7d932d4 commit a172c15

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,22 @@
1818
"README.md"
1919
],
2020
"scripts": {
21+
"analyze": "yarn build -- --stats && webpack-bundle-analyzer build/bundle-stats.json",
2122
"build": "rm -rf lib && yarn run --silent build-translations && bob build && yarn run --silent copy-translations",
23+
"build-translations": "rm -rf .tmpi18ncache || true && mkdir .tmpi18ncache && yarn run babel --config-file ./babel.i18next-extract.json 'src/**/*.{js,jsx,ts,tsx}' --out-dir '.tmpi18ncache/' && rm -rf .tmpi18ncache && prettier --write 'src/i18n/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc .babelrc",
2224
"copy-translations": "echo '\u001b[34mℹ\u001b[0m Copying translation files to \u001b[34mlib/typescript/i18n\u001b[0m' && cp -R -f ./src/i18n ./lib/typescript/src && echo '\u001b[32m✓\u001b[0m Done Copying Translations'",
2325
"docs": "styleguidist build",
24-
"test": "TZ=UTC jest",
2526
"docs-server": "styleguidist server",
26-
"build-translations": "rm -rf .tmpi18ncache || true && mkdir .tmpi18ncache && yarn run babel --config-file ./babel.i18next-extract.json 'src/**/*.{js,jsx,ts,tsx}' --out-dir '.tmpi18ncache/' && rm -rf .tmpi18ncache && prettier --write 'src/i18n/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc .babelrc",
27-
"prettier": "prettier --list-different '**/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc .babelrc",
28-
"prettier-fix": "prettier --write '**/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc .babelrc",
2927
"eslint": "eslint '**/*.{js,md,ts,jsx,tsx}' --max-warnings 0",
30-
"analyze": "yarn build -- --stats && webpack-bundle-analyzer build/bundle-stats.json",
31-
"validate-translations": "node bin/validate-translations.js",
3228
"lint": "prettier --list-different 'src/**/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc .babelrc && eslint 'src/**/*.{js,ts,tsx,md}' --max-warnings 0 && yarn run validate-translations",
3329
"lint-fix": "prettier --write 'src/**/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc .babelrc && eslint --fix 'src/**/*.{js,ts,tsx,md}' --max-warnings 0",
30+
"postversion": "./scripts/post_version.sh",
3431
"prepare": "yarn run build",
35-
"prepare-distribution": "cd examples/SampleApp && npm version patch && react-native-version && git add ./ && git commit -m 'Bump build version' --no-verify"
32+
"prepare-distribution": "cd examples/SampleApp && npm version patch && react-native-version && git add ./ && git commit -m 'Bump build version' --no-verify",
33+
"prettier": "prettier --list-different '**/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc .babelrc",
34+
"prettier-fix": "prettier --write '**/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc .babelrc",
35+
"test": "TZ=UTC jest",
36+
"validate-translations": "node bin/validate-translations.js"
3637
},
3738
"@react-native-community/bob": {
3839
"source": "src",

scripts/post_version.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cd $(dirname "${BASH_SOURCE[0]}")
2+
3+
PACKAGE_VERSION=`awk -F \" '/"version": ".+"/ { print $4; exit; }' ../package.json`
4+
5+
echo "{\n \"version\": \"$PACKAGE_VERSION\"\n}" > ../src/version.json

src/components/Chat/Chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from '../../contexts/translationContext/TranslationContext';
2121
import { useStreami18n } from '../../utils/useStreami18n';
2222

23-
import { version } from '../../../package.json';
23+
import { version } from '../../version.json';
2424

2525
import type { Channel } from 'stream-chat';
2626

src/version.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"version": "3.0.0"
3+
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030
"allowJs": true,
3131
"checkJs": false
3232
},
33-
"include": ["./src/**/*", "styleguideComponents"],
33+
"include": ["./src/**/*"],
3434
"exclude": [
3535
"./src/components/docs/*",
36+
"./src/emoji-data/*.js",
3637
"./src/mock-builders",
3738
"./src/styleguideComponents",
3839
"node_modules",

0 commit comments

Comments
 (0)