hereya-cli 0.33.0 → 0.35.0
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 +64 -23
- package/dist/backend/cloud/cloud-backend.d.ts +27 -0
- package/dist/backend/cloud/cloud-backend.js +334 -0
- package/dist/backend/cloud/login.d.ts +16 -0
- package/dist/backend/cloud/login.js +145 -0
- package/dist/backend/cloud/logout.d.ts +9 -0
- package/dist/backend/cloud/logout.js +12 -0
- package/dist/backend/cloud/utils.d.ts +3 -0
- package/dist/backend/cloud/utils.js +6 -0
- package/dist/backend/common.d.ts +3 -0
- package/dist/backend/config.d.ts +30 -3
- package/dist/backend/config.js +36 -2
- package/dist/backend/file.js +2 -2
- package/dist/backend/index.d.ts +3 -1
- package/dist/backend/index.js +26 -3
- package/dist/backend/secrets.d.ts +5 -0
- package/dist/backend/secrets.js +66 -0
- package/dist/commands/bootstrap/index.js +15 -7
- package/dist/commands/init/index.js +1 -1
- package/dist/commands/login/index.d.ts +9 -0
- package/dist/commands/login/index.js +27 -0
- package/dist/commands/logout/index.d.ts +6 -0
- package/dist/commands/logout/index.js +23 -0
- package/dist/commands/unbootstrap/index.js +12 -1
- package/dist/executor/local.js +3 -1
- package/dist/infrastructure/aws-config.js +16 -5
- package/dist/infrastructure/aws.js +8 -23
- package/oclif.manifest.json +56 -1
- package/package.json +5 -2
|
@@ -7,24 +7,9 @@ import { getIac } from '../iac/index.js';
|
|
|
7
7
|
import { downloadPackage } from '../lib/package/index.js';
|
|
8
8
|
import { runShell } from '../lib/shell.js';
|
|
9
9
|
import { getAwsConfig, getAwsConfigKey } from './aws-config.js';
|
|
10
|
-
import { getPackageDownloadPath } from './common.js';
|
|
10
|
+
import { getPackageDownloadPath, } from './common.js';
|
|
11
11
|
import { destroyPackage, provisionPackage } from './index.js';
|
|
12
12
|
export class AwsInfrastructure {
|
|
13
|
-
// public static configKey = '/hereya-bootstrap/config'
|
|
14
|
-
// public static async getConfig(): Promise<{
|
|
15
|
-
// backendBucket: string
|
|
16
|
-
// terraformStateBucketName: string
|
|
17
|
-
// terraformStateBucketRegion?: string
|
|
18
|
-
// terraformStateLockTableName: string
|
|
19
|
-
// }> {
|
|
20
|
-
// const ssmClient = new SSMClient({})
|
|
21
|
-
// const ssmParameter = await ssmClient.send(
|
|
22
|
-
// new GetParameterCommand({
|
|
23
|
-
// Name: AwsInfrastructure.configKey,
|
|
24
|
-
// }),
|
|
25
|
-
// )
|
|
26
|
-
// return JSON.parse(ssmParameter.Parameter?.Value ?? '{}')
|
|
27
|
-
// }
|
|
28
13
|
async bootstrap(_) {
|
|
29
14
|
const stsClient = new STSClient({});
|
|
30
15
|
const { Account: accountId } = await stsClient.send(new GetCallerIdentityCommand({}));
|
|
@@ -59,7 +44,7 @@ export class AwsInfrastructure {
|
|
|
59
44
|
const downloadPath = await downloadPackage(input.pkgUrl, destPath);
|
|
60
45
|
const region = process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION;
|
|
61
46
|
const infraConfig = {
|
|
62
|
-
...await getAwsConfig(),
|
|
47
|
+
...(await getAwsConfig()),
|
|
63
48
|
region,
|
|
64
49
|
};
|
|
65
50
|
if (!infraConfig.terraformStateBucketName || !infraConfig.terraformStateLockTableName) {
|
|
@@ -192,8 +177,13 @@ export class AwsInfrastructure {
|
|
|
192
177
|
return { success: true, value: parameter.Parameter.ARN };
|
|
193
178
|
}
|
|
194
179
|
async unbootstrap(_) {
|
|
180
|
+
const bootstrapPackage = 'hereya/bootstrap-aws-stack';
|
|
181
|
+
const output = await destroyPackage({ package: bootstrapPackage });
|
|
182
|
+
if (!output.success) {
|
|
183
|
+
throw new Error(output.reason);
|
|
184
|
+
}
|
|
195
185
|
const ssmClient = new SSMClient({});
|
|
196
|
-
const key =
|
|
186
|
+
const key = getAwsConfigKey();
|
|
197
187
|
try {
|
|
198
188
|
await ssmClient.send(new DeleteParameterCommand({
|
|
199
189
|
Name: key,
|
|
@@ -202,11 +192,6 @@ export class AwsInfrastructure {
|
|
|
202
192
|
catch (error) {
|
|
203
193
|
console.log(`Could not delete parameter "${key}": ${error.message}. Continuing with unbootstrap...`);
|
|
204
194
|
}
|
|
205
|
-
const bootstrapPackage = 'hereya/bootstrap-aws-stack';
|
|
206
|
-
const output = await destroyPackage({ package: bootstrapPackage });
|
|
207
|
-
if (!output.success) {
|
|
208
|
-
throw new Error(output.reason);
|
|
209
|
-
}
|
|
210
195
|
}
|
|
211
196
|
async undeploy(input) {
|
|
212
197
|
input.parameters = {
|
package/oclif.manifest.json
CHANGED
|
@@ -313,6 +313,61 @@
|
|
|
313
313
|
"index.js"
|
|
314
314
|
]
|
|
315
315
|
},
|
|
316
|
+
"login": {
|
|
317
|
+
"aliases": [],
|
|
318
|
+
"args": {
|
|
319
|
+
"url": {
|
|
320
|
+
"description": "URL of the Hereya Cloud backend",
|
|
321
|
+
"name": "url",
|
|
322
|
+
"required": true
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
"description": "Login to the Hereya Cloud backend",
|
|
326
|
+
"examples": [
|
|
327
|
+
"<%= config.bin %> <%= command.id %> https://cloud.hereya.dev",
|
|
328
|
+
"<%= config.bin %> <%= command.id %> http://localhost:5173"
|
|
329
|
+
],
|
|
330
|
+
"flags": {},
|
|
331
|
+
"hasDynamicHelp": false,
|
|
332
|
+
"hiddenAliases": [],
|
|
333
|
+
"id": "login",
|
|
334
|
+
"pluginAlias": "hereya-cli",
|
|
335
|
+
"pluginName": "hereya-cli",
|
|
336
|
+
"pluginType": "core",
|
|
337
|
+
"strict": true,
|
|
338
|
+
"enableJsonFlag": false,
|
|
339
|
+
"isESM": true,
|
|
340
|
+
"relativePath": [
|
|
341
|
+
"dist",
|
|
342
|
+
"commands",
|
|
343
|
+
"login",
|
|
344
|
+
"index.js"
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
"logout": {
|
|
348
|
+
"aliases": [],
|
|
349
|
+
"args": {},
|
|
350
|
+
"description": "Logout from Hereya Cloud",
|
|
351
|
+
"examples": [
|
|
352
|
+
"<%= config.bin %> <%= command.id %>"
|
|
353
|
+
],
|
|
354
|
+
"flags": {},
|
|
355
|
+
"hasDynamicHelp": false,
|
|
356
|
+
"hiddenAliases": [],
|
|
357
|
+
"id": "logout",
|
|
358
|
+
"pluginAlias": "hereya-cli",
|
|
359
|
+
"pluginName": "hereya-cli",
|
|
360
|
+
"pluginType": "core",
|
|
361
|
+
"strict": true,
|
|
362
|
+
"enableJsonFlag": false,
|
|
363
|
+
"isESM": true,
|
|
364
|
+
"relativePath": [
|
|
365
|
+
"dist",
|
|
366
|
+
"commands",
|
|
367
|
+
"logout",
|
|
368
|
+
"index.js"
|
|
369
|
+
]
|
|
370
|
+
},
|
|
316
371
|
"remove": {
|
|
317
372
|
"aliases": [],
|
|
318
373
|
"args": {
|
|
@@ -1063,5 +1118,5 @@
|
|
|
1063
1118
|
]
|
|
1064
1119
|
}
|
|
1065
1120
|
},
|
|
1066
|
-
"version": "0.
|
|
1121
|
+
"version": "0.35.0"
|
|
1067
1122
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hereya-cli",
|
|
3
3
|
"description": "Infrastructure as Package",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.35.0",
|
|
5
5
|
"author": "Hereya Developers",
|
|
6
6
|
"bin": {
|
|
7
7
|
"hereya": "./bin/run.js"
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
"@oclif/plugin-plugins": "^5.4.31",
|
|
22
22
|
"glob": "^11.0.1",
|
|
23
23
|
"ignore": "^7.0.3",
|
|
24
|
+
"keytar": "^7.9.0",
|
|
24
25
|
"listr2": "^8.2.5",
|
|
26
|
+
"node-machine-id": "^1.1.12",
|
|
27
|
+
"open": "^10.1.1",
|
|
25
28
|
"simple-git": "^3.27.0",
|
|
26
29
|
"unzip-stream": "^0.3.4",
|
|
27
30
|
"yaml": "^2.7.0",
|
|
@@ -43,7 +46,7 @@
|
|
|
43
46
|
"eslint-plugin-chai-friendly": "^1.0.1",
|
|
44
47
|
"mocha": "^11.1.0",
|
|
45
48
|
"mock-fs": "^5.5.0",
|
|
46
|
-
"nock": "^14.0.
|
|
49
|
+
"nock": "^14.0.3",
|
|
47
50
|
"oclif": "^4.17.27",
|
|
48
51
|
"shx": "^0.3.4",
|
|
49
52
|
"sinon": "^19.0.2",
|