diff --git a/babel.config.js b/babel.config.js index e05f7ae27b7..29ed5632333 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,30 +1,36 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. module.exports = { - presets: ['module:metro-react-native-babel-preset'], + presets: [ + 'module:metro-react-native-babel-preset', + '@babel/preset-typescript', + ['@babel/preset-env', {targets: {node: 'current'}}], + ], env: { production: { plugins: ['transform-remove-console'], }, }, plugins: [ - '@babel/plugin-transform-runtime', ['@babel/plugin-proposal-decorators', {legacy: true}], + '@babel/plugin-proposal-class-properties', + '@babel/plugin-transform-runtime', ['module-resolver', { root: ['.'], alias: { - '@assets': './dist/assets', '@actions': './app/actions', + '@assets': './dist/assets', '@components': './app/components', '@constants': './app/constants', '@i18n': './app/i18n', '@init': './app/init', '@notifications': './app/notifications', - '@share': './share_extension', '@screens': './app/screens', '@selectors': './app/selectors', + '@share': './share_extension', '@store': './app/store', '@telemetry': './app/telemetry', + '@typings': './types', '@utils': './app/utils', '@websocket': './app/client/websocket', }, diff --git a/package.json b/package.json index 6a3721ba5ce..1b68ee3656e 100644 --- a/package.json +++ b/package.json @@ -80,9 +80,11 @@ "devDependencies": { "@babel/cli": "7.12.1", "@babel/core": "7.12.3", - "@babel/plugin-proposal-decorators": "7.12.1", + "@babel/plugin-proposal-class-properties": "7.12.1", + "@babel/plugin-proposal-decorators": "7.12.12", "@babel/plugin-transform-runtime": "7.12.1", "@babel/preset-env": "7.12.1", + "@babel/preset-typescript": "7.12.7", "@babel/register": "7.12.1", "@react-native-community/eslint-config": "2.0.0", "@storybook/addon-knobs": "6.0.28", @@ -135,7 +137,7 @@ "react-native-dotenv": "2.4.2", "react-native-storybook-loader": "2.0.2", "ts-jest": "26.4.4", - "typescript": "4.0.5", + "typescript": "4.1.3", "underscore": "1.11.0", "util": "0.12.3" }, @@ -146,33 +148,33 @@ }, "scripts": { "android": "react-native run-android", - "ios": "react-native run-ios", - "start": "react-native start", + "build-storybook": "build-storybook", + "build:android": "./scripts/build.sh apk", + "build:android-unsigned": "./scripts/build.sh apk unsigned", + "build:ios": "./scripts/build.sh ipa", + "build:ios-sim": "./scripts/build.sh ipa simulator", + "build:ios-unsigned": "./scripts/build.sh ipa unsigned", "check": "npm run lint && npm run tsc", "clean": "./scripts/clean.sh", - "ios-gems": "cd ios && bundle install", + "e2e:android": "cd detox && npm run e2e:android-build && npm run e2e:android-test && cd ..", + "e2e:ios": "cd detox && npm run e2e:ios-test && cd ..", "fix": "npm run lint -- --fix", + "i18n-clean-empty": "npm run mmjstool -- i18n clean-empty --mobile-dir .", + "i18n-extract": "npm run mmjstool -- i18n extract-mobile", + "ios": "react-native run-ios", + "ios-gems": "cd ios && bundle install", "lint": "eslint --ignore-path .gitignore --ignore-pattern node_modules --quiet .", + "mmjstool": "mmjstool", "pod-install": "cd ios && bundle exec pod install", "postinstall": "patch-package && ./scripts/postinstall.sh", - "tsc": "NODE_OPTIONS=--max_old_space_size=12000 tsc --noEmit", - "test": "echo PLEASE ADD TESTS and then modify package.json to run 'jest --forceExit --runInBand --detectOpenHandles'", - "test:watch": "npm test -- --watch", - "test:coverage": "jest --coverage", - "updatesnapshot": "jest --updateSnapshot", - "mmjstool": "mmjstool", - "i18n-extract": "npm run mmjstool -- i18n extract-mobile", - "i18n-clean-empty": "npm run mmjstool -- i18n clean-empty --mobile-dir .", - "e2e:android": "cd detox && npm run e2e:android-build && npm run e2e:android-test && cd ..", - "e2e:ios": "cd detox && npm run e2e:ios-test && cd ..", - "build:ios": "./scripts/build.sh ipa", - "build:ios-unsigned": "./scripts/build.sh ipa unsigned", - "build:ios-sim": "./scripts/build.sh ipa simulator", - "build:android": "./scripts/build.sh apk", - "build:android-unsigned": "./scripts/build.sh apk unsigned", - "build-storybook": "build-storybook", "prestorybook": "rnstl", - "storybook": "start-storybook -p 7007" + "start": "react-native start", + "storybook": "start-storybook -p 7007", + "test": "jest --forceExit --runInBand --detectOpenHandles", + "test:coverage": "jest --coverage", + "test:watch": "npm test -- --watch", + "tsc": "NODE_OPTIONS=--max_old_space_size=12000 tsc --noEmit", + "updatesnapshot": "jest --updateSnapshot" }, "config": { "react-native-storybook-loader": { diff --git a/tsconfig.json b/tsconfig.json index a056eafb8dd..8266c1fb730 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,7 @@ "jsx": "react", "moduleResolution": "node", "noEmit": false, - "strict": false, + "strict": true, "importHelpers": true, "declaration": true, "sourceMap": false, @@ -35,8 +35,8 @@ "paths": { "@assets/*": ["dist/assets/*"], "@components/*": ["app/components/*"], - "@constants/*": ["app/constants/*"], "@constants": ["app/constants/index"], + "@constants/*": ["app/constants/*"], "@i18n": ["app/i18n/index"], "@init/*": ["app/init/*"], "@notifications": ["app/notifications/index"], @@ -45,6 +45,7 @@ "@share/*": ["share_extension/*"], "@store": ["app/store/index"], "@store/*": ["app/store/*"], + "@typings/*": ["types/*"], "@telemetry/*": ["/app/telemetry/*"], "@utils/*": ["app/utils/*"], "@websocket": ["app/client/websocket"], @@ -61,5 +62,5 @@ "babel.config.js", "metro.config.js", "jest.config.js", - ] -} \ No newline at end of file + ], +}