mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
e2e: yarn publish (#3393)
* Update audit.spec.ts * Update README.md * chore: e2e yarn refactor * chore: add yarn publish tests * Update e2e-ci.yml * Update e2e-ci.yml * Update e2e-ci.yml * Update e2e-ci.yml
This commit is contained in:
parent
810bf8c40c
commit
2c0d5ceab8
37 changed files with 403 additions and 209 deletions
37
.github/workflows/e2e-ci.yml
vendored
37
.github/workflows/e2e-ci.yml
vendored
|
@ -32,7 +32,7 @@ jobs:
|
|||
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
pnpm-
|
||||
build:
|
||||
|
@ -49,7 +49,7 @@ jobs:
|
|||
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
|
||||
- name: Install
|
||||
run: pnpm recursive install --frozen-lockfile --reporter=silence --registry http://localhost:4873
|
||||
- name: build
|
||||
|
@ -59,18 +59,17 @@ jobs:
|
|||
id: cache-packages
|
||||
with:
|
||||
path: ./packages/
|
||||
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}
|
||||
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
packages-
|
||||
- name: Cache test
|
||||
uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
|
||||
id: cache-test
|
||||
with:
|
||||
path: ./e2e/
|
||||
key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
test-
|
||||
|
||||
# - name: Cache test
|
||||
# uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
|
||||
# id: cache-test
|
||||
# with:
|
||||
# path: ./e2e/
|
||||
# key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
|
||||
# restore-keys: |
|
||||
# test-
|
||||
e2e-cli:
|
||||
needs: [prepare, build]
|
||||
strategy:
|
||||
|
@ -89,16 +88,18 @@ jobs:
|
|||
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
|
||||
- name: Install
|
||||
run: pnpm recursive install --offline --frozen-lockfile --reporter=silence --ignore-scripts --registry http://localhost:4873
|
||||
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
|
||||
with:
|
||||
path: ./packages/
|
||||
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}
|
||||
- uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
|
||||
with:
|
||||
path: ./e2e/
|
||||
key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}
|
||||
key: pkg-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
|
||||
# - uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # tag=v3
|
||||
# with:
|
||||
# path: ./e2e/
|
||||
# key: test-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.run_id }}-${{ github.sha }}
|
||||
- name: build e2e
|
||||
run: pnpm run build --filter=./e2e
|
||||
- name: Test CLI
|
||||
run: NODE_ENV=production pnpm test --filter ...@verdaccio/e2e-cli-${{matrix.pkg}}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
| cmd | npm6 | npm7 | npm8 | npm9 | pnpm6 | pnpm7 | yarn1 | yarn2 | yarn3 | yarn4 |
|
||||
| --------- | ---- | ---- | ---- | ---- | ----- | ----- | ----- | ----- | ----- | ----- |
|
||||
| publish | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
|
||||
| publish | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| info | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| audit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
|
||||
| install | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
|
@ -24,6 +24,7 @@
|
|||
> notes:
|
||||
>
|
||||
> - yarn search cmd exist in _modern_ but, it do not uses the search registry endpoint.
|
||||
> - yarn _modern_ has two info commands, the one used here is `yarn npm info`
|
||||
|
||||
❌ = no tested
|
||||
✅ = tested
|
||||
|
|
|
@ -4,14 +4,16 @@
|
|||
"version": "1.0.1-6-next.5",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"dependencies": {
|
||||
"devDependencies": {
|
||||
"verdaccio": "workspace:6.0.0-6-next.47",
|
||||
"@verdaccio/core": "workspace:6.0.0-6-next.47",
|
||||
"@verdaccio/config": "workspace:6.0.0-6-next.47",
|
||||
"@verdaccio/types": "workspace:11.0.0-6-next.16",
|
||||
"yaml": "2.1.1",
|
||||
"debug": "4.3.4",
|
||||
"fs-extra": "10.1.0",
|
||||
"got": "11.8.5",
|
||||
"lodash": "4.17.21",
|
||||
"verdaccio": "workspace:6.0.0-6-next.47",
|
||||
"@verdaccio/core": "workspace:6.0.0-6-next.47",
|
||||
"@verdaccio/config": "workspace:6.0.0-6-next.47"
|
||||
"lodash": "4.17.21"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
|
|
|
@ -14,3 +14,4 @@ export { exec, ExecOutput } from './process';
|
|||
export { callRegistry } from './web';
|
||||
export * as npmUtils from './npm-utils';
|
||||
export * as pnpmUtils from './npm-utils';
|
||||
export * as yarnModernUtils from './yarn-modern-utils';
|
||||
|
|
|
@ -62,16 +62,12 @@ export async function prepareYarnModernProject(
|
|||
return { tempFolder };
|
||||
}
|
||||
|
||||
export async function prepareGenericEmptyProject(
|
||||
packageName: string,
|
||||
version: string,
|
||||
port: number,
|
||||
token: string,
|
||||
registryDomain: string,
|
||||
export const getPackageJSON = (
|
||||
packageName,
|
||||
version = '1.0.0',
|
||||
dependencies = {},
|
||||
devDependencies = {}
|
||||
) {
|
||||
const getPackageJSON = (packageName, version = '1.0.0') => {
|
||||
) => {
|
||||
const json = {
|
||||
name: packageName,
|
||||
version,
|
||||
|
@ -83,12 +79,13 @@ export async function prepareGenericEmptyProject(
|
|||
dependencies,
|
||||
devDependencies,
|
||||
keywords: ['foo', 'bar'],
|
||||
author: 'Juan Picado <jotadeveloper@gmail.com>',
|
||||
author: 'Yoooooo <jota@some.org>',
|
||||
license: 'MIT',
|
||||
};
|
||||
return JSON.stringify(json);
|
||||
};
|
||||
const getREADME = (packageName) => `
|
||||
|
||||
export const getREADME = (packageName) => `
|
||||
# My README ${packageName}
|
||||
|
||||
some text
|
||||
|
@ -97,10 +94,23 @@ export async function prepareGenericEmptyProject(
|
|||
|
||||
more text
|
||||
`;
|
||||
|
||||
export async function prepareGenericEmptyProject(
|
||||
packageName: string,
|
||||
version: string,
|
||||
port: number,
|
||||
token: string,
|
||||
registryDomain: string,
|
||||
dependencies: any = {},
|
||||
devDependencies: any = {}
|
||||
) {
|
||||
const getNPMrc = (port, token, registry) => `//localhost:${port}/:_authToken=${token}
|
||||
registry=${registry}`;
|
||||
const tempFolder = await createTempFolder('temp-folder');
|
||||
await writeFile(join(tempFolder, 'package.json'), getPackageJSON(packageName, version));
|
||||
await writeFile(
|
||||
join(tempFolder, 'package.json'),
|
||||
getPackageJSON(packageName, version, dependencies, devDependencies)
|
||||
);
|
||||
await writeFile(join(tempFolder, 'README.md'), getREADME(packageName));
|
||||
await writeFile(join(tempFolder, '.npmrc'), getNPMrc(port, token, registryDomain));
|
||||
return { tempFolder };
|
||||
|
|
54
e2e/cli/cli-commons/src/yarn-modern-utils.ts
Normal file
54
e2e/cli/cli-commons/src/yarn-modern-utils.ts
Normal file
|
@ -0,0 +1,54 @@
|
|||
import { cp, writeFile } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
import { URL } from 'url';
|
||||
import YAML from 'yaml';
|
||||
|
||||
import { Dependencies } from '@verdaccio/types';
|
||||
|
||||
import { createTempFolder, getPackageJSON, getREADME } from './utils';
|
||||
|
||||
export function createYamlConfig(registry: string, token?: string) {
|
||||
const defaultYaml: any = {
|
||||
npmRegistryServer: registry,
|
||||
yarnPath: '.yarn/releases/yarn.js',
|
||||
enableImmutableInstalls: false,
|
||||
unsafeHttpWhitelist: ['localhost'],
|
||||
};
|
||||
|
||||
if (typeof token === 'string') {
|
||||
const url = new URL(registry);
|
||||
defaultYaml.npmRegistries = {
|
||||
[`//${url.hostname}:${url.port}`]: {
|
||||
npmAlwaysAuth: true,
|
||||
npmAuthToken: token,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return YAML.stringify(defaultYaml);
|
||||
}
|
||||
|
||||
export async function prepareYarnModernProject(
|
||||
projectName: string,
|
||||
registryDomain: string,
|
||||
yarnBinPath: string,
|
||||
pkgJson: {
|
||||
packageName: string;
|
||||
version: string;
|
||||
dependencies: Dependencies;
|
||||
devDependencies: Dependencies;
|
||||
},
|
||||
token?: string
|
||||
) {
|
||||
const tempFolder = await createTempFolder(projectName);
|
||||
const yamlContent = createYamlConfig(registryDomain, token);
|
||||
await writeFile(join(tempFolder, '.yarnrc.yml'), yamlContent);
|
||||
const { packageName, version, dependencies, devDependencies } = pkgJson;
|
||||
await writeFile(
|
||||
join(tempFolder, 'package.json'),
|
||||
getPackageJSON(packageName, version, dependencies, devDependencies)
|
||||
);
|
||||
await writeFile(join(tempFolder, 'README.md'), getREADME(packageName));
|
||||
await cp(yarnBinPath, join(tempFolder, '.yarn/releases/yarn.js'), { dereference: true });
|
||||
return { tempFolder };
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
import { join } from 'path';
|
||||
|
||||
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
|
||||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
|
@ -13,19 +11,23 @@ describe('audit a package yarn 2', () => {
|
|||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await prepareYarnModernProject(
|
||||
join(__dirname, './yarn-project'),
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand()
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.0.0' },
|
||||
devDependencies: {},
|
||||
}
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
||||
test.skip('should run yarn npm audit info json body', async () => {
|
||||
test('should run yarn npm audit info json body', async () => {
|
||||
await yarn(projectFolder, 'install');
|
||||
const resp = await yarn(projectFolder, 'npm', 'audit', '--json');
|
||||
console.log('--resp********:', resp);
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.advisories).toBeDefined();
|
||||
expect(parsedBody.advisories['1069969']).toBeDefined();
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { join } from 'path';
|
||||
|
||||
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
|
||||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
|
@ -13,11 +11,16 @@ describe('install a package', () => {
|
|||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await prepareYarnModernProject(
|
||||
join(__dirname, './yarn-project'),
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand()
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.6.0' },
|
||||
devDependencies: {},
|
||||
}
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { join } from 'path';
|
||||
|
||||
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
|
||||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
|
@ -13,11 +11,16 @@ describe('install a packages', () => {
|
|||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await prepareYarnModernProject(
|
||||
join(__dirname, './yarn-install'),
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand()
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.6.0' },
|
||||
devDependencies: {},
|
||||
}
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
|
39
e2e/cli/e2e-yarn2/publish.spec.ts
Normal file
39
e2e/cli/e2e-yarn2/publish.spec.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
describe('install a packages', () => {
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
let projectFolder;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.6.0' },
|
||||
devDependencies: {},
|
||||
},
|
||||
registry.getToken()
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
||||
test('should run yarn publish', async () => {
|
||||
const resp = await yarn(projectFolder, 'install');
|
||||
expect(resp.stdout).toMatch(/Completed/);
|
||||
const resp1 = await yarn(projectFolder, 'npm', 'publish');
|
||||
expect(resp1.stdout).toMatch(/Package archive published/);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
httpRetry: 10
|
||||
httpTimeout: 100000
|
||||
npmRegistryServer: ${registry}
|
||||
yarnPath: .yarn/releases/yarn.js
|
||||
# on CI modify the lock file is not allowed
|
||||
# https://github.com/yarnpkg/berry/discussions/3486#discussioncomment-1379344
|
||||
enableImmutableInstalls: false
|
||||
unsafeHttpWhitelist:
|
||||
- localhost
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "foo",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"react": "18.2.0"
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
httpRetry: 10
|
||||
httpTimeout: 100000
|
||||
npmRegistryServer: ${registry}
|
||||
yarnPath: .yarn/releases/yarn.js
|
||||
|
||||
unsafeHttpWhitelist:
|
||||
- localhost
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "foo",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"jquery": "3.0.0"
|
||||
}
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
import { join } from 'path';
|
||||
|
||||
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
|
||||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
|
@ -13,11 +11,16 @@ describe('audit a package yarn 3', () => {
|
|||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await prepareYarnModernProject(
|
||||
join(__dirname, './yarn-project'),
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand()
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.0.0' },
|
||||
devDependencies: {},
|
||||
}
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { join } from 'path';
|
||||
|
||||
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
|
||||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
|
@ -13,17 +11,21 @@ describe('install a package', () => {
|
|||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await prepareYarnModernProject(
|
||||
join(__dirname, './yarn-project'),
|
||||
'yarn-3',
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand()
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.6.0' },
|
||||
devDependencies: {},
|
||||
}
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
||||
test('should run yarn 3 info json body', async () => {
|
||||
await yarn(projectFolder, 'install');
|
||||
test('should run yarn 2 info json body', async () => {
|
||||
const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json');
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual('react');
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { join } from 'path';
|
||||
|
||||
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
|
||||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
|
@ -13,11 +11,16 @@ describe('install a packages', () => {
|
|||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await prepareYarnModernProject(
|
||||
join(__dirname, './yarn-install'),
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand()
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.6.0' },
|
||||
devDependencies: {},
|
||||
}
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
|
39
e2e/cli/e2e-yarn3/publish.spec.ts
Normal file
39
e2e/cli/e2e-yarn3/publish.spec.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
describe('install a packages', () => {
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
let projectFolder;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.6.0' },
|
||||
devDependencies: {},
|
||||
},
|
||||
registry.getToken()
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
||||
test('should run yarn publish', async () => {
|
||||
const resp = await yarn(projectFolder, 'install');
|
||||
expect(resp.stdout).toMatch(/Completed/);
|
||||
const resp1 = await yarn(projectFolder, 'npm', 'publish');
|
||||
expect(resp1.stdout).toMatch(/Package archive published/);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
httpRetry: 10
|
||||
httpTimeout: 100000
|
||||
npmRegistryServer: ${registry}
|
||||
yarnPath: .yarn/releases/yarn.js
|
||||
# on CI modify the lock file is not allowed
|
||||
# https://github.com/yarnpkg/berry/discussions/3486#discussioncomment-1379344
|
||||
enableImmutableInstalls: false
|
||||
unsafeHttpWhitelist:
|
||||
- localhost
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "foo",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"react": "18.2.0"
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
httpRetry: 10
|
||||
httpTimeout: 100000
|
||||
npmRegistryServer: ${registry}
|
||||
yarnPath: .yarn/releases/yarn.js
|
||||
# on CI modify the lock file is not allowed
|
||||
# https://github.com/yarnpkg/berry/discussions/3486#discussioncomment-1379344
|
||||
enableImmutableInstalls: false
|
||||
unsafeHttpWhitelist:
|
||||
- localhost
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "foo",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"jquery": "3.0.0"
|
||||
}
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
import { join } from 'path';
|
||||
|
||||
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
|
||||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
describe('install a package', () => {
|
||||
jest.setTimeout(10000);
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
let projectFolder;
|
||||
|
||||
|
@ -13,16 +11,21 @@ describe('install a package', () => {
|
|||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await prepareYarnModernProject(
|
||||
join(__dirname, './yarn-project'),
|
||||
'yarn-4',
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand()
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.6.0' },
|
||||
devDependencies: {},
|
||||
}
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
||||
test('should run yarn 4 info json body', async () => {
|
||||
test('should run yarn 2 info json body', async () => {
|
||||
const resp = await yarn(projectFolder, 'npm', 'info', 'react', '--json');
|
||||
const parsedBody = JSON.parse(resp.stdout as string);
|
||||
expect(parsedBody.name).toEqual('react');
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { join } from 'path';
|
||||
|
||||
import { initialSetup, prepareYarnModernProject } from '@verdaccio/test-cli-commons';
|
||||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
|
@ -13,11 +11,16 @@ describe('install a packages', () => {
|
|||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await prepareYarnModernProject(
|
||||
join(__dirname, './yarn-install'),
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand()
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.6.0' },
|
||||
devDependencies: {},
|
||||
}
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
|
39
e2e/cli/e2e-yarn4/publish.spec.ts
Normal file
39
e2e/cli/e2e-yarn4/publish.spec.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { initialSetup, yarnModernUtils } from '@verdaccio/test-cli-commons';
|
||||
|
||||
import { getYarnCommand, yarn } from './utils';
|
||||
|
||||
describe('install a packages', () => {
|
||||
jest.setTimeout(20000);
|
||||
let registry;
|
||||
let projectFolder;
|
||||
|
||||
beforeAll(async () => {
|
||||
const setup = await initialSetup();
|
||||
registry = setup.registry;
|
||||
await registry.init();
|
||||
const { tempFolder } = await yarnModernUtils.prepareYarnModernProject(
|
||||
'yarn-2',
|
||||
registry.getRegistryUrl(),
|
||||
getYarnCommand(),
|
||||
{
|
||||
packageName: '@scope/name',
|
||||
version: '1.0.0',
|
||||
dependencies: { jquery: '3.6.0' },
|
||||
devDependencies: {},
|
||||
},
|
||||
registry.getToken()
|
||||
);
|
||||
projectFolder = tempFolder;
|
||||
});
|
||||
|
||||
test('should run yarn publish', async () => {
|
||||
const resp = await yarn(projectFolder, 'install');
|
||||
expect(resp.stdout).toMatch(/Completed/);
|
||||
const resp1 = await yarn(projectFolder, 'npm', 'publish');
|
||||
expect(resp1.stdout).toMatch(/Package archive published/);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
registry.stop();
|
||||
});
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
httpRetry: 10
|
||||
httpTimeout: 100000
|
||||
npmRegistryServer: ${registry}
|
||||
yarnPath: .yarn/releases/yarn.js
|
||||
# on CI modify the lock file is not allowed
|
||||
# https://github.com/yarnpkg/berry/discussions/3486#discussioncomment-1379344
|
||||
enableImmutableInstalls: false
|
||||
unsafeHttpWhitelist:
|
||||
- localhost
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "foo",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"react": "18.2.0"
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
httpRetry: 10
|
||||
httpTimeout: 100000
|
||||
npmRegistryServer: ${registry}
|
||||
yarnPath: .yarn/releases/yarn.js
|
||||
|
||||
unsafeHttpWhitelist:
|
||||
- localhost
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "foo",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"jquery": "3.0.0"
|
||||
}
|
||||
}
|
|
@ -192,19 +192,23 @@ importers:
|
|||
specifiers:
|
||||
'@verdaccio/config': workspace:6.0.0-6-next.47
|
||||
'@verdaccio/core': workspace:6.0.0-6-next.47
|
||||
'@verdaccio/types': workspace:11.0.0-6-next.16
|
||||
debug: 4.3.4
|
||||
fs-extra: 10.1.0
|
||||
got: 11.8.5
|
||||
lodash: 4.17.21
|
||||
verdaccio: workspace:6.0.0-6-next.47
|
||||
dependencies:
|
||||
yaml: 2.1.1
|
||||
devDependencies:
|
||||
'@verdaccio/config': link:../../../packages/config
|
||||
'@verdaccio/core': link:../../../packages/core/core
|
||||
'@verdaccio/types': link:../../../packages/core/types
|
||||
debug: 4.3.4
|
||||
fs-extra: 10.1.0
|
||||
got: 11.8.5
|
||||
lodash: 4.17.21
|
||||
verdaccio: link:../../../packages/verdaccio
|
||||
yaml: 2.1.1
|
||||
|
||||
e2e/cli/e2e-npm6:
|
||||
specifiers:
|
||||
|
@ -906,7 +910,7 @@ importers:
|
|||
react-i18next: 11.18.6_ad209b3ec0793904285d43906e66750b
|
||||
react-json-view: 1.21.3_3a28dae5d20d968467088dcb8f1d3843
|
||||
react-markdown: 8.0.3_7df2e632d193aca1f14601bd0dc974c3
|
||||
react-redux: 7.2.9_react@17.0.2
|
||||
react-redux: 7.2.9_react-dom@17.0.2+react@17.0.2
|
||||
react-router: 5.3.3_react@17.0.2
|
||||
react-router-dom: 5.3.3_react@17.0.2
|
||||
react-virtualized: 9.22.3_react-dom@17.0.2+react@17.0.2
|
||||
|
@ -7648,6 +7652,9 @@ packages:
|
|||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
react-dom: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@emotion/is-prop-valid': 1.2.0
|
||||
|
@ -7669,6 +7676,9 @@ packages:
|
|||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
react-dom: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@emotion/is-prop-valid': 1.2.0
|
||||
|
@ -7692,6 +7702,9 @@ packages:
|
|||
'@mui/material': ^5.0.0
|
||||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@mui/material': 5.10.6_17a1432779ecebed8795c1bcaeaaf2fe
|
||||
|
@ -7706,6 +7719,9 @@ packages:
|
|||
'@mui/material': ^5.0.0
|
||||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@mui/material': 5.10.6_react-dom@17.0.2+react@17.0.2
|
||||
|
@ -7721,6 +7737,13 @@ packages:
|
|||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
react-dom: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@emotion/react':
|
||||
optional: true
|
||||
'@emotion/styled':
|
||||
optional: true
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@emotion/react': 11.10.4_934231c287e6ee895010b95c7785347a
|
||||
|
@ -7750,6 +7773,13 @@ packages:
|
|||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
react-dom: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@emotion/react':
|
||||
optional: true
|
||||
'@emotion/styled':
|
||||
optional: true
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@mui/base': 5.0.0-alpha.98_react-dom@17.0.2+react@17.0.2
|
||||
|
@ -7773,6 +7803,9 @@ packages:
|
|||
peerDependencies:
|
||||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@mui/utils': 5.10.6_react@17.0.2
|
||||
|
@ -7787,6 +7820,9 @@ packages:
|
|||
peerDependencies:
|
||||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@mui/utils': 5.10.6_react@17.0.2
|
||||
|
@ -7801,6 +7837,11 @@ packages:
|
|||
'@emotion/react': ^11.4.1
|
||||
'@emotion/styled': ^11.3.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@emotion/react':
|
||||
optional: true
|
||||
'@emotion/styled':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@emotion/cache': 11.10.3
|
||||
|
@ -7818,6 +7859,11 @@ packages:
|
|||
'@emotion/react': ^11.4.1
|
||||
'@emotion/styled': ^11.3.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@emotion/react':
|
||||
optional: true
|
||||
'@emotion/styled':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@emotion/cache': 11.10.3
|
||||
|
@ -7832,6 +7878,9 @@ packages:
|
|||
peerDependencies:
|
||||
'@types/react': ^17.0.0
|
||||
react: ^17.0.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@emotion/hash': 0.9.0
|
||||
|
@ -7860,6 +7909,9 @@ packages:
|
|||
peerDependencies:
|
||||
'@types/react': ^17.0.0
|
||||
react: ^17.0.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@emotion/hash': 0.9.0
|
||||
|
@ -7889,6 +7941,13 @@ packages:
|
|||
'@emotion/styled': ^11.3.0
|
||||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@emotion/react':
|
||||
optional: true
|
||||
'@emotion/styled':
|
||||
optional: true
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@emotion/react': 11.10.4_934231c287e6ee895010b95c7785347a
|
||||
|
@ -7912,6 +7971,13 @@ packages:
|
|||
'@emotion/styled': ^11.3.0
|
||||
'@types/react': ^17.0.0 || ^18.0.0
|
||||
react: ^17.0.0 || ^18.0.0
|
||||
peerDependenciesMeta:
|
||||
'@emotion/react':
|
||||
optional: true
|
||||
'@emotion/styled':
|
||||
optional: true
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@mui/private-theming': 5.10.6_react@17.0.2
|
||||
|
@ -7928,12 +7994,18 @@ packages:
|
|||
resolution: {integrity: sha512-lGXtFKe5lp3UxTBGqKI1l7G8sE2xBik8qCfrLHD5olwP/YU0/ReWoWT7Lp1//ri32dK39oPMrJN8TgbkCSbsNA==}
|
||||
peerDependencies:
|
||||
'@types/react': '*'
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dev: false
|
||||
|
||||
/@mui/types/7.2.0_@types+react@17.0.50:
|
||||
resolution: {integrity: sha512-lGXtFKe5lp3UxTBGqKI1l7G8sE2xBik8qCfrLHD5olwP/YU0/ReWoWT7Lp1//ri32dK39oPMrJN8TgbkCSbsNA==}
|
||||
peerDependencies:
|
||||
'@types/react': '*'
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@types/react': 17.0.50
|
||||
dev: true
|
||||
|
@ -9810,6 +9882,9 @@ packages:
|
|||
|
||||
/ajv-formats/2.1.1:
|
||||
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
|
||||
peerDependenciesMeta:
|
||||
ajv:
|
||||
optional: true
|
||||
dependencies:
|
||||
ajv: 8.11.0
|
||||
|
||||
|
@ -18007,6 +18082,9 @@ packages:
|
|||
requiresBuild: true
|
||||
peerDependencies:
|
||||
typescript: '>= 4.2.x <= 4.8.x'
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@mswjs/cookies': 0.2.2
|
||||
'@mswjs/interceptors': 0.17.5
|
||||
|
@ -20705,10 +20783,17 @@ packages:
|
|||
react-fast-compare: 3.2.0
|
||||
dev: false
|
||||
|
||||
/react-redux/7.2.9_react@17.0.2:
|
||||
/react-redux/7.2.9_react-dom@17.0.2+react@17.0.2:
|
||||
resolution: {integrity: sha512-Gx4L3uM182jEEayZfRbI/G11ZpYdNAnBs70lFVMNdHJI76XYtR+7m0MN+eAs7UHBPhWXcnFPaS+9owSCJQHNpQ==}
|
||||
peerDependencies:
|
||||
react: ^16.8.3 || ^17 || ^18
|
||||
react-dom: '*'
|
||||
react-native: '*'
|
||||
peerDependenciesMeta:
|
||||
react-dom:
|
||||
optional: true
|
||||
react-native:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.19.0
|
||||
'@types/react-redux': 7.1.20
|
||||
|
@ -20716,6 +20801,7 @@ packages:
|
|||
loose-envify: 1.4.0
|
||||
prop-types: 15.8.1
|
||||
react: 17.0.2
|
||||
react-dom: 17.0.2_react@17.0.2
|
||||
react-is: 17.0.2
|
||||
dev: true
|
||||
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
{
|
||||
"extends": ["config:base", "schedule:earlyMondays", "helpers:pinGitHubActionDigests"],
|
||||
"prConcurrentLimit": 1,
|
||||
"ignorePaths": [
|
||||
"docker-examples/**",
|
||||
"e2e/cli/e2e-yarn2/yarn-project/**",
|
||||
"e2e/cli/e2e-yarn3/yarn-project/**",
|
||||
"e2e/cli/e2e-yarn4/yarn-project/**",
|
||||
"e2e/cli/e2e-yarn2/yarn-install/**",
|
||||
"e2e/cli/e2e-yarn3/yarn-install/**",
|
||||
"e2e/cli/e2e-yarn4/yarn-install/**"
|
||||
],
|
||||
"ignorePaths": ["docker-examples/**"],
|
||||
"ignoreDeps": [
|
||||
"eslint-plugin-verdaccio",
|
||||
"@verdaccio/test-helper",
|
||||
|
|
Loading…
Reference in a new issue