Skip to content

Commit

Permalink
feat: deprecated satelliteId for id and replace satellitesIds with ids (
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker authored Feb 29, 2024
1 parent 318cdb8 commit 25e5758
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 34 deletions.
30 changes: 15 additions & 15 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@dfinity/identity": "^1.0.1",
"@dfinity/principal": "^1.0.1",
"@junobuild/admin": "^0.0.46",
"@junobuild/cli-tools": "^0.0.3",
"@junobuild/config": "^0.0.2",
"@junobuild/cli-tools": "^0.0.5",
"@junobuild/config": "^0.0.4",
"@junobuild/core-peer": "^0.0.11",
"@junobuild/utils": "^0.0.19",
"conf": "^12.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const initConfig = async () => {

await writeJunoConfig({
config: {
satellite: {satelliteId, source},
...(nonNullish(orbiterId) && {orbiter: {orbiterId}})
satellite: {id: satelliteId, source},
...(nonNullish(orbiterId) && {orbiter: {id: orbiterId}})
},
configType
});
Expand Down
6 changes: 3 additions & 3 deletions src/configs/juno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const writeJunoConfig = async ({
case 'js': {
const {
orbiter,
satellite: {satelliteId, source}
satellite: {id, source}
} = config;

const template = await readTemplateFile({
Expand All @@ -48,9 +48,9 @@ export const writeJunoConfig = async ({
});

const content = template
.replace('<SATELLITE_ID>', satelliteId)
.replace('<SATELLITE_ID>', id)
.replace('<SOURCE>', source ?? DEPLOY_DEFAULT_SOURCE)
.replace('<ORBITER_ID>', orbiter?.orbiterId ?? '');
.replace('<ORBITER_ID>', orbiter?.id ?? '');

await writeFile(`${JUNO_CONFIG_FILENAME}.${configType}`, content, 'utf-8');
break;
Expand Down
8 changes: 4 additions & 4 deletions src/types/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {JunoConfig, JunoConfigEnv, SatelliteConfig} from '@junobuild/config';
import type {JunoConfig, JunoConfigEnv, OrbiterConfig, SatelliteConfig} from '@junobuild/config';

export type ConfigType = 'ts' | 'js' | 'json';

Expand All @@ -7,7 +7,7 @@ export interface SatelliteConfigEnv {
env: JunoConfigEnv;
}

export type JunoConfigWithSatelliteId = Omit<JunoConfig, 'satellite'> & {
satellite: Omit<SatelliteConfig, 'satelliteId' | 'satellitesIds'> &
Required<Pick<SatelliteConfig, 'satelliteId'>>;
export type JunoConfigWithSatelliteId = Omit<JunoConfig, 'satellite' | 'orbiter'> & {
satellite: Omit<SatelliteConfig, 'id' | 'satellitesIds'> & Required<Pick<SatelliteConfig, 'id'>>;
orbiter?: Omit<OrbiterConfig, 'orbiterId'>;
};
4 changes: 2 additions & 2 deletions src/utils/satellite.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import type {SatelliteConfigEnv} from '../types/config';
import {actorParameters} from './actor.utils';

export const satelliteParameters = ({
satellite: {satelliteId: satelliteIdUser, satellitesIds},
satellite: {satelliteId: deprecatedSatelliteId, id, ids},
env: {mode}
}: SatelliteConfigEnv): Omit<SatelliteParameters, 'satelliteId'> &
Required<Pick<SatelliteParameters, 'satelliteId'>> => {
const satelliteId = satellitesIds?.[mode] ?? satelliteIdUser;
const satelliteId = ids?.[mode] ?? id ?? deprecatedSatelliteId;

if (isNullish(satelliteId)) {
console.log(`${red(`A satellite ID for ${mode} must be set in your configuration.`)}`);
Expand Down
4 changes: 2 additions & 2 deletions templates/init/juno.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {defineConfig} from '@junobuild/config';
/** @type {import('@junobuild/config').JunoConfig} */
export default defineConfig({
satellite: {
satelliteId: '<SATELLITE_ID>',
id: '<SATELLITE_ID>',
source: '<SOURCE>'
},
orbiter: {
orbiterId: '<ORBITER_ID>'
id: '<ORBITER_ID>'
}
});
4 changes: 2 additions & 2 deletions templates/init/juno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {defineConfig} from '@junobuild/config';

export default defineConfig({
satellite: {
satelliteId: '<SATELLITE_ID>',
id: '<SATELLITE_ID>',
source: '<SOURCE>'
},
orbiter: {
orbiterId: '<ORBITER_ID>'
id: '<ORBITER_ID>'
}
});
2 changes: 1 addition & 1 deletion templates/init/juno.satellite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {defineConfig} from '@junobuild/config';
/** @type {import('@junobuild/config').JunoConfig} */
export default defineConfig({
satellite: {
satelliteId: '<SATELLITE_ID>',
id: '<SATELLITE_ID>',
source: '<SOURCE>'
}
});
2 changes: 1 addition & 1 deletion templates/init/juno.satellite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {defineConfig} from '@junobuild/config';

export default defineConfig({
satellite: {
satelliteId: '<SATELLITE_ID>',
id: '<SATELLITE_ID>',
source: '<SOURCE>'
}
});

0 comments on commit 25e5758

Please sign in to comment.