Update build scripts for new process

We have to convert *something* to TypeScript so it doesn't complain that there's nothing to compile, so this converts the easiest utility library.

Many of the scripts are copied from the react-sdk.
pull/11801/head
Travis Ralston 2020-01-08 16:09:26 -07:00
parent 4482cac9b4
commit ec66069e96
6 changed files with 1425 additions and 575 deletions

View File

@ -1,11 +1,40 @@
steps:
- label: ":eslint: Lint"
- label: ":eslint: JS Lint"
command:
- "yarn install"
- "yarn lint"
- "echo '--- Install js-sdk'"
- "./scripts/ci/install-deps.sh"
- "yarn lint:js"
plugins:
- docker#v3.0.1:
image: "node:10"
image: "node:12"
# This layer doesn't have a TypeScript linter. This comment is to remind TravisR to fix that.
# - label: ":eslint: TS Lint"
# command:
# - "echo '--- Install js-sdk'"
# - "./scripts/ci/install-deps.sh"
# - "yarn lint:ts"
# plugins:
# - docker#v3.0.1:
# image: "node:12"
- label: ":eslint: Types Lint"
command:
- "echo '--- Install js-sdk'"
- "./scripts/ci/install-deps.sh"
- "yarn lint:types"
plugins:
- docker#v3.0.1:
image: "node:12"
- label: "🛠 Build"
command:
- "echo '--- Install js-sdk'"
- "./scripts/ci/install-deps.sh"
- "yarn build"
plugins:
- docker#v3.0.1:
image: "node:12"
- label: ":karma: Tests"
agents:

26
.stylelintrc.js Normal file
View File

@ -0,0 +1,26 @@
// Copied from react-sdk
// TODO: Only keep one copy of this for synchronization purposes
module.exports = {
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-scss",
],
"rules": {
"indentation": 4,
"comment-empty-line-before": null,
"declaration-empty-line-before": null,
"length-zero-no-unit": null,
"rule-empty-line-before": null,
"color-hex-length": null,
"max-empty-lines": null,
"number-no-trailing-zeros": null,
"number-leading-zero": null,
"selector-list-comma-newline-after": null,
"at-rule-no-unknown": null,
"no-descending-specificity": null,
"scss/at-rule-no-unknown": [true, {
// https://github.com/vector-im/riot-web/issues/10544
"ignoreAtRules": ["define-mixin"],
}],
}
};

View File

@ -11,56 +11,53 @@
},
"license": "Apache-2.0",
"files": [
"AUTHORS.rst",
"CONTRIBUTING.rst",
"deploy",
"docs",
"karma.conf.js",
"lib",
"release.sh",
"scripts",
"res",
"src",
"test",
"webpack.config.js"
"webpack.config.js",
"scripts",
"docs",
"release.sh",
"karma.conf.js",
"deploy",
"CHANGELOG.md",
"CONTRIBUTING.rst",
"LICENSE",
"README.md",
"AUTHORS.rst",
"package.json"
],
"style": "bundle.css",
"scripts": {
"reskindex": "reskindex -h src/header",
"reskindex:watch": "reskindex -h src/header -w",
"i18n": "matrix-gen-i18n",
"prunei18n": "matrix-prune-i18n",
"diff-i18n": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && node scripts/compare-file.js src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
"reskindex": "reskindex -h src/header",
"reskindex:watch": "reskindex -h src/header -w",
"clean": "rimraf lib webapp electron_app/dist",
"build": "yarn clean && yarn build:res && yarn build:compile && yarn build:types && yarn build:bundle",
"build:res": "node scripts/copy-res.js",
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
"build:compile": "yarn reskindex && babel --source-maps -d lib src",
"build:compile": "yarn reskindex && babel -d lib --verbose --extensions \".ts,.js\" src",
"build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production",
"build:bundle:dev": "webpack --progress --bail --mode development",
"build:electron": "yarn clean && yarn build && yarn install:electron && electron-builder -wml --ia32 --x64",
"build:electron": "yarn build && yarn install:electron && electron-builder -wml --ia32 --x64",
"build:electron:linux": "yarn build && electron-builder -l --x64",
"build:electron:macos": "yarn build && electron-builder -m --x64",
"build:electron:windows": "yarn build && electron-builder -w --ia32 --x64",
"build:react-sdk": "node scripts/yarn-sub.js matrix-react-sdk build",
"build:js-sdk": "node scripts/yarn-sub.js matrix-js-sdk start:init",
"build": "yarn build:js-sdk && yarn build:react-sdk && yarn reskindex && yarn build:res && yarn build:bundle",
"build:dev": "yarn build:js-sdk && yarn build:react-sdk && yarn reskindex && yarn build:res && yarn build:bundle:dev",
"dist": "scripts/package.sh",
"build:types": "tsc --emitDeclarationOnly",
"install:electron": "electron-builder install-app-deps",
"electron": "yarn install:electron && electron .",
"dist": "scripts/package.sh",
"start": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n reskindex,res,riot-js \"yarn reskindex:watch\" \"yarn start:res\" \"yarn start:js\"",
"start:res": "node scripts/copy-res.js -w",
"start:js": "webpack-dev-server --host=0.0.0.0 --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js -w --progress --mode development",
"start:js:prod": "cross-env NODE_ENV=production webpack-dev-server -w --progress --mode production",
"start:js-sdk": "node scripts/yarn-sub.js matrix-js-sdk start:watch",
"start:js-sdk:prod": "cross-env NODE_ENV=production node scripts/yarn-sub.js matrix-js-sdk start:watch",
"start:react-sdk": "node scripts/yarn-sub.js matrix-react-sdk start:all",
"start:react-sdk:prod": "cross-env NODE_ENV=production node scripts/yarn-sub.js matrix-react-sdk start:all",
"start": "yarn build:js-sdk && yarn build:react-sdk && concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n js-sdk,react-sdk,reskindex,res,riot-js \"yarn start:js-sdk\" \"yarn start:react-sdk\" \"yarn reskindex:watch\" \"yarn start:res\" \"yarn start:js\"",
"start:prod": "yarn build:js-sdk && yarn build:react-sdk && concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n js-sdk,react-sdk,reskindex,res,riot-js \"yarn start:js-sdk:prod\" \"yarn start:react-sdk:prod\" \"yarn reskindex:watch\" \"yarn start:res\" \"yarn start:js:prod\"",
"lint": "eslint src/",
"lintall": "eslint src/ test/",
"clean": "rimraf lib webapp electron_app/dist",
"prepare": "yarn clean && yarn build:compile",
"electron": "yarn build && yarn install:electron && electron .",
"lint": "yarn lint:types && yarn lint:ts && yarn lint:js && yarn lint:style",
"lint:js": "eslint src test",
"lint:ts": "echo 'We don't actually have a typescript linter at this layer because tslint is being removed from our stack. Presumably your TS is fine.'",
"lint:types": "tsc --noEmit",
"lint:style": "stylelint 'res/css/**/*.scss'",
"test": "karma start --single-run=true --autoWatch=false --browsers VectorChromeHeadless",
"test-multi": "karma start"
"test:multi": "karma start"
},
"dependencies": {
"browser-request": "^0.3.3",
@ -97,7 +94,7 @@
"@babel/preset-typescript": "^7.7.4",
"@babel/register": "^7.7.4",
"@babel/runtime": "^7.7.6",
"@types/react": "^16.9.16",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
"autoprefixer": "^9.7.3",
"babel-eslint": "^10.0.3",
@ -105,7 +102,7 @@
"chokidar": "^2.0.4",
"concurrently": "^4.0.1",
"cpx": "^1.3.2",
"cross-env": "^4.0.0",
"cross-env": "^6.0.3",
"css-loader": "^3.3.2",
"electron-builder": "^21.2.0",
"electron-builder-squirrel-windows": "^21.2.0",
@ -152,6 +149,7 @@
"postcss-strip-inline-comments": "^0.1.5",
"rimraf": "^2.4.3",
"shell-escape": "^0.2.0",
"stylelint": "^12.0.1",
"terser-webpack-plugin": "^2.3.0",
"typescript": "^3.7.3",
"webpack": "^4.41.2",

View File

@ -2,11 +2,6 @@
set -e
dev=""
if [ "$1" = '-d' ]; then
dev=":dev"
fi
if [ -n "$DIST_VERSION" ]; then
version=$DIST_VERSION
else
@ -14,7 +9,7 @@ else
fi
yarn clean
yarn build$dev
yarn build
# include the sample config in the tarball. Arguably this should be done by
# `yarn build`, but it's just too painful.

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import qs from 'querystring';
import * as qs from 'querystring';
// We want to support some name / value pairs in the fragment
// so we're re-using query string like format

1860
yarn.lock

File diff suppressed because it is too large Load Diff