@uniweb/build 0.14.3 → 0.14.5
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/package.json +3 -3
- package/src/hosts/s3-cloudfront.js +51 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.5",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@uniweb/theming": "0.1.3"
|
|
61
61
|
},
|
|
62
62
|
"optionalDependencies": {
|
|
63
|
-
"@uniweb/
|
|
63
|
+
"@uniweb/runtime": "0.8.14",
|
|
64
64
|
"@uniweb/schemas": "0.2.1",
|
|
65
|
-
"@uniweb/
|
|
65
|
+
"@uniweb/content-reader": "1.1.11"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
@@ -332,8 +332,14 @@ function translateAwsError(exitCode, stderr, args) {
|
|
|
332
332
|
* Validate the resolved deploy.yml target. Throws DeployError listing
|
|
333
333
|
* every missing field at once (so the user fixes the whole block in
|
|
334
334
|
* one pass instead of trial-and-error).
|
|
335
|
+
*
|
|
336
|
+
* When ALL required fields are missing (cold-start), the error includes
|
|
337
|
+
* a one-time AWS setup walkthrough so the user knows what to provision
|
|
338
|
+
* before filling in deploy.yml. When only some are missing (partial),
|
|
339
|
+
* the error stays terse — assume the user already provisioned and just
|
|
340
|
+
* needs to finish the config.
|
|
335
341
|
*/
|
|
336
|
-
function validateDeployConfig(deployConfig) {
|
|
342
|
+
function validateDeployConfig(deployConfig, distDir) {
|
|
337
343
|
const missing = []
|
|
338
344
|
if (!deployConfig.bucket) missing.push('bucket')
|
|
339
345
|
if (!deployConfig.distributionId) missing.push('distributionId')
|
|
@@ -341,21 +347,59 @@ function validateDeployConfig(deployConfig) {
|
|
|
341
347
|
|
|
342
348
|
if (missing.length === 0) return
|
|
343
349
|
|
|
350
|
+
const isColdStart = missing.length === 3
|
|
351
|
+
|
|
352
|
+
// Compact message for partial config (user is mid-setup, just finish it).
|
|
353
|
+
if (!isColdStart) {
|
|
354
|
+
throw new DeployError(
|
|
355
|
+
`s3-cloudfront deploy is missing required configuration.`,
|
|
356
|
+
{
|
|
357
|
+
hint: [
|
|
358
|
+
`Add the missing fields to deploy.yml under the resolved target:`,
|
|
359
|
+
``,
|
|
360
|
+
` targets:`,
|
|
361
|
+
` production:`,
|
|
362
|
+
` host: s3-cloudfront`,
|
|
363
|
+
` bucket: <your-bucket-name>`,
|
|
364
|
+
` distributionId: <E1ABC...>`,
|
|
365
|
+
` region: us-east-1`,
|
|
366
|
+
` profile: <optional AWS_PROFILE>`,
|
|
367
|
+
``,
|
|
368
|
+
`Missing: ${missing.join(', ')}`,
|
|
369
|
+
].join('\n'),
|
|
370
|
+
}
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Cold-start: deploy.yml has no bucket/distributionId/region yet.
|
|
375
|
+
// The user is on their first deploy attempt — point them at the
|
|
376
|
+
// setup walkthrough rather than dumping a long inline checklist.
|
|
344
377
|
throw new DeployError(
|
|
345
|
-
`s3-cloudfront deploy
|
|
378
|
+
`s3-cloudfront deploy needs one-time AWS setup before its first run.`,
|
|
346
379
|
{
|
|
347
380
|
hint: [
|
|
348
|
-
`
|
|
381
|
+
`One-time setup walkthrough (S3 bucket, CloudFront distribution,`,
|
|
382
|
+
`IAM user, directory-index Function, custom error responses):`,
|
|
349
383
|
``,
|
|
384
|
+
` https://docs.uniweb.app/docs/reference/aws-s3-cloudfront-setup`,
|
|
385
|
+
``,
|
|
386
|
+
`When done, fill these in deploy.yml next to site.yml:`,
|
|
387
|
+
``,
|
|
388
|
+
` default: production`,
|
|
350
389
|
` targets:`,
|
|
351
390
|
` production:`,
|
|
352
391
|
` host: s3-cloudfront`,
|
|
353
392
|
` bucket: <your-bucket-name>`,
|
|
354
393
|
` distributionId: <E1ABC...>`,
|
|
355
|
-
` region:
|
|
356
|
-
` profile: <optional
|
|
394
|
+
` region: <e.g. ca-central-1>`,
|
|
395
|
+
` profile: <optional — use if you have multiple AWS profiles>`,
|
|
396
|
+
``,
|
|
397
|
+
`Then re-run \`uniweb deploy\`. The build artifact in dist/ is ready;`,
|
|
398
|
+
`nothing else to rebuild between attempts.`,
|
|
357
399
|
``,
|
|
358
|
-
`
|
|
400
|
+
`Prerequisites on this machine:`,
|
|
401
|
+
` • aws CLI on PATH (macOS: \`brew install awscli\`)`,
|
|
402
|
+
` • AWS credentials reachable via env / ~/.aws / SSO / instance role`,
|
|
359
403
|
].join('\n'),
|
|
360
404
|
}
|
|
361
405
|
)
|
|
@@ -377,7 +421,7 @@ function pickCacheControl(rules, kind) {
|
|
|
377
421
|
}
|
|
378
422
|
|
|
379
423
|
async function deploy({ distDir, deployConfig = {}, env = process.env, log = () => {} }) {
|
|
380
|
-
validateDeployConfig(deployConfig)
|
|
424
|
+
validateDeployConfig(deployConfig, distDir)
|
|
381
425
|
|
|
382
426
|
// Augment the manifest written at build time with the resolved
|
|
383
427
|
// target's bucket / distId / region / cache rules so the artifact
|