Skip to content

Commit

Permalink
refactor(monorepo): configure repo utils
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Sep 12, 2023
1 parent 06f95ad commit 7e35d60
Show file tree
Hide file tree
Showing 117 changed files with 2,456 additions and 2,969 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ contracts/compiled
examples/*/pnpm-lock.yaml
pnpm-debug.log
docs-json
docs
9 changes: 9 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
process.env.NODE_ENV = 'test'

module.exports = {
require: ['ts-node/register/transpile-only'],
extension: ['ts'],
watchExtensions: ['ts'],
spec: ['test/**/*.test.ts'],
timeout: 300_000,
}
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ package.json
CHANGELOG.md
**/*.sol
README.md
/packages/nucypher-ts/src/contracts/ethers-typechain/
/packages/shared/src/contracts/ethers-typechain/
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Contribution Guide

Download, install, build, and test with:

```bash
git clone https://github.com/nucypher/nucypher-ts
cd nucypher-ts
pnpm install
```

## Development

TODO: Update

```bash
pnpm build
pnpm test
```

## Documentation

TODO: Update

## Publishing

TODO: Update
2 changes: 1 addition & 1 deletion examples/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "node index.js"
},
"dependencies": {
"@nucypher/nucypher-ts": "workspace:*",
"@nucypher/nucypher-ts": "^1.0.0-alpha.5",
"cors": "^2.8.5",
"express": "^4.18.2"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/react-craco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"dependencies": {
"@craco/craco": "^6.4.3",
"@nucypher/nucypher-ts": "workspace:*",
"@nucypher/nucypher-ts": "^1.0.0-alpha.5",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
Expand Down
4 changes: 2 additions & 2 deletions examples/react-webpack-5-experiments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"description": "A usage example for nucypher-ts",
"author": "Piotr Rosłaniec <[email protected]>",
"scripts": {
"build": "tsc --noEmit && rimraf build && webpack --mode production --progress",
"build": "tsc && rimraf build && webpack --mode production --progress",
"start": "webpack serve --mode development"
},
"dependencies": {
"@nucypher/nucypher-ts": "workspace:*",
"@nucypher/nucypher-ts": "^1.0.0-alpha.5",
"ethers": "^5.4.1",
"file-loader": "^6.2.0",
"react": "^17.0.0",
Expand Down
12 changes: 6 additions & 6 deletions examples/react-webpack-5-experiments/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export function App() {
if (!provider) {
return;
}
const secretKey = SecretKey.fromBytes(Buffer.from('fake-secret-key-32-bytes-alice-x'));
const secretKey = SecretKey.fromBEBytes(Buffer.from('fake-secret-key-32-bytes-alice-x'));
const alice = Alice.fromSecretKey(config, secretKey, provider);
setAlice(alice);
};

const makeBob = () => {
const secretKey = SecretKey.fromBytes(Buffer.from('fake-secret-key-32-bytes-bob-xxx'));
const secretKey = SecretKey.fromBEBytes(Buffer.from('fake-secret-key-32-bytes-bob-xxx'));
const bob = Bob.fromSecretKey(config, secretKey);
setBob(bob);
};
Expand Down Expand Up @@ -103,18 +103,18 @@ export function App() {
<div className="stack left">
<div>
<div>Create Alice and Bob</div>
<button onClick={(e) => makeCharacters()}>Go</button>
<button onClick={() => makeCharacters()}>Go</button>
<div>
{alice && (
<span>
Alice: {`0x${toHexString(alice.verifyingKey.toBytes())}`}
Alice: {`0x${toHexString(alice.verifyingKey.toCompressedBytes())}`}
</span>
)}
</div>
<div>
{bob && (
<span>
Bob: {`0x${toHexString(bob.verifyingKey.toBytes())}`}
Bob: {`0x${toHexString(bob.verifyingKey.toCompressedBytes())}`}
</span>
)}
</div>
Expand All @@ -123,7 +123,7 @@ export function App() {
{alice && bob && (
<div>
<div>Create a policy</div>
<button onClick={(e) => runExample()}>Go</button>
<button onClick={() => runExample()}>Go</button>
</div>
)}

Expand Down
2 changes: 1 addition & 1 deletion examples/webpack-5-experiments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"start": "webpack-dev-server"
},
"dependencies": {
"@nucypher/nucypher-ts": "workspace:*"
"@nucypher/nucypher-ts": "^1.0.0-alpha.5"
},
"devDependencies": {
"copy-webpack-plugin": "^10.2.4",
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"start": "webpack-dev-server"
},
"dependencies": {
"@nucypher/nucypher-ts": "workspace:*",
"@nucypher/nucypher-ts": "^1.0.0-alpha.5",
"ethers": "^5.5.2"
},
"devDependencies": {
Expand Down
22 changes: 22 additions & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/** @type {import('jest').Config} */
const config = {
"preset": "ts-jest",
"testEnvironment": "node",
"transform": {
"^.+\\.ts": "babel-jest"
},
"coverageReporters": [
"json",
"text",
"html",
"lcov",
"clover"
],
"collectCoverage": true,
"coverageDirectory": "coverage",
"collectCoverageFrom": [
"src/**/*.ts"
]
}

module.exports = config;
22 changes: 0 additions & 22 deletions jest.config.js

This file was deleted.

20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
"license": "GPL-3.0-only",
"author": "Piotr Roslaniec <[email protected]>",
"scripts": {
"postinstall": "pnpm build",
"docs": "run-s docs:root docs:packages",
"docs:root": "typedoc",
"docs:packages": "pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' docs",
"build:docs": "run-s docs:root docs:packages docs:merge",
"docs:root": "typedoc --out build/docs",
"docs:packages": "pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' build/docs",
"docs:merge": "typedoc --entryPointStrategy merge \"docs-json/*.json\"",
"doc:publish": "gh-pages -m \"[ci skip] Updates\" -d build/docs",
"format": "prettier --check \"./**/*.ts\" README.md",
Expand All @@ -17,13 +16,14 @@
"typecheck": "pnpm --parallel --aggregate-output --reporter append-only typecheck",
"build": "tsc --build --verbose ./tsconfig.prod.json",
"watch": "tsc --build --verbose --watch ./tsconfig.prod.json",
"package:check": "pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' package-check",
"test": "pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' test",
"test:fix": "pnpm fix && pnpm format:fix && pnpm typecheck && pnpm test",
"package:check": "pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' package-check",
"packages:lint": "pnpm packages:sort --check",
"packages:sort": "sort-package-json \"package.json\" \"examples/*/package.json\" \"packages/*/package.json\"",
"exports:lint": "pnpm run --parallel --aggregate-output --reporter append-only --filter './packages/**' exports:lint",
"fix": "pnpm lint:fix && pnpm format:fix && pnpm packages:sort",
"ci:lint": "pnpm lint && pnpm typecheck && pnpm package:check && pnpm packages:lint"
"ci:lint": "run-p lint typecheck package:check packages:lint exports:lint"
},
"devDependencies": {
"@skypack/package-check": "^0.2.2",
Expand All @@ -47,7 +47,8 @@
"prettier": "^2.8.8",
"sort-package-json": "^2.5.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"ts-jest-resolver": "^2.0.1",
"ts-node": "^10.7.0",
"ts-unused-exports": "^10.0.1",
"typedoc": "^0.25.1",
"typedoc-plugin-missing-exports": "^2.1.0",
Expand All @@ -57,7 +58,10 @@
"baseDir": ".",
"files": [
{
"path": "**/nucypher-ts/build/**/*.*"
"path": "**/shared/build/**/*.*"
},
{
"path": "**/taco/build/**/*.*"
}
]
},
Expand Down
Loading

0 comments on commit 7e35d60

Please sign in to comment.