Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build scripts for new process #11801

Merged
merged 8 commits into from Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 23 additions & 18 deletions .babelrc
@@ -1,20 +1,25 @@
{
"presets": [
"react",
"es2015",
"es2016"
],
"plugins": [
[
"transform-builtin-extend",
{
"globals": ["Error"]
}
],
"transform-class-properties",
"transform-object-rest-spread",
"transform-runtime",
"add-module-exports",
"syntax-dynamic-import"
]
"sourceMaps": true,
"presets": [
["@babel/preset-env", {
"targets": {
"browsers": [
"last 2 versions"
]
}
}],
"@babel/preset-typescript",
"@babel/preset-flow",
"@babel/preset-react"
],
"plugins": [
["@babel/plugin-proposal-decorators", {"legacy": true}],
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-flow-comments",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-transform-runtime"
]
}
35 changes: 31 additions & 4 deletions .buildkite/pipeline.yaml
@@ -1,11 +1,38 @@
steps:
- label: ":eslint: Lint"
- label: ":eslint: JS Lint"
command:
- "yarn install"
- "yarn lint"
- "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:
- "yarn install"
- "yarn lint:types"
plugins:
- docker#v3.0.1:
image: "node:12"

- label: "🛠 Build"
command:
# TODO: This probably needs to be more sophisticated than "just install stuff"
- "yarn install"
- "yarn build"
plugins:
- docker#v3.0.1:
image: "node:12"

- label: ":karma: Tests"
agents:
Expand Down Expand Up @@ -54,4 +81,4 @@ steps:
- "yarn diff-i18n"
plugins:
- docker#v3.0.1:
image: "node:10"
image: "node:10"
26 changes: 26 additions & 0 deletions .stylelintrc.js
@@ -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"],
}],
}
};
131 changes: 68 additions & 63 deletions package.json
Expand Up @@ -11,60 +11,55 @@
},
"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": {
"babel-polyfill": "^6.26.0",
"babel-runtime": "^6.26.0",
"browser-request": "^0.3.3",
"favico.js": "^0.3.10",
"gemini-scrollbar": "github:matrix-org/gemini-scrollbar#91e1e566",
Expand All @@ -83,27 +78,32 @@
"url": "^0.11.0"
},
"devDependencies": {
"autoprefixer": "^6.6.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.1.1",
"babel-loader": "^7.1.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-builtin-extend": "^1.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-es2017": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-decorators": "^7.7.4",
"@babel/plugin-proposal-export-default-from": "^7.7.4",
"@babel/plugin-proposal-numeric-separator": "^7.7.4",
"@babel/plugin-proposal-object-rest-spread": "^7.7.4",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-transform-flow-comments": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.6",
"@babel/preset-flow": "^7.7.4",
"@babel/preset-react": "^7.7.4",
"@babel/preset-typescript": "^7.7.4",
"@babel/register": "^7.7.4",
"@babel/runtime": "^7.7.6",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
"autoprefixer": "^9.7.3",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"chokidar": "^2.0.4",
"concurrently": "^4.0.1",
"cpx": "^1.3.2",
"cross-env": "^4.0.0",
"css-loader": "^2.1.0",
"cross-env": "^6.0.3",
"css-loader": "^3.3.2",
"electron-builder": "^21.2.0",
"electron-builder-squirrel-windows": "^21.2.0",
"electron-devtools-installer": "^2.2.4",
Expand All @@ -117,7 +117,7 @@
"eslint-plugin-react-hooks": "^2.2.0",
"expect": "^1.16.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^3.0.1",
"file-loader": "^5.0.2",
"fs-extra": "^0.30.0",
"html-webpack-plugin": "^3.2.0",
"json-loader": "^0.5.3",
Expand All @@ -133,23 +133,28 @@
"loader-utils": "^1.2.3",
"matrix-mock-request": "^1.2.3",
"matrix-react-test-utils": "^0.2.2",
"mini-css-extract-plugin": "^0.8.0",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"mocha": "^5.2.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss-extend": "^1.0.5",
"postcss-import": "^11.1.0",
"postcss-loader": "^2.1.6",
"postcss-mixins": "^6.2.0",
"postcss-nested": "^3.0.0",
"postcss-scss": "^1.0.6",
"postcss-simple-vars": "^4.1.0",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"postcss-mixins": "^6.2.3",
"postcss-nested": "^4.2.1",
"postcss-preset-env": "^6.7.0",
"postcss-scss": "^2.0.0",
"postcss-simple-vars": "^5.0.2",
"postcss-strip-inline-comments": "^0.1.5",
"rimraf": "^2.4.3",
"shell-escape": "^0.2.0",
"source-map-loader": "^0.2.4",
"webpack": "^4.23.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.11"
"stylelint": "^12.0.1",
"terser-webpack-plugin": "^2.3.0",
"typescript": "^3.7.3",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.9.0"
},
"build": {
"appId": "im.riot.app",
Expand Down
14 changes: 0 additions & 14 deletions postcss.config.js

This file was deleted.

7 changes: 1 addition & 6 deletions scripts/package.sh
Expand Up @@ -2,19 +2,14 @@

set -e

dev=""
if [ "$1" = '-d' ]; then
dev=":dev"
fi

if [ -n "$DIST_VERSION" ]; then
version=$DIST_VERSION
else
version=`git describe --dirty --tags || echo unknown`
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.
Expand Down
2 changes: 1 addition & 1 deletion src/vector/url_utils.js → src/vector/url_utils.ts
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions tsconfig.json
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es2016",
"noImplicitAny": false,
"sourceMap": false,
"outDir": "./lib",
"declaration": true,
"types": [
"node"
]
},
"include": [
"./src/**/*.ts"
]
}