Skip to content

Commit

Permalink
Node refactor (#254)
Browse files Browse the repository at this point in the history
* checkpoint

* Fix compiler errors

* Remove dry-run version bump
  • Loading branch information
SebastienGllmt authored Nov 16, 2023
1 parent 7b95a46 commit 798a7e0
Show file tree
Hide file tree
Showing 81 changed files with 1,330 additions and 2,424 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"editor.tabSize": 2,
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
Expand Down
6 changes: 6 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"groups": {
"paima-sdk": {
"projects": ["directory:packages/paima-sdk/*"]
},
"node-sdk": {
"projects": ["directory:packages/node-sdk/*"]
},
"build-utils": {
"projects": ["directory:packages/build-utils/*"]
}
}
}
Expand Down
3,635 changes: 1,231 additions & 2,404 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"prebuild": "npx nx run-many --parallel=${NX_PARALLEL:-3} -t prebuild",
"build": "npm run lint:configs && npx nx run-many --parallel=${NX_PARALLEL:-3} -t build",
"test": "npm run lint:configs && npx nx run-many --parallel=${NX_PARALLEL:-3} -t test",
"release:lib": "./wipe.sh && sh ./tools/scripts/bump-version.sh && npm run build && npm run lint && npm run test && read -p 'Enter OTP: ' otp && export NPM_CONFIG_OTP=$otp && npx nx release publish -g paima-sdk",
"release:lib": "./wipe.sh && sh ./tools/scripts/bump-version.sh && npm run build && npm run lint && npm run test && read -p 'Enter OTP: ' otp && export NPM_CONFIG_OTP=$otp && npx nx release publish -g paima-sdk && npx nx release publish -g node-sdk",
"release:bin": "./wipe.sh && npm run lint:configs && npx nx run-many --parallel=${NX_PARALLEL:-3} -t release && mkdir -p ./bin && cp -r ./packages/engine/paima-standalone/packaged/@standalone/* ./bin"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions packages/build-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.base.json",
}
4 changes: 2 additions & 2 deletions packages/engine/paima-funnel/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
{ "path": "../../paima-sdk/paima-utils/tsconfig.build.json" },
{ "path": "../paima-runtime/tsconfig.build.json" },
{ "path": "../../paima-sdk/paima-prando" },
{ "path": "../../paima-sdk/paima-db" },
{ "path": "../../paima-sdk/paima-utils-backend" },
{ "path": "../../node-sdk/paima-db" },
{ "path": "../../node-sdk/paima-utils-backend" },
{ "path": "../../paima-sdk/paima-crypto/tsconfig.build.json" },
{ "path": "../../paima-sdk/paima-concise/tsconfig.build.json" },
]
Expand Down
2 changes: 1 addition & 1 deletion packages/engine/paima-runtime/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"include": ["src/**/*", "test/**/*"],
"references": [
{ "path": "../../paima-sdk/paima-utils/tsconfig.build.json" },
{ "path": "../../paima-sdk/paima-db" },
{ "path": "../../node-sdk/paima-db" },
]
}
4 changes: 2 additions & 2 deletions packages/engine/paima-sm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"references": [
{ "path": "../../paima-sdk/paima-utils/tsconfig.build.json" },
{ "path": "../paima-runtime/tsconfig.build.json" },
{ "path": "../../paima-sdk/paima-db" },
{ "path": "../../node-sdk/paima-db" },
{ "path": "../../paima-sdk/paima-prando" },
{ "path": "../../paima-sdk/paima-concise/tsconfig.build.json" },
{ "path": "../../paima-sdk/paima-utils-backend" },
{ "path": "../../node-sdk/paima-utils-backend" },
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"src/**/*.json"
],
"references": [
{ "path": "../paima-utils/tsconfig.build.json" }
{ "path": "../../paima-sdk/paima-utils/tsconfig.build.json" }
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
export default {
displayName: '@paima/utils-backend',
preset: '../../../jest.preset.js',
coverageDirectory: '../../../coverage/packages/engine/paima-utils-backend',
coverageDirectory: '../../../coverage/packages/node-sdk/paima-utils-backend',
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"include": ["src/**/*"],
"references": [
{ "path": "../paima-db" },
{ "path": "../paima-utils/tsconfig.build.json" },
{ "path": "../../paima-sdk/paima-utils/tsconfig.build.json" },
]
}
5 changes: 5 additions & 0 deletions packages/node-sdk/publish-wrapper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Paima Node SDK

Node-only portion of the SDK for Paima Engine. This package wraps all other core node-only packages of the Paima SDK, allowing to easily get access to all Paima features with a single dependency. This dependency can be excluded in frontends to compatibility with non-node based environments.

You can find the full docs for Paima [here](https://docs.paimastudios.com/).
32 changes: 32 additions & 0 deletions packages/node-sdk/publish-wrapper/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@paima/node-sdk",
"version": "2.0.1",
"publishConfig": {
"access": "public"
},
"description": "Node SDK for Paima Engine",
"type": "module",
"author": "Paima Studios",
"license": "See license file",
"repository": {
"type": "git",
"url": "git+https://github.com/PaimaStudios/paima-engine.git"
},
"homepage": "https://docs.paimastudios.com",
"keywords": [
"autonomous worlds",
"focg",
"onchain game",
"paima"
],
"scripts": {
"lint:eslint": "eslint .",
"build:copy": "cp package.json ./build/ && cp README.md ./build/",
"build": "npx tsc --build tsconfig.json && npm run build:copy"
},
"devDependencies": {},
"dependencies": {
"@paima/db": "2.0.1",
"@paima/utils-backend": "2.0.1"
}
}
12 changes: 12 additions & 0 deletions packages/node-sdk/publish-wrapper/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@paima/node-sdk",
"targets": {
"nx-release-publish": {
"dependsOn": ["^nx-release-publish"],
"executor": "@nx/js:release-publish",
"options": {
"packageRoot": "{projectRoot}/build/"
}
}
}
}
File renamed without changes.
17 changes: 17 additions & 0 deletions packages/node-sdk/publish-wrapper/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build",
"resolveJsonModule": true
},
"include": [
"src/**/*",
"src/**/*.json"
],
"files": [],
"references": [
{ "path": "../paima-db" },
{ "path": "../paima-utils-backend" }
]
}
3 changes: 3 additions & 0 deletions packages/node-sdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.base.json",
}
2 changes: 0 additions & 2 deletions packages/paima-sdk/paima-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@
"dependencies": {
"@paima/concise": "2.0.1",
"@paima/crypto": "2.0.1",
"@paima/db": "2.0.1",
"@paima/executors": "2.0.1",
"@paima/mw-core": "2.0.1",
"@paima/prando": "2.0.1",
"@paima/providers": "2.0.1",
"@paima/utils-backend": "2.0.1",
"@paima/utils": "2.0.1"
}
}
1 change: 0 additions & 1 deletion packages/paima-sdk/paima-sdk/src/prando.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from '@paima/prando';
// default types are not included automatically in export *
export { default } from '@paima/prando';

export type * from '@paima/prando';
2 changes: 0 additions & 2 deletions packages/paima-sdk/paima-sdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
{ "path": "../paima-utils/tsconfig.build.json" },
{ "path": "../paima-crypto/tsconfig.build.json" },
{ "path": "../paima-providers/tsconfig.build.json" },
{ "path": "../paima-db" },
{ "path": "../paima-utils-backend" },
{ "path": "../paima-concise/tsconfig.build.json" },
{ "path": "../paima-executors" },
{ "path": "../paima-mw-core" },
Expand Down
6 changes: 4 additions & 2 deletions tools/scripts/bump-version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

read -p "Enter version number: " version && npx nx release version $version -g paima-sdk
npx nx release version $version -d -g paima-sdk
read -p "Enter version number: " version
npx nx release version $version -g paima-sdk
npx nx release version $version -g node-sdk
npx nx release version $version -g build-utils
2 changes: 1 addition & 1 deletion tools/scripts/check-implicit-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function isPackage(path: string): boolean {
return false;
}

const libFolders = ['paima-sdk'];
const libFolders = ['paima-sdk', 'node-sdk', 'build-utils'];
function isLib(path: string): boolean {
for (const lib of libFolders) {
if (path.includes(`packages/${lib}`)) {
Expand Down
7 changes: 4 additions & 3 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@
"@paima/batcher-transaction-poster/*": ["./packages/batcher/batcher-transaction-poster/*"],
"@paima/batcher-utils/*": ["./packages/batcher/utils/*"],
"@paima/batcher-webserver/*": ["./packages/batcher/webserver/*"],
"@paima/build-utils/*": ["./packages/paima-sdk/paima-build-utils/*"],
"@paima/build-utils/*": ["./packages/build-utils/paima-build-utils/*"],
"@paima/db/*": ["./packages/node-sdk/paima-db/*"],
"@paima/node-sdk/*": ["./packages/node-sdk/publish-wrapper/*"],
"@paima/utils-backend/*": ["./packages/node-sdk/paima-utils-backend/*"],
"@paima/concise/*": ["./packages/paima-sdk/paima-concise/*"],
"@paima/crypto/*": ["./packages/paima-sdk/paima-crypto/*"],
"@paima/db/*": ["./packages/paima-sdk/paima-db/*"],
"@paima/executors/*": ["./packages/paima-sdk/paima-executors/*"],
"@paima/funnel/*": ["./packages/engine/paima-funnel/*"],
"@paima/mw-core/*": ["./packages/paima-sdk/paima-mw-core/*"],
Expand All @@ -45,7 +47,6 @@
"@paima/runtime/*": ["./packages/engine/paima-runtime/*"],
"@paima/sdk/*": ["./packages/paima-sdk/paima-sdk/*"],
"@paima/sm/*": ["./packages/engine/paima-sm/*"],
"@paima/utils-backend/*": ["./packages/paima-sdk/paima-utils-backend/*"],
"@paima/utils/*": ["./packages/paima-sdk/paima-utils/*"],
"@standalone/paima-batcher/*": ["./packages/batcher/batcher-standalone/*"],
"@standalone/paima-engine/*": ["./packages/engine/paima-standalone/*"],
Expand Down

0 comments on commit 798a7e0

Please sign in to comment.