Skip to content
Snippets Groups Projects
Commit 92f5bec5 authored by Marin Karamihalev's avatar Marin Karamihalev
Browse files

added esm and browser bundles

parent b3ea19de
No related branches found
No related tags found
No related merge requests found
......@@ -4,4 +4,7 @@ coverage/
build/
**/*.crt
**/*.key
src/testy.ts
\ No newline at end of file
src/testy.ts
lib
lib-esm
_bundles
\ No newline at end of file
.*
**/tsconfig.json
**/webpack.config.js
node_modules
src
public
\ No newline at end of file
Source diff could not be displayed: it is too large. Options to address this: view the blob.
{
"name": "usp-js",
"version": "0.1.15",
"version": "0.1.16",
"description": "Helper library for easy usp communication using mqtt over tcp or ws.",
"main": "build/src/index.js",
"main": "lib/index.js",
"web": "_bundles/index.min.js",
"scripts": {
"dev": "tsc -w --outDir build",
"build": "tsc --outDir build",
"clean": "shx rm -rf _bundles lib lib-esm",
"ts": "tsc && tsc -m es6 --outDir lib-esm",
"wb": "webpack --mode=production",
"build": "npm run clean && npm run ts && npm run wb",
"dev": "tsc --watch",
"test": "mocha tests/integration",
"docs": "npx typedoc",
"prepublishOnly": "npm run build && npm run docs"
......@@ -18,11 +22,15 @@
"protobufjs": "^6.10.1"
},
"devDependencies": {
"awesome-typescript-loader": "^5.2.1",
"mocha": "^8.2.1",
"parcel-bundler": "^1.12.4",
"typedoc": "^0.19.2",
"typescript": "^4.0.5"
"shx": "^0.3.3",
"typedoc": "^0.20.36",
"typescript": "^4.2.4",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.0.0",
"webpack-cli": "^4.6.0"
},
"type": "commonjs",
"types": "build/src/types.d.ts"
"types": "lib-esm/index.d.ts"
}
const assert = require("assert");
const connect = require("../../build/src").default;
const connect = require("../../lib").default;
const config = require("./config.json");
const fs = require('fs')
......
{
"exclude": ["node_modules", "build", "tests", "docs"],
"exclude": ["node_modules", "dist", "tests", "docs", "public", "webpack.config.js", "lib"],
"compilerOptions": {
"target": "ES5",
"module": "CommonJS",
"lib": ["ESNext"],
"allowJs": true,
"outDir": "build",
// "rootDir": "src",
"outDir": "lib",
"strict": true,
"noImplicitAny": false,
......@@ -17,7 +16,7 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"declaration": true,
"declaration": true
},
"compileOnSave": true,
"typedocOptions": {
......@@ -25,6 +24,12 @@
"out": "public",
"inputFiles": ["./src"],
"includeDeclarations": true,
"exclude": ["**/node_modules/**", "**/testy.ts", "**/protobuf-spec/**", "**/usp/**"]
"exclude": [
"**/node_modules/**",
"**/testy.ts",
"**/lib/**",
"**/protobuf-spec/**",
"**/usp/**"
]
}
}
const path = require("path");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
module.exports = {
entry: {
"index": "./src/index.ts",
},
output: {
path: path.resolve(__dirname, "_bundles"),
filename: "[name].js",
libraryTarget: "umd",
library: "UspJs",
umdNamedDefine: true,
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
devtool: "source-map",
optimization: {
minimizer: [
new UglifyJsPlugin({
uglifyOptions: {
minimize: true,
sourceMap: true,
include: /\.min\.js$/,
},
}),
],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader",
exclude: /node_modules/,
query: {
declaration: false,
},
},
],
},
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment