mirror of https://github.com/actions/setup-node
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
|
@ -0,0 +1,12 @@
|
|||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
|
@ -1 +1,2 @@
|
|||
* text=auto eol=lf
|
||||
.licenses/** -diff linguist-generated=true
|
||||
|
|
|
@ -4,7 +4,6 @@ about: Create a bug report
|
|||
title: ''
|
||||
labels: bug, needs triage
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 --->
|
||||
|
@ -17,15 +16,18 @@ A clear and concise description of what the bug is.
|
|||
Specify the action version
|
||||
|
||||
**Platform:**
|
||||
|
||||
- [ ] Ubuntu
|
||||
- [ ] macOS
|
||||
- [ ] Windows
|
||||
|
||||
**Runner type:**
|
||||
|
||||
- [ ] Hosted
|
||||
- [ ] Self-hosted
|
||||
|
||||
**Tools version:**
|
||||
|
||||
<!--- Please specify versions of node and package manager (npm, yarn, pnpm and etc)-->
|
||||
|
||||
**Repro steps:**
|
||||
|
|
|
@ -5,6 +5,7 @@ title: ''
|
|||
labels: feature request, needs triage
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
<!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 --->
|
||||
<!--- Before opening up a new feature request, please make sure to check for similar existing issues and pull requests -->
|
||||
|
||||
|
@ -15,4 +16,5 @@ Describe your proposal.
|
|||
Justification or a use case for your proposal.
|
||||
|
||||
**Are you willing to submit a PR?**
|
||||
|
||||
<!--- We accept contributions! -->
|
|
@ -5,5 +5,6 @@ Describe your changes.
|
|||
Add link to the related issue.
|
||||
|
||||
**Check list:**
|
||||
|
||||
- [ ] Mark if documentation changes are required.
|
||||
- [ ] Mark if tests were added or updated to cover the changes.
|
|
@ -0,0 +1,3 @@
|
|||
.licenses/
|
||||
dist/
|
||||
pnpm-lock.yaml
|
|
@ -1,11 +1,8 @@
|
|||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid",
|
||||
"parser": "typescript"
|
||||
"arrowParens": "avoid"
|
||||
}
|
|
@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation.
|
|||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
- Using welcoming and inclusive language
|
||||
- Being respectful of differing viewpoints and experiences
|
||||
- Gracefully accepting constructive criticism
|
||||
- Focusing on what is best for the community
|
||||
- Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
|
|
@ -15,11 +15,7 @@ describe('authutil tests', () => {
|
|||
let dbgSpy: jest.SpyInstance;
|
||||
|
||||
beforeAll(async () => {
|
||||
const randPath = path.join(
|
||||
Math.random()
|
||||
.toString(36)
|
||||
.substring(7)
|
||||
);
|
||||
const randPath = path.join(Math.random().toString(36).substring(7));
|
||||
console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions
|
||||
process.env['GITHUB_ENV'] = ''; // Stub out Environment file functionality so we can verify it writes to standard out (toolkit is backwards compatible)
|
||||
const tempDir = path.join(_runnerDir, randPath, 'temp');
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
# 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!
|
||||
|
@ -19,6 +23,7 @@ As the first stage, we won't support custom locations for `package-lock.json`, `
|
|||
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:
|
||||
- `npm` - enable caching for npm dependencies
|
||||
- `yarn` - enable caching for yarn dependencies
|
||||
|
@ -33,7 +38,9 @@ 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
|
||||
|
@ -44,6 +51,7 @@ steps:
|
|||
```
|
||||
|
||||
Yarn package manager:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
|
|
@ -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
|
||||
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,6 +33,7 @@ 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
|
||||
|
@ -37,6 +43,7 @@ steps:
|
|||
cache: npm
|
||||
cache-dependency-path: 'sub-project/package-lock.json'
|
||||
```
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
|
|
@ -14,6 +14,7 @@ In order to get the most out of using your lockfile on continuous integration fo
|
|||
Ensure that `package-lock.json` is always committed, use `npm ci` instead of `npm install` when installing packages.
|
||||
|
||||
**See also:**
|
||||
|
||||
- [Documentation of `package-lock.json`](https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json)
|
||||
- [Documentation of `npm ci`](https://docs.npmjs.com/cli/v8/commands/npm-ci)
|
||||
|
||||
|
@ -22,6 +23,7 @@ Ensure that `package-lock.json` is always committed, use `npm ci` instead of `np
|
|||
To ensure that `yarn.lock` is always committed, use `yarn install --immutable` when installing packages.
|
||||
|
||||
**See also:**
|
||||
|
||||
- [Documentation of `yarn.lock`](https://classic.yarnpkg.com/en/docs/yarn-lock)
|
||||
- [Documentation of `--frozen-lockfile` option](https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-frozen-lockfile)
|
||||
- [QA - Should lockfiles be committed to the repoistory?](https://yarnpkg.com/getting-started/qa/#should-lockfiles-be-committed-to-the-repository)
|
||||
|
@ -32,6 +34,7 @@ To ensure that `yarn.lock` is always committed, use `yarn install --immutable` w
|
|||
Ensure that `pnpm-lock.yaml` is always committed, when on CI pass `--frozen-lockfile` to `pnpm install` when installing packages.
|
||||
|
||||
**See also:**
|
||||
|
||||
- [Working with Git - Lockfiles](https://pnpm.io/git#lockfiles)
|
||||
- [Documentation of `--frozen-lockfile` option](https://pnpm.io/cli/install#--frozen-lockfile)
|
||||
|
||||
|
@ -58,6 +61,7 @@ steps:
|
|||
|
||||
The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc`, `.node-version` or `.tool-versions`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
|
||||
See [supported version syntax](https://github.com/actions/setup-node#supported-version-syntax)
|
||||
|
||||
> The action will search for the node version file relative to the repository root.
|
||||
|
||||
```yaml
|
||||
|
@ -75,6 +79,7 @@ steps:
|
|||
You can use any of the [supported operating systems](https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners), and the compatible `architecture` can be selected using `architecture`. Values are `x86`, `x64`, `arm64`, `armv6l`, `armv7l`, `ppc64le`, `s390x` (not all of the architectures are available on all platforms).
|
||||
|
||||
When using `architecture`, `node-version` must be provided as well.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
|
@ -91,10 +96,12 @@ jobs:
|
|||
```
|
||||
|
||||
## Caching packages data
|
||||
|
||||
The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions.
|
||||
|
||||
**Caching yarn dependencies:**
|
||||
Yarn caching handles both yarn versions: 1 or 2.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -107,6 +114,7 @@ steps:
|
|||
```
|
||||
|
||||
**Caching pnpm (v6.10+) dependencies:**
|
||||
|
||||
```yaml
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
|
@ -129,6 +137,7 @@ steps:
|
|||
```
|
||||
|
||||
**Using wildcard patterns to cache dependencies**
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -142,6 +151,7 @@ steps:
|
|||
```
|
||||
|
||||
**Using a list of file paths to cache dependencies**
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -192,6 +202,7 @@ jobs:
|
|||
```
|
||||
|
||||
## Publish to npmjs and GPR with npm
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -212,6 +223,7 @@ steps:
|
|||
```
|
||||
|
||||
## Publish to npmjs and GPR with yarn
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -232,6 +244,7 @@ steps:
|
|||
```
|
||||
|
||||
## Use private packages
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -247,7 +260,9 @@ steps:
|
|||
# `npm rebuild` will run all those post-install scripts for us.
|
||||
- run: npm rebuild && npm run prepare --if-present
|
||||
```
|
||||
|
||||
### Yarn2 configuration
|
||||
|
||||
Yarn2 ignores both .npmrc and .yarnrc files created by the action, so before installing dependencies from the private repo it is necessary either to create or to modify existing yarnrc.yml file with `yarn config set` commands.
|
||||
|
||||
Below you can find a sample "Setup .yarnrc.yml" step, that is going to allow you to configure a private GitHub registry for 'my-org' organisation.
|
||||
|
@ -268,4 +283,5 @@ steps:
|
|||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
```
|
||||
|
||||
NOTE: As per https://github.com/actions/setup-node/issues/49 you cannot use `secrets.GITHUB_TOKEN` to access private GitHub Packages within the same organisation but in a different repository.
|
||||
|
|
|
@ -6,13 +6,13 @@ We have prepared a short guide so that the process of making your contribution i
|
|||
|
||||
## How can I contribute...
|
||||
|
||||
* [Contribute Documentation:green_book:](#contribute-documentation)
|
||||
- [Contribute Documentation:green_book:](#contribute-documentation)
|
||||
|
||||
* [Contribute Code :computer:](#contribute-code)
|
||||
- [Contribute Code :computer:](#contribute-code)
|
||||
|
||||
* [Provide Support on Issues:pencil:](#provide-support-on-issues)
|
||||
- [Provide Support on Issues:pencil:](#provide-support-on-issues)
|
||||
|
||||
* [Review Pull Requests:mag:](#review-pull-requests)
|
||||
- [Review Pull Requests:mag:](#review-pull-requests)
|
||||
|
||||
## Contribute documentation
|
||||
|
||||
|
@ -92,7 +92,7 @@ Helping out other users with their questions is an awesome way of contributing t
|
|||
- Respond to the issue with whatever details are needed to clarify the question, or get more details about what's going on
|
||||
- Once the discussion wraps up and things are clarified, ask the original issue filer (or a maintainer) to close it for you
|
||||
|
||||
*Some notes on picking up support issues:*
|
||||
_Some notes on picking up support issues:_
|
||||
|
||||
- Avoid responding to issues you don't know you can answer accurately
|
||||
- Try to refer to past issues with accepted answers as much as possible. Link to them from your replies
|
||||
|
@ -100,10 +100,8 @@ Helping out other users with their questions is an awesome way of contributing t
|
|||
|
||||
> If some user is violating our code of conduct [standards](https://github.com/actions/setup-node/blob/main/CODE_OF_CONDUCT.md#our-standards), refer to the [Enforcement](https://github.com/actions/setup-node/blob/main/CODE_OF_CONDUCT.md#enforcement) section of the Code of Conduct to resolve the conflict
|
||||
|
||||
|
||||
## Review pull requests
|
||||
|
||||
|
||||
Another great way to contribute is to review pull request. Please, be extra kind: people who submit code/doc contributions are putting themselves in a pretty vulnerable position, and have put time and care into what they've done (even if that's not obvious to you!) Please, always respond with respect, and be understanding, but don't feel like you need to sacrifice your standards for their sake, either.
|
||||
|
||||
**How to review:**
|
||||
|
|
|
@ -8,4 +8,4 @@ module.exports = {
|
|||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
verbose: true
|
||||
}
|
||||
};
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
"@vercel/ncc": "^0.33.4",
|
||||
"jest": "^27.2.5",
|
||||
"jest-circus": "^27.2.5",
|
||||
"prettier": "^1.19.1",
|
||||
"prettier": "^2.7.1",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^3.8.3"
|
||||
}
|
||||
|
@ -4247,15 +4247,18 @@
|
|||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
|
||||
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
|
||||
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"prettier": "bin-prettier.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-format": {
|
||||
|
@ -8426,9 +8429,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
|
||||
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
|
||||
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
|
||||
"dev": true
|
||||
},
|
||||
"pretty-format": {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
"main": "lib/setup-node.js",
|
||||
"scripts": {
|
||||
"build": "ncc build -o dist/setup src/setup-node.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"format": "prettier --write .",
|
||||
"format-check": "prettier --check .",
|
||||
"test": "jest --coverage",
|
||||
"pre-checkin": "npm run format && npm run build && npm test"
|
||||
},
|
||||
|
@ -40,7 +40,7 @@
|
|||
"@vercel/ncc": "^0.33.4",
|
||||
"jest": "^27.2.5",
|
||||
"jest-circus": "^27.2.5",
|
||||
"prettier": "^1.19.1",
|
||||
"prettier": "^2.7.1",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^3.8.3"
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
"target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
|
||||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
||||
"outDir": "./lib" /* Redirect output structure to the directory. */,
|
||||
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
|
||||
"sourceMap": true,
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
"noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */,
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
},
|
||||
"exclude": ["__tests__", "lib", "node_modules"]
|
||||
|
|
Loading…
Reference in New Issue