mirror of
https://github.com/actions/setup-node.git
synced 2025-07-04 08:33:47 +00:00
chore: upgrade Prettier and run on full repo
- Move Prettier 1 -> to support `.` glob and built-in parsers - Move whitespace settings to EditorConfig that Prettier reads - Expand glob to run on all non-generated files
This commit is contained in:
parent
e954e15431
commit
c2dd1f600a
28 changed files with 1503 additions and 1457 deletions
|
@ -1,25 +1,30 @@
|
|||
# 0. Caching dependencies
|
||||
|
||||
Date: 2021-05-21
|
||||
|
||||
Status: Accepted
|
||||
|
||||
# Context
|
||||
|
||||
`actions/setup-node` is the 2nd most popular action in GitHub Actions. A lot of customers use it in conjunction with [actions/cache](https://github.com/actions/cache) to speed up dependencies installation.
|
||||
See more examples on proper usage in [actions/cache documentation](https://github.com/actions/cache/blob/main/examples.md#node---npm).
|
||||
|
||||
# Goals & Anti-Goals
|
||||
|
||||
Integration of caching functionality into `actions/setup-node` action will bring the following benefits for action users:
|
||||
|
||||
- Decrease the entry threshold for using the cache for Node.js dependencies and simplify initial configuration
|
||||
- Simplify YAML pipelines because no need additional steps to enable caching
|
||||
- More users will use cache for Node.js so more customers will have fast builds!
|
||||
|
||||
We will add support for NPM and Yarn dependencies caching.
|
||||
As the first stage, we won't support custom locations for `package-lock.json`, `yarn.lock` files and action will work only when files are located in repository root.
|
||||
As the first stage, we won't support custom locations for `package-lock.json`, `yarn.lock` files and action will work only when files are located in repository root.
|
||||
|
||||
We don't pursue the goal to provide wide customization of caching in scope of `actions/setup-node` action. The purpose of this integration is covering ~90% of basic use-cases. If user needs flexible customization, we should advice them to use `actions/cache` directly.
|
||||
|
||||
# Decision
|
||||
- Add `cache` input parameter to `actions/setup-node`. For now, input will accept the following values:
|
||||
|
||||
- Add `cache` input parameter to `actions/setup-node`. For now, input will accept the following values:
|
||||
- `npm` - enable caching for npm dependencies
|
||||
- `yarn` - enable caching for yarn dependencies
|
||||
- `''` - disable caching (default value)
|
||||
|
@ -33,24 +38,27 @@ We don't pursue the goal to provide wide customization of caching in scope of `a
|
|||
- Yarn 2 (retrieved via `yarn config get cacheFolder`)
|
||||
|
||||
# Example of real use-cases
|
||||
|
||||
Npm package manager:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: npm
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: npm
|
||||
```
|
||||
|
||||
Yarn package manager:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: yarn
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: yarn
|
||||
```
|
||||
|
||||
# Release process
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
# 0. Support caching dependencies for mono repos
|
||||
|
||||
Date: 2021-07-13
|
||||
|
||||
Status: Proposed
|
||||
|
||||
## Context
|
||||
|
||||
Currently, `actions/setup-node` supports caching dependencies for Npm and Yarn package managers.
|
||||
For the first iteration, we have decided to not support cases where `package-lock.json` / `yarn.lock` are located outside of repository root.
|
||||
Current implementation searches the following file patterns in the repository root: `package-lock.json`, `yarn.lock` (in order of resolving priorities)
|
||||
|
@ -12,11 +14,14 @@ Obviously, it made build-in caching unusable for mono-repos and repos with compl
|
|||
We would like to revisit this decision and add customization for dependencies lock file location.
|
||||
|
||||
## Proposal
|
||||
|
||||
We have the following options:
|
||||
1. Allow to specify directory where `package-lock.json` or `yarn.lock` are located
|
||||
|
||||
1. Allow to specify directory where `package-lock.json` or `yarn.lock` are located
|
||||
2. Allow to specify path to the dependencies lock file (including directory path and filename)
|
||||
|
||||
The second option looks more generic because it allows to:
|
||||
|
||||
- specify multiple dependencies files using file patterns like `**/package-lock.json` ([one of recommended approaches in actions/cache](https://github.com/actions/cache/blob/main/examples.md#macos-and-ubuntu))
|
||||
- specify custom dependencies files like `src/npm-shrinkwrap.json`
|
||||
- change default resolving priority if both `yarn.lock` and `package-lock.json` exist in repository
|
||||
|
@ -28,21 +33,23 @@ If provided path contains wildcards, the action will search all maching files an
|
|||
The hash of provided matched files will be used as a part of cache key.
|
||||
|
||||
Yaml examples:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
cache: npm
|
||||
cache-dependency-path: 'sub-project/package-lock.json'
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
cache: npm
|
||||
cache-dependency-path: 'sub-project/package-lock.json'
|
||||
```
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
cache: yarn
|
||||
cache-dependency-path: 'sub-project/**/yarn.lock'
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14
|
||||
cache: yarn
|
||||
cache-dependency-path: 'sub-project/**/yarn.lock'
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue