From 4c9ade5ecb9b5e5c97b33e226f5656f636889432 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 15 Aug 2016 12:16:08 +0100 Subject: [PATCH] Use cpx to copy olm.js, and add watcher We are now using `cpx` to copy the emojione files, so we might as well use it for olm.js, rather than rolling our own - particularly since that makes it easy to add a watcher for `npm start`. We have to add a `-L` to the `cpx` invocation, otherwise, if olm is a symlink (as is useful for development), cpx ends up watching the symlink, which obviously never changes. --- package.json | 7 ++++--- scripts/staticfiles.js | 21 --------------------- 2 files changed, 4 insertions(+), 24 deletions(-) delete mode 100755 scripts/staticfiles.js diff --git a/package.json b/package.json index 64c1d38aaa..be87139b26 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "build:compile": "babel --source-maps -d lib src", "build:bundle": "NODE_ENV=production webpack -p lib/vector/index.js vector/bundle.js", "build:bundle:dev": "NODE_ENV=production webpack --optimize-occurence-order lib/vector/index.js vector/bundle.js", - "build:staticfiles": "scripts/staticfiles.js", + "build:staticfiles": "cpx -v node_modules/olm/olm.js vector/", "build": "npm run build:staticfiles && npm run build:emojione && npm run build:css && npm run build:compile && npm run build:bundle", "build:dev": "npm run build:staticfiles && npm run build:emojione && npm run build:css && npm run build:compile && npm run build:bundle:dev", "package": "scripts/package.sh", @@ -26,9 +26,10 @@ "start:js": "webpack -w src/vector/index.js vector/bundle.js", "start:js:prod": "NODE_ENV=production webpack -w src/vector/index.js vector/bundle.js", "start:skins:css": "catw \"src/skins/vector/css/**/*.css\" -o vector/components.css", + "start:staticfiles": "cpx -Lwv node_modules/olm/olm.js vector/", "//cache": "Note the -c 1 below due to https://code.google.com/p/chromium/issues/detail?id=508270", - "start": "parallelshell \"npm run build:staticfiles\" \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", - "start:prod": "parallelshell \"npm run build:staticfiles\" \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", + "start": "parallelshell \"npm run start:staticfiles\" \"npm run start:emojione\" \"npm run start:js\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", + "start:prod": "parallelshell \"npm run start:staticfiles\" \"npm run start:emojione\" \"npm run start:js:prod\" \"npm run start:skins:css\" \"http-server -c 1 vector\"", "clean": "rimraf lib vector/olm.js vector/bundle.css vector/bundle.js vector/bundle.js.map vector/webpack.css* vector/emojione", "prepublish": "npm run build:css && npm run build:compile", "test": "karma start --single-run=true --autoWatch=false --browsers PhantomJS --colors=false", diff --git a/scripts/staticfiles.js b/scripts/staticfiles.js deleted file mode 100755 index 3dbf451cd3..0000000000 --- a/scripts/staticfiles.js +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env node - -// copy static files from node_modules to the vector directory -// - -var fs = require('fs-extra'); - -function exists(f) { - try { - fs.statSync(f); - return true; - } catch(e) { - return false; - } -} - -const olm = 'node_modules/olm/olm.js'; -if (exists(olm)) { - console.log("copy", olm, "-> vector"); - fs.copySync(olm, 'vector/olm.js'); -}