Skip to content

Commit

Permalink
Separate builds for node and the browser and compilers can now differ…
Browse files Browse the repository at this point in the history
…entiate
  • Loading branch information
fuzzc0re committed Sep 29, 2023
1 parent c3008c3 commit 78dc879
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
"npm": ">=8"
},
"dependencies": {
"@deliberative/crypto": "file:deliberative-crypto-0.7.5.tgz"
"@deliberative/crypto": "file:deliberative-crypto-1.0.4.tgz"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@deliberative/crypto",
"description": "Libsodium, Merkle trees, Shamir secret sharing wasm module for nodejs and the browser.",
"version": "1.0.4",
"version": "1.0.5",
"repository": {
"type": "git",
"url": "https://github.com/deliberative/crypto.git"
Expand Down Expand Up @@ -44,7 +44,7 @@
".": {
"node": {
"module": "./lib/index.node.mjs",
"require": "./lib/index.cjs",
"require": "./lib/index.node.cjs",
"import": "./lib/index.node.mjs"
},
"browser": {
Expand All @@ -69,7 +69,7 @@
"code:debug": "cross-env NODE_ENV=development rollup --config rollup.config.ts --configPlugin typescript",
"build:browser": "cross-env NODE_OR_BROWSER=browser npm-run-all -s wasm code",
"build:node": "cross-env NODE_OR_BROWSER=node npm-run-all -s wasm code",
"build": "npm-run-all -s build:browser build:node",
"build": "npm-run-all -s build:node build:browser",
"postbuild": "node scripts/post.js",
"build:browser:debug": "cross-env NODE_OR_BROWSER=browser npm-run-all -s wasm:debug code:debug postbuild",
"build:node:debug": "cross-env NODE_OR_BROWSER=node npm-run-all -s wasm:debug code:debug postbuild",
Expand Down
12 changes: 6 additions & 6 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import replace from "@rollup/plugin-replace";
import typescript from "@rollup/plugin-typescript";
import url from "@rollup/plugin-url";
// import { terser } from "rollup-plugin-terser";
import analyzer from "rollup-plugin-analyzer";
// import analyzer from "rollup-plugin-analyzer";
import copy from "rollup-plugin-copy";
import fs from "node:fs";

Expand All @@ -22,16 +22,16 @@ const plugins = [
"process.env.NODE_ENV": JSON.stringify(production),
}),

commonjs(),

resolve({
// jsnext: true,
// main: true,
// module: true,
browser: true,
preferBuiltins: false,
browser,
preferBuiltins: !browser,
}),

commonjs(),

url(),

json({
Expand Down Expand Up @@ -64,7 +64,7 @@ const plugins = [
],
}),

analyzer(),
// analyzer(),
];

export default [
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const withJS = ` \
-s MODULARIZE=1 \
-s MAIN_MODULE=2 \
-s POLYFILL=0 \
-s BUILD_AS_WORKER=1 \
-s NO_DYNAMIC_EXECUTION=1 \
`;

const browser = process.env.NODE_OR_BROWSER === "browser" ? ` \
Expand Down

0 comments on commit 78dc879

Please sign in to comment.