mirror of
https://github.com/strapi/strapi.git
synced 2025-06-27 00:41:25 +00:00
chore: use yalc to run e2e tsts
This commit is contained in:
parent
b373446907
commit
efd534b8a8
22
scripts/yalc-link.js
Executable file
22
scripts/yalc-link.js
Executable file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
const { join } = require('path');
|
||||
const { promisify } = require('util');
|
||||
const execa = require('execa');
|
||||
const fs = require('fs-extra');
|
||||
const glob = promisify(require('glob').glob);
|
||||
|
||||
async function run() {
|
||||
const proc = await execa('yarn', ['workspaces', 'list', '--json', '--no-private'], {
|
||||
cwd: join(__dirname, '..'),
|
||||
});
|
||||
|
||||
const packages = proc.stdout
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map((info) => JSON.parse(info).name);
|
||||
|
||||
await execa('npx', ['yalc', 'link', ...packages], { stdio: 'inherit' });
|
||||
}
|
||||
|
||||
run().catch((err) => console.error(err));
|
28
scripts/yalc-publish.js
Executable file
28
scripts/yalc-publish.js
Executable file
@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
const { join } = require('path');
|
||||
const { promisify } = require('util');
|
||||
const execa = require('execa');
|
||||
const fs = require('fs-extra');
|
||||
const glob = promisify(require('glob').glob);
|
||||
|
||||
async function run() {
|
||||
const proc = await execa('yarn', ['workspaces', 'list', '--json', '--no-private'], {
|
||||
cwd: join(__dirname, '..'),
|
||||
});
|
||||
|
||||
const packagesDirs = proc.stdout
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map((info) => JSON.parse(info).location);
|
||||
|
||||
await Promise.all(
|
||||
packagesDirs.map(async (dir) => {
|
||||
await execa('npx', ['yalc', 'publish', '--no-scripts', dir], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
run().catch((err) => console.error(err));
|
@ -61,15 +61,20 @@ const generateTestApp = async ({ appPath, database, template, link = false }) =>
|
||||
|
||||
await generateNew(scope);
|
||||
if (link) {
|
||||
await linkPackages(appPath);
|
||||
await linkPackages(scope);
|
||||
}
|
||||
};
|
||||
|
||||
const linkPackages = async (appPath) => {
|
||||
const rootPath = path.resolve(__dirname, '../..');
|
||||
fs.writeFileSync(path.join(appPath, 'yarn.lock'), '');
|
||||
await execa('yarn', ['link', '-A', rootPath], {
|
||||
cwd: appPath,
|
||||
const linkPackages = async (scope) => {
|
||||
fs.writeFileSync(path.join(scope.rootPath, 'yarn.lock'), '');
|
||||
|
||||
await execa('node', [path.join(__dirname, '../..', 'scripts', 'yalc-link.js')], {
|
||||
cwd: scope.rootPath,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
|
||||
await execa('yarn', ['install'], {
|
||||
cwd: scope.rootPath,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
};
|
||||
|
@ -53,6 +53,13 @@ yargs
|
||||
try {
|
||||
const { concurrency, domains, setup } = argv;
|
||||
|
||||
/**
|
||||
* Publshing all pacakges to the yalc store
|
||||
*/
|
||||
await execa('node', [path.join(__dirname, '../..', 'scripts', 'yalc-publish.js')], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
|
||||
/**
|
||||
* We don't need to spawn more apps than we have domains,
|
||||
* but equally if someone sets the concurrency to 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user