Add transpilation for javascript files to ease node 6 compatibility

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-03-23 18:22:48 +00:00
parent 7945bb5a77
commit 8fc11df959
3 changed files with 9 additions and 10 deletions

View File

@ -9,12 +9,12 @@
},
"scripts": {
"start": "./entry.sh",
"build": "webpack",
"build:debug": "npm run typescript:release && npm run coffeescript:release && npm run migrations:copy && npm run packagejson:copy",
"build": "npm run typescript:release && webpack",
"build:debug": "npm run typescript:release && npm run coffeescript:release && npm run packagejson:copy",
"lint": "npm run lint:coffee && npm run lint:typescript",
"test": "npm run lint && npm run test-nolint",
"test-nolint": "npm run test:build && TEST=1 JUNIT_REPORT_PATH=report.xml istanbul cover _mocha && npm run coverage",
"test:build": "npm run typescript:test-build && npm run coffeescript:test && npm run testitems:copy && npm run migrations:copy-test && npm run packagejson:copy",
"test:build": "npm run typescript:test-build && npm run coffeescript:test && npm run testitems:copy && npm run packagejson:copy",
"coverage": "istanbul report text && istanbul report html",
"test:fast": "TEST=1 mocha --opts test/fast-mocha.opts",
"test:debug": "npm run test:build && TEST=1 mocha --inspect-brk",
@ -23,8 +23,6 @@
"typescript:release": "tsc --project tsconfig.release.json && cp -r build/src/* build && rm -rf build/src",
"coffeescript:test": "coffee -m -c -o build .",
"coffeescript:release": "coffee -m -c -o build src",
"migrations:copy": "cp -r src/migrations build/",
"migrations:copy-test": "cp -r src/migrations build/src",
"packagejson:copy": "cp package.json build/",
"testitems:copy": "cp -r test/data build/test/",
"lint:coffee": "balena-lint src/ test/",

View File

@ -8,7 +8,8 @@
"outDir": "./build/",
"skipLibCheck": true,
"lib": ["es6"],
"resolveJsonModule": true
"resolveJsonModule": true,
"allowJs": true
},
"include": ["src/**/*.ts", "test/**/*.ts", "typings/**/*.d.ts"]
"include": ["src/**/*.ts", "src/**/*.js", "test/**/*.ts", "typings/**/*.d.ts"]
}

View File

@ -101,7 +101,7 @@ module.exports = function(env) {
use: require.resolve('coffee-loader'),
},
{
test: /\.ts$/,
test: /\.ts$|\.js$/,
use: [
{
loader: 'ts-loader',
@ -133,13 +133,13 @@ module.exports = function(env) {
}),
new CopyWebpackPlugin([
{
from: './src/migrations',
from: './build/migrations',
to: 'migrations',
},
]),
new webpack.ContextReplacementPlugin(
/\.\/migrations/,
path.resolve(__dirname, 'src/migrations')
path.resolve(__dirname, 'build/migrations')
),
],
};