@fastly/compute-js-static-publish 8.0.0-beta.4 → 8.0.0-beta.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.
@@ -1 +1 @@
1
- {"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AA4GA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuehD"}
1
+ {"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AA4GA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBA0ehD"}
@@ -314,22 +314,24 @@ export async function action(actionArgs) {
314
314
  const variantFilePath = path.resolve(storageContentDir, variantFilename);
315
315
  let variantMetadata = variantMetadatas.get(variant);
316
316
  if (variantMetadata != null) {
317
- console.log(` 🏃‍♂️ Asset "${variantKey}" is identical to an item we already know about, reusing existing copy.`);
317
+ if (verbose) {
318
+ console.log(` 🏃‍♂️ Asset "${variantKey}" is identical to an item we already know about, reusing existing copy.`);
319
+ }
318
320
  }
319
321
  else {
320
322
  if (!overwriteExisting) {
321
323
  const assetVariantMetadata = await storageProvider.getExistingAssetVariant(variantKey);
322
324
  if (assetVariantMetadata != null) {
323
- console.log(` ・ Asset found in storage with key "${variantKey}".`);
325
+ if (verbose) {
326
+ console.log(` ・ Asset found in storage with key "${variantKey}".`);
327
+ }
324
328
  // And we already know its hash and size.
325
329
  variantMetadata = Object.assign(assetVariantMetadata, { existsInKvStore: true });
326
330
  }
327
331
  }
328
332
  if (variantMetadata == null) {
329
- await ensureVariantFileExists(variantFilePath, variant, file);
330
- if (localMode) {
331
- console.log(` ・ Prepping asset for storage with key "${variantKey}".`);
332
- }
333
+ console.log(` ↦ Prepping new asset for storage: "${variantKey}"`);
334
+ await ensureVariantFileExists(variantFilePath, variant, file, verbose);
333
335
  let contentEncoding, hash, size;
334
336
  if (variant === 'original') {
335
337
  contentEncoding = undefined;
@@ -662,7 +662,7 @@ export async function action(actionArgs) {
662
662
  packageJsonScripts['fastly:publish'] = 'npx @fastly/compute-js-static-publish publish-content';
663
663
  }
664
664
  else if (storageMode === 's3') {
665
- packageJsonScripts['publish'] = 'npx @fastly/compute-js-static-publish publish-content --local';
665
+ packageJsonScripts['s3:publish'] = 'npx @fastly/compute-js-static-publish publish-content';
666
666
  }
667
667
  resourceFiles['package.json'] = JSON.stringify({
668
668
  name,
@@ -908,11 +908,11 @@ To publish your content to your S3-compatible bucket
908
908
 
909
909
  Using an AWS profile set with "aws configure", type:
910
910
  cd ${COMPUTE_JS_DIR}
911
- AWS_PROFILE=xxxx npm run publish
911
+ AWS_PROFILE=xxxx npm run s3:publish
912
912
 
913
913
  Using AWS IAM credentials, type:
914
914
  cd ${COMPUTE_JS_DIR}
915
- AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxxx npm run publish
915
+ AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxxx npm run s3:publish
916
916
 
917
917
  To run your Compute application locally
918
918
 
@@ -1,4 +1,4 @@
1
1
  import { type ContentCompressionTypes } from '../../models/compression/index.js';
2
2
  export type Variants = 'original' | ContentCompressionTypes;
3
- export declare function ensureVariantFileExists(variantFilePath: string, variant: Variants, file: string): Promise<void>;
3
+ export declare function ensureVariantFileExists(variantFilePath: string, variant: Variants, file: string, verbose: boolean): Promise<void>;
4
4
  //# sourceMappingURL=variants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/variants.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAIjF,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,uBAAuB,CAAC;AAE5D,wBAAsB,uBAAuB,CAC3C,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,MAAM,iBAyBb"}
1
+ {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/variants.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAIjF,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,uBAAuB,CAAC;AAE5D,wBAAsB,uBAAuB,CAC3C,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,iBA6BjB"}
@@ -5,19 +5,23 @@
5
5
  import fs from 'node:fs';
6
6
  import { algs } from '../compression/index.js';
7
7
  import { rootRelative } from './files.js';
8
- export async function ensureVariantFileExists(variantFilePath, variant, file) {
8
+ export async function ensureVariantFileExists(variantFilePath, variant, file, verbose) {
9
9
  // Compress/prepare the asset if it doesn't already exist
10
10
  // We disregard chunked copies of the file and only check for the existence
11
11
  // of the main copy of the file at this point.
12
12
  if (!fs.existsSync(variantFilePath)) {
13
13
  if (variant === 'original') {
14
14
  fs.cpSync(file, variantFilePath);
15
- console.log(` 📄→📄 Copied file '${rootRelative(file)}' to '${rootRelative(variantFilePath)}'.`);
15
+ if (verbose) {
16
+ console.log(` 📄→📄 Copied file '${rootRelative(file)}' to '${rootRelative(variantFilePath)}'.`);
17
+ }
16
18
  }
17
19
  else {
18
20
  const compressTo = algs[variant];
19
21
  await compressTo(file, variantFilePath);
20
- console.log(` 📄→🗄️ Compressed file '${rootRelative(file)}' to '${rootRelative(variantFilePath)}' [${variant}].`);
22
+ if (verbose) {
23
+ console.log(` 📄→🗄️ Compressed file '${rootRelative(file)}' to '${rootRelative(variantFilePath)}' [${variant}].`);
24
+ }
21
25
  }
22
26
  // However, if we did just create the file,
23
27
  // we delete any chunked copies that may exist as they can be out of date.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fastly/compute-js-static-publish",
3
3
  "type": "module",
4
- "version": "8.0.0-beta.4",
4
+ "version": "8.0.0-beta.5",
5
5
  "description": "Static Publisher for Fastly Compute JavaScript",
6
6
  "main": "build/index.js",
7
7
  "exports": {