Add and configure Webpack as build tool
This commit is contained in:
parent
f01e82b532
commit
1636a3c6f4
6 changed files with 4263 additions and 4 deletions
3
.babelrc
Normal file
3
.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"plugins": ["@babel/plugin-proposal-class-properties"]
|
||||||
|
}
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -8,3 +8,7 @@ lib/
|
||||||
# bolt
|
# bolt
|
||||||
.bolt-work/
|
.bolt-work/
|
||||||
|
|
||||||
|
# webpack
|
||||||
|
/build/
|
||||||
|
/dist/
|
||||||
|
|
||||||
|
|
4217
package-lock.json
generated
4217
package-lock.json
generated
File diff suppressed because it is too large
Load diff
15
package.json
15
package.json
|
@ -4,10 +4,11 @@
|
||||||
"description": "A programming language for rapid prototyping",
|
"description": "A programming language for rapid prototyping",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"bolt": "lib/bin/bolt.js",
|
"bolt": "build/bin/bolt.js"
|
||||||
"bolt-treegen": "lib/bin/bolt-treegen.js"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"watch": "webpack --watch --config webpack.dev.js",
|
||||||
|
"prepare": "webpack --config webpack.dev.js",
|
||||||
"test": "mocha lib/test"
|
"test": "mocha lib/test"
|
||||||
},
|
},
|
||||||
"author": "Sam Vervaeck <vervaeck.sam@skynet.be>",
|
"author": "Sam Vervaeck <vervaeck.sam@skynet.be>",
|
||||||
|
@ -36,9 +37,17 @@
|
||||||
"yargs": "^15.3.1"
|
"yargs": "^15.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.10.1",
|
||||||
|
"@babel/plugin-proposal-class-properties": "^7.10.1",
|
||||||
"@types/chai": "^4.2.11",
|
"@types/chai": "^4.2.11",
|
||||||
"@types/mocha": "^7.0.2",
|
"@types/mocha": "^7.0.2",
|
||||||
|
"babel-loader": "^8.1.0",
|
||||||
"chai": "^4.2.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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
import "reflect-metadata"
|
import "reflect-metadata"
|
||||||
import "source-map-support/register"
|
import "source-map-support/register"
|
||||||
|
|
27
webpack.dev.js
Normal file
27
webpack.dev.js
Normal 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' },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue