From 70881312faee83d5238945ea2a70ef0386670398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 17 Jan 2019 10:49:57 +0100 Subject: [PATCH] improve demo tasks, add a live server and update readme --- README.md | 24 ++++++++++++++++++++++-- package.json | 11 +++++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3db42a9f..67cae907 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,37 @@ This is a POC, not at all production ready code!!! +## Installation + +``` +npm install +``` ## Tests +``` npm run test npm run test:watch - +``` ## Build code bundles +``` npm run bundle:core npm run bundle:core:watch +``` ## Demo page -npm run demo \ No newline at end of file +There are three commands that can be used to play with the demo application: + +``` +npm run demo:build +npm run demo:watch +npm run demo:serve +``` + +- *build* prepare a folder with all the static files compiled. It is located in + dist/demo +- *watch* recompile the typescript files as soon as they are changed +- *serve* starts a live-server pointing to the dist/demo (which will reload the + page whenever the files are changed) \ No newline at end of file diff --git a/package.json b/package.json index 60ac2832..a4eab998 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,12 @@ "test": "jest", "test:watch": "jest --watch", "bundle:core": "tsc -m es6 --lib es2017,dom --target esnext --outdir dist src/bundles/core.ts && rollup dist/bundles/core.js --file dist/bundle-core.js --format iife", - "bundle:core:watch": "nodemon -w src -e ts -x 'npm run bundle:core'", - "demo": "cp -r demo/ dist/demo && tsc -m amd --lib es2017,dom --target esnext --outfile dist/demo/main.js demo/src/main.ts", - "postdemo": "open dist/demo/index.html" + "bundle:core:watch": "npm run bundle:core -- --watch", + "demo:build": "cp -r demo/ dist/demo && npm run demo:build:js", + "demo:build:js": "tsc -m amd --lib es2017,dom --target esnext --outfile dist/demo/main.js demo/src/main.ts", + "predemo:watch": "npm run demo:build", + "demo:watch": "npm run demo:build:js -- --watch", + "demo:serve": "live-server dist/demo/" }, "repository": { "type": "git", @@ -24,11 +27,11 @@ "devDependencies": { "@types/jest": "^23.3.12", "jest": "^23.6.0", - "nodemon": "^1.18.9", "rollup": "^1.1.0", "rollup-plugin-typescript2": "^0.19.0", "source-map-support": "^0.5.10", "ts-jest": "^23.10.5", + "live-server": "^1.2.1", "typescript": "^3.2.2" } }