Skip to content

Commit 5d62144

Browse files
committed
Merge branch 'kats/s3'
2 parents 62c01da + fe39abc commit 5d62144

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Before publishing your content, your S3-compatible bucket must already exist.
153153
Type the following:
154154

155155
```sh
156-
npm run publish
156+
npm run s3:publish
157157
```
158158

159159
#### 3. Preview Locally
@@ -541,7 +541,7 @@ Before publishing your content, your S3-compatible bucket must already exist.
541541
Publish your content by typing:
542542

543543
```sh
544-
npm run publish
544+
npm run s3:publish
545545
```
546546

547547
Then start the local development server:
@@ -565,7 +565,7 @@ When you're ready for production:
565565
Once deployed, publish content like so:
566566
567567
```sh
568-
npm run publish
568+
npm run s3:publish
569569
```
570570
571571
This:
@@ -577,7 +577,7 @@ This:
577577
> [!TIP]
578578
> Upload to a specific collection by specifying the collection name when publishing content:
579579
> ```sh
580-
> npm run publish -- --collection-name=preview-42
580+
> npm run s3:publish -- --collection-name=preview-42
581581
> ```
582582
583583
**No Wasm redeploy needed** unless you:

src/cli/commands/manage/publish-content.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -393,28 +393,31 @@ export async function action(actionArgs: string[]) {
393393
let variantMetadata = variantMetadatas.get(variant);
394394
if (variantMetadata != null) {
395395

396-
console.log(` 🏃‍♂️ Asset "${variantKey}" is identical to an item we already know about, reusing existing copy.`);
396+
if (verbose) {
397+
console.log(` 🏃‍♂️ Asset "${variantKey}" is identical to an item we already know about, reusing existing copy.`);
398+
}
397399

398400
} else {
399401

400402
if (!overwriteExisting) {
401403
const assetVariantMetadata = await storageProvider.getExistingAssetVariant(variantKey);
402404
if (assetVariantMetadata != null) {
403-
console.log(` ・ Asset found in storage with key "${variantKey}".`);
405+
if (verbose) {
406+
console.log(` ・ Asset found in storage with key "${variantKey}".`);
407+
}
404408
// And we already know its hash and size.
405409
variantMetadata = Object.assign(assetVariantMetadata, { existsInKvStore: true });
406410
}
407411
}
408412

409413
if (variantMetadata == null) {
414+
console.log(` ↦ Prepping new asset for storage: "${variantKey}"`);
410415
await ensureVariantFileExists(
411416
variantFilePath,
412417
variant,
413418
file,
419+
verbose,
414420
);
415-
if (localMode) {
416-
console.log(` ・ Prepping asset for storage with key "${variantKey}".`);
417-
}
418421

419422
let contentEncoding, hash, size;
420423
if (variant === 'original') {

src/cli/commands/scaffold/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ export async function action(actionArgs: string[]) {
780780
packageJsonScripts['dev:publish'] = 'npx @fastly/compute-js-static-publish publish-content --local';
781781
packageJsonScripts['fastly:publish'] = 'npx @fastly/compute-js-static-publish publish-content';
782782
} else if (storageMode === 's3') {
783-
packageJsonScripts['publish'] = 'npx @fastly/compute-js-static-publish publish-content --local';
783+
packageJsonScripts['s3:publish'] = 'npx @fastly/compute-js-static-publish publish-content';
784784
}
785785
resourceFiles['package.json'] = JSON.stringify({
786786
name,
@@ -1038,11 +1038,11 @@ To publish your content to your S3-compatible bucket
10381038
10391039
Using an AWS profile set with "aws configure", type:
10401040
cd ${COMPUTE_JS_DIR}
1041-
AWS_PROFILE=xxxx npm run publish
1041+
AWS_PROFILE=xxxx npm run s3:publish
10421042
10431043
Using AWS IAM credentials, type:
10441044
cd ${COMPUTE_JS_DIR}
1045-
AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxxx npm run publish
1045+
AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxxx npm run s3:publish
10461046
10471047
To run your Compute application locally
10481048

src/cli/util/variants.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export async function ensureVariantFileExists(
1414
variantFilePath: string,
1515
variant: Variants,
1616
file: string,
17+
verbose: boolean,
1718
) {
1819

1920
// Compress/prepare the asset if it doesn't already exist
@@ -23,13 +24,17 @@ export async function ensureVariantFileExists(
2324
if (variant === 'original') {
2425

2526
fs.cpSync(file, variantFilePath);
26-
console.log(` 📄→📄 Copied file '${rootRelative(file)}' to '${rootRelative(variantFilePath)}'.`);
27+
if (verbose) {
28+
console.log(` 📄→📄 Copied file '${rootRelative(file)}' to '${rootRelative(variantFilePath)}'.`);
29+
}
2730

2831
} else {
2932

3033
const compressTo = algs[variant];
3134
await compressTo(file, variantFilePath);
32-
console.log(` 📄→🗄️ Compressed file '${rootRelative(file)}' to '${rootRelative(variantFilePath)}' [${variant}].`);
35+
if (verbose) {
36+
console.log(` 📄→🗄️ Compressed file '${rootRelative(file)}' to '${rootRelative(variantFilePath)}' [${variant}].`);
37+
}
3338

3439
}
3540

0 commit comments

Comments
 (0)