Skip to content

Commit

Permalink
build: update libraries (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
lezram authored May 29, 2021
1 parent 26df3aa commit 8120d25
Show file tree
Hide file tree
Showing 8 changed files with 1,841 additions and 3,467 deletions.
22 changes: 22 additions & 0 deletions e2e/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@lezram/math-interval</title>
<script src="../dist/browser/math-interval.js"></script>
</head>
<body>

<div id="result"></div>

<script>
const Interval = MathInterval.Interval;
const timeInterval = new Interval(Date.UTC(2020, 0, 1), Date.UTC(2020, 0, 3), false, true);

console.log(timeInterval);
document.getElementById("result").innerText = JSON.stringify(timeInterval);
</script>
</body>
</html>
3 changes: 2 additions & 1 deletion e2e/test-build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const assert = require("assert");
const Interval = require("../dist/node").Interval;
const {Interval} = require("../dist/node");

const result = new Interval(1, 2);

assert.equal(result.contains(1), true);
assert.deepEqual(result, {start: 1, end: 2, includeStart: true, includeEnd: true});
console.log(result);
5,222 changes: 1,785 additions & 3,437 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lezram/math-interval",
"version": "1.0.1",
"version": "1.1.0",
"description": "Working with mathematical intervals",
"main": "dist/node/index.js",
"types": "dist/node/index.d.ts",
Expand All @@ -26,15 +26,15 @@
"license": "MIT",
"devDependencies": {
"@testdeck/jest": "^0.1.2",
"@types/jest": "^26.0.21",
"awesome-typescript-loader": "^5.2.1",
"jest": "^26.6.3",
"terser-webpack-plugin": "^5.1.1",
"ts-jest": "^26.5.4",
"ts-node": "^9.1.1",
"typescript": "^3.9.9",
"webpack": "^5.27.1",
"webpack-cli": "^4.5.0"
"@types/jest": "^26.0.23",
"jest": "^27.0.1",
"terser-webpack-plugin": "^5.1.2",
"ts-jest": "^27.0.1",
"ts-loader": "^9.2.2",
"ts-node": "^10.0.0",
"typescript": "^4.3.2",
"webpack": "^5.38.1",
"webpack-cli": "^4.7.0"
},
"files": [
"dist"
Expand Down
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
import {Interval} from "./Interval";

export {Interval};
exports = module.exports = {Interval};

export {Interval} from "./Interval";
7 changes: 5 additions & 2 deletions tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"compilerOptions": {
"module": "es6",
"moduleResolution": "Node",
"moduleResolution": "node",
"outDir": "dist/browser",
"noImplicitAny": true,
"lib": [
"es5",
"es6"
],
"sourceMap": true,
"experimentalDecorators": true
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": [
"src/**/*.ts"
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"moduleResolution": "Node",
"declaration": true,
"outDir": "dist/node",
"noImplicitAny": true,
"lib": [
"es2016"
],
Expand Down
27 changes: 15 additions & 12 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ module.exports = {
'math-interval': './src/index.ts',
'math-interval.min': './src/index.ts'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist', 'browser'),
library: 'MathInterval',
umdNamedDefine: true
},
mode: "production",
devtool: 'source-map',
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
include: /\.min\.js$/,
Expand All @@ -19,22 +26,18 @@ module.exports = {
rules: [
{
test: /\.ts$/,
loader: "awesome-typescript-loader",
use: [{
loader: 'ts-loader',
options: {
configFile: "tsconfig.browser.json"
}
}],
exclude: /node_modules/,
options: {
configFileName: 'tsconfig.browser.json'
},

},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist', 'browser'),
libraryTarget: 'var',
library: 'MathInterval',
umdNamedDefine: true
},
}
};

0 comments on commit 8120d25

Please sign in to comment.