diff --git a/README.md b/README.md index 80ca27d..79be031 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# storage-upload +# storage-upload [![Build status](https://ci.nfp.is/api/projects/status/29k8rnhf5w8s0hn4/branch/master?svg=true)](https://ci.nfp.is/project/AppVeyor/storage-upload/branch/master) Micro service for uploading and image resizing files to a storage server. diff --git a/appveyor.yml b/appveyor.yml index 5d31cef..1beaf4f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,14 +12,21 @@ skip_tags: true # Maximum number of concurrent jobs for the project max_jobs: 1 +clone_depth: 1 # Build worker image (VM template) build_cloud: Docker -image: node + +environment: + docker_image: node:16-alpine + npm_config_cache: /appveyor/projects/cache build_script: - - sh: npm install - - sh: npm list --all + - sh: | + chown -R node:node /appveyor/projects + npm install + npm list --all test_script: - - sh: npm test \ No newline at end of file + - sh: | + npm run test:linux \ No newline at end of file diff --git a/package.json b/package.json index 05364f3..81bb116 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "flaska": "^0.9.8", "formidable": "^1.2.2", "nconf-lite": "^2.0.0", - "sharp-lite": "^1.29.5" + "sharp-lite": "^1.29.6" }, "devDependencies": { "eltro": "^1.2.3" diff --git a/test.js b/test.js new file mode 100644 index 0000000..fec7759 --- /dev/null +++ b/test.js @@ -0,0 +1,27 @@ +const fs = require('fs'); +const os = require('os'); +const path = require('path'); + +const env = process.env; + +const mkdirSync = function (dirPath) { + try { + fs.mkdirSync(dirPath, { recursive: true }); + } catch (err) { + /* istanbul ignore next */ + if (err.code !== 'EEXIST') { + throw err; + } + } +}; + +const cachePath = function () { + const npmCachePath = env.npm_config_cache || /* istanbul ignore next */ + (env.APPDATA ? path.join(env.APPDATA, 'npm-cache') : path.join(os.homedir(), '.npm')); + mkdirSync(npmCachePath); + const libvipsCachePath = path.join(npmCachePath, '_libvips'); + mkdirSync(libvipsCachePath); + return libvipsCachePath; +}; + +cachePath() \ No newline at end of file