Skip to content
Branch: master
Find file History

Latest commit

larixer and arcanis Adds support for setting compression level on produced zip archives (#…
…1132)

* Adds support for setting compression level on archives

* Updatte versions

* Remove unused function

* Map default compression level to 6

* Use "mixed" as default

Co-authored-by: Maël Nison <nison.mael@gmail.com>
Latest commit 05d93b3 Apr 2, 2020

Files

Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
bin/@yarnpkg Releasing 21 new packages Mar 12, 2020
sources Adds support for setting compression level on produced zip archives (#… Apr 2, 2020
README.md
package.json Releasing 11 new packages Mar 25, 2020

README.md

@yarnpkg/plugin-exec

This plugin will add support to Yarn for the exec: protocol. This protocol is special in that it'll instruct Yarn to execute the specified Node script and use its output as package content (thus treating the script as a kind of package factory).

Install

yarn plugin import exec

Usage

package.json

{
  "dependencies": {
    "pkg": "exec:./gen-pkg.js"
  }
}

gen-pkg.js

const {mkdirSync, writeFileSync} = require(`fs`);
const generatorPath = process.argv[2];

mkdirSync(`${generatorPath}/build`);

writeFileSync(`${generatorPath}/build/package.json`, JSON.stringify({
  name: `pkg`,
  version: `1.0.0`,
}));

writeFileSync(`${generatorPath}/build/index.js`, `module.exports = ${Date.now()};\n`);

Documentation

The script will be invoked with one parameter which is a temporary directory. You're free to do whatever you want inside, but at the end of the execution Yarn will expect a build directory to have been created inside it that will then be compressed into an archive and stored within the cache.

Busting the cache isn't currently supported - you'll need to manually remove the relevant archives from your cache each time you want to update the content of the package. Help welcome!

You can’t perform that action at this time.