runcloud 0.2.233 → 0.2.234

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.
@@ -178,6 +178,12 @@ export async function runFlagSet(client, projectId, env, key, options, log) {
178
178
  const { flag } = (await client.patch(flagPath(projectId, env, key), fields));
179
179
  log(`Saved ${key} in ${envWord(env)}: ${flag.enabled ? 'on' : 'off'}. Who gets it: ${whoGetsIt(flag)}.`);
180
180
  }
181
+ export async function runFlagPromote(client, projectId, key, yes, log) {
182
+ if (!yes)
183
+ throw new Error(`Copying ${key} to production changes who gets it there and what they see, at once if it is on. Run again with --yes to copy it.`);
184
+ const { flag } = (await client.post(`${base(projectId)}/flags/${encodeURIComponent(key)}/promote`));
185
+ log(`Copied ${key} to production: ${flag.enabled ? 'on' : 'off'}. Who gets it: ${whoGetsIt(flag)}.${flag.enabled ? '' : ` Turn it on with: newly flags on ${key} --env prod`}`);
186
+ }
181
187
  export async function runFlagDelete(client, projectId, env, key, yes, log) {
182
188
  if (env === 'production' && !yes)
183
189
  throw new Error(`Deleting ${key} turns it off for every live user. Run again with --yes to delete it from production.`);
@@ -289,6 +295,8 @@ export function registerFlags(program) {
289
295
  const c = ctx(o.project);
290
296
  await runFlagSet(c.client, c.projectId, flagEnv(o.env), key, { ...o, on: o.on ? true : o.off ? false : undefined }, log);
291
297
  }));
298
+ flags.command('promote <key>').description("Copy a Development flag's groups, value and variants to Production (its on/off stays)").option('--yes', 'confirm changing production').option('--project <id>')
299
+ .action((key, o) => run(async () => { const c = ctx(o.project); await runFlagPromote(c.client, c.projectId, key, Boolean(o.yes), log); }));
292
300
  flags.command('delete <key>').option('--yes', 'confirm deleting from production').option(...envOption).option('--project <id>')
293
301
  .action((key, o) => run(async () => { const c = ctx(o.project); await runFlagDelete(c.client, c.projectId, flagEnv(o.env), key, Boolean(o.yes), log); }));
294
302
  flags.command('log <key>').description("Who changed a flag (in Newly, the agent or the CLI), and what").option(...envOption).option('--project <id>')
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.233';
1
+ export const CLI_VERSION = '0.2.234';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.233",
3
+ "version": "0.2.234",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
Binary file
Binary file