@xano/cli 0.0.45 → 0.0.47

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/README.md CHANGED
@@ -54,8 +54,8 @@ xano profile list
54
54
  xano profile list --details # Show masked tokens and settings
55
55
 
56
56
  # Get/set default profile
57
- xano profile get_default
58
- xano profile set_default myprofile
57
+ xano profile get
58
+ xano profile set myprofile
59
59
 
60
60
  # Edit a profile
61
61
  xano profile edit myprofile -w 123
@@ -470,6 +470,16 @@ profiles:
470
470
  default: default
471
471
  ```
472
472
 
473
+ ### Update
474
+
475
+ ```bash
476
+ # Update the CLI to the latest version
477
+ xano update
478
+
479
+ # Check for updates without installing
480
+ xano update --check
481
+ ```
482
+
473
483
  ## Scripts
474
484
 
475
485
  ### Bump Version
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- export default class ProfileGetDefault extends Command {
2
+ export default class ProfileGet extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  run(): Promise<void>;
@@ -3,24 +3,19 @@ import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
4
  import * as os from 'node:os';
5
5
  import * as path from 'node:path';
6
- export default class ProfileGetDefault extends Command {
6
+ export default class ProfileGet extends Command {
7
7
  static description = 'Get the current default profile name';
8
8
  static examples = [
9
- `$ xano profile:get-default
9
+ `$ xano profile get
10
10
  production
11
- `,
12
- `$ xano profile:get-default
13
- No default profile set
14
11
  `,
15
12
  ];
16
13
  async run() {
17
14
  const configDir = path.join(os.homedir(), '.xano');
18
15
  const credentialsPath = path.join(configDir, 'credentials.yaml');
19
- // Check if credentials file exists
20
16
  if (!fs.existsSync(credentialsPath)) {
21
17
  this.error(`Credentials file not found at ${credentialsPath}. No profiles exist.`);
22
18
  }
23
- // Read credentials file
24
19
  let credentials;
25
20
  try {
26
21
  const fileContent = fs.readFileSync(credentialsPath, 'utf8');
@@ -33,7 +28,6 @@ No default profile set
33
28
  catch (error) {
34
29
  this.error(`Failed to parse credentials file: ${error}`);
35
30
  }
36
- // Get and display the default profile
37
31
  if (credentials.default) {
38
32
  this.log(credentials.default);
39
33
  }
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- export default class ProfileSetDefault extends Command {
2
+ export default class ProfileSet extends Command {
3
3
  static args: {
4
4
  name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
@@ -3,7 +3,7 @@ import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
4
  import * as os from 'node:os';
5
5
  import * as path from 'node:path';
6
- export default class ProfileSetDefault extends Command {
6
+ export default class ProfileSet extends Command {
7
7
  static args = {
8
8
  name: Args.string({
9
9
  description: 'Profile name to set as default',
@@ -12,22 +12,17 @@ export default class ProfileSetDefault extends Command {
12
12
  };
13
13
  static description = 'Set the default profile';
14
14
  static examples = [
15
- `$ xano profile:set-default production
15
+ `$ xano profile set production
16
16
  Default profile set to 'production'
17
- `,
18
- `$ xano profile:set-default staging
19
- Default profile set to 'staging'
20
17
  `,
21
18
  ];
22
19
  async run() {
23
- const { args } = await this.parse(ProfileSetDefault);
20
+ const { args } = await this.parse(ProfileSet);
24
21
  const configDir = path.join(os.homedir(), '.xano');
25
22
  const credentialsPath = path.join(configDir, 'credentials.yaml');
26
- // Check if credentials file exists
27
23
  if (!fs.existsSync(credentialsPath)) {
28
24
  this.error(`Credentials file not found at ${credentialsPath}. Create a profile first using 'profile:create'.`);
29
25
  }
30
- // Read existing credentials file
31
26
  let credentials;
32
27
  try {
33
28
  const fileContent = fs.readFileSync(credentialsPath, 'utf8');
@@ -40,13 +35,10 @@ Default profile set to 'staging'
40
35
  catch (error) {
41
36
  this.error(`Failed to parse credentials file: ${error}`);
42
37
  }
43
- // Check if profile exists
44
38
  if (!(args.name in credentials.profiles)) {
45
39
  this.error(`Profile '${args.name}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}`);
46
40
  }
47
- // Set the default profile
48
41
  credentials.default = args.name;
49
- // Write the updated credentials back to the file
50
42
  try {
51
43
  const yamlContent = yaml.dump(credentials, {
52
44
  indent: 2,
@@ -71,7 +71,7 @@ Impersonation successful!
71
71
  const params = new URLSearchParams({
72
72
  _ti: response._ti,
73
73
  });
74
- const impersonateUrl = `${frontendUrl}/tenant-impersonate?${params.toString()}`;
74
+ const impersonateUrl = `${frontendUrl}/impersonate?${params.toString()}`;
75
75
  if (flags['url-only']) {
76
76
  this.log(impersonateUrl);
77
77
  }
@@ -2,5 +2,10 @@ import BaseCommand from '../../base-command.js';
2
2
  export default class Update extends BaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
+ static flags: {
6
+ check: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
5
10
  run(): Promise<void>;
6
11
  }
@@ -1,11 +1,17 @@
1
+ import { Flags } from '@oclif/core';
1
2
  import { execSync } from 'node:child_process';
2
3
  import BaseCommand from '../../base-command.js';
3
4
  export default class Update extends BaseCommand {
4
5
  static description = 'Update the Xano CLI to the latest version';
5
- static examples = [
6
- `$ xano update`,
7
- ];
6
+ static examples = [`$ xano update`, `$ xano update --check`];
7
+ static flags = {
8
+ ...BaseCommand.flags,
9
+ check: Flags.boolean({
10
+ description: 'Check for updates without installing',
11
+ }),
12
+ };
8
13
  async run() {
14
+ const { flags } = await this.parse(Update);
9
15
  const currentVersion = this.config.version;
10
16
  this.log(`Current version: ${currentVersion}`);
11
17
  this.log('Checking for updates...');
@@ -15,6 +21,10 @@ export default class Update extends BaseCommand {
15
21
  this.log(`Already up to date (${currentVersion})`);
16
22
  return;
17
23
  }
24
+ if (flags.check) {
25
+ this.log(`Update available: ${currentVersion} → ${latest}`);
26
+ return;
27
+ }
18
28
  this.log(`Updating @xano/cli ${currentVersion} → ${latest}...`);
19
29
  execSync('npm install -g @xano/cli@latest', { stdio: 'inherit' });
20
30
  this.log(`Updated to ${latest}`);