Skip to content

Commit ec66069

Browse files
committed
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.
1 parent 4482cac commit ec66069

6 files changed

Lines changed: 1428 additions & 578 deletions

File tree

.buildkite/pipeline.yaml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,40 @@
11
steps:
2-
- label: ":eslint: Lint"
2+
- label: ":eslint: JS Lint"
33
command:
4-
- "yarn install"
5-
- "yarn lint"
4+
- "echo '--- Install js-sdk'"
5+
- "./scripts/ci/install-deps.sh"
6+
- "yarn lint:js"
67
plugins:
78
- docker#v3.0.1:
8-
image: "node:10"
9+
image: "node:12"
10+
11+
# This layer doesn't have a TypeScript linter. This comment is to remind TravisR to fix that.
12+
# - label: ":eslint: TS Lint"
13+
# command:
14+
# - "echo '--- Install js-sdk'"
15+
# - "./scripts/ci/install-deps.sh"
16+
# - "yarn lint:ts"
17+
# plugins:
18+
# - docker#v3.0.1:
19+
# image: "node:12"
20+
21+
- label: ":eslint: Types Lint"
22+
command:
23+
- "echo '--- Install js-sdk'"
24+
- "./scripts/ci/install-deps.sh"
25+
- "yarn lint:types"
26+
plugins:
27+
- docker#v3.0.1:
28+
image: "node:12"
29+
30+
- label: "🛠 Build"
31+
command:
32+
- "echo '--- Install js-sdk'"
33+
- "./scripts/ci/install-deps.sh"
34+
- "yarn build"
35+
plugins:
36+
- docker#v3.0.1:
37+
image: "node:12"
938

1039
- label: ":karma: Tests"
1140
agents:
@@ -54,4 +83,4 @@ steps:
5483
- "yarn diff-i18n"
5584
plugins:
5685
- docker#v3.0.1:
57-
image: "node:10"
86+
image: "node:10"

.stylelintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copied from react-sdk
2+
// TODO: Only keep one copy of this for synchronization purposes
3+
module.exports = {
4+
"extends": "stylelint-config-standard",
5+
"plugins": [
6+
"stylelint-scss",
7+
],
8+
"rules": {
9+
"indentation": 4,
10+
"comment-empty-line-before": null,
11+
"declaration-empty-line-before": null,
12+
"length-zero-no-unit": null,
13+
"rule-empty-line-before": null,
14+
"color-hex-length": null,
15+
"max-empty-lines": null,
16+
"number-no-trailing-zeros": null,
17+
"number-leading-zero": null,
18+
"selector-list-comma-newline-after": null,
19+
"at-rule-no-unknown": null,
20+
"no-descending-specificity": null,
21+
"scss/at-rule-no-unknown": [true, {
22+
// https://github.com/vector-im/riot-web/issues/10544
23+
"ignoreAtRules": ["define-mixin"],
24+
}],
25+
}
26+
};

package.json

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,53 @@
1111
},
1212
"license": "Apache-2.0",
1313
"files": [
14-
"AUTHORS.rst",
15-
"CONTRIBUTING.rst",
16-
"deploy",
17-
"docs",
18-
"karma.conf.js",
1914
"lib",
20-
"release.sh",
21-
"scripts",
15+
"res",
2216
"src",
23-
"test",
24-
"webpack.config.js"
17+
"webpack.config.js",
18+
"scripts",
19+
"docs",
20+
"release.sh",
21+
"karma.conf.js",
22+
"deploy",
23+
"CHANGELOG.md",
24+
"CONTRIBUTING.rst",
25+
"LICENSE",
26+
"README.md",
27+
"AUTHORS.rst",
28+
"package.json"
2529
],
2630
"style": "bundle.css",
2731
"scripts": {
28-
"reskindex": "reskindex -h src/header",
29-
"reskindex:watch": "reskindex -h src/header -w",
3032
"i18n": "matrix-gen-i18n",
3133
"prunei18n": "matrix-prune-i18n",
3234
"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",
35+
"reskindex": "reskindex -h src/header",
36+
"reskindex:watch": "reskindex -h src/header -w",
37+
"clean": "rimraf lib webapp electron_app/dist",
38+
"build": "yarn clean && yarn build:res && yarn build:compile && yarn build:types && yarn build:bundle",
3339
"build:res": "node scripts/copy-res.js",
3440
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
35-
"build:compile": "yarn reskindex && babel --source-maps -d lib src",
41+
"build:compile": "yarn reskindex && babel -d lib --verbose --extensions \".ts,.js\" src",
3642
"build:bundle": "cross-env NODE_ENV=production webpack -p --progress --bail --mode production",
37-
"build:bundle:dev": "webpack --progress --bail --mode development",
38-
"build:electron": "yarn clean && yarn build && yarn install:electron && electron-builder -wml --ia32 --x64",
43+
"build:electron": "yarn build && yarn install:electron && electron-builder -wml --ia32 --x64",
3944
"build:electron:linux": "yarn build && electron-builder -l --x64",
4045
"build:electron:macos": "yarn build && electron-builder -m --x64",
4146
"build:electron:windows": "yarn build && electron-builder -w --ia32 --x64",
42-
"build:react-sdk": "node scripts/yarn-sub.js matrix-react-sdk build",
43-
"build:js-sdk": "node scripts/yarn-sub.js matrix-js-sdk start:init",
44-
"build": "yarn build:js-sdk && yarn build:react-sdk && yarn reskindex && yarn build:res && yarn build:bundle",
45-
"build:dev": "yarn build:js-sdk && yarn build:react-sdk && yarn reskindex && yarn build:res && yarn build:bundle:dev",
46-
"dist": "scripts/package.sh",
47+
"build:types": "tsc --emitDeclarationOnly",
4748
"install:electron": "electron-builder install-app-deps",
48-
"electron": "yarn install:electron && electron .",
49+
"dist": "scripts/package.sh",
50+
"start": "concurrently --kill-others-on-fail --prefix \"{time} [{name}]\" -n reskindex,res,riot-js \"yarn reskindex:watch\" \"yarn start:res\" \"yarn start:js\"",
4951
"start:res": "node scripts/copy-res.js -w",
5052
"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",
51-
"start:js:prod": "cross-env NODE_ENV=production webpack-dev-server -w --progress --mode production",
52-
"start:js-sdk": "node scripts/yarn-sub.js matrix-js-sdk start:watch",
53-
"start:js-sdk:prod": "cross-env NODE_ENV=production node scripts/yarn-sub.js matrix-js-sdk start:watch",
54-
"start:react-sdk": "node scripts/yarn-sub.js matrix-react-sdk start:all",
55-
"start:react-sdk:prod": "cross-env NODE_ENV=production node scripts/yarn-sub.js matrix-react-sdk start:all",
56-
"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\"",
57-
"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\"",
58-
"lint": "eslint src/",
59-
"lintall": "eslint src/ test/",
60-
"clean": "rimraf lib webapp electron_app/dist",
61-
"prepare": "yarn clean && yarn build:compile",
53+
"electron": "yarn build && yarn install:electron && electron .",
54+
"lint": "yarn lint:types && yarn lint:ts && yarn lint:js && yarn lint:style",
55+
"lint:js": "eslint src test",
56+
"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.'",
57+
"lint:types": "tsc --noEmit",
58+
"lint:style": "stylelint 'res/css/**/*.scss'",
6259
"test": "karma start --single-run=true --autoWatch=false --browsers VectorChromeHeadless",
63-
"test-multi": "karma start"
60+
"test:multi": "karma start"
6461
},
6562
"dependencies": {
6663
"browser-request": "^0.3.3",
@@ -97,15 +94,15 @@
9794
"@babel/preset-typescript": "^7.7.4",
9895
"@babel/register": "^7.7.4",
9996
"@babel/runtime": "^7.7.6",
100-
"@types/react": "^16.9.16",
97+
"@types/react": "^16.9.17",
10198
"@types/react-dom": "^16.9.4",
10299
"autoprefixer": "^9.7.3",
103100
"babel-eslint": "^10.0.3",
104101
"babel-loader": "^8.0.6",
105102
"chokidar": "^2.0.4",
106103
"concurrently": "^4.0.1",
107104
"cpx": "^1.3.2",
108-
"cross-env": "^4.0.0",
105+
"cross-env": "^6.0.3",
109106
"css-loader": "^3.3.2",
110107
"electron-builder": "^21.2.0",
111108
"electron-builder-squirrel-windows": "^21.2.0",
@@ -152,6 +149,7 @@
152149
"postcss-strip-inline-comments": "^0.1.5",
153150
"rimraf": "^2.4.3",
154151
"shell-escape": "^0.2.0",
152+
"stylelint": "^12.0.1",
155153
"terser-webpack-plugin": "^2.3.0",
156154
"typescript": "^3.7.3",
157155
"webpack": "^4.41.2",

scripts/package.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22

33
set -e
44

5-
dev=""
6-
if [ "$1" = '-d' ]; then
7-
dev=":dev"
8-
fi
9-
105
if [ -n "$DIST_VERSION" ]; then
116
version=$DIST_VERSION
127
else
138
version=`git describe --dirty --tags || echo unknown`
149
fi
1510

1611
yarn clean
17-
yarn build$dev
12+
yarn build
1813

1914
# include the sample config in the tarball. Arguably this should be done by
2015
# `yarn build`, but it's just too painful.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import qs from 'querystring';
17+
import * as qs from 'querystring';
1818

1919
// We want to support some name / value pairs in the fragment
2020
// so we're re-using query string like format

0 commit comments

Comments
 (0)