Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add lerna and use yarn workspaces #50

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ package-lock.json
**/lib/*.ts
build
cache
out
out

# lerna
lerna-debug.log
4 changes: 4 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "0.0.23"
}
17 changes: 17 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "test"],
"parallel": 4
}
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": [],
"production": ["default"]
}
}
25 changes: 15 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
{
"private": true,
"name": "sismo-connect-sdk",
"version": "1.0.8",
"description": "Sismo Connect packages",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/index.d.ts",
"workspaces": [
"packages/*"
],
"scripts": {
"build": "yarn && yarn build:sismo-connect-client && yarn build:sismo-connect-server && yarn build:sismo-connect-react",
"build:sismo-connect-client": "cd packages/sismo-connect-client && yarn && yarn build",
"build:sismo-connect-server": "cd packages/sismo-connect-server && yarn && yarn build",
"build:sismo-connect-react": "cd packages/sismo-connect-react && yarn && yarn build",
"prepare": "yarn prepare:client && yarn prepare:server",
"prepare:client": "cd ./packages/sismo-connect-client && yarn",
"prepare:server": "cd ./packages/sismo-connect-server && yarn",
"clean": "npx lerna clean --yes",
"build": "npx lerna run build",
"build:client": "npx lerna run build --scope=@sismo-core/sismo-connect-client",
"build:server": "npx lerna run build --scope=@sismo-core/sismo-connect-server",
"build:react": "npx lerna run build --scope=@sismo-core/sismo-connect-react",
"build:common": "npx lerna run build --scope=@sismo-core/sismo-connect-common",
"test": "npx lerna run test",
"test:client": "npx lerna run test --scope=@sismo-core/sismo-connect-client",
"test:server": "npx lerna run test --scope=@sismo-core/sismo-connect-server",
"eslint": "eslint --max-warnings=0",
"prettier": "prettier --write 'packages/**/*'",
"prettier:check": "prettier --check 'packages/**/*'",
"test": "yarn test:client && yarn test:server",
"test:client": "cd ./packages/sismo-connect-client && yarn test",
"test:server": "cd ./packages/sismo-connect-server && yarn test"
"clear-nx-cache": "nx reset"
},
"devDependencies": {
"eslint": "^8.34.0",
"lerna": "^7.1.5",
"prettier": "^2.8.4",
"tslib": "^2.5.0",
"typescript": "^4.9.5"
Expand Down
46 changes: 46 additions & 0 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@sismo-core/sismo-connect-common",
"version": "0.0.23",
"description": "Sismo Connect common package",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "rollup -c --bundleConfigAsCjs",
"eslint": "eslint --max-warnings=0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-typescript": "^11.0.0",
"prettier": "^3.0.0",
"rollup": "^3.15.0",
"rollup-plugin-dts": "^5.1.1",
"ts-node": "^10.9.1",
"tslib": "2.4.0",
"typescript": "^4.9.5"
},
"publishConfig": {
"access": "restricted"
},
"files": [
"lib",
"src"
],
"repository": "git@github.com:sismo-core/sismo-connect-packages.git",
"author": "leo@sismo.io",
"license": "MIT",
"dependencies": {
"@ethersproject/bignumber": "5.7.0",
"js-base64": "^3.7.5",
"pako": "^2.1.0",
"viem": "^0.3.1"
},
"lint-staged": {
"src/**/*": "prettier --write --ignore-unknown",
"src/**/*.{ts,tsx,js,jsx}": [
"eslint --max-warnings=0"
]
}
}
34 changes: 34 additions & 0 deletions packages/common/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";

export default [
{
input: "src/index.ts",
output: [
{
file: "lib/esm/index.js",
format: "esm",
sourcemap: true,
},
{
file: "lib/cjs/index.js",
format: "cjs",
sourcemap: true,
},
],
plugins: [resolve(), commonjs(), typescript({ tsconfig: "./tsconfig.json" })],
external: ["viem", "js-base64", "pako"],
},
{
input: "lib/esm/types/index.d.ts",
output: [
{
file: "lib/index.d.ts",
format: "esm",
},
],
plugins: [dts.default()],
},
];
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./types";
2 changes: 0 additions & 2 deletions packages/common/types.ts → packages/common/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { BigNumberish } from "@ethersproject/bignumber";

export const SISMO_CONNECT_VERSION = `sismo-connect-v1.1`;

export type SismoConnectRequest = {
Expand Down
9 changes: 9 additions & 0 deletions packages/common/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib",
"declarationDir": "./types"
},
"include": ["src", "./rollup.config.js"],
"exclude": ["node_modules"]
}
7 changes: 6 additions & 1 deletion packages/sismo-connect-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@
"lib",
"src"
],
"repository": "git@github.com:sismo-core/sismo-connect-packages.git",
"repository": {
"type": "git",
"url": "git@github.com:sismo-core/sismo-connect-packages.git",
"directory": "packages/sismo-connect-client"
},
"author": "leo@sismo.io",
"license": "MIT",
"dependencies": {
"@sismo-core/sismo-connect-common": "workspace:*",
"@ethersproject/bignumber": "5.7.0",
"js-base64": "^3.7.5",
"pako": "^2.1.0",
Expand Down
Loading