Add and configure Webpack as build tool

This commit is contained in:
Sam Vervaeck 2020-05-30 11:31:38 +02:00
parent f01e82b532
commit 1636a3c6f4
6 changed files with 4263 additions and 4 deletions

3
.babelrc Normal file
View file

@ -0,0 +1,3 @@
{
"plugins": ["@babel/plugin-proposal-class-properties"]
}

4
.gitignore vendored
View file

@ -8,3 +8,7 @@ lib/
# bolt
.bolt-work/
# webpack
/build/
/dist/

4217
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,10 +4,11 @@
"description": "A programming language for rapid prototyping",
"main": "lib/index.js",
"bin": {
"bolt": "lib/bin/bolt.js",
"bolt-treegen": "lib/bin/bolt-treegen.js"
"bolt": "build/bin/bolt.js"
},
"scripts": {
"watch": "webpack --watch --config webpack.dev.js",
"prepare": "webpack --config webpack.dev.js",
"test": "mocha lib/test"
},
"author": "Sam Vervaeck <vervaeck.sam@skynet.be>",
@ -36,9 +37,17 @@
"yargs": "^15.3.1"
},
"devDependencies": {
"@babel/core": "^7.10.1",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@types/chai": "^4.2.11",
"@types/mocha": "^7.0.2",
"babel-loader": "^8.1.0",
"chai": "^4.2.0",
"mocha": "^7.2.0"
"concurrently": "^5.2.0",
"mocha": "^7.2.0",
"ts-loader": "^7.0.5",
"typescript": "^3.9.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
}
}

View file

@ -1,4 +1,3 @@
#!/usr/bin/env node
import "reflect-metadata"
import "source-map-support/register"

27
webpack.dev.js Normal file
View file

@ -0,0 +1,27 @@
const webpack = require("webpack");
const path = require("path");
module.exports = {
target: 'node',
mode: 'development',
entry: './src/bin/bolt.ts',
output: {
filename: 'bin/bolt.js',
path: path.resolve(__dirname, 'build'),
},
resolve: {
extensions: [".ts", ".js"],
},
plugins: [
new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
],
devtool: 'source-map',
module: {
rules: [
{ test: /\.ts$/, loader: "ts-loader", options: { transpileOnly: true } },
{ test: /\.m?js$/, exclude: /node_modules/, loader: 'babel-loader' },
]
}
};