Skip to content

Commit

Permalink
add pnpm9
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpicado committed Apr 25, 2024
1 parent db72883 commit 6a6af7c
Show file tree
Hide file tree
Showing 26 changed files with 5,005 additions and 1,578 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/e2e-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
pnpm config set store-dir ~/.pnpm-store
- name: Set up .npmrc
run: |
echo "//registry.verdaccio.org/:_authToken=${{ secrets.VERDACCIO_TOKEN }}" > .npmrc
echo "//registry.verdaccio.org/:_authToken=${{ secrets.VERDACCIO_TOKEN }}" > .npmrc
- name: registry
run: npm config set registry https://registry.verdaccio.org
run: npm config set registry https://registry.verdaccio.org
- name: Install
run: pnpm install
- name: Cache .pnpm-store
Expand Down Expand Up @@ -74,9 +74,9 @@ jobs:
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
- name: Set up .npmrc
run: |
echo "//registry.verdaccio.org/:_authToken=${{ secrets.VERDACCIO_TOKEN }}" > .npmrc
echo "//registry.verdaccio.org/:_authToken=${{ secrets.VERDACCIO_TOKEN }}" > .npmrc
- name: registry
run: npm config set registry https://registry.verdaccio.org
run: npm config set registry https://registry.verdaccio.org
- name: Install
run: pnpm install --frozen-lockfile
- uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-ui-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:

- name: Set up .npmrc
run: |
echo "//registry.verdaccio.org/:_authToken=${{ secrets.VERDACCIO_TOKEN }}" > .npmrc
echo "//registry.verdaccio.org/:_authToken=${{ secrets.VERDACCIO_TOKEN }}" > .npmrc
- name: registry
run: npm config set registry https://registry.verdaccio.org

- name: Install pnpm
run: |
corepack enable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: corepack prepare pnpm@latest-8 --activate
- name: Set up .npmrc
run: |
echo "//registry.verdaccio.org/:_authToken=${{ secrets.VERDACCIO_TOKEN }}" > .npmrc
echo "//registry.verdaccio.org/:_authToken=${{ secrets.VERDACCIO_TOKEN }}" > .npmrc
- name: registry
run: npm config set registry https://registry.verdaccio.org
- name: install
Expand Down
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/e2e-5.x.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# E2E CLI Testing for 6.x

> For 5.x versions, check `5.x` branch
> For 5.x versions, check `5.x` branch
What is included on these test?

Expand All @@ -21,23 +21,24 @@ All docker test are run with GitHub Actions
## With npm cli

> It uses the latest `npmjs` version published
- Default configuration only
- Test with all popular package managers

### Commands Tested

| cmd | npm6 | npm7 | npm8 | npm9 | npm10 | pnpm6 | pnpm7 | yarn1 | yarn2 | yarn3 | yarn4 |
| --------- | ---- | ---- | ---- | ---- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| publish ||||||||||||
| info ||||||||||||
| audit ||||||||||||
| install ||||||||||||
| deprecate ||||||||||||
| ping ||||||||||||
| search ||||||||||||
| star ||||||||||||
| stars ||||||||||||
| dist-tag ||||||||||||
| cmd | npm6 | npm7 | npm8 | npm9 | pnpm6 | pnpm7 | pnpm8 | pnpm9 | yarn1 | yarn2 | yarn3 | yarn4 |
| --------- | ---- | ---- | ---- | ---- | ----- | ----- | ----- |-------| ----- | ----- | ----- | ----- |
| publish |||||||| |||||
| info |||||||| |||||
| audit |||||||| |||||
| install |||||||| |||||
| deprecate |||||||| | ||||
| ping |||||||| | ||||
| search |||||||| | ||||
| star |||||||| | ||||
| stars |||||||| | ||||
| dist-tag |||||||| |||||

> notes:
>
Expand Down
24 changes: 12 additions & 12 deletions e2e/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

### Commands Tested

| cmd | npm6 | npm7 | npm8 | npm9 | pnpm6 | pnpm7 | pnpm8 | yarn1 | yarn2 | yarn3 | yarn4 |
| --------- | ---- | ---- | ---- | ---- | ----- | ----- | ----- | ----- | ----- | ----- | ----- |
| publish ||||||||||||
| info ||||||||||||
| audit ||||||||||||
| install ||||||||||||
| deprecate ||||||||||||
| ping ||||||||||||
| search ||||||||||||
| star ||||||||||||
| stars ||||||||||||
| dist-tag ||||||||||||
| cmd | npm6 | npm7 | npm8 | npm9 | pnpm6 | pnpm7 | pnpm8 | pnpm9 | yarn1 | yarn2 | yarn3 | yarn4 |
| --------- | ---- | ---- | ---- | ---- | ----- | ----- | ----- |-------| ----- | ----- | ----- | ----- |
| publish |||||||| |||||
| info |||||||| |||||
| audit |||||||| |||||
| install |||||||| |||||
| deprecate |||||||| | ||||
| ping |||||||| | ||||
| search |||||||| | ||||
| star |||||||| | ||||
| stars |||||||| | ||||
| dist-tag |||||||| |||||

> notes:
>
Expand Down
3 changes: 3 additions & 0 deletions e2e/cli/e2e-pnpm9/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../../.babelrc"
}
7 changes: 7 additions & 0 deletions e2e/cli/e2e-pnpm9/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rules": {
"no-console": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/explicit-member-accessibility": 0
}
}
39 changes: 39 additions & 0 deletions e2e/cli/e2e-pnpm9/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# @verdaccio/e2e-cli-pnpm7

## 1.0.1-6-next.5

### Patch Changes

- @verdaccio/test-cli-commons@1.0.1-6-next.5

## 1.0.1-6-next.4

### Patch Changes

- @verdaccio/test-cli-commons@1.0.1-6-next.4

## 1.0.1-6-next.3

### Patch Changes

- 351aeeaa: fix(deps): @verdaccio/utils should be a prod dep of local-storage
- Updated dependencies [351aeeaa]
- @verdaccio/test-cli-commons@1.0.1-6-next.3

## 1.0.1-6-next.2

### Patch Changes

- @verdaccio/test-cli-commons@1.0.1-6-next.2

## 1.0.1-6-next.1

### Patch Changes

- @verdaccio/test-cli-commons@1.0.1-6-next.1

## 1.0.1-6-next.0

### Patch Changes

- @verdaccio/test-cli-commons@1.0.1-6-next.0
45 changes: 45 additions & 0 deletions e2e/cli/e2e-pnpm9/audit.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { addRegistry, initialSetup, prepareGenericEmptyProject } from '@verdaccio/test-cli-commons';

import { pnpm } from './utils';

describe('install a package', () => {
jest.setTimeout(10000);
let registry;

beforeAll(async () => {
const setup = await initialSetup();
registry = setup.registry;
await registry.init();
});

test.each([['verdaccio-memory', '@verdaccio/cli']])(
'should audit a package %s',
async (pkgName) => {
const { tempFolder } = await prepareGenericEmptyProject(
pkgName,
'1.0.0-patch',
registry.port,
registry.getToken(),
registry.getRegistryUrl(),
{ jquery: '3.6.1' }
);
// install is required to create package lock file
await pnpm({ cwd: tempFolder }, 'install', ...addRegistry(registry.getRegistryUrl()));
const resp = await pnpm(
{ cwd: tempFolder },
'audit',
'--json',
...addRegistry(registry.getRegistryUrl())
);
const parsedBody = JSON.parse(resp.stdout as string);
expect(parsedBody.metadata).toBeDefined();
expect(parsedBody.actions).toBeDefined();
expect(parsedBody.advisories).toBeDefined();
expect(parsedBody.muted).toBeDefined();
}
);

afterAll(async () => {
registry.stop();
});
});
115 changes: 115 additions & 0 deletions e2e/cli/e2e-pnpm9/deprecate.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import {
addRegistry,
initialSetup,
pnpmUtils,
prepareGenericEmptyProject,
} from '@verdaccio/test-cli-commons';

import { pnpm } from './utils';

describe('deprecate a package', () => {
jest.setTimeout(20000);
let registry;

async function deprecate(tempFolder, packageVersion, registry, message) {
await pnpm(
{ cwd: tempFolder },
'deprecate',
packageVersion,
message,
'--json',
...addRegistry(registry.getRegistryUrl())
);
}

beforeAll(async () => {
const setup = await initialSetup();
registry = setup.registry;
await registry.init();
});

test.each([['@verdaccio/deprecated-1']])(
'should deprecate a single package %s',
async (pkgName) => {
const message = 'some message';
const { tempFolder } = await prepareGenericEmptyProject(
pkgName,
'1.0.0',
registry.port,
registry.getToken(),
registry.getRegistryUrl()
);
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
// deprecate one version
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
// verify is deprecated
const infoBody = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
expect(infoBody.name).toEqual(pkgName);
expect(infoBody.deprecated).toEqual(message);
}
);

test.each([['@verdaccio/deprecated-2']])('should un-deprecate a package %s', async (pkgName) => {
const message = 'some message';
const { tempFolder } = await prepareGenericEmptyProject(
pkgName,
'1.0.0',
registry.port,
registry.getToken(),
registry.getRegistryUrl()
);
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
// deprecate one version
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, message);
// verify is deprecated
const infoBody = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
expect(infoBody.deprecated).toEqual(message);
// empty string is same as undeprecate
await deprecate(tempFolder, `${pkgName}@1.0.0`, registry, '');
const infoBody2 = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}`, registry);
expect(infoBody2.deprecated).toBeUndefined();
});

test.each([['@verdaccio/deprecated-3']])(
'should deprecate a multiple packages %s',
async (pkgName) => {
const message = 'some message';
const { tempFolder } = await prepareGenericEmptyProject(
pkgName,
'1.0.0',
registry.port,
registry.getToken(),
registry.getRegistryUrl()
);
// publish 1.0.0
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
// publish 1.1.0
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
// publish 1.2.0
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
// publish 1.3.0
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
// // deprecate all version
await deprecate(tempFolder, pkgName, registry, message);
// verify is deprecated
for (let v of ['1.0.0', '1.1.0', '1.2.0', '1.3.0']) {
const infoResp = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}@${v}`, registry);
expect(infoResp.deprecated).toEqual(message);
}
// publish normal version
// publish 1.4.0
await pnpmUtils.bumbUp(pnpm, tempFolder, registry);
await pnpmUtils.publish(pnpm, tempFolder, pkgName, registry);
const infoResp = await pnpmUtils.getInfoVersions(pnpm, `${pkgName}@1.4.0`, registry);
// must be not deprecated
expect(infoResp.deprecated).toBeUndefined();
}
);

afterAll(async () => {
registry.stop();
});
});
Loading

0 comments on commit 6a6af7c

Please sign in to comment.