Skip to content

Commit

Permalink
migrating cjs -> esm
Browse files Browse the repository at this point in the history
  • Loading branch information
fybx committed Oct 7, 2024
1 parent b91c95b commit 3609a15
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 18 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
2 changes: 1 addition & 1 deletion dist/bundle.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">

<head>
<title>ZKL Key Derivation Service Demo</title>
</head>

<body>
<script src="bundle.js"></script>
</body>

</html>
2 changes: 1 addition & 1 deletion index.js → dist/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateKeypair } from "./key-derivation.js";
import { generateKeypair } from "../key-derivation.js";

(async () => {
console.log("start");
Expand Down
9 changes: 0 additions & 9 deletions index.html

This file was deleted.

2 changes: 1 addition & 1 deletion key-derivation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from "@scure/bip39";
import { wordlist } from "@scure/bip39/wordlists/english";
import elliptic from "elliptic";
import { Key } from "./key";
import { Key } from "./key.js";

const MNEMONIC_STRENGTH = 192;
//const CURVE = "curve25519"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@zklx/kds",
"version": "1.0.0",
"version": "1.0.1",
"description": "zk-Lokomotive key derivation service",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down
14 changes: 9 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
const path = require("path");
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
import path from "path";
import { fileURLToPath } from "url";
import webpack from "webpack";
import TerserPlugin from "terser-webpack-plugin";

module.exports = {
entry: "./index.js",
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export default {
entry: "./dist/index.js",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist")
Expand Down

0 comments on commit 3609a15

Please sign in to comment.