Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions .changeset/cruel-candles-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'codama': minor
'@codama/cli': minor
---

Decouples the `@codama/cli` package to the main `codama` library as this was causing renderer updates to unnecessarily bump core Codama libraries.
6 changes: 2 additions & 4 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@

This package provides a CLI for the Codama library that can be used to run scripts on Codama IDLs.

Note that, whilst the CLI code is located in the `@codama/cli` package, the CLI binary is directly provided by the main `codama` library.

## Getting started

To get started with Codama, simply install `codama` to your project and run the `init` command like so:
To get started with Codama, simply install `@codama/cli` which provides the `codama` binary. Then, run the `init` command like so:

```sh
pnpm install codama
pnpm install @codama/cli
codama init
```

Expand Down
File renamed without changes.
10 changes: 8 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@codama/cli",
"version": "1.0.12",
"description": "The package that provides a CLI for the Codama standard",
"description": "A CLI for setting up and managing Codama IDLs",
"exports": {
"types": "./dist/types/index.d.ts",
"node": {
Expand All @@ -13,8 +13,13 @@
"module": "./dist/index.node.mjs",
"types": "./dist/types/index.d.ts",
"type": "commonjs",
"bin": {
"codama": "./bin/cli.cjs"
},
"files": [
"./bin",
"./dist/types",
"./dist/cli.*",
"./dist/index.*"
],
"sideEffects": false,
Expand All @@ -24,8 +29,9 @@
"cli"
],
"scripts": {
"build": "rimraf dist && pnpm build:src && pnpm build:types",
"build": "rimraf dist && pnpm build:src && pnpm build:cli && pnpm build:types",
"build:src": "zx ../../node_modules/@codama/internals/scripts/build-src.mjs node",
"build:cli": "zx ../../node_modules/@codama/internals/scripts/build-src.mjs cli",
"build:types": "zx ../../node_modules/@codama/internals/scripts/build-types.mjs",
"dev": "zx ../../node_modules/@codama/internals/scripts/test-unit.mjs node --watch",
"lint": "zx ../../node_modules/@codama/internals/scripts/lint.mjs",
Expand Down
16 changes: 16 additions & 0 deletions packages/cli/src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createProgram } from '../program';
import { logDebug, logError } from '../utils';

const program = createProgram();

export async function run(argv: readonly string[]) {
try {
await program.parseAsync(argv);
} catch (err) {
if (program.opts().debug) {
logDebug(`${(err as { stack: string }).stack}`);
}
logError((err as { message: string }).message);
process.exitCode = 1;
}
}
6 changes: 1 addition & 5 deletions packages/library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@
"react-native": "./dist/index.react-native.mjs",
"types": "./dist/types/index.d.ts",
"type": "commonjs",
"bin": "./bin/cli.cjs",
"files": [
"./bin",
"./dist/types",
"./dist/cli.*",
"./dist/index.*"
],
"sideEffects": false,
Expand All @@ -42,9 +39,8 @@
"code generation"
],
"scripts": {
"build": "rimraf dist && pnpm build:src && pnpm build:cli && pnpm build:types",
"build": "rimraf dist && pnpm build:src && pnpm build:types",
"build:src": "zx ../../node_modules/@codama/internals/scripts/build-src.mjs library",
"build:cli": "zx ../../node_modules/@codama/internals/scripts/build-src.mjs cli",
"build:types": "zx ../../node_modules/@codama/internals/scripts/build-types.mjs",
"dev": "zx ../../node_modules/@codama/internals/scripts/test-unit.mjs node --watch",
"lint": "zx ../../node_modules/@codama/internals/scripts/lint.mjs",
Expand Down