From b837899302d8067e10c7ee7e960eaf31dba707b6 Mon Sep 17 00:00:00 2001 From: Nafis Hossain Date: Fri, 5 Jul 2024 17:05:58 +1000 Subject: [PATCH] feat: update readme --- readme.md | 41 ++++++++++++++++++++++++++++++++++++++++- src/config.ts | 5 ++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 4c90524..65635b6 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,43 @@ lilsync ------- -lilsync is a tool that takes images from an s3 compatible cloud storage, creates optimised/resized versions of those images and reuploads them. \ No newline at end of file +lilsync is a tool that takes images from an s3 compatible cloud storage, creates optimised/resized versions of those images and reuploads them. + +Get Started +=========== + +Install: +``` +npm install -g lilsync +``` + +Then create a config file in your home directory called `.lilsyncrc.yaml`. + +Config +====== +lilsync requires a config file called .lilsyncrc.yaml either in the current directory or in your home directory. + +An example home directory is as follows: +``` +bucketName: milkyway +credentials: + accessKeyId: "abc" + secretKey: "def" + endpointUrl: "https://s3.somewhere.tld" +inputConfig: + outputPath: "out/" + inputPath: "images/" + outputImages: + - width: 1250 + quality: 95 + - width: 500 + quality: 95 + ext: png +``` + +- bucketName: string representing the bucket where images will be stored +- credentials: s3 compatible credentials. Instead of providing this section you can also have the following environment variables: `ACCESS_KEY_ID`, `SECRET_KEY` and `ENDPOINT_URL` +- inputConfig: + - outputPath: all images created by lilsync will be put in this folder. it doesnt have to exist in the bucket + - inputPath: lilsync will look inside this folder and find images to convert + - outputImages: a list of the formats you want to be created. all images from the input folder will have a new image created in the output folder for each format in this section. Requires at least a `width` or `height` to be defined. Available keys: `width`, `height`, `quality`, `ext` \ No newline at end of file diff --git a/src/config.ts b/src/config.ts index c3b9656..e601b1d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -82,7 +82,10 @@ export const getCredentials = (configCredentials?: { export const getConfig = (): Config => { try { - const explorerSync = cosmiconfigSync("lilsync"); + const explorerSync = cosmiconfigSync("lilsync", { + searchStrategy: "global", + stopDir: "/", + }); const result = explorerSync.search(); if (!result || !result.config) {