chore: switch from npm to pnpm (#8514)

pull/8530/head
Ben McCann 2 years ago committed by GitHub
parent be645202d6
commit d64e86a260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,12 +24,14 @@ jobs:
os: ubuntu-latest os: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: npm cache: pnpm
- run: npm install - run: pnpm install --frozen-lockfile
- run: npm run test:integration - run: node node_modules/puppeteer/install.js
- run: pnpm test:integration
env: env:
CI: true CI: true
Lint: Lint:
@ -37,10 +39,11 @@ jobs:
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
cache: npm cache: pnpm
- run: 'npm i && npm run lint' - run: 'pnpm i && pnpm lint'
Unit: Unit:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 10 timeout-minutes: 10
@ -59,10 +62,11 @@ jobs:
os: ubuntu-latest os: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
cache: npm cache: pnpm
- run: npm install - run: pnpm install
env: env:
SKIP_PREPARE: true SKIP_PREPARE: true
- run: npm run test:unit - run: pnpm test:unit

@ -72,9 +72,9 @@ Small pull requests are much easier to review and more likely to get merged.
### Installation ### Installation
1. Ensure you have [npm](https://www.npmjs.com/get-npm) installed. 1. Ensure you have [pnpm](https://pnpm.io/installation) installed.
1. After cloning the repository, run `npm install` in the root of the repository. 1. After cloning the repository, run `pnpm install` in the root of the repository.
1. To start a development server, run `npm run dev`. 1. To compile in watch mode, run `pnpm dev`.
### Creating a branch ### Creating a branch
@ -94,8 +94,8 @@ Test samples are kept in `/test/xxx/samples` folder.
#### Running tests #### Running tests
1. To run test, run `npm run test`. 1. To run test, run `pnpm test`.
1. To run test for a specific feature, you can use the `-g` (aka `--grep`) option. For example, to only run test involving transitions, run `npm run test -- -g transition`. 1. To run test for a specific feature, you can use the `-g` (aka `--grep`) option. For example, to only run test involving transitions, run `pnpm test -- -g transition`.
##### Running solo test ##### Running solo test
@ -106,11 +106,11 @@ Test samples are kept in `/test/xxx/samples` folder.
##### Updating `.expected` files ##### Updating `.expected` files
1. Tests suites like `css`, `js`, `server-side-rendering` asserts that the generated output has to match the content in the `.expected` file. For example, in the `js` test suites, the generated js code is compared against the content in `expected.js`. 1. Tests suites like `css`, `js`, `server-side-rendering` asserts that the generated output has to match the content in the `.expected` file. For example, in the `js` test suites, the generated js code is compared against the content in `expected.js`.
1. To update the content of the `.expected` file, run the test with `--update` flag. (`npm run test --update`) 1. To update the content of the `.expected` file, run the test with `--update` flag. (`pnpm test --update`)
### Style guide ### Style guide
[Eslint](https://eslint.org) will catch most styling issues that may exist in your code. You can check the status of your code styling by simply running `npm run lint`. [Eslint](https://eslint.org) will catch most styling issues that may exist in your code. You can check the status of your code styling by simply running `pnpm lint`.
#### Code conventions #### Code conventions
@ -122,8 +122,8 @@ Test samples are kept in `/test/xxx/samples` folder.
Please make sure the following is done when submitting a pull request: Please make sure the following is done when submitting a pull request:
1. Describe your **test plan** in your pull request description. Make sure to test your changes. 1. Describe your **test plan** in your pull request description. Make sure to test your changes.
1. Make sure your code lints (`npm run lint`). 1. Make sure your code lints (`pnpm lint`).
1. Make sure your tests pass (`npm run test`). 1. Make sure your tests pass (`pnpm test`).
All pull requests should be opened against the `master` branch. Make sure the PR does only one thing, otherwise please split it. All pull requests should be opened against the `master` branch. Make sure the PR does only one thing, otherwise please split it.

@ -34,7 +34,7 @@ To install and work on Svelte locally:
```bash ```bash
git clone https://github.com/sveltejs/svelte.git git clone https://github.com/sveltejs/svelte.git
cd svelte cd svelte
npm install pnpm install
``` ```
> Do not use Yarn to install the dependencies, as the specific package versions in `package-lock.json` are used to build and test Svelte. > Do not use Yarn to install the dependencies, as the specific package versions in `package-lock.json` are used to build and test Svelte.
@ -42,13 +42,13 @@ npm install
To build the compiler and all the other modules included in the package: To build the compiler and all the other modules included in the package:
```bash ```bash
npm run build pnpm build
``` ```
To watch for changes and continually rebuild the package (this is useful if you're using [npm link](https://docs.npmjs.com/cli/link.html) to test out changes in a project locally): To watch for changes and continually rebuild the package (this is useful if you're using [`pnpm link`](https://pnpm.io/cli/link) to test out changes in a project locally):
```bash ```bash
npm run dev pnpm dev
``` ```
The compiler is written in [TypeScript](https://www.typescriptlang.org/), but don't let that put you off — it's basically just JavaScript with type annotations. You'll pick it up in no time. If you're using an editor other than [Visual Studio Code](https://code.visualstudio.com/), you may need to install a plugin in order to get syntax highlighting and code hints, etc. The compiler is written in [TypeScript](https://www.typescriptlang.org/), but don't let that put you off — it's basically just JavaScript with type annotations. You'll pick it up in no time. If you're using an editor other than [Visual Studio Code](https://code.visualstudio.com/), you may need to install a plugin in order to get syntax highlighting and code hints, etc.
@ -57,13 +57,13 @@ The compiler is written in [TypeScript](https://www.typescriptlang.org/), but do
### Running Tests ### Running Tests
```bash ```bash
npm run test pnpm test
``` ```
To filter tests, use `-g` (aka `--grep`). For example, to only run tests involving transitions: To filter tests, use `-g` (aka `--grep`). For example, to only run tests involving transitions:
```bash ```bash
npm run test -- -g transition pnpm test -- -g transition
``` ```

9435
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -130,6 +130,7 @@
"@rollup/plugin-virtual": "^3.0.1", "@rollup/plugin-virtual": "^3.0.1",
"@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.8.0", "@sveltejs/eslint-config": "github:sveltejs/eslint-config#v5.8.0",
"@types/aria-query": "^5.0.1", "@types/aria-query": "^5.0.1",
"@types/estree": "^1.0.0",
"@types/mocha": "^10.0.1", "@types/mocha": "^10.0.1",
"@types/node": "^14.14.31", "@types/node": "^14.14.31",
"@typescript-eslint/eslint-plugin": "^5.58.0", "@typescript-eslint/eslint-plugin": "^5.58.0",
@ -159,5 +160,9 @@
"tslib": "^2.5.0", "tslib": "^2.5.0",
"typescript": "^5.0.4", "typescript": "^5.0.4",
"util": "^0.12.5" "util": "^0.12.5"
},
"packageManager": "pnpm@7.32.0",
"engines": {
"pnpm": ">=7.0.0"
} }
} }

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
// https://github.com/sveltejs/svelte/issues/7633 // https://github.com/sveltejs/svelte/issues/7633
export default { export default {
async test({ assert, target, component, window }) { async test({ assert, target, component }) {
let inputs = target.querySelectorAll('input'); let inputs = target.querySelectorAll('input');
assert.equal(inputs[0].checked, true); assert.equal(inputs[0].checked, true);

@ -1,6 +1,6 @@
// https://github.com/sveltejs/svelte/issues/7633 // https://github.com/sveltejs/svelte/issues/7633
export default { export default {
async test({ assert, target, component, window }) { async test({ assert, target, component }) {
let inputs = target.querySelectorAll('input'); let inputs = target.querySelectorAll('input');
assert.equal(inputs[0].checked, true); assert.equal(inputs[0].checked, true);

@ -4,7 +4,7 @@ export default {
<div>[N] B <button>Toggle</button></div> <div>[N] B <button>Toggle</button></div>
<div>[N] C <button>Toggle</button></div> <div>[N] C <button>Toggle</button></div>
`, `,
async test({ component, target, assert, window }) { async test({ target, assert, window }) {
const [btn1, btn2, btn3] = target.querySelectorAll('button'); const [btn1, btn2, btn3] = target.querySelectorAll('button');
await btn1.dispatchEvent(new window.MouseEvent('click')); await btn1.dispatchEvent(new window.MouseEvent('click'));
await btn2.dispatchEvent(new window.MouseEvent('click')); await btn2.dispatchEvent(new window.MouseEvent('click'));

@ -9,19 +9,14 @@ const href: Action<HTMLAnchorElement> = (node) => {
}; };
href; href;
const required: Action<HTMLElement, boolean> = (node, param) => { const required: Action<HTMLElement, boolean> = (_node, _param) => {};
node;
param;
};
required(null as any, true); required(null as any, true);
// @ts-expect-error (only in strict mode) boolean missing // @ts-expect-error (only in strict mode) boolean missing
required(null as any); required(null as any);
// @ts-expect-error no boolean // @ts-expect-error no boolean
required(null as any, 'string'); required(null as any, 'string');
const required1: Action<HTMLElement, boolean> = (node, param) => { const required1: Action<HTMLElement, boolean> = (_node, _param) => {
node;
param;
return { return {
update: (p) => p === true, update: (p) => p === true,
destroy: () => {} destroy: () => {}
@ -29,14 +24,10 @@ const required1: Action<HTMLElement, boolean> = (node, param) => {
}; };
required1; required1;
const required2: Action<HTMLElement, boolean> = (node) => { const required2: Action<HTMLElement, boolean> = (_node) => {};
node;
};
required2; required2;
const required3: Action<HTMLElement, boolean> = (node, param) => { const required3: Action<HTMLElement, boolean> = (_node, _param) => {
node;
param;
return { return {
// @ts-expect-error comparison always resolves to false // @ts-expect-error comparison always resolves to false
update: (p) => p === 'd', update: (p) => p === 'd',
@ -45,18 +36,13 @@ const required3: Action<HTMLElement, boolean> = (node, param) => {
}; };
required3; required3;
const optional: Action<HTMLElement, boolean | undefined> = (node, param?) => { const optional: Action<HTMLElement, boolean | undefined> = (_node, _param?) => {};
node;
param;
};
optional(null as any, true); optional(null as any, true);
optional(null as any); optional(null as any);
// @ts-expect-error no boolean // @ts-expect-error no boolean
optional(null as any, 'string'); optional(null as any, 'string');
const optional1: Action<HTMLElement, boolean | undefined> = (node, param?) => { const optional1: Action<HTMLElement, boolean | undefined> = (_node, _param?) => {
node;
param;
return { return {
update: (p) => p === true, update: (p) => p === true,
destroy: () => {} destroy: () => {}
@ -64,20 +50,13 @@ const optional1: Action<HTMLElement, boolean | undefined> = (node, param?) => {
}; };
optional1; optional1;
const optional2: Action<HTMLElement, boolean | undefined> = (node) => { const optional2: Action<HTMLElement, boolean | undefined> = (_node) => {};
node;
};
optional2; optional2;
const optional3: Action<HTMLElement, boolean | undefined> = (node, param) => { const optional3: Action<HTMLElement, boolean | undefined> = (_node, _param) => {};
node;
param;
};
optional3; optional3;
const optional4: Action<HTMLElement, boolean | undefined> = (node, param?) => { const optional4: Action<HTMLElement, boolean | undefined> = (_node, _param?) => {
node;
param;
return { return {
// @ts-expect-error comparison always resolves to false // @ts-expect-error comparison always resolves to false
update: (p) => p === 'd', update: (p) => p === 'd',
@ -86,17 +65,14 @@ const optional4: Action<HTMLElement, boolean | undefined> = (node, param?) => {
}; };
optional4; optional4;
const no: Action<HTMLElement, never> = (node) => { const no: Action<HTMLElement, never> = (_node) => {};
node;
};
// @ts-expect-error second param // @ts-expect-error second param
no(null as any, true); no(null as any, true);
no(null as any); no(null as any);
// @ts-expect-error second param // @ts-expect-error second param
no(null as any, 'string'); no(null as any, 'string');
const no1: Action<HTMLElement, never> = (node) => { const no1: Action<HTMLElement, never> = (_node) => {
node;
return { return {
destroy: () => {} destroy: () => {}
}; };
@ -104,15 +80,15 @@ const no1: Action<HTMLElement, never> = (node) => {
no1; no1;
// @ts-expect-error param given // @ts-expect-error param given
const no2: Action<HTMLElement, never> = (node, param?) => {}; const no2: Action<HTMLElement, never> = (_node, _param?) => {};
no2; no2;
// @ts-expect-error param given // @ts-expect-error param given
const no3: Action<HTMLElement, never> = (node, param) => {}; const no3: Action<HTMLElement, never> = (_node, _param) => {};
no3; no3;
// @ts-expect-error update method given // @ts-expect-error update method given
const no4: Action<HTMLElement, never> = (node) => { const no4: Action<HTMLElement, never> = (_node) => {
return { return {
update: () => {}, update: () => {},
destroy: () => {} destroy: () => {}

Loading…
Cancel
Save