Skip to content

Commit af76a71

Browse files
authored
Update codama init command to match renderer changes (#981)
1 parent cb75772 commit af76a71

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

.changeset/tiny-aliens-notice.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codama/cli': minor
3+
---
4+
5+
Update the `codama init` command to match new renderer arguments

packages/cli/src/commands/init.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ function getOutputPath(explicitOutput: string | undefined, options: Pick<InitOpt
7171
type PromptResult = {
7272
idlPath: string;
7373
jsPath?: string;
74-
rustCrate?: string;
7574
rustPath?: string;
7675
scripts: string[];
7776
};
@@ -117,19 +116,13 @@ async function getPromptResult(
117116
},
118117
{
119118
initial: defaults.jsPath,
120-
message: '[js] Where should the JavaScript code be generated?',
119+
message: '[js] Where is the JavaScript client package located?',
121120
name: 'jsPath',
122121
type: hasScript('js'),
123122
},
124123
{
125-
initial: defaults.rustCrate,
124+
initial: defaults.rustPath,
126125
message: '[rust] Where is the Rust client crate located?',
127-
name: 'rustCrate',
128-
type: hasScript('rust'),
129-
},
130-
{
131-
initial: (prev: string) => `${prev}/src/generated`,
132-
message: '[rust] Where should the Rust code be generated?',
133126
name: 'rustPath',
134127
type: hasScript('rust'),
135128
},
@@ -141,9 +134,8 @@ async function getPromptResult(
141134
function getDefaultPromptResult(): PromptResult {
142135
return {
143136
idlPath: 'program/idl.json',
144-
jsPath: 'clients/js/src/generated',
145-
rustCrate: 'clients/rust',
146-
rustPath: 'clients/rust/src/generated',
137+
jsPath: 'clients/js',
138+
rustPath: 'clients/rust',
147139
scripts: ['js', 'rust'],
148140
};
149141
}
@@ -185,7 +177,7 @@ function getConfigFromPromptResult(result: PromptResult): Config {
185177
if (result.scripts.includes('rust')) {
186178
scripts.rust = {
187179
from: '@codama/renderers-rust',
188-
args: [result.rustPath, { crateFolder: result.rustCrate, formatCode: true }],
180+
args: [result.rustPath, { formatCode: true }],
189181
};
190182
}
191183
return { idl: result.idlPath, before: [], scripts };

0 commit comments

Comments
 (0)