Skip to content

Commit

Permalink
fix: write to existing filename with same extension (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker authored Jun 23, 2024
1 parent 5c03b00 commit 4379ac0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ const initConfig = async () => {
satellite: {id: satelliteId, source},
...(nonNullish(orbiterId) && {orbiter: {id: orbiterId}})
},
configType
configType,
configPath: originalConfigPath
});

// We delete the deprecated juno.json, which is now replaced with juno.config.json|ts|js, as just created above.
Expand Down
6 changes: 4 additions & 2 deletions src/configs/juno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ export const junoConfigFile = (): {configPath: string; configType: ConfigType} =

export const writeJunoConfig = async ({
config,
configType
configType,
configPath
}: {
config: JunoConfigWithSatelliteId;
configType: ConfigType;
configPath: string | undefined;
}): Promise<void> => {
switch (configType) {
case 'ts':
Expand All @@ -52,7 +54,7 @@ export const writeJunoConfig = async ({
.replace('<SOURCE>', source ?? DEPLOY_DEFAULT_SOURCE)
.replace('<ORBITER_ID>', orbiter?.id ?? '');

await writeFile(`${JUNO_CONFIG_FILENAME}.${configType}`, content, 'utf-8');
await writeFile(configPath ?? `${JUNO_CONFIG_FILENAME}.${configType}`, content, 'utf-8');
break;
}
default: {
Expand Down

0 comments on commit 4379ac0

Please sign in to comment.