Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6e18b9b
add bundle analyzer
a-b-r-o-w-n Nov 7, 2019
3cc5ae3
add gzip compression on server
a-b-r-o-w-n Nov 7, 2019
05df40c
add loading spinner
a-b-r-o-w-n Nov 8, 2019
28b515a
enable dynamic import support
a-b-r-o-w-n Nov 8, 2019
ee7f3f7
use different port for server debugging
a-b-r-o-w-n Nov 8, 2019
d2e3cee
convert LG page to typescript
a-b-r-o-w-n Nov 8, 2019
fcdf4ac
dynamic import of lg and lu pages and code editor
a-b-r-o-w-n Nov 8, 2019
e0e3742
fix example description truncation
a-b-r-o-w-n Nov 8, 2019
28276e8
dynamically load settings page
a-b-r-o-w-n Nov 8, 2019
820c3fb
lazily load home page
a-b-r-o-w-n Nov 8, 2019
d9845c3
lazily load designer page
a-b-r-o-w-n Nov 8, 2019
c47666f
update webpack dependencies for perf improvements
a-b-r-o-w-n Nov 8, 2019
734d097
use ts-loader instead of babel
a-b-r-o-w-n Nov 8, 2019
b0d4a03
remove webpack dependencies from shared
a-b-r-o-w-n Nov 8, 2019
5423652
lazily load code editor bits in form editor
a-b-r-o-w-n Nov 8, 2019
5a09ec1
use lodash.* packages instead of main package
a-b-r-o-w-n Nov 8, 2019
26910a5
use lodash es6 imports instead of single packages
a-b-r-o-w-n Nov 11, 2019
f7d5014
add lodash eslint plugin
a-b-r-o-w-n Nov 11, 2019
569aa91
fix merge conflict
a-b-r-o-w-n Nov 11, 2019
6188483
bump fsevents
a-b-r-o-w-n Nov 11, 2019
b44b8af
add custom lint rule to enforce es6 module import from office-ui
a-b-r-o-w-n Nov 11, 2019
3ce654f
just import office-ui types
a-b-r-o-w-n Nov 11, 2019
3b5d48e
update lint message
a-b-r-o-w-n Nov 11, 2019
43aaed4
use es6 imports for office-ui
a-b-r-o-w-n Nov 11, 2019
12c8ac8
update lint message
a-b-r-o-w-n Nov 11, 2019
393f7f7
use es6 module imports
a-b-r-o-w-n Nov 11, 2019
555a1d5
convert to es6 module imports of office ui
a-b-r-o-w-n Nov 11, 2019
c521bb7
lazily load onboarding assets
a-b-r-o-w-n Nov 11, 2019
ddf12f4
add jsx pragma to onboarding components
a-b-r-o-w-n Nov 11, 2019
01e2284
add eslint plugin emotion
a-b-r-o-w-n Nov 11, 2019
1baaac0
apply jsx pragma to missing files
a-b-r-o-w-n Nov 11, 2019
7d2d983
update ts-jest
a-b-r-o-w-n Nov 11, 2019
0259141
don't include tests in webpack build
a-b-r-o-w-n Nov 11, 2019
0a11715
fix jest config
a-b-r-o-w-n Nov 11, 2019
88b0a80
update usage of cascading css props
a-b-r-o-w-n Nov 12, 2019
3947794
Merge branch 'master' into bundle-size
a-b-r-o-w-n Nov 12, 2019
271a165
fix lint error
a-b-r-o-w-n Nov 12, 2019
c84737d
add include to webpack ts-loader
a-b-r-o-w-n Nov 12, 2019
ca3a053
Merge branch 'master' into bundle-size
a-b-r-o-w-n Nov 12, 2019
a2f2b37
use same lodash version for all packages
a-b-r-o-w-n Nov 12, 2019
22d415c
remove unused variables
a-b-r-o-w-n Nov 12, 2019
ffa00fb
use yarn instead of yarn install
a-b-r-o-w-n Nov 12, 2019
bbb1678
force yarn install
a-b-r-o-w-n Nov 12, 2019
fc4d75d
remove unused variable
a-b-r-o-w-n Nov 12, 2019
5e0db08
add semantic PR config
a-b-r-o-w-n Nov 12, 2019
78aaef6
add job timeout
a-b-r-o-w-n Nov 12, 2019
8c6373b
Merge branch 'master' into bundle-size
a-b-r-o-w-n Nov 12, 2019
70a7482
Merge branch 'master' into bundle-size
a-b-r-o-w-n Nov 12, 2019
493bcda
Merge branch 'master' into bundle-size
a-b-r-o-w-n Nov 12, 2019
e83b0ea
remove semantic config
a-b-r-o-w-n Nov 12, 2019
e82d06c
use esnext module for client packages
a-b-r-o-w-n Nov 13, 2019
37d19ec
clear yarn cache
a-b-r-o-w-n Nov 13, 2019
a5de7ae
use camel cased lodash function names in imports
a-b-r-o-w-n Nov 13, 2019
1c4e4c1
fix last lowercase lodash package
a-b-r-o-w-n Nov 13, 2019
7ca04fd
remove clearing yarn cache
a-b-r-o-w-n Nov 13, 2019
29b17e2
Merge branch 'master' into bundle-size
a-b-r-o-w-n Nov 14, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
ci:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- name: Checkout
Expand All @@ -30,7 +31,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn install
run: yarn install
run: yarn
working-directory: Composer
- name: yarn build:dev
run: yarn build:dev
Expand All @@ -57,6 +58,7 @@ jobs:
e2e:
name: E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- name: Checkout
Expand All @@ -73,7 +75,7 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn install
run: yarn install
run: yarn
working-directory: Composer
- name: yarn build:prod
run: yarn build:prod
Expand All @@ -95,13 +97,15 @@ jobs:
botproject:
name: BotProject
runs-on: windows-latest
timeout-minutes: 20

steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set Dotnet Version
uses: actions/setup-dotnet@v1
with:
dotnet-version: "2.1.802" # SDK Version to use.
dotnet-version: "3.0.100" # SDK Version to use.
- name: dotnet build
run: dotnet build
working-directory: BotProject/CSharp
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"type": "node",
"request": "attach",
"name": "Server: Attach",
"port": 9229,
"port": 9228,
"sourceMaps": true
}
]
Expand Down
26 changes: 25 additions & 1 deletion Composer/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ module.exports = {
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/eslint-recommended',
'prettier/@typescript-eslint',
'plugin:@bfc/bfcomposer/recommended',
],
plugins: ['import', 'notice', 'security'],
plugins: ['import', 'notice', 'security', 'lodash'],
env: {
browser: true,
es6: true,
Expand All @@ -21,6 +22,8 @@ module.exports = {
templateFile: require.resolve('./license.js'),
},
],

// typescript
'@typescript-eslint/ban-ts-ignore': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
Expand Down Expand Up @@ -54,6 +57,27 @@ module.exports = {
'security/detect-possible-timing-attacks': 'error',
'security/detect-pseudoRandomBytes': 'error',
'security/detect-unsafe-regex': 'error',

// lodash
'lodash/callback-binding': 'error',
'lodash/collection-method-value': 'error',
'lodash/collection-return': 'error',
'lodash/no-double-unwrap': 'error',
'lodash/no-extra-args': 'error',
'lodash/no-unbound-this': 'error',
'lodash/unwrap': 'error',
'lodash/identity-shorthand': 'error',
'lodash/import-scope': ['error', 'method'],
'lodash/matches-prop-shorthand': 'error',
'lodash/matches-shorthand': 'error',
'lodash/path-style': 'error',
'lodash/prefer-compact': 'error',
'lodash/prefer-flat-map': 'error',
'lodash/prefer-immutable-method': 'error',
'lodash/prefer-map': 'error',
'lodash/prefer-reject': 'error',
'lodash/preferred-alias': 'error',
'lodash/prop-shorthand': 'error',
},
overrides: [
{
Expand Down
8 changes: 7 additions & 1 deletion Composer/.eslintrc.react.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ['./.eslintrc.js', 'plugin:react/recommended'],
plugins: ['react-hooks', 'format-message'],
plugins: ['react-hooks', 'format-message', 'emotion'],
settings: {
react: {
version: '16.9.0',
Expand All @@ -14,17 +14,23 @@ module.exports = {
},
},
rules: {
// format message
'format-message/literal-pattern': 'error',
'format-message/no-invalid-pattern': 'error',
'format-message/no-missing-params': ['error', { allowNonLiteral: false }],

// react hooks
'react-hooks/exhaustive-deps': 'off',
'react-hooks/rules-of-hooks': 'error',

// react
'react/display-name': 'off',
'react/no-danger': 'error',
'react/no-deprecated': 'warn',
'react/prop-types': 'warn',

// emotion
'emotion/jsx-import': 'error',
},
overrides: [
{
Expand Down
3 changes: 3 additions & 0 deletions Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@babel/preset-env": "7.3.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@bfc/eslint-plugin-bfcomposer": "*",
"@emotion/babel-preset-css-prop": "^10.0.17",
"@typescript-eslint/eslint-plugin": "2.6.0",
"@typescript-eslint/parser": "2.6.0",
Expand All @@ -72,9 +73,11 @@
"cypress-testing-library": "^3.0.1",
"eslint": "^5.15.1",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-emotion": "^10.0.14",
"eslint-plugin-format-message": "^6.2.3",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "6.1.2",
"eslint-plugin-lodash": "^6.0.0",
"eslint-plugin-notice": "^0.7.8",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "7.12.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,38 @@ const ProblemChild = () => {
};

describe('<ErrorBoundary/>', () => {
let consoleErrorStub, consoleLogStub;

beforeEach(() => {
consoleErrorStub = jest.spyOn(console, 'error').mockImplementation(() => {});
consoleLogStub = jest.spyOn(console, 'log').mockImplementation(() => {});
});

afterEach(() => {
consoleErrorStub.mockRestore();
consoleLogStub.mockRestore();
});

it('should just render the children if error not occur', () => {
ErrorBoundary.contextType = Store;
const { container, debug } = render(
const { container } = render(
<ErrorBoundary>
<div>test</div>
</ErrorBoundary>
);
debug();
expect(container).toHaveTextContent('test');
});

it('all the components will not crash with ErrorBoundary even child compoent throw a error', () => {
ErrorBoundary.contextType = Store;
const { container, debug } = render(
const { container } = render(
<div>
<ErrorBoundary>
<ProblemChild />
</ErrorBoundary>
<div> will not crash</div>
</div>
);
debug();
expect(container).toHaveTextContent('will not crash');
});

Expand Down
64 changes: 13 additions & 51 deletions Composer/packages/client/config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
'use strict';

const fs = require('fs');
const path = require('path');

const webpack = require('webpack');
const resolve = require('resolve');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
Expand All @@ -20,8 +17,6 @@ const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeM
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin-alt');
const typescriptFormatter = require('react-dev-utils/typescriptFormatter');
const MonacoWebpackPlugin = require('@bfcomposer/monaco-editor-webpack-plugin');

const getClientEnvironment = require('./env');
Expand All @@ -30,9 +25,6 @@ const paths = require('./paths');
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';

// Check if TypeScript is setup
const useTypeScript = fs.existsSync(paths.appTsConfig);

// style files regexes
const cssRegex = /\.css$/;
const cssModuleRegex = /\.module\.css$/;
Expand Down Expand Up @@ -190,11 +182,6 @@ module.exports = function(webpackEnv) {
ascii_only: true,
},
},
// Use multi-process parallel running to improve the build speed
// Default number of concurrent runs: os.cpus().length - 1
parallel: true,
// Enable file caching
cache: true,
sourceMap: shouldUseSourceMap,
}),
// This is only used in production mode
Expand Down Expand Up @@ -240,12 +227,7 @@ module.exports = function(webpackEnv) {
// https://github.com/facebook/create-react-app/issues/290
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: paths.moduleFileExtensions.map(ext => `.${ext}`).filter(ext => useTypeScript || !ext.includes('ts')),
alias: {
// Support React Native Web
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
'react-native': 'react-native-web',
},
extensions: paths.moduleFileExtensions.map(ext => `.${ext}`),
plugins: [
// Adds support for installing with Plug'n'Play, leading to faster installs and adding
// guards against forgotten dependencies and such.
Expand Down Expand Up @@ -304,10 +286,19 @@ module.exports = function(webpackEnv) {
name: 'static/media/[name].[hash:8].[ext]',
},
},
{
test: /\.tsx?$/,
include: paths.appSrc,
loader: require.resolve('ts-loader'),
options: PnpWebpackPlugin.tsLoaderOptions({
transpileOnly: isEnvDevelopment,
configFile: path.resolve(__dirname, '../tsconfig.build.json'),
}),
},
// Process application JS with Babel.
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
// The preset includes JSX, Flow, and some ESnext features.
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
test: /\.(js|jsx)$/,
include: paths.appSrc,
loader: require.resolve('babel-loader'),
options: {
Expand Down Expand Up @@ -336,7 +327,7 @@ module.exports = function(webpackEnv) {
// Process any JS outside of the app with Babel.
// Unlike the application JS, we only compile the standard ES features.
{
test: /\.(js|mjs)$/,
test: /\.(js)$/,
exclude: /@babel(?:\/|\\{1,2})runtime/,
loader: require.resolve('babel-loader'),
options: {
Expand Down Expand Up @@ -516,35 +507,6 @@ module.exports = function(webpackEnv) {
new RegExp('/[^/]+\\.[^/]+$'),
],
}),
// TypeScript type checking
useTypeScript &&
new ForkTsCheckerWebpackPlugin({
typescript: resolve.sync('typescript', {
basedir: paths.appNodeModules,
}),
async: false,
checkSyntacticErrors: true,
tsconfig: paths.appTsConfig,
compilerOptions: {
module: 'esnext',
moduleResolution: 'node',
resolveJsonModule: true,
isolatedModules: true,
noEmit: true,
jsx: 'preserve',
},
reportFiles: [
'**',
'!**/*.json',
'!**/__tests__/**',
'!**/?(*.)(spec|test).*',
'!**/src/setupProxy.*',
'!**/src/setupTests.*',
],
watch: paths.appSrc,
silent: true,
formatter: typescriptFormatter,
}),
].filter(Boolean),
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
Expand Down
20 changes: 16 additions & 4 deletions Composer/packages/client/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
// eslint-disable-next-line
const path = require('path');
module.exports = {
preset: 'ts-jest/presets/js-with-ts',
// transform: {
// '^.+\\.tsx?$': 'ts-jest',
// '^.+\\.jsx?$': 'babel-jest',
// },
moduleNameMapper: {
// Any imports of .scss / .css files will instead import styleMock.js which is an empty object
'\\.(jpg|jpeg|png|svg|gif)$': '<rootDir>/__tests__/jestMocks/styleMock.js',
'\\.(s)?css$': '<rootDir>/__tests__/jestMocks/styleMock.js',

// use commonjs modules for test so they do not need to be compiled
'office-ui-fabric-react/lib/(.*)$': 'office-ui-fabric-react/lib-commonjs/$1',
'@uifabric/fluent-theme/lib/(.*)$': '@uifabric/fluent-theme/lib-commonjs/$1',
},
testPathIgnorePatterns: ['/node_modules/', '/jestMocks/', '/testUtils/'],
transform: {
'^.+\\.(j|t)sx?$': 'babel-jest',
},
// Some node modules are packaged and distributed in a non-transpiled form
// (ex. contain import & export statements); and Jest won't be able to
// understand them because node_modules aren't transformed by default. So
// we can specify that they need to be transformed here.
transformIgnorePatterns: ['"/node_modules/(?!office-ui-fabric-react).+\\.js$"'],
transformIgnorePatterns: ['/node_modules/'],

setupFilesAfterEnv: [path.resolve(__dirname, './setupTests.js')],
globals: {
'ts-jest': {
tsConfig: path.resolve(__dirname, './tsconfig.json'),
diagnostics: false,
},
},
};
Loading