Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deprecated satelliteId for id and replace satellitesIds with ids #105

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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>'
}
});
Loading