From fd26775a0fd68cd8b203bc069f94fc0bda1866da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 4 Apr 2019 13:20:45 +0200 Subject: [PATCH] imp: adapt build scripts to allow ES5 output --- README.md | 15 ++++++++------- package.json | 4 +++- tsconfig.json | 3 +-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 12fd032d..daa51cc8 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,14 @@ client will ever be converted to typescript (even though I would really like it) Some npm scripts are available: -| Command | Description | -| ------------------ | -------------------------------------------------- | -| npm install | install every dependency required for this project | -| npm run build | build a bundle of _owl_ in the _/dist/_ folder | -| npm run minify | minify the prebuilt owl.js file | -| npm run test | run all tests | -| npm run test:watch | run all tests, and keep a watcher | +| Command | Description | +| ------------------ | --------------------------------------------------------- | +| npm install | install every dependency required for this project | +| npm run build | build a bundle of _owl_ in the _/dist/_ folder | +| npm run build:es5 | build a bundle of _owl_ in the _/dist/_ folder (ES5 code) | +| npm run minify | minify the prebuilt owl.js file | +| npm run test | run all tests | +| npm run test:watch | run all tests, and keep a watcher | ## Documentation diff --git a/package.json b/package.json index ff8974fe..07383cef 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,11 @@ "description": "Odoo Web Lab", "main": "src/index.ts", "scripts": { - "build:js": "tsc --lib es2017,dom --target esnext --outDir dist/owl src/*", + "build:js": "tsc --target esnext --module es6 --outDir dist/owl src/*", + "build:js:es5": "tsc --target es5 --module es6 --outDir dist/owl src/*", "build:bundle": "rollup -c", "build": "npm run build:js && npm run build:bundle", + "build:es5": "npm run build:js:es5 && npm run build:bundle", "minify": "uglifyjs dist/owl.js -o dist/owl.min.js --compress --mangle", "dev": "npm-run-all --parallel \"build:* -- --watch\"", "test": "jest", diff --git a/tsconfig.json b/tsconfig.json index ef446d2b..140a9259 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,11 +3,10 @@ "module": "commonjs", "preserveConstEnums": true, "noImplicitThis": true, - "lib": ["es2015", "dom"], "removeComments": false, "inlineSourceMap": true, "declaration": true, - "target": "es6", + "target": "es5", "outDir": "dist", "alwaysStrict": true, "noUnusedLocals": true,