@novacraft-engineering/pulsar-cli 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrate.js +3 -1
- package/package.json +1 -1
- package/pulsar.js +8 -4
package/migrate.js
CHANGED
|
@@ -115,7 +115,9 @@ async function migrateApp({source, sourceApp, org, pulsarApps, args, dryRun, row
|
|
|
115
115
|
}
|
|
116
116
|
row.sourceKey = sourceDeployment.key || '-';
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
const existingDeployment = pulsarApp?.deployments?.[deploymentName];
|
|
119
|
+
if (existingDeployment && !existingDeployment.key) throw new Error('Deployment keys are hidden for this login. Run "pulsar login" again, then retry.');
|
|
120
|
+
row.pulsarKey = existingDeployment?.key;
|
|
119
121
|
if (!row.pulsarKey && dryRun) row.pulsarKey = '(new)';
|
|
120
122
|
else if (!row.pulsarKey) {
|
|
121
123
|
({key: row.pulsarKey} = await api(`/apps/${pulsarApp.id}/deployments`, {method: 'POST', body: {name: deploymentName}}));
|
package/package.json
CHANGED
package/pulsar.js
CHANGED
|
@@ -351,18 +351,21 @@ async function cmdLogin(args) {
|
|
|
351
351
|
const email = await prompt('Email: ');
|
|
352
352
|
const password = await prompt('Password: ', true);
|
|
353
353
|
const deviceId = loadConfig().deviceId || crypto.randomBytes(16).toString('hex');
|
|
354
|
-
const {token, user} = await api('/auth/login', {method: 'POST', body: {email, password}, headers: {'x-device-id': deviceId}, allowAnonymous: true});
|
|
354
|
+
const {token, user} = await api('/auth/login', {method: 'POST', body: {email, password, client: 'cli'}, headers: {'x-device-id': deviceId}, allowAnonymous: true});
|
|
355
355
|
saveConfig({apiUrl, token, deviceId});
|
|
356
356
|
console.log(`✓ logged in as ${user.email} (${user.platformRole})`);
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
const HIDDEN_KEYS = 'Deployment keys are hidden for this login. Run "pulsar login" again to see them.';
|
|
360
|
+
const shownKey = (deployment) => deployment.key || `${deployment.keyHint || ''}•••• (hidden: run "pulsar login" again)`;
|
|
361
|
+
|
|
359
362
|
async function cmdApps() {
|
|
360
363
|
const apps = await api('/apps');
|
|
361
364
|
if (!apps.length) return console.log('(no apps)');
|
|
362
365
|
for (const app of apps) {
|
|
363
366
|
console.log(`\n${app.name} [${app.os}] ${app.id}`);
|
|
364
367
|
for (const [name, deployment] of Object.entries(app.deployments)) {
|
|
365
|
-
console.log(` ${name.padEnd(11)} key: ${deployment
|
|
368
|
+
console.log(` ${name.padEnd(11)} key: ${shownKey(deployment)}`);
|
|
366
369
|
}
|
|
367
370
|
}
|
|
368
371
|
}
|
|
@@ -643,11 +646,11 @@ async function cmdDeployment(args) {
|
|
|
643
646
|
if (sub === 'add') {
|
|
644
647
|
if (!depName) die('Usage: pulsar deployment add <app> <name>');
|
|
645
648
|
const created = await api(`/apps/${app.id}/deployments`, {method: 'POST', body: {name: depName}});
|
|
646
|
-
console.log(`✓ added ${created.name}\n key: ${created
|
|
649
|
+
console.log(`✓ added ${created.name}\n key: ${shownKey(created)}`);
|
|
647
650
|
} else if (sub === 'ls' || sub === 'list') {
|
|
648
651
|
const full = await api(`/apps/${app.id}`);
|
|
649
652
|
for (const [name, deployment] of Object.entries(full.deployments)) {
|
|
650
|
-
console.log(` ${name.padEnd(12)} ${deployment
|
|
653
|
+
console.log(` ${name.padEnd(12)} ${shownKey(deployment)}`);
|
|
651
654
|
}
|
|
652
655
|
} else {
|
|
653
656
|
die('Usage: pulsar deployment <add|ls> <app> [name]');
|
|
@@ -707,6 +710,7 @@ async function cmdKeys(args) {
|
|
|
707
710
|
const matches = apps.filter((app) => app.name.toLowerCase().startsWith(`${project.toLowerCase()}-`));
|
|
708
711
|
if (!matches.length) die(`No apps for project "${project}". Known: ${apps.map((app) => app.name).join(', ')}`);
|
|
709
712
|
|
|
713
|
+
if (matches.some((app) => Object.values(app.deployments || {}).some((deployment) => !deployment.key))) die(HIDDEN_KEYS);
|
|
710
714
|
const vars = {};
|
|
711
715
|
for (const app of matches) {
|
|
712
716
|
for (const deployment of ['Staging', 'Production']) {
|