Merge pull request #2558 from vector-im/dbkr/build_vector_dir

Build all of the vector dir in the build process
This commit is contained in:
David Baker 2016-11-11 17:51:25 +00:00 committed by GitHub
commit 2bcb27b24f
48 changed files with 31 additions and 34 deletions

6
.gitignore vendored
View File

@ -6,11 +6,7 @@
/lib /lib
/node_modules /node_modules
/packages/ /packages/
/vector/bundle.* /webapp
/vector/emojione/
/vector/config.json
/vector/index.html
/vector/olm.*
.DS_Store .DS_Store
npm-debug.log npm-debug.log
electron/dist electron/dist

View File

@ -160,7 +160,7 @@ electron.app.on('ready', () => {
icon: `${__dirname}/../img/riot.ico`, icon: `${__dirname}/../img/riot.ico`,
width: 1024, height: 768, width: 1024, height: 768,
}); });
mainWindow.loadURL(`file://${__dirname}/../../vector/index.html`); mainWindow.loadURL(`file://${__dirname}/../../webapp/index.html`);
electron.Menu.setApplicationMenu(VectorMenu); electron.Menu.setApplicationMenu(VectorMenu);
mainWindow.on('closed', () => { mainWindow.on('closed', () => {

View File

@ -27,23 +27,27 @@
"matrix-react-parent": "matrix-react-sdk", "matrix-react-parent": "matrix-react-sdk",
"scripts": { "scripts": {
"reskindex": "reskindex -h src/header", "reskindex": "reskindex -h src/header",
"build:emojione": "cpx \"node_modules/emojione/assets/svg/*\" vector/emojione/svg/", "build:res": "cpx \"{src/skins/vector/fonts,src/skins/vector/img}/**\" webapp/ && cpx \"{res/media,res/vector-icons}/**\" webapp/",
"build:config": "cpx config.json webapp/",
"build:emojione": "cpx \"node_modules/emojione/assets/svg/*\" webapp/emojione/svg/",
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js", "build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
"build:css": "mkdirp build && catw \"src/skins/vector/css/**/*.css\" -o build/components.css --no-watch", "build:css": "mkdirp build && catw \"src/skins/vector/css/**/*.css\" -o build/components.css --no-watch",
"build:compile": "babel --source-maps -d lib src", "build:compile": "babel --source-maps -d lib src",
"build:bundle": "NODE_ENV=production webpack -p --progress", "build:bundle": "NODE_ENV=production webpack -p --progress",
"build:bundle:dev": "webpack --optimize-occurence-order --progress", "build:bundle:dev": "webpack --optimize-occurence-order --progress",
"build:electron": "build -lwm", "build:electron": "build -lwm",
"build": "node scripts/babelcheck.js && npm run build:emojione && npm run build:css && npm run build:bundle", "build": "node scripts/babelcheck.js && npm run build:res && npm run build:config && npm run build:emojione && npm run build:css && npm run build:bundle",
"build:dev": "npm run build:emojione && npm run build:css && npm run build:bundle:dev", "build:dev": "npm run build:emojione && npm run build:css && npm run build:bundle:dev",
"dist": "scripts/package.sh", "dist": "scripts/package.sh",
"start:emojione": "cpx \"node_modules/emojione/assets/svg/*\" vector/emojione/svg/ -w", "start:res": "parallelshell \"cpx -w \\\"{src/skins/vector/fonts,src/skins/vector/img}/**\\\" webapp/\" \"cpx -w \\\"{res/media,res/vector-icons}/**\\\" webapp/\"",
"start:config": "cpx -w config.json webapp/",
"start:emojione": "cpx \"node_modules/emojione/assets/svg/*\" webapp/emojione/svg/ -w",
"start:js": "webpack-dev-server -w --progress", "start:js": "webpack-dev-server -w --progress",
"start:js:prod": "NODE_ENV=production webpack-dev-server -w --progress", "start:js:prod": "NODE_ENV=production webpack-dev-server -w --progress",
"start:skins:css": "mkdirp build && catw \"src/skins/vector/css/**/*.css\" -o build/components.css", "start:skins:css": "mkdirp build && catw \"src/skins/vector/css/**/*.css\" -o build/components.css",
"start": "node scripts/babelcheck.js && parallelshell \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\"", "start": "node scripts/babelcheck.js && parallelshell \"npm run start:emojione\" \"npm run start:res\" \"npm run start:config\" \"npm run start:js\" \"npm run start:skins:css\"",
"start:prod": "parallelshell \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\"", "start:prod": "parallelshell \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\"",
"clean": "rimraf build lib vector/olm.* vector/bundle.* vector/emojione vector/index.html", "clean": "rimraf build lib webapp",
"prepublish": "npm run build:compile", "prepublish": "npm run build:compile",
"test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false", "test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false",
"test:multi": "karma start" "test:multi": "karma start"
@ -128,12 +132,12 @@
"//asar=false": "https://github.com/electron-userland/electron-builder/issues/675", "//asar=false": "https://github.com/electron-userland/electron-builder/issues/675",
"asar": false, "asar": false,
"dereference": true, "dereference": true,
"//files": "We bundle everything, so we only need to include vector/", "//files": "We bundle everything, so we only need to include webapp/",
"files": [ "files": [
"!**/*", "!**/*",
"electron/src/**", "electron/src/**",
"electron/img/**", "electron/img/**",
"vector/**", "webapp/**",
"package.json" "package.json"
], ],
"squirrelWindows": { "squirrelWindows": {

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -25,11 +25,7 @@ cp -r olm/package node_modules/olm
# run the mocha tests # run the mocha tests
npm run test npm run test
# build our artifacts; dumps them in ./vector rm dist/vector-*.tar.gz || true # rm previous artifacts without failing if it doesn't exist
npm run build:dev
# gzip up ./vector
rm vector-*.tar.gz || true # rm previous artifacts without failing if it doesn't exist
# node_modules deps from 'npm install' don't have a .git dir so can't # node_modules deps from 'npm install' don't have a .git dir so can't
# rev-parse; but they do set the commit in package.json under 'gitHead' which # rev-parse; but they do set the commit in package.json under 'gitHead' which
@ -39,4 +35,4 @@ JSSDK_SHA=$(grep 'gitHead' node_modules/matrix-js-sdk/package.json | cut -d \" -
VECTOR_SHA=$(git rev-parse --short=12 HEAD) # use the ACTUAL SHA rather than assume develop VECTOR_SHA=$(git rev-parse --short=12 HEAD) # use the ACTUAL SHA rather than assume develop
tar -zcvhf vector-$VECTOR_SHA-react-$REACT_SHA-js-$JSSDK_SHA.tar.gz vector #g[z]ip, [c]reate archive, [v]erbose, [f]ilename, [h]ard-dereference (do not archive symlinks) DIST_VERSION=vector-$VECTOR_SHA-react-$REACT_SHA-js-$JSSDK_SHA scripts/package.sh -d

View File

@ -2,15 +2,21 @@
set -e set -e
dev=""
if [ "$1" == '-d' ]; then
dev=":dev"
fi
if [ -n "$DIST_VERSION" ]; then if [ -n "$DIST_VERSION" ]; then
version=$DIST_VERSION version=$DIST_VERSION
else else
version=`git describe --dirty --tags || echo unknown` version=`git describe --dirty --tags || echo unknown`
fi fi
npm run build npm run clean
npm run build$dev
mkdir -p dist mkdir -p dist
cp -r vector vector-$version cp -r webapp vector-$version
echo $version > vector-$version/version echo $version > vector-$version/version
tar chvzf dist/vector-$version.tar.gz vector-$version tar chvzf dist/vector-$version.tar.gz vector-$version
rm -r vector-$version rm -r vector-$version

View File

@ -110,20 +110,17 @@ def on_receive_jenkins_poke():
filename = download_file(tar_gz_url) filename = download_file(tar_gz_url)
print("Downloaded file: %s" % filename) print("Downloaded file: %s" % filename)
name_str = filename.replace(".tar.gz", "") name_str = filename.replace(".tar.gz", "")
untar_location = os.path.join(arg_extract_path, name_str) untar_to(filename, arg_extract_path)
untar_to(filename, untar_location)
extracted_dir = os.path.join(arg_extract_path, name_str)
if arg_should_clean: if arg_should_clean:
os.remove(filename) os.remove(filename)
# stamp the version somewhere JS can get to it create_symlink(source=extracted_dir, linkname=arg_symlink)
with open(os.path.join(untar_location, "vector/version"), "w") as stamp_file:
stamp_file.write(name_str)
create_symlink(source=os.path.join(untar_location, "vector"), linkname=arg_symlink)
if arg_config_location: if arg_config_location:
create_symlink(source=arg_config_location, linkname=os.path.join(untar_location, "vector", 'config.json')) create_symlink(source=arg_config_location, linkname=os.path.join(extracted_dir, 'config.json'))
return jsonify({}) return jsonify({})

View File

@ -1 +0,0 @@
../src/skins/vector/fonts

View File

@ -1 +0,0 @@
../src/skins/vector/img/

View File

@ -39,7 +39,7 @@ module.exports = {
], ],
}, },
output: { output: {
path: path.join(__dirname, "vector"), path: path.join(__dirname, "webapp"),
filename: "[name].[chunkhash].js", filename: "[name].[chunkhash].js",
devtoolModuleFilenameTemplate: function(info) { devtoolModuleFilenameTemplate: function(info) {
// Reading input source maps gives only relative paths here for // Reading input source maps gives only relative paths here for
@ -98,8 +98,8 @@ module.exports = {
// configuration for the webpack-dev-server // configuration for the webpack-dev-server
devServer: { devServer: {
// serve unwebpacked assets from vector. // serve unwebpacked assets from webapp.
contentBase: './vector', contentBase: './webapp',
}, },
}; };