Skip to content
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
70 changes: 35 additions & 35 deletions package-lock.json

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
"@dfinity/ic-management": "^6.1.1",
"@dfinity/identity": "^2.3.0",
"@dfinity/principal": "^2.3.0",
"@junobuild/admin": "^0.5.0-next-2025-05-31.3",
"@junobuild/cdn": "^0.1.0-next-2025-05-31.3",
"@junobuild/cli-tools": "^0.2.0-next-2025-05-31.3",
"@junobuild/admin": "^0.5.0-next-2025-06-01",
"@junobuild/cdn": "^0.1.0-next-2025-06-01",
"@junobuild/cli-tools": "^0.2.0-next-2025-06-01",
"@junobuild/config": "^0.1.8",
"@junobuild/config-loader": "^0.2.1",
"@junobuild/core": "^0.1.15-next-2025-05-31.3",
"@junobuild/core": "^0.1.15-next-2025-06-01",
"@junobuild/did-tools": "^0.2.1",
"@junobuild/storage": "^0.2.0-next-2025-05-31.3",
"@junobuild/storage": "^0.2.0-next-2025-06-01",
"@junobuild/utils": "^0.1.3",
"chokidar": "^4.0.3",
"conf": "^13.1.0",
Expand Down
12 changes: 10 additions & 2 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@junobuild/cli-tools';
import {uploadBlob} from '@junobuild/core';
import {junoConfigExist} from '../configs/juno.config';
import {clearProposalStagedAssets} from '../services/changes/changes.clear.services';
import {clear} from '../services/clear.services';
import {
type DeployFnParams,
Expand Down Expand Up @@ -87,16 +88,23 @@ const deployWithProposal = async ({args, clearOption}: {args?: string[]; clearOp
});
};

const {result} = await executeDeployWithProposal({
const result = await executeDeployWithProposal({
args,
deployFn,
uploadFileFn
});

if (result !== 'deployed') {
if (result.result !== 'deployed') {
return;
}

const {proposalId} = result;

await clearProposalStagedAssets({
args,
proposalId
});

await links(args);
};

Expand Down
1 change: 1 addition & 0 deletions src/help/changes.apply.help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const usage = `Usage: ${green('juno')} ${cyan('changes')} ${magenta('apply')} ${
Options:
${yellow('-i, --id')} The ID of the change to apply.
${yellow('-s, --hash')} The expected hash of all included changes (for verification).
${yellow('-k, --keep-staged')} Keep staged assets in memory after applying the change.
${yellow('-h, --help')} Output usage information.`;

const doc = `${CHANGES_APPLY_DESCRIPTION}
Expand Down
1 change: 1 addition & 0 deletions src/help/changes.reject.help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const usage = `Usage: ${green('juno')} ${cyan('changes')} ${magenta('reject')} $
Options:
${yellow('-i, --id')} The ID of the change to reject.
${yellow('-s, --hash')} The expected hash of all included changes (for verification).
${yellow('-k, --keep-staged')} Keep staged assets in memory after applying the change.
${yellow('-h, --help')} Output usage information.`;

const doc = `${CHANGES_REJECT_DESCRIPTION}
Expand Down
7 changes: 6 additions & 1 deletion src/help/deploy.help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ const usage = `Usage: ${green('juno')} ${cyan('deploy')} ${yellow('[options]')}
Options:
${yellow('-c, --clear')} Clear existing app files before proceeding with deployment.
${yellow('-n, --no-apply')} Submit the deployment as a change but do not apply it yet.
${yellow('-k, --keep-staged')} Keep staged assets in memory after applying the change.
${yellow('-i, --immediate')} Deploy files instantly (bypasses the change workflow).
${helpMode}
${yellow('-h, --help')} Output usage information.`;
${yellow('-h, --help')} Output usage information.

Notes:

- The option ${yellow('--keep-staged')} only applies when ${yellow('--no-apply')} is NOT used (i.e. the change is applied immediately).`;

const doc = `${DEPLOY_DESCRIPTION}

Expand Down
25 changes: 24 additions & 1 deletion src/services/changes/changes.apply.services.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
import {hexStringToUint8Array} from '@dfinity/utils';
import {commitProposal} from '@junobuild/cdn';
import ora from 'ora';
import type {SatelliteParametersWithId} from '../../types/satellite';
import {readChangesIdAndHash} from '../../utils/changes.utils';
import {assertConfigAndLoadSatelliteContext} from '../../utils/satellite.utils';
import {clearProposalStagedAssets} from './changes.clear.services';

export const applyChanges = async (args?: string[]) => {
const {satellite} = await assertConfigAndLoadSatelliteContext(args);

const {proposalId, hash} = readChangesIdAndHash(args);

await executeApplyChanges({satellite, proposalId, hash});

await clearProposalStagedAssets({
args,
proposalId
});
};

const executeApplyChanges = async ({
satellite,
proposalId,
hash
}: {
proposalId: bigint;
hash: string;
satellite: SatelliteParametersWithId;
}) => {
const spinner = ora('Applying...').start();

try {
Expand All @@ -22,8 +41,12 @@ export const applyChanges = async (args?: string[]) => {
}
});

spinner.stop();

console.log(`\n🎯 Change ID ${proposalId} applied.`);
} finally {
} catch (err: unknown) {
spinner.stop();

throw err;
}
};
40 changes: 40 additions & 0 deletions src/services/changes/changes.clear.services.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {deleteProposalAssets} from '@junobuild/cdn';
import {hasArgs} from '@junobuild/cli-tools';
import {green} from 'kleur';
import ora from 'ora';
import {assertConfigAndLoadSatelliteContext} from '../../utils/satellite.utils';

export const clearProposalStagedAssets = async ({
args,
proposalId
}: {
args?: string[];
proposalId: bigint;
}) => {
const keepAssets = hasArgs({args, options: ['-k', '--keep-staged']});

if (keepAssets) {
return;
}

console.log('');

const spinner = ora('Deleting staged assets...').start();

try {
const {satellite} = await assertConfigAndLoadSatelliteContext(args);

await deleteProposalAssets({
cdn: {satellite},
proposalIds: [proposalId]
});

spinner.stop();

console.log(`${green('✔')} Staged assets deleted.`);
} catch (err: unknown) {
spinner.stop();

throw err;
}
};
25 changes: 24 additions & 1 deletion src/services/changes/changes.reject.services.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
import {hexStringToUint8Array} from '@dfinity/utils';
import {rejectProposal} from '@junobuild/cdn';
import ora from 'ora';
import type {SatelliteParametersWithId} from '../../types/satellite';
import {readChangesIdAndHash} from '../../utils/changes.utils';
import {assertConfigAndLoadSatelliteContext} from '../../utils/satellite.utils';
import {clearProposalStagedAssets} from './changes.clear.services';

export const rejectChanges = async (args?: string[]) => {
const {satellite} = await assertConfigAndLoadSatelliteContext(args);

const {proposalId, hash} = readChangesIdAndHash(args);

await executeRejectChanges({satellite, proposalId, hash});

await clearProposalStagedAssets({
args,
proposalId
});
};

const executeRejectChanges = async ({
satellite,
proposalId,
hash
}: {
proposalId: bigint;
hash: string;
satellite: SatelliteParametersWithId;
}) => {
const spinner = ora('Rejecting...').start();

try {
Expand All @@ -22,8 +41,12 @@ export const rejectChanges = async (args?: string[]) => {
}
});

spinner.stop();

console.log(`\n🚫 Change ID ${proposalId} rejected.`);
} finally {
} catch (err: unknown) {
spinner.stop();

throw err;
}
};