@hot-updater/aws 0.30.8 → 0.30.10
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/dist/iac/index.cjs +107 -27
- package/dist/iac/index.mjs +108 -28
- package/dist/lambda/index.cjs +1 -1
- package/package.json +8 -8
package/dist/iac/index.cjs
CHANGED
|
@@ -7325,7 +7325,7 @@ var SSMKeyPairManager = class {
|
|
|
7325
7325
|
};
|
|
7326
7326
|
//#endregion
|
|
7327
7327
|
//#region iac/templates.ts
|
|
7328
|
-
const getConfigScaffold = (build,
|
|
7328
|
+
const getConfigScaffold = (build, authMode) => {
|
|
7329
7329
|
const storageConfig = {
|
|
7330
7330
|
imports: [{
|
|
7331
7331
|
pkg: "@hot-updater/aws",
|
|
@@ -7343,21 +7343,42 @@ const getConfigScaffold = (build, { profile }) => {
|
|
|
7343
7343
|
cloudfrontDistributionId: process.env.HOT_UPDATER_CLOUDFRONT_DISTRIBUTION_ID!,
|
|
7344
7344
|
})`
|
|
7345
7345
|
};
|
|
7346
|
-
let helperStatements
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7346
|
+
let helperStatements;
|
|
7347
|
+
switch (authMode.mode) {
|
|
7348
|
+
case "sso":
|
|
7349
|
+
helperStatements = [{
|
|
7350
|
+
name: "commonOptions",
|
|
7351
|
+
strategy: "merge-object",
|
|
7352
|
+
code: `
|
|
7351
7353
|
const commonOptions = {
|
|
7352
7354
|
bucketName: process.env.HOT_UPDATER_S3_BUCKET_NAME!,
|
|
7353
7355
|
region: process.env.HOT_UPDATER_S3_REGION!,
|
|
7354
7356
|
credentials: fromSSO({ profile: process.env.HOT_UPDATER_AWS_PROFILE! }),
|
|
7355
7357
|
};`.trim()
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7358
|
+
}];
|
|
7359
|
+
break;
|
|
7360
|
+
case "local":
|
|
7361
|
+
helperStatements = [{
|
|
7362
|
+
name: "commonOptions",
|
|
7363
|
+
strategy: "merge-object",
|
|
7364
|
+
code: authMode.profile ? `
|
|
7365
|
+
const commonOptions = {
|
|
7366
|
+
bucketName: process.env.HOT_UPDATER_S3_BUCKET_NAME!,
|
|
7367
|
+
region: process.env.HOT_UPDATER_S3_REGION!,
|
|
7368
|
+
credentials: fromIni({ profile: process.env.HOT_UPDATER_AWS_PROFILE! }),
|
|
7369
|
+
};`.trim() : `
|
|
7370
|
+
const commonOptions = {
|
|
7371
|
+
bucketName: process.env.HOT_UPDATER_S3_BUCKET_NAME!,
|
|
7372
|
+
region: process.env.HOT_UPDATER_S3_REGION!,
|
|
7373
|
+
credentials: fromNodeProviderChain(),
|
|
7374
|
+
};`.trim()
|
|
7375
|
+
}];
|
|
7376
|
+
break;
|
|
7377
|
+
case "account":
|
|
7378
|
+
helperStatements = [{
|
|
7379
|
+
name: "commonOptions",
|
|
7380
|
+
strategy: "merge-object",
|
|
7381
|
+
code: `
|
|
7361
7382
|
const commonOptions = {
|
|
7362
7383
|
bucketName: process.env.HOT_UPDATER_S3_BUCKET_NAME!,
|
|
7363
7384
|
region: process.env.HOT_UPDATER_S3_REGION!,
|
|
@@ -7366,12 +7387,25 @@ const commonOptions = {
|
|
|
7366
7387
|
secretAccessKey: process.env.HOT_UPDATER_S3_SECRET_ACCESS_KEY!,
|
|
7367
7388
|
},
|
|
7368
7389
|
};`.trim()
|
|
7369
|
-
|
|
7390
|
+
}];
|
|
7391
|
+
break;
|
|
7392
|
+
}
|
|
7370
7393
|
const builder = new _hot_updater_cli_tools.ConfigBuilder().setBuildType(build).setStorage(storageConfig).setDatabase(databaseConfig).setIntermediateCode(helperStatements.map((statement) => statement.code.trim()).join("\n\n"));
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7394
|
+
switch (authMode.mode) {
|
|
7395
|
+
case "sso":
|
|
7396
|
+
builder.addImport({
|
|
7397
|
+
pkg: "@aws-sdk/credential-provider-sso",
|
|
7398
|
+
named: ["fromSSO"]
|
|
7399
|
+
});
|
|
7400
|
+
break;
|
|
7401
|
+
case "local":
|
|
7402
|
+
builder.addImport({
|
|
7403
|
+
pkg: "@aws-sdk/credential-providers",
|
|
7404
|
+
named: [authMode.profile ? "fromIni" : "fromNodeProviderChain"]
|
|
7405
|
+
});
|
|
7406
|
+
break;
|
|
7407
|
+
case "account": break;
|
|
7408
|
+
}
|
|
7375
7409
|
return (0, _hot_updater_cli_tools.createHotUpdaterConfigScaffoldFromBuilder)(builder, { helperStatements });
|
|
7376
7410
|
};
|
|
7377
7411
|
const SOURCE_TEMPLATE = `// Add this to your App.tsx
|
|
@@ -7402,15 +7436,28 @@ const runInit = async ({ build }) => {
|
|
|
7402
7436
|
process.exit(1);
|
|
7403
7437
|
}
|
|
7404
7438
|
let credentials;
|
|
7439
|
+
let configAuthMode = { mode: "account" };
|
|
7440
|
+
let awsProfile = null;
|
|
7405
7441
|
const mode = await _hot_updater_cli_tools.p.select({
|
|
7406
7442
|
message: "Select the mode to login to AWS",
|
|
7407
|
-
options: [
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7443
|
+
options: [
|
|
7444
|
+
{
|
|
7445
|
+
label: "Current AWS CLI Session / Default Credential Chain",
|
|
7446
|
+
value: "local-session"
|
|
7447
|
+
},
|
|
7448
|
+
{
|
|
7449
|
+
label: "Shared AWS Profile",
|
|
7450
|
+
value: "shared-profile"
|
|
7451
|
+
},
|
|
7452
|
+
{
|
|
7453
|
+
label: "AWS SSO Login",
|
|
7454
|
+
value: "sso"
|
|
7455
|
+
},
|
|
7456
|
+
{
|
|
7457
|
+
label: "AWS Access Key ID & Secret Access Key",
|
|
7458
|
+
value: "account"
|
|
7459
|
+
}
|
|
7460
|
+
]
|
|
7414
7461
|
});
|
|
7415
7462
|
if (_hot_updater_cli_tools.p.isCancel(mode)) process.exit(1);
|
|
7416
7463
|
_hot_updater_cli_tools.p.log.message(_hot_updater_cli_tools.colors.blue("The following permissions are required:"));
|
|
@@ -7419,7 +7466,6 @@ const runInit = async ({ build }) => {
|
|
|
7419
7466
|
_hot_updater_cli_tools.p.log.message(`${_hot_updater_cli_tools.colors.blue("CloudFrontFullAccess")}: Create and update CloudFront distributions`);
|
|
7420
7467
|
_hot_updater_cli_tools.p.log.message(`${_hot_updater_cli_tools.colors.blue("IAMFullAccess")}: Get or create IAM roles for Lambda@Edge`);
|
|
7421
7468
|
_hot_updater_cli_tools.p.log.message(`${_hot_updater_cli_tools.colors.blue("AmazonSSMFullAccess")}: Access to SSM Parameters for storing CloudFront key pairs`);
|
|
7422
|
-
let ssoProfile = null;
|
|
7423
7469
|
if (mode === "sso") try {
|
|
7424
7470
|
const profile = await _hot_updater_cli_tools.p.text({
|
|
7425
7471
|
message: "Enter the SSO profile name",
|
|
@@ -7427,7 +7473,11 @@ const runInit = async ({ build }) => {
|
|
|
7427
7473
|
placeholder: "default"
|
|
7428
7474
|
});
|
|
7429
7475
|
if (_hot_updater_cli_tools.p.isCancel(profile)) process.exit(1);
|
|
7430
|
-
|
|
7476
|
+
awsProfile = profile;
|
|
7477
|
+
configAuthMode = {
|
|
7478
|
+
mode: "sso",
|
|
7479
|
+
profile
|
|
7480
|
+
};
|
|
7431
7481
|
await execa("aws", [
|
|
7432
7482
|
"sso",
|
|
7433
7483
|
"login",
|
|
@@ -7442,6 +7492,34 @@ const runInit = async ({ build }) => {
|
|
|
7442
7492
|
if (error instanceof ExecaError) _hot_updater_cli_tools.p.log.error(error.stdout || error.stderr || error.message);
|
|
7443
7493
|
process.exit(1);
|
|
7444
7494
|
}
|
|
7495
|
+
else if (mode === "local-session") try {
|
|
7496
|
+
configAuthMode = {
|
|
7497
|
+
mode: "local",
|
|
7498
|
+
profile: null
|
|
7499
|
+
};
|
|
7500
|
+
credentials = await (0, _aws_sdk_credential_providers.fromNodeProviderChain)()();
|
|
7501
|
+
} catch (error) {
|
|
7502
|
+
if (error instanceof Error) _hot_updater_cli_tools.p.log.error(error.message);
|
|
7503
|
+
process.exit(1);
|
|
7504
|
+
}
|
|
7505
|
+
else if (mode === "shared-profile") try {
|
|
7506
|
+
const profile = await _hot_updater_cli_tools.p.text({
|
|
7507
|
+
message: "Enter the AWS profile name",
|
|
7508
|
+
defaultValue: process.env.AWS_PROFILE ?? "default",
|
|
7509
|
+
placeholder: process.env.AWS_PROFILE ?? "default",
|
|
7510
|
+
validate: (value) => (value ?? "").trim() ? void 0 : "AWS profile name is required"
|
|
7511
|
+
});
|
|
7512
|
+
if (_hot_updater_cli_tools.p.isCancel(profile)) process.exit(1);
|
|
7513
|
+
awsProfile = profile.trim();
|
|
7514
|
+
configAuthMode = {
|
|
7515
|
+
mode: "local",
|
|
7516
|
+
profile: awsProfile
|
|
7517
|
+
};
|
|
7518
|
+
credentials = await (0, _aws_sdk_credential_providers.fromIni)({ profile: awsProfile })();
|
|
7519
|
+
} catch (error) {
|
|
7520
|
+
if (error instanceof Error) _hot_updater_cli_tools.p.log.error(error.message);
|
|
7521
|
+
process.exit(1);
|
|
7522
|
+
}
|
|
7445
7523
|
else {
|
|
7446
7524
|
const creds = await _hot_updater_cli_tools.p.group({
|
|
7447
7525
|
accessKeyId: () => _hot_updater_cli_tools.p.text({
|
|
@@ -7458,6 +7536,7 @@ const runInit = async ({ build }) => {
|
|
|
7458
7536
|
accessKeyId: creds.accessKeyId,
|
|
7459
7537
|
secretAccessKey: creds.secretAccessKey
|
|
7460
7538
|
};
|
|
7539
|
+
configAuthMode = { mode: "account" };
|
|
7461
7540
|
}
|
|
7462
7541
|
if (!credentials) {
|
|
7463
7542
|
_hot_updater_cli_tools.p.log.error("Couldn't fetch the credentials.");
|
|
@@ -7542,7 +7621,7 @@ const runInit = async ({ build }) => {
|
|
|
7542
7621
|
distributionId,
|
|
7543
7622
|
accountId
|
|
7544
7623
|
});
|
|
7545
|
-
const configWriteResult = await (0, _hot_updater_cli_tools.writeHotUpdaterConfig)(getConfigScaffold(build,
|
|
7624
|
+
const configWriteResult = await (0, _hot_updater_cli_tools.writeHotUpdaterConfig)(getConfigScaffold(build, configAuthMode));
|
|
7546
7625
|
await (0, _hot_updater_cli_tools.makeEnv)({
|
|
7547
7626
|
HOT_UPDATER_S3_BUCKET_NAME: bucketName,
|
|
7548
7627
|
HOT_UPDATER_S3_REGION: bucketRegion,
|
|
@@ -7556,10 +7635,11 @@ const runInit = async ({ build }) => {
|
|
|
7556
7635
|
value: credentials.secretAccessKey
|
|
7557
7636
|
}
|
|
7558
7637
|
} : {},
|
|
7559
|
-
...
|
|
7638
|
+
...awsProfile !== null ? { HOT_UPDATER_AWS_PROFILE: awsProfile } : {},
|
|
7560
7639
|
HOT_UPDATER_CLOUDFRONT_DISTRIBUTION_ID: distributionId
|
|
7561
7640
|
});
|
|
7562
7641
|
if (mode === "sso") await (0, _hot_updater_cli_tools.ensureInstallPackages)({ devDependencies: ["@aws-sdk/credential-provider-sso"] });
|
|
7642
|
+
else if (mode === "local-session" || mode === "shared-profile") await (0, _hot_updater_cli_tools.ensureInstallPackages)({ devDependencies: ["@aws-sdk/credential-providers"] });
|
|
7563
7643
|
_hot_updater_cli_tools.p.log.success("Generated '.env.hotupdater' file with AWS settings.");
|
|
7564
7644
|
if (configWriteResult.status === "created") _hot_updater_cli_tools.p.log.success("Generated 'hot-updater.config.ts' file with AWS settings.");
|
|
7565
7645
|
else if (configWriteResult.status === "merged") _hot_updater_cli_tools.p.log.success("Updated 'hot-updater.config.ts' file with AWS settings.");
|
package/dist/iac/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { fromSSO } from "@aws-sdk/credential-providers";
|
|
2
|
+
import { fromIni, fromNodeProviderChain, fromSSO } from "@aws-sdk/credential-providers";
|
|
3
3
|
import { ConfigBuilder, colors, copyDirToTmp, createHotUpdaterConfigScaffoldFromBuilder, createZip, ensureInstallPackages, getCwd, link, makeEnv, p, transformEnv, transformTemplate, writeHotUpdaterConfig } from "@hot-updater/cli-tools";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
@@ -7320,7 +7320,7 @@ var SSMKeyPairManager = class {
|
|
|
7320
7320
|
};
|
|
7321
7321
|
//#endregion
|
|
7322
7322
|
//#region iac/templates.ts
|
|
7323
|
-
const getConfigScaffold = (build,
|
|
7323
|
+
const getConfigScaffold = (build, authMode) => {
|
|
7324
7324
|
const storageConfig = {
|
|
7325
7325
|
imports: [{
|
|
7326
7326
|
pkg: "@hot-updater/aws",
|
|
@@ -7338,21 +7338,42 @@ const getConfigScaffold = (build, { profile }) => {
|
|
|
7338
7338
|
cloudfrontDistributionId: process.env.HOT_UPDATER_CLOUDFRONT_DISTRIBUTION_ID!,
|
|
7339
7339
|
})`
|
|
7340
7340
|
};
|
|
7341
|
-
let helperStatements
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7341
|
+
let helperStatements;
|
|
7342
|
+
switch (authMode.mode) {
|
|
7343
|
+
case "sso":
|
|
7344
|
+
helperStatements = [{
|
|
7345
|
+
name: "commonOptions",
|
|
7346
|
+
strategy: "merge-object",
|
|
7347
|
+
code: `
|
|
7346
7348
|
const commonOptions = {
|
|
7347
7349
|
bucketName: process.env.HOT_UPDATER_S3_BUCKET_NAME!,
|
|
7348
7350
|
region: process.env.HOT_UPDATER_S3_REGION!,
|
|
7349
7351
|
credentials: fromSSO({ profile: process.env.HOT_UPDATER_AWS_PROFILE! }),
|
|
7350
7352
|
};`.trim()
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7353
|
+
}];
|
|
7354
|
+
break;
|
|
7355
|
+
case "local":
|
|
7356
|
+
helperStatements = [{
|
|
7357
|
+
name: "commonOptions",
|
|
7358
|
+
strategy: "merge-object",
|
|
7359
|
+
code: authMode.profile ? `
|
|
7360
|
+
const commonOptions = {
|
|
7361
|
+
bucketName: process.env.HOT_UPDATER_S3_BUCKET_NAME!,
|
|
7362
|
+
region: process.env.HOT_UPDATER_S3_REGION!,
|
|
7363
|
+
credentials: fromIni({ profile: process.env.HOT_UPDATER_AWS_PROFILE! }),
|
|
7364
|
+
};`.trim() : `
|
|
7365
|
+
const commonOptions = {
|
|
7366
|
+
bucketName: process.env.HOT_UPDATER_S3_BUCKET_NAME!,
|
|
7367
|
+
region: process.env.HOT_UPDATER_S3_REGION!,
|
|
7368
|
+
credentials: fromNodeProviderChain(),
|
|
7369
|
+
};`.trim()
|
|
7370
|
+
}];
|
|
7371
|
+
break;
|
|
7372
|
+
case "account":
|
|
7373
|
+
helperStatements = [{
|
|
7374
|
+
name: "commonOptions",
|
|
7375
|
+
strategy: "merge-object",
|
|
7376
|
+
code: `
|
|
7356
7377
|
const commonOptions = {
|
|
7357
7378
|
bucketName: process.env.HOT_UPDATER_S3_BUCKET_NAME!,
|
|
7358
7379
|
region: process.env.HOT_UPDATER_S3_REGION!,
|
|
@@ -7361,12 +7382,25 @@ const commonOptions = {
|
|
|
7361
7382
|
secretAccessKey: process.env.HOT_UPDATER_S3_SECRET_ACCESS_KEY!,
|
|
7362
7383
|
},
|
|
7363
7384
|
};`.trim()
|
|
7364
|
-
|
|
7385
|
+
}];
|
|
7386
|
+
break;
|
|
7387
|
+
}
|
|
7365
7388
|
const builder = new ConfigBuilder().setBuildType(build).setStorage(storageConfig).setDatabase(databaseConfig).setIntermediateCode(helperStatements.map((statement) => statement.code.trim()).join("\n\n"));
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7389
|
+
switch (authMode.mode) {
|
|
7390
|
+
case "sso":
|
|
7391
|
+
builder.addImport({
|
|
7392
|
+
pkg: "@aws-sdk/credential-provider-sso",
|
|
7393
|
+
named: ["fromSSO"]
|
|
7394
|
+
});
|
|
7395
|
+
break;
|
|
7396
|
+
case "local":
|
|
7397
|
+
builder.addImport({
|
|
7398
|
+
pkg: "@aws-sdk/credential-providers",
|
|
7399
|
+
named: [authMode.profile ? "fromIni" : "fromNodeProviderChain"]
|
|
7400
|
+
});
|
|
7401
|
+
break;
|
|
7402
|
+
case "account": break;
|
|
7403
|
+
}
|
|
7370
7404
|
return createHotUpdaterConfigScaffoldFromBuilder(builder, { helperStatements });
|
|
7371
7405
|
};
|
|
7372
7406
|
const SOURCE_TEMPLATE = `// Add this to your App.tsx
|
|
@@ -7397,15 +7431,28 @@ const runInit = async ({ build }) => {
|
|
|
7397
7431
|
process.exit(1);
|
|
7398
7432
|
}
|
|
7399
7433
|
let credentials;
|
|
7434
|
+
let configAuthMode = { mode: "account" };
|
|
7435
|
+
let awsProfile = null;
|
|
7400
7436
|
const mode = await p.select({
|
|
7401
7437
|
message: "Select the mode to login to AWS",
|
|
7402
|
-
options: [
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7438
|
+
options: [
|
|
7439
|
+
{
|
|
7440
|
+
label: "Current AWS CLI Session / Default Credential Chain",
|
|
7441
|
+
value: "local-session"
|
|
7442
|
+
},
|
|
7443
|
+
{
|
|
7444
|
+
label: "Shared AWS Profile",
|
|
7445
|
+
value: "shared-profile"
|
|
7446
|
+
},
|
|
7447
|
+
{
|
|
7448
|
+
label: "AWS SSO Login",
|
|
7449
|
+
value: "sso"
|
|
7450
|
+
},
|
|
7451
|
+
{
|
|
7452
|
+
label: "AWS Access Key ID & Secret Access Key",
|
|
7453
|
+
value: "account"
|
|
7454
|
+
}
|
|
7455
|
+
]
|
|
7409
7456
|
});
|
|
7410
7457
|
if (p.isCancel(mode)) process.exit(1);
|
|
7411
7458
|
p.log.message(colors.blue("The following permissions are required:"));
|
|
@@ -7414,7 +7461,6 @@ const runInit = async ({ build }) => {
|
|
|
7414
7461
|
p.log.message(`${colors.blue("CloudFrontFullAccess")}: Create and update CloudFront distributions`);
|
|
7415
7462
|
p.log.message(`${colors.blue("IAMFullAccess")}: Get or create IAM roles for Lambda@Edge`);
|
|
7416
7463
|
p.log.message(`${colors.blue("AmazonSSMFullAccess")}: Access to SSM Parameters for storing CloudFront key pairs`);
|
|
7417
|
-
let ssoProfile = null;
|
|
7418
7464
|
if (mode === "sso") try {
|
|
7419
7465
|
const profile = await p.text({
|
|
7420
7466
|
message: "Enter the SSO profile name",
|
|
@@ -7422,7 +7468,11 @@ const runInit = async ({ build }) => {
|
|
|
7422
7468
|
placeholder: "default"
|
|
7423
7469
|
});
|
|
7424
7470
|
if (p.isCancel(profile)) process.exit(1);
|
|
7425
|
-
|
|
7471
|
+
awsProfile = profile;
|
|
7472
|
+
configAuthMode = {
|
|
7473
|
+
mode: "sso",
|
|
7474
|
+
profile
|
|
7475
|
+
};
|
|
7426
7476
|
await execa("aws", [
|
|
7427
7477
|
"sso",
|
|
7428
7478
|
"login",
|
|
@@ -7437,6 +7487,34 @@ const runInit = async ({ build }) => {
|
|
|
7437
7487
|
if (error instanceof ExecaError) p.log.error(error.stdout || error.stderr || error.message);
|
|
7438
7488
|
process.exit(1);
|
|
7439
7489
|
}
|
|
7490
|
+
else if (mode === "local-session") try {
|
|
7491
|
+
configAuthMode = {
|
|
7492
|
+
mode: "local",
|
|
7493
|
+
profile: null
|
|
7494
|
+
};
|
|
7495
|
+
credentials = await fromNodeProviderChain()();
|
|
7496
|
+
} catch (error) {
|
|
7497
|
+
if (error instanceof Error) p.log.error(error.message);
|
|
7498
|
+
process.exit(1);
|
|
7499
|
+
}
|
|
7500
|
+
else if (mode === "shared-profile") try {
|
|
7501
|
+
const profile = await p.text({
|
|
7502
|
+
message: "Enter the AWS profile name",
|
|
7503
|
+
defaultValue: process.env.AWS_PROFILE ?? "default",
|
|
7504
|
+
placeholder: process.env.AWS_PROFILE ?? "default",
|
|
7505
|
+
validate: (value) => (value ?? "").trim() ? void 0 : "AWS profile name is required"
|
|
7506
|
+
});
|
|
7507
|
+
if (p.isCancel(profile)) process.exit(1);
|
|
7508
|
+
awsProfile = profile.trim();
|
|
7509
|
+
configAuthMode = {
|
|
7510
|
+
mode: "local",
|
|
7511
|
+
profile: awsProfile
|
|
7512
|
+
};
|
|
7513
|
+
credentials = await fromIni({ profile: awsProfile })();
|
|
7514
|
+
} catch (error) {
|
|
7515
|
+
if (error instanceof Error) p.log.error(error.message);
|
|
7516
|
+
process.exit(1);
|
|
7517
|
+
}
|
|
7440
7518
|
else {
|
|
7441
7519
|
const creds = await p.group({
|
|
7442
7520
|
accessKeyId: () => p.text({
|
|
@@ -7453,6 +7531,7 @@ const runInit = async ({ build }) => {
|
|
|
7453
7531
|
accessKeyId: creds.accessKeyId,
|
|
7454
7532
|
secretAccessKey: creds.secretAccessKey
|
|
7455
7533
|
};
|
|
7534
|
+
configAuthMode = { mode: "account" };
|
|
7456
7535
|
}
|
|
7457
7536
|
if (!credentials) {
|
|
7458
7537
|
p.log.error("Couldn't fetch the credentials.");
|
|
@@ -7537,7 +7616,7 @@ const runInit = async ({ build }) => {
|
|
|
7537
7616
|
distributionId,
|
|
7538
7617
|
accountId
|
|
7539
7618
|
});
|
|
7540
|
-
const configWriteResult = await writeHotUpdaterConfig(getConfigScaffold(build,
|
|
7619
|
+
const configWriteResult = await writeHotUpdaterConfig(getConfigScaffold(build, configAuthMode));
|
|
7541
7620
|
await makeEnv({
|
|
7542
7621
|
HOT_UPDATER_S3_BUCKET_NAME: bucketName,
|
|
7543
7622
|
HOT_UPDATER_S3_REGION: bucketRegion,
|
|
@@ -7551,10 +7630,11 @@ const runInit = async ({ build }) => {
|
|
|
7551
7630
|
value: credentials.secretAccessKey
|
|
7552
7631
|
}
|
|
7553
7632
|
} : {},
|
|
7554
|
-
...
|
|
7633
|
+
...awsProfile !== null ? { HOT_UPDATER_AWS_PROFILE: awsProfile } : {},
|
|
7555
7634
|
HOT_UPDATER_CLOUDFRONT_DISTRIBUTION_ID: distributionId
|
|
7556
7635
|
});
|
|
7557
7636
|
if (mode === "sso") await ensureInstallPackages({ devDependencies: ["@aws-sdk/credential-provider-sso"] });
|
|
7637
|
+
else if (mode === "local-session" || mode === "shared-profile") await ensureInstallPackages({ devDependencies: ["@aws-sdk/credential-providers"] });
|
|
7558
7638
|
p.log.success("Generated '.env.hotupdater' file with AWS settings.");
|
|
7559
7639
|
if (configWriteResult.status === "created") p.log.success("Generated 'hot-updater.config.ts' file with AWS settings.");
|
|
7560
7640
|
else if (configWriteResult.status === "merged") p.log.success("Updated 'hot-updater.config.ts' file with AWS settings.");
|
package/dist/lambda/index.cjs
CHANGED
|
@@ -5686,7 +5686,7 @@ function findRoute(router, method, path) {
|
|
|
5686
5686
|
}
|
|
5687
5687
|
//#endregion
|
|
5688
5688
|
//#region ../../packages/server/src/version.ts
|
|
5689
|
-
const HOT_UPDATER_SERVER_VERSION = "0.30.
|
|
5689
|
+
const HOT_UPDATER_SERVER_VERSION = "0.30.10";
|
|
5690
5690
|
//#endregion
|
|
5691
5691
|
//#region ../../packages/server/src/handler.ts
|
|
5692
5692
|
var HandlerBadRequestError = class extends Error {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/aws",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.10",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"es-toolkit": "^1.32.0",
|
|
43
43
|
"execa": "9.5.2",
|
|
44
44
|
"mime": "^4.0.4",
|
|
45
|
-
"@hot-updater/
|
|
46
|
-
"@hot-updater/
|
|
47
|
-
"@hot-updater/mock": "0.30.
|
|
48
|
-
"@hot-updater/test-utils": "0.30.
|
|
45
|
+
"@hot-updater/js": "0.30.10",
|
|
46
|
+
"@hot-updater/core": "0.30.10",
|
|
47
|
+
"@hot-updater/mock": "0.30.10",
|
|
48
|
+
"@hot-updater/test-utils": "0.30.10"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@aws-sdk/client-cloudfront": "3.1008.0",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@aws-sdk/lib-storage": "3.1008.0",
|
|
61
61
|
"hono": "4.12.9",
|
|
62
62
|
"aws-lambda": "1.0.7",
|
|
63
|
-
"@hot-updater/cli-tools": "0.30.
|
|
64
|
-
"@hot-updater/plugin-core": "0.30.
|
|
65
|
-
"@hot-updater/server": "0.30.
|
|
63
|
+
"@hot-updater/cli-tools": "0.30.10",
|
|
64
|
+
"@hot-updater/plugin-core": "0.30.10",
|
|
65
|
+
"@hot-updater/server": "0.30.10"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsdown",
|