Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependencies linking #4615

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions tasks/link-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

const fs = require('fs');
const { shellSync: exec } = require('execa');
const { shellSync } = require('execa');
const path = require('path');

const customLinkersMap = {
Expand All @@ -19,7 +19,7 @@ const customLinkersMap = {
'bpmn-io/form-js': linkFormJs
};

const clientDir = path.join(__dirname, '..', 'client');
const builderDir = path.join(__dirname, '..');
const dependenciesDir = path.join(__dirname, '.linked-dependencies');

const dependencies = getDependencies();
Expand Down Expand Up @@ -98,7 +98,7 @@ async function linkDependencies(dependencies) {
* @param {Dependency} dependency
*/
function linkFromGitHub({ repo, ref }) {
exec(`npm i ${repo}#${ref}`, { cwd: clientDir });
exec(`npm i ${repo}#${ref}`, { cwd: builderDir });
}

/**
Expand Down Expand Up @@ -129,7 +129,7 @@ function linkDmnJs({ repo, ref }) {
const dmnJsDir = path.join(rootDir, 'packages', 'dmn-js');
exec('yarn link', { cwd: dmnJsDir });

exec('yarn link dmn-js', { cwd: clientDir });
exec('yarn link dmn-js', { cwd: builderDir });
}

/**
Expand All @@ -154,7 +154,7 @@ function linkWithYarn({ repo, ref }) {
const packageJson = path.join(rootDir, 'package.json');
const packageName = getPackageName(packageJson);

exec(`yarn link ${packageName}`, { cwd: clientDir });
exec(`yarn link ${packageName}`, { cwd: builderDir });

console.log(`Linked ${packageName}.`);
}
Expand Down Expand Up @@ -187,7 +187,7 @@ function linkFormJs({ repo, ref }) {
const formJsDir = path.join(rootDir, 'packages', 'form-js');
exec('yarn link', { cwd: formJsDir });

exec('yarn link @bpmn-io/form-js', { cwd: clientDir });
exec('yarn link @bpmn-io/form-js', { cwd: builderDir });
}

function gitClone(repo, target = toDirName(repo)) {
Expand Down Expand Up @@ -215,3 +215,10 @@ async function del(path) {

return delModule.deleteAsync(path);
}

function exec(...args) {
const { stdout, stderr } = shellSync(...args);

stdout && console.log(stdout);
stderr && console.error(stderr);
}
Loading