From 55c1fc8ea8b972b76e9913b79c8897c6f104751f Mon Sep 17 00:00:00 2001 From: ilya saldin Date: Tue, 30 Apr 2024 17:36:13 +0500 Subject: [PATCH] feat(global): setup CD --- commitlint.config.ts | 2 +- nx.json | 76 +++++++++++++++++--------------------- package.json | 9 +++-- packages/core/package.json | 4 +- packages/core/project.json | 19 ++++++++-- project.json | 2 +- 6 files changed, 59 insertions(+), 53 deletions(-) diff --git a/commitlint.config.ts b/commitlint.config.ts index b8a089c..1ae2c65 100644 --- a/commitlint.config.ts +++ b/commitlint.config.ts @@ -38,7 +38,7 @@ export default { 'scope-enum': [ RuleConfigSeverity.Error, 'always', - ['global', 'core', 'examples', 'ethers', 'web3.js'], + ['global', 'core', 'examples', 'ethers', 'web3.js', 'release'], ], }, prompt: { diff --git a/nx.json b/nx.json index 450cd6d..c0050af 100644 --- a/nx.json +++ b/nx.json @@ -1,4 +1,5 @@ { + "extends": "nx/presets/npm.json", "$schema": "./node_modules/nx/schemas/nx-schema.json", "namedInputs": { "default": ["{projectRoot}/*", "{projectRoot}/**/*", "sharedGlobals"], @@ -14,48 +15,6 @@ ], "sharedGlobals": [] }, - "plugins": [ - { - "plugin": "@nx/vite/plugin", - "options": { - "buildTargetName": "build", - "previewTargetName": "preview", - "testTargetName": "test", - "serveTargetName": "serve", - "serveStaticTargetName": "serve-static" - } - }, - { - "plugin": "@nx/eslint/plugin", - "options": { - "targetName": "lint" - } - }, - { - "plugin": "@nx/jest/plugin", - "options": { - "targetName": "test" - } - } - ], - "generators": { - "@nx/react": { - "application": { - "babel": true, - "style": "tailwind", - "linter": "eslint", - "bundler": "vite" - }, - "component": { - "style": "tailwind" - }, - "library": { - "style": "tailwind", - "linter": "eslint", - "unitTestRunner": "vitest" - } - } - }, "targetDefaults": { "@nx/js:tsc": { "dependsOn": ["^build"], @@ -67,8 +26,39 @@ } }, "release": { + "projects": ["*"], "version": { - "preVersionCommand": "npx nx run-many -t build" + "preVersionCommand": "npx nx run-many -t build", + "conventionalCommits": true + }, + "changelog": { + "workspaceChangelog": { + "createRelease": "github", + "renderOptions": { + "authors": false + } + } + }, + "conventionalCommits": { + "types": { + "refactor": { + "semverBump": "patch", + "title": "Refactoring" + } + } + } + }, + "plugins": [ + { + "plugin": "@nx/eslint/plugin", + "options": { + "targetName": "lint" + } + } + ], + "pluginsConfig": { + "@nx/js": { + "analyzeSourceFiles": true } } } diff --git a/package.json b/package.json index 757661f..cb1fbf1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@ditto-sdk/source", - "version": "0.0.0", + "name": "ditto-sdk-monorepo", + "version": "0.1.0", "license": "MIT", "scripts": { "nx": "nx", @@ -69,7 +69,7 @@ "vite": "~5.0.0", "vite-plugin-dts": "~2.3.0", "vitest": "^1.3.1", - "@ditto-network/core": "file:packages/core", + "@ditto-network/core": "0.4.0", "@ditto-network/ethers": "file:packages/ethers", "@ditto-network/web3.js": "file:packages/web3js", "web3": "4.8.0" @@ -82,6 +82,9 @@ "path": "@commitlint/cz-commitlint" } }, + "workspaces": [ + "packages/*" + ], "nx": { "includedScripts": [] } diff --git a/packages/core/package.json b/packages/core/package.json index 064b247..b51e6ff 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@ditto-network/core", - "version": "0.0.4", + "version": "0.1.0", "files": [ "src" ], @@ -11,7 +11,7 @@ "ethers": "6.11.1", "ethers5": "npm:ethers@5.7.1", "fetch-ponyfill": "7.1.0", - "rambda": "9.2.0" + "rambda": "^9.2.0" }, "type": "commonjs", "main": "./src/index.js", diff --git a/packages/core/project.json b/packages/core/project.json index 5cc9ced..67b8f4c 100644 --- a/packages/core/project.json +++ b/packages/core/project.json @@ -1,18 +1,31 @@ { - "name": "ditto-sdk", + "name": "core", "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/core/src", "projectType": "library", + "release": { + "version": { + "generatorOptions": { + "packageRoot": "dist/{projectRoot}", + "currentVersionResolver": "git-tag" + } + } + }, "targets": { + "nx-release-publish": { + "options": { + "packageRoot": "dist/{projectRoot}" + } + }, "prepare-prod-config": { - "command": "mv ./dist/ditto-sdk/src/lib/config/config.prod.js ./dist/ditto-sdk/src/lib/config/config.js", + "command": "mv dist/packages/core/src/lib/config/config.prod.js dist/packages/core/src/lib/config/config.js", "dependsOn": ["compile"] }, "compile": { "executor": "@nx/js:tsc", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/ditto-sdk", + "outputPath": "dist/packages/core", "main": "packages/core/src/index.ts", "tsConfig": "packages/core/tsconfig.lib.json", "assets": ["packages/core/*.md"] diff --git a/project.json b/project.json index e1ca279..f5e859e 100644 --- a/project.json +++ b/project.json @@ -1,5 +1,5 @@ { - "name": "@ditto-sdk/source", + "name": "ditto-sdk-monorepo", "$schema": "node_modules/nx/schemas/project-schema.json", "targets": { "local-registry": {