@laioutr/cli 0.3.1 → 0.3.2
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 +106 -1
- package/dist/api/fetchRc.d.ts +10 -0
- package/dist/api/fetchRc.js +35 -0
- package/dist/api/releaseAppVersion.d.ts +13 -0
- package/dist/api/releaseAppVersion.js +27 -0
- package/dist/commands/app/release.d.ts +12 -0
- package/dist/commands/app/release.js +63 -0
- package/dist/commands/rc/fetch.d.ts +18 -0
- package/dist/commands/rc/fetch.js +28 -0
- package/dist/commands/rc/update.d.ts +13 -0
- package/dist/commands/rc/update.js +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/laioutr-base-command.d.ts +8 -0
- package/dist/laioutr-base-command.js +18 -0
- package/dist/rc/validation.d.ts +8 -0
- package/dist/rc/validation.js +8 -0
- package/oclif.manifest.json +208 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @laioutr/cli
|
|
|
20
20
|
$ laioutr COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ laioutr (--version)
|
|
23
|
-
@laioutr/cli/0.3.
|
|
23
|
+
@laioutr/cli/0.3.2 darwin-arm64 node-v22.22.2
|
|
24
24
|
$ laioutr --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ laioutr COMMAND
|
|
@@ -31,6 +31,7 @@ USAGE
|
|
|
31
31
|
# Commands
|
|
32
32
|
|
|
33
33
|
<!-- commands -->
|
|
34
|
+
* [`laioutr app release`](#laioutr-app-release)
|
|
34
35
|
* [`laioutr help [COMMAND]`](#laioutr-help-command)
|
|
35
36
|
* [`laioutr plugins`](#laioutr-plugins)
|
|
36
37
|
* [`laioutr plugins add PLUGIN`](#laioutr-plugins-add-plugin)
|
|
@@ -42,6 +43,37 @@ USAGE
|
|
|
42
43
|
* [`laioutr plugins uninstall [PLUGIN]`](#laioutr-plugins-uninstall-plugin)
|
|
43
44
|
* [`laioutr plugins unlink [PLUGIN]`](#laioutr-plugins-unlink-plugin)
|
|
44
45
|
* [`laioutr plugins update`](#laioutr-plugins-update)
|
|
46
|
+
* [`laioutr project fetch-rc [FILENAME]`](#laioutr-project-fetch-rc-filename)
|
|
47
|
+
* [`laioutr rc fetch [FILENAME]`](#laioutr-rc-fetch-filename)
|
|
48
|
+
* [`laioutr rc update [FILENAME]`](#laioutr-rc-update-filename)
|
|
49
|
+
|
|
50
|
+
## `laioutr app release`
|
|
51
|
+
|
|
52
|
+
Publish an app version to the Laioutr platform.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
USAGE
|
|
56
|
+
$ laioutr app release --cockpitApiHost <value> --cwd <value> -k <value> [-c stable|testing]
|
|
57
|
+
|
|
58
|
+
FLAGS
|
|
59
|
+
-c, --channel=<option> Release channel (auto-detected from version if omitted)
|
|
60
|
+
<options: stable|testing>
|
|
61
|
+
-k, --key=<value> (required) API key for authentication
|
|
62
|
+
--cockpitApiHost=<value> (required) [default: https://cockpit.laioutr.cloud] cockpit api host
|
|
63
|
+
--cwd=<value> (required) [default: /Users/sl/src/laioutr/apps/cli] current working directory
|
|
64
|
+
|
|
65
|
+
DESCRIPTION
|
|
66
|
+
Publish an app version to the Laioutr platform.
|
|
67
|
+
|
|
68
|
+
EXAMPLES
|
|
69
|
+
$ laioutr app release
|
|
70
|
+
|
|
71
|
+
$ laioutr app release --channel testing
|
|
72
|
+
|
|
73
|
+
LAIOUTR_API_KEY=orgKey_xxx laioutr app release
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
_See code: [src/commands/app/release.ts](https://github.com/laioutr/laioutr/blob/v0.3.2/src/commands/app/release.ts)_
|
|
45
77
|
|
|
46
78
|
## `laioutr help [COMMAND]`
|
|
47
79
|
|
|
@@ -352,4 +384,77 @@ DESCRIPTION
|
|
|
352
384
|
```
|
|
353
385
|
|
|
354
386
|
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.41/src/commands/plugins/update.ts)_
|
|
387
|
+
|
|
388
|
+
## `laioutr project fetch-rc [FILENAME]`
|
|
389
|
+
|
|
390
|
+
Fetches the laioutrrc.json of a project from the cockpit api.
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
USAGE
|
|
394
|
+
$ laioutr project fetch-rc [FILENAME] --cockpitApiHost <value> --cwd <value> -e <value> -s <value> -p <value>
|
|
395
|
+
|
|
396
|
+
FLAGS
|
|
397
|
+
-e, --environmentName=<value> (required) [default: main] environment name
|
|
398
|
+
-p, --project=<value> (required) <organization slug>/<project slug>
|
|
399
|
+
-s, --projectSecret=<value> (required) project secret
|
|
400
|
+
--cockpitApiHost=<value> (required) [default: https://cockpit.laioutr.cloud] cockpit api host
|
|
401
|
+
--cwd=<value> (required) [default: /Users/sl/src/laioutr/apps/cli] current working directory
|
|
402
|
+
|
|
403
|
+
DESCRIPTION
|
|
404
|
+
Fetches the laioutrrc.json of a project from the cockpit api.
|
|
405
|
+
|
|
406
|
+
ALIASES
|
|
407
|
+
$ laioutr project fetch-rc
|
|
408
|
+
|
|
409
|
+
EXAMPLES
|
|
410
|
+
$ laioutr project fetch-rc
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## `laioutr rc fetch [FILENAME]`
|
|
414
|
+
|
|
415
|
+
Fetches the laioutrrc.json of a project from the cockpit api.
|
|
416
|
+
|
|
417
|
+
```
|
|
418
|
+
USAGE
|
|
419
|
+
$ laioutr rc fetch [FILENAME] --cockpitApiHost <value> --cwd <value> -e <value> -s <value> -p <value>
|
|
420
|
+
|
|
421
|
+
FLAGS
|
|
422
|
+
-e, --environmentName=<value> (required) [default: main] environment name
|
|
423
|
+
-p, --project=<value> (required) <organization slug>/<project slug>
|
|
424
|
+
-s, --projectSecret=<value> (required) project secret
|
|
425
|
+
--cockpitApiHost=<value> (required) [default: https://cockpit.laioutr.cloud] cockpit api host
|
|
426
|
+
--cwd=<value> (required) [default: /Users/sl/src/laioutr/apps/cli] current working directory
|
|
427
|
+
|
|
428
|
+
DESCRIPTION
|
|
429
|
+
Fetches the laioutrrc.json of a project from the cockpit api.
|
|
430
|
+
|
|
431
|
+
ALIASES
|
|
432
|
+
$ laioutr project fetch-rc
|
|
433
|
+
|
|
434
|
+
EXAMPLES
|
|
435
|
+
$ laioutr rc fetch
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
_See code: [src/commands/rc/fetch.ts](https://github.com/laioutr/laioutr/blob/v0.3.2/src/commands/rc/fetch.ts)_
|
|
439
|
+
|
|
440
|
+
## `laioutr rc update [FILENAME]`
|
|
441
|
+
|
|
442
|
+
Updates an existing laioutrrc.json file with the latest from the cockpit api.
|
|
443
|
+
|
|
444
|
+
```
|
|
445
|
+
USAGE
|
|
446
|
+
$ laioutr rc update [FILENAME] --cockpitApiHost <value> --cwd <value>
|
|
447
|
+
|
|
448
|
+
FLAGS
|
|
449
|
+
--cockpitApiHost=<value> (required) [default: https://cockpit.laioutr.cloud] cockpit api host
|
|
450
|
+
--cwd=<value> (required) [default: /Users/sl/src/laioutr/apps/cli] current working directory
|
|
451
|
+
|
|
452
|
+
DESCRIPTION
|
|
453
|
+
Updates an existing laioutrrc.json file with the latest from the cockpit api.
|
|
454
|
+
|
|
455
|
+
EXAMPLES
|
|
456
|
+
$ laioutr rc update
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
_See code: [src/commands/rc/update.ts](https://github.com/laioutr/laioutr/blob/v0.3.2/src/commands/rc/update.ts)_
|
|
355
460
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface HostApiOptions {
|
|
2
|
+
cockpitApiHost: string;
|
|
3
|
+
}
|
|
4
|
+
export interface ProjectApiOptions extends HostApiOptions {
|
|
5
|
+
project: string;
|
|
6
|
+
projectSecret: string;
|
|
7
|
+
environmentName: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const fetchRc: (flags: ProjectApiOptions) => Promise<string>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
const apiResponseSchema = z.object({
|
|
4
|
+
content: z.string(),
|
|
5
|
+
});
|
|
6
|
+
export const fetchRc = async (flags) => {
|
|
7
|
+
const url = `${flags.cockpitApiHost}/api/v1/project/fetch-rc`;
|
|
8
|
+
const [organizationSlug, projectSlug] = flags.project.replace('/p/', '').split('/');
|
|
9
|
+
const response = await fetch(url, {
|
|
10
|
+
body: JSON.stringify({
|
|
11
|
+
environmentName: flags.environmentName,
|
|
12
|
+
organizationSlug,
|
|
13
|
+
projectSecret: flags.projectSecret,
|
|
14
|
+
projectSlug,
|
|
15
|
+
}),
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
},
|
|
19
|
+
method: 'POST',
|
|
20
|
+
});
|
|
21
|
+
const body = await response.text();
|
|
22
|
+
let data = null;
|
|
23
|
+
if (response.status !== 200) {
|
|
24
|
+
throw new Error(`Failed to fetch RC file. Status: ${response.status} ${response.statusText}. Body: ${body}`);
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
data = JSON.parse(body);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error(error, response);
|
|
31
|
+
throw new Error('Failed to parse RC file. See error message above.');
|
|
32
|
+
}
|
|
33
|
+
const parsed = apiResponseSchema.parse(data);
|
|
34
|
+
return parsed.content;
|
|
35
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ReleaseOptions {
|
|
2
|
+
cockpitApiHost: string;
|
|
3
|
+
apiKey: string;
|
|
4
|
+
packageName: string;
|
|
5
|
+
version: string;
|
|
6
|
+
configSchema: Record<string, unknown>;
|
|
7
|
+
peerDependencies: Record<string, string>;
|
|
8
|
+
channel?: 'stable' | 'testing';
|
|
9
|
+
}
|
|
10
|
+
export declare const releaseAppVersion: (options: ReleaseOptions) => Promise<{
|
|
11
|
+
message: string;
|
|
12
|
+
versionId?: string | undefined;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
const releaseResponseSchema = z.object({
|
|
3
|
+
message: z.string(),
|
|
4
|
+
versionId: z.string().optional(),
|
|
5
|
+
});
|
|
6
|
+
export const releaseAppVersion = async (options) => {
|
|
7
|
+
const url = `${options.cockpitApiHost}/api/v1/app/release`;
|
|
8
|
+
const response = await fetch(url, {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
headers: {
|
|
11
|
+
'Content-Type': 'application/json',
|
|
12
|
+
Authorization: `Bearer ${options.apiKey}`,
|
|
13
|
+
},
|
|
14
|
+
body: JSON.stringify({
|
|
15
|
+
packageName: options.packageName,
|
|
16
|
+
version: options.version,
|
|
17
|
+
configSchema: options.configSchema,
|
|
18
|
+
peerDependencies: options.peerDependencies,
|
|
19
|
+
channel: options.channel,
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
const body = await response.text();
|
|
23
|
+
if (response.status !== 200) {
|
|
24
|
+
throw new Error(`Release failed (${response.status}): ${body}`);
|
|
25
|
+
}
|
|
26
|
+
return releaseResponseSchema.parse(JSON.parse(body));
|
|
27
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import LaioutrBaseCommand from '../../laioutr-base-command.js';
|
|
2
|
+
export default class AppRelease extends LaioutrBaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
key: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
channel: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
cockpitApiHost: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
cwd: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { Flags } from '@oclif/core';
|
|
4
|
+
import { releaseAppVersion } from '../../api/releaseAppVersion.js';
|
|
5
|
+
import LaioutrBaseCommand from '../../laioutr-base-command.js';
|
|
6
|
+
export default class AppRelease extends LaioutrBaseCommand {
|
|
7
|
+
static description = 'Publish an app version to the Laioutr platform.';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> app release',
|
|
10
|
+
'<%= config.bin %> app release --channel testing',
|
|
11
|
+
'LAIOUTR_API_KEY=orgKey_xxx <%= config.bin %> app release',
|
|
12
|
+
];
|
|
13
|
+
static flags = {
|
|
14
|
+
...LaioutrBaseCommand.flags,
|
|
15
|
+
key: Flags.string({
|
|
16
|
+
char: 'k',
|
|
17
|
+
description: 'API key for authentication',
|
|
18
|
+
env: 'LAIOUTR_API_KEY',
|
|
19
|
+
required: true,
|
|
20
|
+
}),
|
|
21
|
+
channel: Flags.string({
|
|
22
|
+
char: 'c',
|
|
23
|
+
description: 'Release channel (auto-detected from version if omitted)',
|
|
24
|
+
options: ['stable', 'testing'],
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
async run() {
|
|
28
|
+
const { flags } = await this.parse(AppRelease);
|
|
29
|
+
// 1. Read package.json
|
|
30
|
+
const pkgPath = path.join(flags.cwd, 'package.json');
|
|
31
|
+
const pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));
|
|
32
|
+
if (!pkg.name || !pkg.version) {
|
|
33
|
+
this.error('package.json must have "name" and "version" fields');
|
|
34
|
+
}
|
|
35
|
+
// 2. Import configSchema via jiti
|
|
36
|
+
let configSchema = {};
|
|
37
|
+
try {
|
|
38
|
+
const { createJiti } = await import('jiti');
|
|
39
|
+
const jiti = createJiti(flags.cwd);
|
|
40
|
+
const mod = await jiti.import(path.join(flags.cwd, 'src/module.ts'));
|
|
41
|
+
configSchema = mod.configSchema ?? {};
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
this.warn('Could not import configSchema from src/module.ts — publishing without config schema');
|
|
45
|
+
}
|
|
46
|
+
// 3. Extract peer dependencies
|
|
47
|
+
const peerDependencies = pkg.peerDependencies ?? {};
|
|
48
|
+
// 4. Detect channel
|
|
49
|
+
const channel = flags.channel;
|
|
50
|
+
this.log(`Publishing ${pkg.name}@${pkg.version}...`);
|
|
51
|
+
// 5. Call the release API
|
|
52
|
+
const result = await releaseAppVersion({
|
|
53
|
+
cockpitApiHost: flags.cockpitApiHost,
|
|
54
|
+
apiKey: flags.key,
|
|
55
|
+
packageName: pkg.name,
|
|
56
|
+
version: pkg.version,
|
|
57
|
+
configSchema,
|
|
58
|
+
peerDependencies,
|
|
59
|
+
channel,
|
|
60
|
+
});
|
|
61
|
+
this.log(result.message);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import LaioutrBaseCommand from '../../laioutr-base-command.js';
|
|
2
|
+
export default class ProjectRcFetch extends LaioutrBaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
fileName: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
environmentName: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
projectSecret: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
cockpitApiHost: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
cwd: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
static aliases: string[];
|
|
16
|
+
static deprecateAliases: boolean;
|
|
17
|
+
run(): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { writeFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { Args, Flags } from '@oclif/core';
|
|
4
|
+
import { fetchRc } from '../../api/fetchRc.js';
|
|
5
|
+
import LaioutrBaseCommand from '../../laioutr-base-command.js';
|
|
6
|
+
export default class ProjectRcFetch extends LaioutrBaseCommand {
|
|
7
|
+
static args = {
|
|
8
|
+
...LaioutrBaseCommand.args,
|
|
9
|
+
fileName: Args.string({ default: 'laioutrrc.json', name: 'fileName', required: false }),
|
|
10
|
+
};
|
|
11
|
+
static description = 'Fetches the laioutrrc.json of a project from the cockpit api.';
|
|
12
|
+
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
13
|
+
static flags = {
|
|
14
|
+
...LaioutrBaseCommand.flags,
|
|
15
|
+
environmentName: Flags.string({ char: 'e', default: 'main', description: 'environment name', env: 'ENVIRONMENT_NAME', required: true }),
|
|
16
|
+
projectSecret: Flags.string({ char: 's', description: 'project secret', env: 'PROJECT_SECRET', required: true }),
|
|
17
|
+
project: Flags.string({ char: 'p', description: '<organization slug>/<project slug>', env: 'PROJECT', required: true }),
|
|
18
|
+
};
|
|
19
|
+
static aliases = ['project:fetch-rc'];
|
|
20
|
+
static deprecateAliases = true;
|
|
21
|
+
async run() {
|
|
22
|
+
const { args, flags } = await this.parse(ProjectRcFetch);
|
|
23
|
+
const rc = await fetchRc(flags);
|
|
24
|
+
const filePath = path.join(flags.cwd, args.fileName);
|
|
25
|
+
this.log('Writing RC file', filePath);
|
|
26
|
+
return writeFile(filePath, rc);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import LaioutrBaseCommand from '../../laioutr-base-command.js';
|
|
2
|
+
export default class ProjectRcUpdate extends LaioutrBaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
fileName: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
cockpitApiHost: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
cwd: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { Args } from '@oclif/core';
|
|
4
|
+
import { fetchRc } from '../../api/fetchRc.js';
|
|
5
|
+
import LaioutrBaseCommand from '../../laioutr-base-command.js';
|
|
6
|
+
import { rcWithLaioutrMetaSchema } from '../../rc/validation.js';
|
|
7
|
+
export default class ProjectRcUpdate extends LaioutrBaseCommand {
|
|
8
|
+
static args = {
|
|
9
|
+
...LaioutrBaseCommand.args,
|
|
10
|
+
fileName: Args.string({ default: 'laioutrrc.json', name: 'fileName', required: false }),
|
|
11
|
+
};
|
|
12
|
+
static description = 'Updates an existing laioutrrc.json file with the latest from the cockpit api.';
|
|
13
|
+
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
14
|
+
static flags = {
|
|
15
|
+
...LaioutrBaseCommand.flags,
|
|
16
|
+
};
|
|
17
|
+
async run() {
|
|
18
|
+
const { args, flags } = await this.parse(ProjectRcUpdate);
|
|
19
|
+
const currentRcRaw = await readFile(path.join(flags.cwd, args.fileName), 'utf-8');
|
|
20
|
+
const currentRc = rcWithLaioutrMetaSchema.parse(JSON.parse(currentRcRaw));
|
|
21
|
+
const options = {
|
|
22
|
+
...flags,
|
|
23
|
+
project: currentRc.laioutr.projectSlug,
|
|
24
|
+
projectSecret: currentRc.laioutr.projectSecretKey,
|
|
25
|
+
environmentName: currentRc.laioutr.environmentName,
|
|
26
|
+
};
|
|
27
|
+
this.log('Fetching latest RC for project', options.project);
|
|
28
|
+
const rc = await fetchRc(options);
|
|
29
|
+
const filePath = path.join(flags.cwd, args.fileName);
|
|
30
|
+
this.log('Writing RC file', filePath);
|
|
31
|
+
return writeFile(filePath, rc);
|
|
32
|
+
}
|
|
33
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default abstract class LaioutrBaseCommand extends Command {
|
|
3
|
+
static args: {};
|
|
4
|
+
static flags: {
|
|
5
|
+
cockpitApiHost: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
cwd: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
export default class LaioutrBaseCommand extends Command {
|
|
3
|
+
static args = {};
|
|
4
|
+
static flags = {
|
|
5
|
+
cockpitApiHost: Flags.string({
|
|
6
|
+
default: 'https://cockpit.laioutr.cloud',
|
|
7
|
+
description: 'cockpit api host',
|
|
8
|
+
env: 'COCKPIT_API_HOST',
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
cwd: Flags.string({
|
|
12
|
+
default: process.cwd(),
|
|
13
|
+
description: 'current working directory',
|
|
14
|
+
env: 'CWD',
|
|
15
|
+
required: true,
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -1,4 +1,210 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commands": {
|
|
3
|
-
|
|
2
|
+
"commands": {
|
|
3
|
+
"app:release": {
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"args": {},
|
|
6
|
+
"description": "Publish an app version to the Laioutr platform.",
|
|
7
|
+
"examples": [
|
|
8
|
+
"<%= config.bin %> app release",
|
|
9
|
+
"<%= config.bin %> app release --channel testing",
|
|
10
|
+
"LAIOUTR_API_KEY=orgKey_xxx <%= config.bin %> app release"
|
|
11
|
+
],
|
|
12
|
+
"flags": {
|
|
13
|
+
"cockpitApiHost": {
|
|
14
|
+
"description": "cockpit api host",
|
|
15
|
+
"env": "COCKPIT_API_HOST",
|
|
16
|
+
"name": "cockpitApiHost",
|
|
17
|
+
"required": true,
|
|
18
|
+
"default": "https://cockpit.laioutr.cloud",
|
|
19
|
+
"hasDynamicHelp": false,
|
|
20
|
+
"multiple": false,
|
|
21
|
+
"type": "option"
|
|
22
|
+
},
|
|
23
|
+
"cwd": {
|
|
24
|
+
"description": "current working directory",
|
|
25
|
+
"env": "CWD",
|
|
26
|
+
"name": "cwd",
|
|
27
|
+
"required": true,
|
|
28
|
+
"default": "/Users/sl/src/laioutr/apps/cli",
|
|
29
|
+
"hasDynamicHelp": false,
|
|
30
|
+
"multiple": false,
|
|
31
|
+
"type": "option"
|
|
32
|
+
},
|
|
33
|
+
"key": {
|
|
34
|
+
"char": "k",
|
|
35
|
+
"description": "API key for authentication",
|
|
36
|
+
"env": "LAIOUTR_API_KEY",
|
|
37
|
+
"name": "key",
|
|
38
|
+
"required": true,
|
|
39
|
+
"hasDynamicHelp": false,
|
|
40
|
+
"multiple": false,
|
|
41
|
+
"type": "option"
|
|
42
|
+
},
|
|
43
|
+
"channel": {
|
|
44
|
+
"char": "c",
|
|
45
|
+
"description": "Release channel (auto-detected from version if omitted)",
|
|
46
|
+
"name": "channel",
|
|
47
|
+
"hasDynamicHelp": false,
|
|
48
|
+
"multiple": false,
|
|
49
|
+
"options": [
|
|
50
|
+
"stable",
|
|
51
|
+
"testing"
|
|
52
|
+
],
|
|
53
|
+
"type": "option"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"hasDynamicHelp": false,
|
|
57
|
+
"hiddenAliases": [],
|
|
58
|
+
"id": "app:release",
|
|
59
|
+
"pluginAlias": "@laioutr/cli",
|
|
60
|
+
"pluginName": "@laioutr/cli",
|
|
61
|
+
"pluginType": "core",
|
|
62
|
+
"strict": true,
|
|
63
|
+
"enableJsonFlag": false,
|
|
64
|
+
"isESM": true,
|
|
65
|
+
"relativePath": [
|
|
66
|
+
"dist",
|
|
67
|
+
"commands",
|
|
68
|
+
"app",
|
|
69
|
+
"release.js"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"rc:fetch": {
|
|
73
|
+
"aliases": [
|
|
74
|
+
"project:fetch-rc"
|
|
75
|
+
],
|
|
76
|
+
"args": {
|
|
77
|
+
"fileName": {
|
|
78
|
+
"default": "laioutrrc.json",
|
|
79
|
+
"name": "fileName",
|
|
80
|
+
"required": false
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"deprecateAliases": true,
|
|
84
|
+
"description": "Fetches the laioutrrc.json of a project from the cockpit api.",
|
|
85
|
+
"examples": [
|
|
86
|
+
"<%= config.bin %> <%= command.id %>"
|
|
87
|
+
],
|
|
88
|
+
"flags": {
|
|
89
|
+
"cockpitApiHost": {
|
|
90
|
+
"description": "cockpit api host",
|
|
91
|
+
"env": "COCKPIT_API_HOST",
|
|
92
|
+
"name": "cockpitApiHost",
|
|
93
|
+
"required": true,
|
|
94
|
+
"default": "https://cockpit.laioutr.cloud",
|
|
95
|
+
"hasDynamicHelp": false,
|
|
96
|
+
"multiple": false,
|
|
97
|
+
"type": "option"
|
|
98
|
+
},
|
|
99
|
+
"cwd": {
|
|
100
|
+
"description": "current working directory",
|
|
101
|
+
"env": "CWD",
|
|
102
|
+
"name": "cwd",
|
|
103
|
+
"required": true,
|
|
104
|
+
"default": "/Users/sl/src/laioutr/apps/cli",
|
|
105
|
+
"hasDynamicHelp": false,
|
|
106
|
+
"multiple": false,
|
|
107
|
+
"type": "option"
|
|
108
|
+
},
|
|
109
|
+
"environmentName": {
|
|
110
|
+
"char": "e",
|
|
111
|
+
"description": "environment name",
|
|
112
|
+
"env": "ENVIRONMENT_NAME",
|
|
113
|
+
"name": "environmentName",
|
|
114
|
+
"required": true,
|
|
115
|
+
"default": "main",
|
|
116
|
+
"hasDynamicHelp": false,
|
|
117
|
+
"multiple": false,
|
|
118
|
+
"type": "option"
|
|
119
|
+
},
|
|
120
|
+
"projectSecret": {
|
|
121
|
+
"char": "s",
|
|
122
|
+
"description": "project secret",
|
|
123
|
+
"env": "PROJECT_SECRET",
|
|
124
|
+
"name": "projectSecret",
|
|
125
|
+
"required": true,
|
|
126
|
+
"hasDynamicHelp": false,
|
|
127
|
+
"multiple": false,
|
|
128
|
+
"type": "option"
|
|
129
|
+
},
|
|
130
|
+
"project": {
|
|
131
|
+
"char": "p",
|
|
132
|
+
"description": "<organization slug>/<project slug>",
|
|
133
|
+
"env": "PROJECT",
|
|
134
|
+
"name": "project",
|
|
135
|
+
"required": true,
|
|
136
|
+
"hasDynamicHelp": false,
|
|
137
|
+
"multiple": false,
|
|
138
|
+
"type": "option"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"hasDynamicHelp": false,
|
|
142
|
+
"hiddenAliases": [],
|
|
143
|
+
"id": "rc:fetch",
|
|
144
|
+
"pluginAlias": "@laioutr/cli",
|
|
145
|
+
"pluginName": "@laioutr/cli",
|
|
146
|
+
"pluginType": "core",
|
|
147
|
+
"strict": true,
|
|
148
|
+
"enableJsonFlag": false,
|
|
149
|
+
"isESM": true,
|
|
150
|
+
"relativePath": [
|
|
151
|
+
"dist",
|
|
152
|
+
"commands",
|
|
153
|
+
"rc",
|
|
154
|
+
"fetch.js"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"rc:update": {
|
|
158
|
+
"aliases": [],
|
|
159
|
+
"args": {
|
|
160
|
+
"fileName": {
|
|
161
|
+
"default": "laioutrrc.json",
|
|
162
|
+
"name": "fileName",
|
|
163
|
+
"required": false
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"description": "Updates an existing laioutrrc.json file with the latest from the cockpit api.",
|
|
167
|
+
"examples": [
|
|
168
|
+
"<%= config.bin %> <%= command.id %>"
|
|
169
|
+
],
|
|
170
|
+
"flags": {
|
|
171
|
+
"cockpitApiHost": {
|
|
172
|
+
"description": "cockpit api host",
|
|
173
|
+
"env": "COCKPIT_API_HOST",
|
|
174
|
+
"name": "cockpitApiHost",
|
|
175
|
+
"required": true,
|
|
176
|
+
"default": "https://cockpit.laioutr.cloud",
|
|
177
|
+
"hasDynamicHelp": false,
|
|
178
|
+
"multiple": false,
|
|
179
|
+
"type": "option"
|
|
180
|
+
},
|
|
181
|
+
"cwd": {
|
|
182
|
+
"description": "current working directory",
|
|
183
|
+
"env": "CWD",
|
|
184
|
+
"name": "cwd",
|
|
185
|
+
"required": true,
|
|
186
|
+
"default": "/Users/sl/src/laioutr/apps/cli",
|
|
187
|
+
"hasDynamicHelp": false,
|
|
188
|
+
"multiple": false,
|
|
189
|
+
"type": "option"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"hasDynamicHelp": false,
|
|
193
|
+
"hiddenAliases": [],
|
|
194
|
+
"id": "rc:update",
|
|
195
|
+
"pluginAlias": "@laioutr/cli",
|
|
196
|
+
"pluginName": "@laioutr/cli",
|
|
197
|
+
"pluginType": "core",
|
|
198
|
+
"strict": true,
|
|
199
|
+
"enableJsonFlag": false,
|
|
200
|
+
"isESM": true,
|
|
201
|
+
"relativePath": [
|
|
202
|
+
"dist",
|
|
203
|
+
"commands",
|
|
204
|
+
"rc",
|
|
205
|
+
"update.js"
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"version": "0.3.2"
|
|
4
210
|
}
|