Skip to content

Commit e081e2d

Browse files
committed
Converted dist packing to commonjs format. Add packing of the web version. Enabled production mode.
1 parent 08fc677 commit e081e2d

File tree

3 files changed

+48
-15
lines changed

3 files changed

+48
-15
lines changed

package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-forge",
3-
"version": "1.6.3",
3+
"version": "1.6.4",
44
"description": "JavaScript data transformation and analysis toolkit inspired by Pandas and LINQ.",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",
@@ -20,11 +20,13 @@
2020
"tw": "npm run test:watch",
2121
"test:watch": "nyc mocha --watch --opts ./src/test/mocha.opts",
2222
"api-docs": "typedoc --options typedoc.json --out docs/api ./src/index.ts ./src/lib/dataframe.ts ./src/lib/series.ts ./src/lib/index.ts",
23-
"prepublishOnly": "npm run clean && npm run test && npm run build && npm run pack",
23+
"prepublishOnly": "npm run clean && npm run test && npm run build && npm run pack:node && npm run pack:web",
2424
"coveralls": "nyc report --reporter=text-lcov | coveralls",
25-
"p": "npm run pack",
26-
"pack": "webpack --config webpack.node.config.js && npm run bundle-typedefs",
27-
"bundle-typedefs": "dts-bundle --name data-forge --main build/index.d.ts --baseDir = build --out ../dist/index.d.ts"
25+
"pn": "npm run pack:node",
26+
"pack:node": "webpack --config webpack.node.config.js && npm run bundle-typedefs",
27+
"pw": "npm run pack:web",
28+
"pack:web": "webpack --config webpack.web.config.js",
29+
"bundle-typedefs": "dts-bundle --name data-forge --main build/index.d.ts --baseDir = build --out ../dist/node/index.d.ts"
2830
},
2931
"repository": {
3032
"type": "git",

webpack.node.config.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
const path = require('path');
2-
const nodeExternals = require('webpack-node-externals');
1+
const path = require("path");
2+
const nodeExternals = require("webpack-node-externals");
33

44
module.exports = {
5-
entry: './src/index.ts',
5+
entry: "./src/index.ts",
66
output: {
7-
path: path.resolve(__dirname, 'dist'),
8-
filename: "index.js"
7+
path: path.resolve(__dirname, "dist", "node"),
8+
filename: "index.js",
9+
libraryTarget: "commonjs2",
910
},
1011

11-
target: 'node',
12+
target: "node",
1213
externals: [ nodeExternals() ], // Ignore all modules in node_modules folder.
13-
mode: 'development', // TODO: 'production', Want to minify the output.
14-
devtool: 'source-map',
14+
mode: "production",
15+
devtool: "source-map",
1516

1617
resolve: {
17-
extensions: [ '.tsx', '.ts', '.js' ],
18+
extensions: [ ".tsx", ".ts", ".js" ],
1819
},
1920

2021
module: {
2122
rules: [
2223
{
2324
test: /\.tsx?$/,
24-
use: 'ts-loader',
25+
use: "ts-loader",
2526
exclude: /node_modules/,
2627
},
2728
],

webpack.web.config.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const path = require("path");
2+
const nodeExternals = require("webpack-node-externals");
3+
4+
module.exports = {
5+
entry: "./src/index.ts",
6+
output: {
7+
path: path.resolve(__dirname, "dist", "web"),
8+
filename: "index.js",
9+
library: "dataForge",
10+
},
11+
12+
target: "web",
13+
mode: "production",
14+
devtool: "source-map",
15+
16+
resolve: {
17+
extensions: [ ".tsx", ".ts", ".js" ],
18+
},
19+
20+
module: {
21+
rules: [
22+
{
23+
test: /\.tsx?$/,
24+
use: "ts-loader",
25+
exclude: /node_modules/,
26+
},
27+
],
28+
},
29+
30+
};

0 commit comments

Comments
 (0)