Skip to content

Commit 6a4f500

Browse files
committed
Make packages JSR ready
1 parent 089daed commit 6a4f500

File tree

257 files changed

+928
-827
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+928
-827
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ node_modules
2222
!.yarn/versions
2323

2424
# Deno
25-
deno.lock
25+
deno.lock
26+
# Dnt generate npm package
27+
packages/*/npm/

deno.jsonc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
{
2-
"nodeModulesDir": "auto"
2+
"nodeModulesDir": "auto",
3+
"workspace": [
4+
"./packages/as-sha256",
5+
"./packages/persistent-merkle-tree",
6+
"./packages/persistent-ts",
7+
"./packages/simpleserialize.com",
8+
"./packages/ssz"
9+
],
10+
"tasks": {
11+
"test": "deno task --filter ssz test:unit"
12+
},
13+
"imports": {
14+
"@deno/dnt": "jsr:@deno/dnt@^0.41.3"
15+
}
316
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"scripts": {
99
"clean": "lerna run clean",
1010
"generate": "lerna run generate",
11-
"build": "yarn clean && lerna run build",
1211
"lint": "lerna run lint",
1312
"check-types": "lerna run check-types",
1413
"test:browsers": "lerna run test:browsers",

packages/as-sha256/build.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {build, emptyDir} from "@deno/dnt";
2+
import packageJSON from "./package.json" with {type: "json"};
3+
import {getBuildOptions} from "../../scripts/build_npm.ts";
4+
5+
await emptyDir("./npm");
6+
7+
await build({
8+
...getBuildOptions(packageJSON),
9+
entryPoints: ["./src/index.ts"],
10+
});

packages/as-sha256/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
"url": "git+https://github.com/chainsafe/ssz.git"
1414
},
1515
"type": "module",
16-
"main": "./lib/index.js",
17-
"types": "./lib/index.d.ts",
16+
"main": "src/index.ts",
1817
"files": [
19-
"lib",
2018
"build"
2119
],
2220
"scripts": {
@@ -32,7 +30,7 @@
3230
"asbuild:simd": "yarn asbuild:simd:untouched && yarn asbuild:simd:optimized",
3331
"build:lib": "tsc -p tsconfig.build.json",
3432
"build:web": "webpack --mode production --entry ./index.js --output ./dist/as-sha256.min.js",
35-
"build": "yarn asbuild && yarn asbuild:simd && yarn generate && yarn build:lib",
33+
"build": "yarn asbuild && yarn asbuild:simd && yarn generate",
3634
"test:unit": "vitest run --dir test/unit/",
3735
"test:browsers": "vitest run --config ./vitest.browser.config.ts --dir test/unit",
3836
"benchmark": "node -r ts-node/register ./node_modules/.bin/benchmark 'test/perf/*.test.ts'",

packages/as-sha256/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {allocUnsafe} from "./alloc.js";
2-
import {newInstance, WasmContext} from "./wasm.js";
3-
import type {HashObject} from "./hashObject.js";
4-
import {byteArrayIntoHashObject, byteArrayToHashObject, hashObjectToByteArray} from "./hashObject.js";
5-
import SHA256 from "./sha256.js";
1+
import {allocUnsafe} from "./alloc.ts";
2+
import {newInstance, WasmContext} from "./wasm.ts";
3+
import type {HashObject} from "./hashObject.ts";
4+
import {byteArrayIntoHashObject, byteArrayToHashObject, hashObjectToByteArray} from "./hashObject.ts";
5+
import SHA256 from "./sha256.ts";
66
export {HashObject, byteArrayToHashObject, hashObjectToByteArray, byteArrayIntoHashObject, SHA256};
77

88
let ctx: WasmContext;

packages/as-sha256/src/sha256.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {newInstance, WasmContext} from "./wasm.js";
1+
import {newInstance, WasmContext} from "./wasm.ts";
22

33
/**
44
* Class based SHA256

packages/as-sha256/src/wasm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {wasmCode} from "./wasmCode.js";
2-
import {wasmSimdCode} from "./wasmSimdCode.js";
1+
import {wasmCode} from "./wasmCode.ts";
2+
import {wasmSimdCode} from "./wasmSimdCode.ts";
33

44
export interface WasmContext {
55
readonly HAS_SIMD: boolean;

packages/as-sha256/test/unit/getSimdTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
55
import {describe, beforeAll, expect, it} from "vitest";
66
import crypto from "crypto";
7-
import {byteArrayToHashObject, hashObjectToByteArray} from "../../src/hashObject.js";
7+
import {byteArrayToHashObject, hashObjectToByteArray} from "../../src/hashObject.ts";
88

99
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1010
export function getSimdTests(sha256: any, useSimd: boolean): void {

packages/as-sha256/test/unit/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
digest64,
99
digest64HashObjects,
1010
hashObjectToByteArray,
11-
} from "../../src/index.js";
11+
} from "../../src/index.ts";
1212

1313
describe("hashObjectToByteArray and byteArrayToHashObject", function () {
1414
const tcs = [

0 commit comments

Comments
 (0)