@xano/cli 0.0.45 → 0.0.46
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 +9 -2
- package/dist/commands/profile/{get_default → get}/index.d.ts +1 -1
- package/dist/commands/profile/{get_default → get}/index.js +2 -8
- package/dist/commands/profile/{set_default → set}/index.d.ts +1 -1
- package/dist/commands/profile/{set_default → set}/index.js +3 -11
- package/oclif.manifest.json +1667 -1669
- package/package.json +1 -1
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
|
|
58
|
-
xano profile
|
|
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,13 @@ 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
|
+
|
|
473
480
|
## Scripts
|
|
474
481
|
|
|
475
482
|
### Bump Version
|
|
@@ -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
|
|
6
|
+
export default class ProfileGet extends Command {
|
|
7
7
|
static description = 'Get the current default profile name';
|
|
8
8
|
static examples = [
|
|
9
|
-
`$ xano profile
|
|
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
|
}
|
|
@@ -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
|
|
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
|
|
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(
|
|
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,
|