@granite-js/forge-cli 0.1.0 → 0.1.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/CHANGELOG.md +19 -0
- package/dist/index.js +25 -6
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @granite-js/forge-cli
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @granite-js/deployment-manager@0.1.2
|
|
8
|
+
- @granite-js/cli@0.1.2
|
|
9
|
+
|
|
10
|
+
## 0.1.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- d675415: Improve scaffolding to provide a better showcase UI
|
|
15
|
+
- 7f0afd4: Updated forge-cli to support reading AWS configuration files when available, instead of relying solely on environment variables.
|
|
16
|
+
- 10a5f3f: empty
|
|
17
|
+
- Updated dependencies [d675415]
|
|
18
|
+
- Updated dependencies [10a5f3f]
|
|
19
|
+
- @granite-js/deployment-manager@0.1.1
|
|
20
|
+
- @granite-js/cli@0.1.1
|
|
21
|
+
|
|
3
22
|
## 0.1.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Command } from "@commander-js/extra-typings";
|
|
2
2
|
import path from "path";
|
|
3
|
+
import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
|
|
4
|
+
import { loadSharedConfigFiles } from "@aws-sdk/shared-ini-file-loader";
|
|
3
5
|
import * as p$3 from "@clack/prompts";
|
|
4
6
|
import * as p$2 from "@clack/prompts";
|
|
5
7
|
import * as p$1 from "@clack/prompts";
|
|
@@ -150,14 +152,19 @@ const envSchema = v.object({
|
|
|
150
152
|
AWS_SECRET_ACCESS_KEY: v.string(),
|
|
151
153
|
AWS_SESSION_TOKEN: v.optional(v.string())
|
|
152
154
|
});
|
|
155
|
+
const awsCredentialsProvider = fromNodeProviderChain();
|
|
153
156
|
function deploy() {
|
|
154
157
|
return new Command("deploy").description("Deploy a Granite application").requiredOption("--bucket <BUCKET>", "AWS bucket").action(async (options) => {
|
|
155
|
-
const config = await
|
|
158
|
+
const [config, awsCredentials, region] = await Promise.all([
|
|
159
|
+
loadConfig(),
|
|
160
|
+
awsCredentialsProvider(),
|
|
161
|
+
getRegion()
|
|
162
|
+
]);
|
|
156
163
|
const envResult = v.safeParse(envSchema, {
|
|
157
|
-
AWS_REGION:
|
|
158
|
-
AWS_ACCESS_KEY_ID:
|
|
159
|
-
AWS_SECRET_ACCESS_KEY:
|
|
160
|
-
AWS_SESSION_TOKEN:
|
|
164
|
+
AWS_REGION: region,
|
|
165
|
+
AWS_ACCESS_KEY_ID: awsCredentials.accessKeyId,
|
|
166
|
+
AWS_SECRET_ACCESS_KEY: awsCredentials.secretAccessKey,
|
|
167
|
+
AWS_SESSION_TOKEN: awsCredentials.sessionToken
|
|
161
168
|
});
|
|
162
169
|
if (!envResult.success) {
|
|
163
170
|
const missingVars = envResult.issues.map((issue) => {
|
|
@@ -173,7 +180,7 @@ function deploy() {
|
|
|
173
180
|
iosBundle: path.join(config.outdir, `bundle.ios.hbc`),
|
|
174
181
|
androidBundle: path.join(config.outdir, `bundle.android.hbc`)
|
|
175
182
|
}, { s3Client: new S3Client({
|
|
176
|
-
region
|
|
183
|
+
region,
|
|
177
184
|
bucket: options.bucket,
|
|
178
185
|
credentials: {
|
|
179
186
|
accessKeyId: envResult.output.AWS_ACCESS_KEY_ID,
|
|
@@ -183,6 +190,18 @@ function deploy() {
|
|
|
183
190
|
}) });
|
|
184
191
|
});
|
|
185
192
|
}
|
|
193
|
+
async function getRegion() {
|
|
194
|
+
const { configFile } = await loadSharedConfigFiles();
|
|
195
|
+
const envRegion = process.env.AWS_REGION;
|
|
196
|
+
if (envRegion != null) return envRegion;
|
|
197
|
+
const currentProfile = process.env.AWS_PROFILE;
|
|
198
|
+
if (currentProfile != null) {
|
|
199
|
+
const region = configFile?.[currentProfile]?.region;
|
|
200
|
+
if (region != null) return region;
|
|
201
|
+
}
|
|
202
|
+
const defaultRegion = configFile.default?.region;
|
|
203
|
+
return defaultRegion;
|
|
204
|
+
}
|
|
186
205
|
|
|
187
206
|
//#endregion
|
|
188
207
|
//#region src/helpers/command.ts
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@granite-js/forge-cli",
|
|
3
3
|
"description": "A CLI tool for managing Granite applications",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.2",
|
|
6
6
|
"bin": {
|
|
7
7
|
"granite-forge": "./bin/index.js"
|
|
8
8
|
},
|
|
@@ -14,20 +14,23 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"prepack": "yarn build",
|
|
16
16
|
"typecheck": "tsc --noEmit",
|
|
17
|
-
"test": "vitest --run --passWithNoTests",
|
|
17
|
+
"test": "vitest --run --coverage --passWithNoTests",
|
|
18
18
|
"build": "tsdown"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^22.10.2",
|
|
22
|
+
"@vitest/coverage-v8": "^3.1.4",
|
|
22
23
|
"tsdown": "^0.11.13",
|
|
23
24
|
"typescript": "^5.8.3",
|
|
24
25
|
"vitest": "^3.1.4"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
28
|
+
"@aws-sdk/credential-providers": "^3.817.0",
|
|
29
|
+
"@aws-sdk/shared-ini-file-loader": "^3.374.0",
|
|
27
30
|
"@clack/prompts": "^0.10.1",
|
|
28
31
|
"@commander-js/extra-typings": "^14.0.0",
|
|
29
|
-
"@granite-js/cli": "0.1.
|
|
30
|
-
"@granite-js/deployment-manager": "0.1.
|
|
32
|
+
"@granite-js/cli": "0.1.2",
|
|
33
|
+
"@granite-js/deployment-manager": "0.1.2",
|
|
31
34
|
"commander": "^14.0.0",
|
|
32
35
|
"uuid": "^11.1.0",
|
|
33
36
|
"valibot": "^1.1.0"
|