instant-cli 0.22.179 → 0.22.180

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > instant-cli@0.22.179 build /home/runner/work/instant/instant/client/packages/cli
2
+ > instant-cli@0.22.180 build /home/runner/work/instant/instant/client/packages/cli
3
3
  > rm -rf dist; tsc -p tsconfig.build.json
4
4
 
package/dist/index.js CHANGED
@@ -185,7 +185,7 @@ function formatHelp(cmd, helper) {
185
185
  function formatItem(term, description) {
186
186
  if (description) {
187
187
  const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;
188
- return helper.wrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth);
188
+ return helper.boxWrap(fullText, helpWidth - itemIndentWidth, termWidth + itemSeparatorWidth);
189
189
  }
190
190
  return term;
191
191
  }
@@ -197,7 +197,10 @@ function formatHelp(cmd, helper) {
197
197
  // Description
198
198
  const commandDescription = helper.commandDescription(cmd);
199
199
  if (commandDescription.length > 0) {
200
- output = output.concat([helper.wrap(commandDescription, helpWidth, 0), '']);
200
+ output = output.concat([
201
+ helper.boxWrap(commandDescription, helpWidth, 0),
202
+ '',
203
+ ]);
201
204
  }
202
205
  // Arguments
203
206
  const argumentList = helper.visibleArguments(cmd).map((argument) => {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,CAAC;AAEV,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MA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B,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE;YAChE,OAAO,UAAU,CACf,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EACzB,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CACjC,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;gBACrB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;gBAChC,UAAU,CAAC,gBAAgB,CAAC;gBAC5B,EAAE;aACH,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,OAAO,CAAC,aAAa,CAAC;IACpB,iBAAiB,EAAE,IAAI;IACvB,UAAU;CACX,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { loadEnv } from './util/loadEnv.ts';\nloadEnv();\n\nimport { Command, Option } from '@commander-js/extra-typings';\nimport chalk from 'chalk';\nimport { Effect, Layer } from 'effect';\nimport version from './version.js';\nimport { initCommand } from './commands/init.ts';\nimport { initWithoutFilesCommand } from './commands/initWithoutFiles.ts';\nimport { loginCommand } from './commands/login.ts';\nimport { logoutCommand } from './commands/logout.ts';\nimport {\n AuthLayerLive,\n BaseLayerLive,\n runCommandEffect,\n WithAppLayer,\n} from './layer.ts';\nimport { infoCommand } from './commands/info.ts';\nimport { pullCommand } from './commands/pull.ts';\nimport type { SchemaPermsOrBoth } from './commands/pull.ts';\nimport { claimCommand } from './commands/claim.ts';\nimport { pushCommand } from './commands/push.ts';\nimport { explorerCmd } from './commands/explorer.ts';\nimport { queryCmd } from './commands/query.ts';\nimport { program } from './program.ts';\nimport { PACKAGE_ALIAS_AND_FULL_NAMES } from './context/projectInfo.ts';\n\nexport type OptsFromCommand<C> =\n C extends Command<any, infer R, any> ? R : never;\n\nprogram\n .name('instant-cli')\n .addOption(globalOption('-t --token <token>', 'Auth token override'))\n .addOption(globalOption('-y --yes', \"Answer 'yes' to all prompts\"))\n .addOption(globalOption('--env <file>', 'Use a specific .env file'))\n .addOption(\n globalOption('-v --version', 'Print the version number', () => {\n console.log(version);\n process.exit(0);\n }),\n )\n .addHelpOption(globalOption('-h --help', 'Print the help text for a command'))\n .usage(`<command> ${chalk.dim('[options] [args]')}`);\n\n// Command List\nexport const initDef = program\n .command('init')\n .description('Set up a new project.')\n .option(\n '-a --app <app-id>',\n 'If you have an existing app ID, we can pull schema and perms from there.',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option('--title <title>', 'Title for the created app')\n .action((options) => {\n return runCommandEffect(\n initCommand(options).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n title: options.title,\n appId: options.app,\n packageName: options.package as any,\n applyEnv: true,\n }),\n ),\n ),\n );\n });\n\nexport const initWithoutFilesDef = program\n .command('init-without-files')\n .description('Generate a new app id and admin token pair without any files.')\n .option('--title <title>', 'Title for the created app.')\n .option(\n '--org-id <org-id>',\n 'Organization id for app. Cannot be used with --temp flag.',\n )\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((opts) => {\n return runCommandEffect(\n initWithoutFilesCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const loginDef = program\n .command('login')\n .description('Log into your account')\n .option('-p --print', 'Prints the auth token into the console.')\n .option(\n '--headless',\n 'Print the login URL instead of trying to open the browser',\n )\n .action(async (opts) => {\n await runCommandEffect(\n loginCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nprogram\n .command('logout')\n .description('Log out of your Instant account')\n .action(async () => {\n return runCommandEffect(\n logoutCommand().pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const infoDef = program\n .command('info')\n .description('Display CLI version and login status')\n .action(async () => {\n return runCommandEffect(\n infoCommand().pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }).pipe(Layer.catchAll(() => Layer.empty)), // make the auth layer optional\n ),\n ),\n );\n });\n\nexport const explorerDef = program\n .command('explorer')\n .description('Opens the Explorer in your browser')\n .option(\n '-a --app <app-id>',\n 'App ID to open the explorer to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n explorerCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n appId: opts.app,\n }),\n ),\n ),\n );\n });\n\nexport const queryDef = program\n .command('query')\n .argument('<query>', 'InstaQL query as JSON/JSON5')\n .option(\n '-a --app <app-id>',\n 'App ID to query. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--admin', 'Run the query as admin (bypasses permissions)')\n .option('--as-email <email>', 'Run the query as a specific user by email')\n .option('--as-guest', 'Run the query as an unauthenticated guest')\n .option(\n '--as-token <refresh-token>',\n 'Run the query as a user identified by refresh token',\n )\n .description('Run an InstaQL query against your app.')\n .action(async function (queryArg, opts) {\n return runCommandEffect(queryCmd(queryArg, opts));\n });\n\nexport const pullDef = program\n .command('pull')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to pull. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to pull to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option(\n '--experimental-type-preservation',\n \"[Experimental] Preserve manual type changes like `status: i.json<'online' | 'offline'>()` when doing `instant-cli pull schema`\",\n )\n .description('Pull schema and perm files from production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pullCommand(arg as SchemaPermsOrBoth, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n packageName: inputOpts.package as\n | 'react'\n | 'react-native'\n | 'core'\n | 'admin'\n | undefined,\n appId: inputOpts.app,\n }),\n ),\n ),\n );\n });\n\nexport const pushDef = program\n .command('push')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to push. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to push to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '--skip-check-types',\n \"Don't check types on the server when pushing schema\",\n )\n .option(\n '--rename [renames...]',\n 'List of full attribute names separated by a \":\"\\n Example:`push --rename posts.author:posts.creator stores.owner:stores.manager`',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .description('Push schema and perm files to production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pushCommand(arg, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: inputOpts.app,\n coerceLibraryInstall: true,\n coerceAuth: false,\n allowAdminToken: true,\n applyEnv: true,\n packageName:\n inputOpts.package as keyof typeof PACKAGE_ALIAS_AND_FULL_NAMES,\n }),\n ),\n ),\n );\n });\n\nexport const claimDef = program\n .command('claim')\n .description('Transfer a temporary app into your Instant account')\n .option(\n '-a --app <app-id>',\n 'App to claim. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async function (opts) {\n return runCommandEffect(\n claimCommand.pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n allowAdminToken: false,\n appId: opts.app,\n applyEnv: false,\n }),\n ),\n ),\n );\n });\n//// Program setup /////\n\nfunction globalOption(\n flags: string,\n description?: string,\n argParser?: (value: string, prev?: unknown) => unknown,\n) {\n const opt = new Option(flags, description);\n if (argParser) {\n opt.argParser(argParser);\n }\n // @ts-ignore\n // __global does not exist on `Option`,\n // but we use it in `getLocalAndGlobalOptions`, to produce\n // our own custom list of local and global options.\n // For more info, see the original PR:\n // https://github.com/instantdb/instant/pull/505\n opt.__global = true;\n return opt;\n}\n\nfunction getLocalAndGlobalOptions(cmd: any, helper: any) {\n const mixOfLocalAndGlobal = helper.visibleOptions(cmd);\n const localOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => !option.__global,\n );\n const globalOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => option.__global,\n );\n const globalOptions = helper.visibleGlobalOptions(cmd);\n\n return [localOptionsFromMix, globalOptionsFromMix.concat(globalOptions)];\n}\n\nfunction formatHelp(\n this: { showGlobalOptions: boolean },\n cmd: any,\n helper: any,\n) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth || 80;\n const itemIndentWidth = 2;\n const itemSeparatorWidth = 2; // between term and description\n function formatItem(term: string, description: string | undefined) {\n if (description) {\n const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;\n return helper.wrap(\n fullText,\n helpWidth - itemIndentWidth,\n termWidth + itemSeparatorWidth,\n );\n }\n return term;\n }\n function formatList(textArray: string[]) {\n return textArray.join('\\n').replace(/^/gm, ' '.repeat(itemIndentWidth));\n }\n\n // Usage\n let output = [`${helper.commandUsage(cmd)}`, ''];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([helper.wrap(commandDescription, helpWidth, 0), '']);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument: any) => {\n return formatItem(\n helper.argumentTerm(argument),\n helper.argumentDescription(argument),\n );\n });\n if (argumentList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Arguments'),\n formatList(argumentList),\n '',\n ]);\n }\n const [visibleOptions, visibleGlobalOptions] = getLocalAndGlobalOptions(\n cmd,\n helper,\n );\n\n // Options\n const optionList = visibleOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (optionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Options'),\n formatList(optionList),\n '',\n ]);\n }\n // Commands\n const commandList = helper.visibleCommands(cmd).map((cmd: any) => {\n return formatItem(\n helper.subcommandTerm(cmd),\n helper.subcommandDescription(cmd),\n );\n });\n if (commandList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Commands'),\n formatList(commandList),\n '',\n ]);\n }\n\n if (this.showGlobalOptions) {\n const globalOptionList = visibleGlobalOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (globalOptionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Global Options'),\n formatList(globalOptionList),\n '',\n ]);\n }\n }\n\n return output.join('\\n');\n}\n\nprogram.configureHelp({\n showGlobalOptions: true,\n formatHelp,\n});\n\nprogram.parse(process.argv);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,CAAC;AAEV,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAC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C,CAAC;QACH,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;gBACrB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;gBAChC,UAAU,CAAC,gBAAgB,CAAC;gBAC5B,EAAE;aACH,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,OAAO,CAAC,aAAa,CAAC;IACpB,iBAAiB,EAAE,IAAI;IACvB,UAAU;CACX,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { loadEnv } from './util/loadEnv.ts';\nloadEnv();\n\nimport { Command, Option } from '@commander-js/extra-typings';\nimport chalk from 'chalk';\nimport { Effect, Layer } from 'effect';\nimport version from './version.js';\nimport { initCommand } from './commands/init.ts';\nimport { initWithoutFilesCommand } from './commands/initWithoutFiles.ts';\nimport { loginCommand } from './commands/login.ts';\nimport { logoutCommand } from './commands/logout.ts';\nimport {\n AuthLayerLive,\n BaseLayerLive,\n runCommandEffect,\n WithAppLayer,\n} from './layer.ts';\nimport { infoCommand } from './commands/info.ts';\nimport { pullCommand } from './commands/pull.ts';\nimport type { SchemaPermsOrBoth } from './commands/pull.ts';\nimport { claimCommand } from './commands/claim.ts';\nimport { pushCommand } from './commands/push.ts';\nimport { explorerCmd } from './commands/explorer.ts';\nimport { queryCmd } from './commands/query.ts';\nimport { program } from './program.ts';\nimport { PACKAGE_ALIAS_AND_FULL_NAMES } from './context/projectInfo.ts';\n\nexport type OptsFromCommand<C> =\n C extends Command<any, infer R, any> ? R : never;\n\nprogram\n .name('instant-cli')\n .addOption(globalOption('-t --token <token>', 'Auth token override'))\n .addOption(globalOption('-y --yes', \"Answer 'yes' to all prompts\"))\n .addOption(globalOption('--env <file>', 'Use a specific .env file'))\n .addOption(\n globalOption('-v --version', 'Print the version number', () => {\n console.log(version);\n process.exit(0);\n }),\n )\n .addHelpOption(globalOption('-h --help', 'Print the help text for a command'))\n .usage(`<command> ${chalk.dim('[options] [args]')}`);\n\n// Command List\nexport const initDef = program\n .command('init')\n .description('Set up a new project.')\n .option(\n '-a --app <app-id>',\n 'If you have an existing app ID, we can pull schema and perms from there.',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option('--title <title>', 'Title for the created app')\n .action((options) => {\n return runCommandEffect(\n initCommand(options).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n title: options.title,\n appId: options.app,\n packageName: options.package as any,\n applyEnv: true,\n }),\n ),\n ),\n );\n });\n\nexport const initWithoutFilesDef = program\n .command('init-without-files')\n .description('Generate a new app id and admin token pair without any files.')\n .option('--title <title>', 'Title for the created app.')\n .option(\n '--org-id <org-id>',\n 'Organization id for app. Cannot be used with --temp flag.',\n )\n .option(\n '--temp',\n 'Create a temporary app which will automatically delete itself after >24 hours.',\n )\n .action((opts) => {\n return runCommandEffect(\n initWithoutFilesCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const loginDef = program\n .command('login')\n .description('Log into your account')\n .option('-p --print', 'Prints the auth token into the console.')\n .option(\n '--headless',\n 'Print the login URL instead of trying to open the browser',\n )\n .action(async (opts) => {\n await runCommandEffect(\n loginCommand(opts).pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nprogram\n .command('logout')\n .description('Log out of your Instant account')\n .action(async () => {\n return runCommandEffect(\n logoutCommand().pipe(Effect.provide(BaseLayerLive)),\n );\n });\n\nexport const infoDef = program\n .command('info')\n .description('Display CLI version and login status')\n .action(async () => {\n return runCommandEffect(\n infoCommand().pipe(\n Effect.provide(\n AuthLayerLive({\n coerce: false,\n allowAdminToken: false,\n }).pipe(Layer.catchAll(() => Layer.empty)), // make the auth layer optional\n ),\n ),\n );\n });\n\nexport const explorerDef = program\n .command('explorer')\n .description('Opens the Explorer in your browser')\n .option(\n '-a --app <app-id>',\n 'App ID to open the explorer to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async (opts) => {\n return runCommandEffect(\n explorerCmd(opts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n coerceAuth: true,\n appId: opts.app,\n }),\n ),\n ),\n );\n });\n\nexport const queryDef = program\n .command('query')\n .argument('<query>', 'InstaQL query as JSON/JSON5')\n .option(\n '-a --app <app-id>',\n 'App ID to query. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option('--admin', 'Run the query as admin (bypasses permissions)')\n .option('--as-email <email>', 'Run the query as a specific user by email')\n .option('--as-guest', 'Run the query as an unauthenticated guest')\n .option(\n '--as-token <refresh-token>',\n 'Run the query as a user identified by refresh token',\n )\n .description('Run an InstaQL query against your app.')\n .action(async function (queryArg, opts) {\n return runCommandEffect(queryCmd(queryArg, opts));\n });\n\nexport const pullDef = program\n .command('pull')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to pull. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to pull to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .option(\n '--experimental-type-preservation',\n \"[Experimental] Preserve manual type changes like `status: i.json<'online' | 'offline'>()` when doing `instant-cli pull schema`\",\n )\n .description('Pull schema and perm files from production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pullCommand(arg as SchemaPermsOrBoth, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: true,\n packageName: inputOpts.package as\n | 'react'\n | 'react-native'\n | 'core'\n | 'admin'\n | undefined,\n appId: inputOpts.app,\n }),\n ),\n ),\n );\n });\n\nexport const pushDef = program\n .command('push')\n .argument(\n '[schema|perms|all]',\n 'Which configuration to push. Defaults to `all`',\n )\n .option(\n '-a --app <app-id>',\n 'App ID to push to. Defaults to *_INSTANT_APP_ID in .env',\n )\n .option(\n '--skip-check-types',\n \"Don't check types on the server when pushing schema\",\n )\n .option(\n '--rename [renames...]',\n 'List of full attribute names separated by a \":\"\\n Example:`push --rename posts.author:posts.creator stores.owner:stores.manager`',\n )\n .option(\n '-p --package <react|react-native|core|admin|solid|svelte>',\n 'Which package to automatically install if there is not one installed already.',\n )\n .description('Push schema and perm files to production.')\n .addHelpText(\n 'after',\n `\nEnvironment Variables:\n INSTANT_SCHEMA_FILE_PATH Override schema file location (default: instant.schema.ts)\n INSTANT_PERMS_FILE_PATH Override perms file location (default: instant.perms.ts)\n`,\n )\n .action(async function (arg, inputOpts) {\n return runCommandEffect(\n pushCommand(arg, inputOpts).pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n appId: inputOpts.app,\n coerceLibraryInstall: true,\n coerceAuth: false,\n allowAdminToken: true,\n applyEnv: true,\n packageName:\n inputOpts.package as keyof typeof PACKAGE_ALIAS_AND_FULL_NAMES,\n }),\n ),\n ),\n );\n });\n\nexport const claimDef = program\n .command('claim')\n .description('Transfer a temporary app into your Instant account')\n .option(\n '-a --app <app-id>',\n 'App to claim. Defaults to *_INSTANT_APP_ID in .env',\n )\n .action(async function (opts) {\n return runCommandEffect(\n claimCommand.pipe(\n Effect.provide(\n WithAppLayer({\n coerce: false,\n allowAdminToken: false,\n appId: opts.app,\n applyEnv: false,\n }),\n ),\n ),\n );\n });\n//// Program setup /////\n\nfunction globalOption(\n flags: string,\n description?: string,\n argParser?: (value: string, prev?: unknown) => unknown,\n) {\n const opt = new Option(flags, description);\n if (argParser) {\n opt.argParser(argParser);\n }\n // @ts-ignore\n // __global does not exist on `Option`,\n // but we use it in `getLocalAndGlobalOptions`, to produce\n // our own custom list of local and global options.\n // For more info, see the original PR:\n // https://github.com/instantdb/instant/pull/505\n opt.__global = true;\n return opt;\n}\n\nfunction getLocalAndGlobalOptions(cmd: any, helper: any) {\n const mixOfLocalAndGlobal = helper.visibleOptions(cmd);\n const localOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => !option.__global,\n );\n const globalOptionsFromMix = mixOfLocalAndGlobal.filter(\n (option: any) => option.__global,\n );\n const globalOptions = helper.visibleGlobalOptions(cmd);\n\n return [localOptionsFromMix, globalOptionsFromMix.concat(globalOptions)];\n}\n\nfunction formatHelp(\n this: { showGlobalOptions: boolean },\n cmd: any,\n helper: any,\n) {\n const termWidth = helper.padWidth(cmd, helper);\n const helpWidth = helper.helpWidth || 80;\n const itemIndentWidth = 2;\n const itemSeparatorWidth = 2; // between term and description\n function formatItem(term: string, description: string | undefined) {\n if (description) {\n const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;\n return helper.boxWrap(\n fullText,\n helpWidth - itemIndentWidth,\n termWidth + itemSeparatorWidth,\n );\n }\n return term;\n }\n function formatList(textArray: string[]) {\n return textArray.join('\\n').replace(/^/gm, ' '.repeat(itemIndentWidth));\n }\n\n // Usage\n let output = [`${helper.commandUsage(cmd)}`, ''];\n\n // Description\n const commandDescription = helper.commandDescription(cmd);\n if (commandDescription.length > 0) {\n output = output.concat([\n helper.boxWrap(commandDescription, helpWidth, 0),\n '',\n ]);\n }\n\n // Arguments\n const argumentList = helper.visibleArguments(cmd).map((argument: any) => {\n return formatItem(\n helper.argumentTerm(argument),\n helper.argumentDescription(argument),\n );\n });\n if (argumentList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Arguments'),\n formatList(argumentList),\n '',\n ]);\n }\n const [visibleOptions, visibleGlobalOptions] = getLocalAndGlobalOptions(\n cmd,\n helper,\n );\n\n // Options\n const optionList = visibleOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (optionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Options'),\n formatList(optionList),\n '',\n ]);\n }\n // Commands\n const commandList = helper.visibleCommands(cmd).map((cmd: any) => {\n return formatItem(\n helper.subcommandTerm(cmd),\n helper.subcommandDescription(cmd),\n );\n });\n if (commandList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Commands'),\n formatList(commandList),\n '',\n ]);\n }\n\n if (this.showGlobalOptions) {\n const globalOptionList = visibleGlobalOptions.map((option: any) => {\n return formatItem(\n helper.optionTerm(option),\n helper.optionDescription(option),\n );\n });\n if (globalOptionList.length > 0) {\n output = output.concat([\n chalk.dim.bold('Global Options'),\n formatList(globalOptionList),\n '',\n ]);\n }\n }\n\n return output.join('\\n');\n}\n\nprogram.configureHelp({\n showGlobalOptions: true,\n formatHelp,\n});\n\nprogram.parse(process.argv);\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "instant-cli",
3
3
  "type": "module",
4
- "version": "0.22.179",
4
+ "version": "0.22.180",
5
5
  "description": "Instant's CLI",
6
6
  "homepage": "https://github.com/instantdb/instant/tree/main/client/packages/cli",
7
7
  "repository": {
@@ -48,9 +48,9 @@
48
48
  "strip-ansi": "^7.1.2",
49
49
  "terminal-link": "^3.0.0",
50
50
  "unconfig": "^0.5.5",
51
- "@instantdb/core": "0.22.179",
52
- "@instantdb/platform": "0.22.179",
53
- "@instantdb/version": "0.22.179"
51
+ "@instantdb/core": "0.22.180",
52
+ "@instantdb/platform": "0.22.180",
53
+ "@instantdb/version": "0.22.180"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@babel/core": "^7.17.9",
package/src/index.ts CHANGED
@@ -332,7 +332,7 @@ function formatHelp(
332
332
  function formatItem(term: string, description: string | undefined) {
333
333
  if (description) {
334
334
  const fullText = `${term.padEnd(termWidth + itemSeparatorWidth)}${description}`;
335
- return helper.wrap(
335
+ return helper.boxWrap(
336
336
  fullText,
337
337
  helpWidth - itemIndentWidth,
338
338
  termWidth + itemSeparatorWidth,
@@ -350,7 +350,10 @@ function formatHelp(
350
350
  // Description
351
351
  const commandDescription = helper.commandDescription(cmd);
352
352
  if (commandDescription.length > 0) {
353
- output = output.concat([helper.wrap(commandDescription, helpWidth, 0), '']);
353
+ output = output.concat([
354
+ helper.boxWrap(commandDescription, helpWidth, 0),
355
+ '',
356
+ ]);
354
357
  }
355
358
 
356
359
  // Arguments