Skip to content

Commit

Permalink
build: use nx for release version management (#239)
Browse files Browse the repository at this point in the history
This PR integrates `nx` to manage the monorepo, at first only using it
to manage the version evolution of the different packages in the
monorepo, however, in the future we could leverage it to benefit from
cached builds, tests, etc...

I've create a `orbit-cli` package that upon calling `pnpm install` in
the repo takes care of building it and making it available in the `PATH`
env var, which then makes it possible to directly call `orbit-cli` from
the terminal.

After this PR the release process will need 2 steps:

- First calling `orbit-cli release prepare`, this will evaluate if there
is a need to bump versions based on the conventional commits available,
once completed this will stage the changes and create a release commit
that will also include a new file, the `.release.json`

- Secondly, in a follow up PR, i'll introduce a workflow that when
pushing to main it will trigger `orbit-cli release publish`, this
command leverages the `.release.json` available and creates the
necessary tags for the affected packages and will create the github
release page automatically, this leverages `nx release` from the
orbit-cli

I've setup that all packages will evolve independently, but nx takes
care of bumping the necessary versions when the package is a dependency
in another.

---------

Co-authored-by: olaszakos <[email protected]>
  • Loading branch information
keplervital and olaszakos authored May 10, 2024
1 parent de847e5 commit 9c0371a
Show file tree
Hide file tree
Showing 40 changed files with 3,514 additions and 590 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @dfinity/trust @mraszyk
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ wasms/*.wasm.gz
/src
.canbench
.canbench_output


.nx/cache
170 changes: 0 additions & 170 deletions CHANGELOG.md

This file was deleted.

22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,30 @@ members = [
"libs/orbit-essentials-macros-tests",
]

[workspace.package]
authors = ["DFINITY Stiftung"]
edition = "2021"
repository = "https://github.com/dfinity/orbit"
homepage = "https://github.com/dfinity/orbit#readme"
license = "Apache-2.0"

[profile.release]
lto = true
opt-level = 'z'
codegen-units = 1

[workspace.dependencies]
control-panel-api = { path = "./core/control-panel/api" }
upgrader-api = { path = "./core/upgrader/api" }
station-api = { path = "./core/station/api" }
anyhow = "1.0.75"
deunicode = "1.4.4"
async-trait = "0.1"
byteorder = "1.5"
canbench-rs = "0.1.1"
candid = "0.10.3"
candid_parser = "0.1.3"
canfund = { path = "./libs/canfund" }
convert_case = "0.6"
futures = "0.3"
getrandom = { version = "0.2", features = ["custom"] }
hex = "0.4"
orbit-essentials = { path = "./libs/orbit-essentials" }
orbit-essentials-macros = { path = "./libs/orbit-essentials-macros" }
ic-cdk = "0.13.2"
ic-cdk-macros = "0.9"
ic-cdk-timers = "0.7.0"
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@dfinity/orbit-wallet",
"name": "wallet-dapp",
"private": true,
"version": "0.0.1",
"type": "module",
Expand Down
5 changes: 5 additions & 0 deletions apps/wallet/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"name": "wallet-dapp",
"projectType": "application"
}
16 changes: 16 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "orbit-cli",
"version": "0.0.1",
"bin": {
"orbit-cli": "./dist/cli.js"
},
"main": "cli.js",
"scripts": {
"build": "tsc",
"start": "node dist/cli.js",
"expose": "pnpm link --global"
},
"devDependencies": {
"commander": "12.0.0"
}
}
22 changes: 22 additions & 0 deletions cli/src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { program } from 'commander';
import { version } from '../package.json';
import release from './release';

program
.storeOptionsAsProperties(false)
.version(version)
.name('orbit-cli')
.description('The Orbit CLI includes tools for managing projects in the workspace')
.command('path')
.description('Print the path to the Orbit CLI')
.action(() => console.log(__dirname));

program.addCommand(release);

program
.parseAsync()
.then(() => process.exit(0))
.catch(error => {
console.error(`The command failed with an error: ${error}`);
process.exit(1);
});
10 changes: 10 additions & 0 deletions cli/src/release/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createCommand } from 'commander';
import releasePrepare from './prepare';
import releasePublish from './publish';

const command = createCommand('release').description('Handle the release of projects');

command.addCommand(releasePrepare);
command.addCommand(releasePublish);

export default command;
Loading

0 comments on commit 9c0371a

Please sign in to comment.