From dbdb7acf06b01f588fa9e54db8d6c71573f343b4 Mon Sep 17 00:00:00 2001
From: JackYang
diff --git a/CDN/package.json b/CDN/package.json index b8fb90f76..17422a75b 100755 --- a/CDN/package.json +++ b/CDN/package.json @@ -3,16 +3,17 @@ "version": "1.9.5", "description": "Zoom sample app for web client WebSDK", "main": "index.js", - "dependencies": {}, - "devDependencies": { - "concurrently": "^3.5.1", - "http-server": "^0.12.1" - }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "concurrently \"http-server -a 0.0.0.0 -p 9999 -c-1 -o index.html\"", - "https": "concurrently \"http-server -a 0.0.0.0 -p 9999 -c-1 -S -C localhost.crt -K localhost.key -o https://localhost:9999/index.html\"" + "start": "set NODE_ENV=development && set BABEL_ENV=development && webpack serve --config webpack.config.dev.js", + "https": "set NODE_ENV=development && set BABEL_ENV=development && webpack serve --config webpack.config.dev.js --https", + "corp": "set NODE_ENV=development && set BABEL_ENV=development && node corp.js --corp" }, - "author": "Yang Jack", - "license": "ISC" + "author": "Jack Jack", + "license": "ISC", + "devDependencies": { + "webpack": "5.28.0", + "webpack-cli": "4.5.0", + "webpack-dev-server": "3.11.2" + } } diff --git a/CDN/webpack.config.dev.js b/CDN/webpack.config.dev.js new file mode 100644 index 000000000..76515c95f --- /dev/null +++ b/CDN/webpack.config.dev.js @@ -0,0 +1,41 @@ +const path = require('path'); +const webpack = require('webpack'); +const args = process.argv.slice(2); +let https = false; +let disableCORP = true; +if (args.includes('--https')) https = true; +if (args.includes('--corp')) disableCORP = false; + + +module.exports = { + devtool: 'eval', + entry: { + }, + context: __dirname, + target: 'web', + devServer: { + https, + cert: './localhost.crt', + key: './localhost.key', + host: '0.0.0.0', + port: 9999, + hot: true, + overlay: true, + historyApiFallback: false, + watchContentBase: true, + disableHostCheck: true, + headers: { + 'Access-Control-Allow-Origin': https ? 'https://0.0.0.0:9999' : 'http://0.0.0.0:9999' + }, + open: 'chrome', + openPage: https ? 'https://127.0.0.1:9999' : 'http://127.0.0.1:9999', + }, + mode: 'development', + plugins: [ + new webpack.HotModuleReplacementPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('development'), + 'process.env.BABEL_ENV': JSON.stringify('development'), + }), + ], +}; diff --git a/Local/.eslintrc b/Local/.eslintrc index 0e294584c..0383cbabf 100755 --- a/Local/.eslintrc +++ b/Local/.eslintrc @@ -1,68 +1,20 @@ { - "extends": "airbnb", + "parser": "@babel/eslint-parser", + "extends": [ + "airbnb", "prettier" + ], + "plugins": ["prettier"], "rules": { - "indent": [ - "error", - 4 - ], - "linebreak-style": [ - "error", - "unix" - ], - "semi": [ - "error", - "always" - ], - "comma-dangle": 0, - "no-console": "off", - "react/jsx-filename-extension": [1, { - "extensions": [".js", ".jsx"] - }], - "global-require": "off", - "react/prop-types": [ - 1, - { "ignore": "ignore", "customValidators": "customValidator" } - ], - "react/destructuring-assignment": [true , "always", { "ignoreClassFields": true }], - "react/jsx-indent": [true, 4], - "max-len": 0, - "class-methods-use-this": 0, - "react/jsx-indent-props": 0, - "import/no-named-as-default": 0, - "jsx-a11y/click-events-have-key-events": 0, - "jsx-a11y/interactive-supports-focus": 0, - "no-bitwise": 0, - "no-trailing-spaces": ["error", { "ignoreComments": true }], - "react/no-string-refs": 0, - "jsx-a11y/no-static-element-interactions": [ - "error", - { - "handlers": [ - "onClick", - "onMouseDown", - "onMouseUp", - "onKeyPress", - "onKeyDown", - "onKeyUp", - "onMouseOver", - "onMouseOut" - ] - } - ] + "prettier/prettier": ["warn", { + "singleQuote": true, + "semi": true, + "trailingComma": "none" + }], + "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }] }, - "env": { - "amd": true, - "browser": true, - "jquery": true, - "node": true, - "es6": true, - "worker": true - }, - "globals": { - "document": true, - "window": true, - "$": true, - "_": true - }, - "parser": "babel-eslint" + "ignorePatterns": [ + "js/index.js", + "js/meeting.js", + "js/tool.js" + ] } \ No newline at end of file diff --git a/Local/corp.js b/Local/corp.js new file mode 100644 index 000000000..e3439b3fc --- /dev/null +++ b/Local/corp.js @@ -0,0 +1,44 @@ +const webpack = require('webpack'); +const WebpackDevServer = require('webpack-dev-server'); +const webpackConfig = require('./webpack.config.dev'); + +function runFunc(err) { + if (err) { + console.log(err); + } + console.log('Listening at http://127.0.0.1:9999/index.html'); +} + +new WebpackDevServer(webpack(webpackConfig), { + publicPath: '/static', + hot: true, + host: '0.0.0.0', + open: 'chrome', + after(app, server) { + }, + headers: { + // 'Cross-Origin-Embedder-Policy': 'unsafe-none', + // 'Cross-Origin-Opener-Policy': 'unsafe-none', + }, + openPage: 'http://127.0.0.1:9999/index.html', + disableHostCheck: true, + historyApiFallback: true, + proxy: [{ + path: '/meeting.html', + target: 'http://127.0.0.1:9998/' + }] +}).listen(9999, '0.0.0.0', runFunc); + +new WebpackDevServer(webpack(webpackConfig), { + publicPath: '/static', + hot: true, + host: '0.0.0.0', + after(app, server) { + }, + headers: { + 'Cross-Origin-Embedder-Policy': 'require-corp', + 'Cross-Origin-Opener-Policy': 'same-origin', + }, + disableHostCheck: true, + historyApiFallback: true, +}).listen(9998, '0.0.0.0', runFunc); diff --git a/Local/helper.html b/Local/helper.html new file mode 100644 index 000000000..94b0d6f2d --- /dev/null +++ b/Local/helper.html @@ -0,0 +1,9 @@ +