diff --git a/.gitignore b/.gitignore index f10048e..989e02c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.env +.env* analyzer dist images diff --git a/package.json b/package.json index e783952..a4f7d04 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fdmg/imgix-upload", - "version": "0.0.5", + "version": "0.0.6", "description": "Command-line tool to upload images to the FDMG IMGIX S3 Bucket", "main": "dist/app.js", "preferGlobal": true, @@ -17,8 +17,10 @@ "build:dev": "webpack --mode=development", "dry-run": "npm run start -- --dry-run -s -v", "dogfood": "dotenv fiu -- -v -s -i ./images", + "dogfood2": "dotenv fiu -- -v -s -i ./public/images", "help": "node -r dotenv/config dist/app.js --help", "start": "node -r dotenv/config dist/app.js -o ./imageMap.json -i ./images -s", + "start2": "node -r dotenv/config dist/app.js -o ./imageMap.json -i ./public/images -s", "release:fdmg": "node modifyPackageJson.js -s @fdmg", "release:fdmediagroep": "node modifyPackageJson.js -s @fdmediagroep", "test": "echo \"Error: no test specified\" && exit 1", diff --git a/src/app.ts b/src/app.ts index cf2d63e..2431e88 100644 --- a/src/app.ts +++ b/src/app.ts @@ -21,14 +21,12 @@ type Hashes = { const argv: any = yargs(process.argv.slice(2)).options({ bucket: { alias: "b", - default: "fd-dev-public-images", description: "S3 bucket", requiresArg: true, required: false, }, cacheControl: { alias: "c", - default: "max-age=15768000", description: "cache-control header", requiresArg: true, required: false, @@ -42,29 +40,25 @@ const argv: any = yargs(process.argv.slice(2)).options({ }, environment: { alias: "e", - default: "development", description: "Environment: development | acceptance | production", requiresArg: true, required: false, }, imagesFolder: { alias: "i", - default: "./public", - description: "folder holding all the images", + description: "folder holding all the images e.g.: ./public", requiresArg: true, required: true, }, outputImageMapLocation: { alias: "o", - default: "./imageMap.json", - description: "output image map file name", + description: "output image map file name e.g.: ./imageMap.json", requiresArg: true, required: true, }, region: { alias: "r", - default: "eu-west-1", - description: "AWS Region", + description: "AWS Region e.g: eu-west-1", requiresArg: true, required: false, }, @@ -160,6 +154,14 @@ async function uploadToS3(absolutePath: string, hashedFileName: string) { mime.contentType(absolutePath.replace(/\//g, "")) || undefined; if (!argv.dryRun) { try { + console.log({ + Bucket, + CacheControl, + Key: hashedFileName, + ContentType, + ContentEncoding: "gzip", + ACL: "public-read", + }); // Put object to S3. await s3 .upload({