From 9aef8471472c0ec241de3b2d5db75a4386ecd3e9 Mon Sep 17 00:00:00 2001 From: Joost De Cock Date: Fri, 14 Jan 2022 13:08:52 +0100 Subject: [PATCH] chore: Install plugin dev dependencies during workflow This updates the automated generation for github workflows to (also) install the dev dependencies for plugins. This should resolve issues with workflows failing. Or at the very least bring us closer to them working. Shout-out to Jason for the peer pressure :) --- config/templates/workflows/tests.plugin.yml | 2 +- scripts/reconfigure.js | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config/templates/workflows/tests.plugin.yml b/config/templates/workflows/tests.plugin.yml index e9ee88660aa..0364b05fa52 100644 --- a/config/templates/workflows/tests.plugin.yml +++ b/config/templates/workflows/tests.plugin.yml @@ -37,7 +37,7 @@ jobs: env: CI: true - name: Install peer & test dependencies - run: "cd packages/{{ plugin }} && npm install {{{ peerdeps }}} mocha chai" + run: "cd packages/{{ plugin }} && npm install {{{ peerdeps }}} {{{ devdeps }}}" env: CI: true - name: Build plugin diff --git a/scripts/reconfigure.js b/scripts/reconfigure.js index 43f6bd8dc38..06d13ea3084 100644 --- a/scripts/reconfigure.js +++ b/scripts/reconfigure.js @@ -462,6 +462,7 @@ function configurePkgUnitTests(type, pkg, config) { const source = path.join(config.repoPath, 'config', 'templates', 'tests', `${type}s`) // Write templates const peerdeps = peerDependencies(pkg, config, type) + const devdeps = devDependencies(pkg, config, type) const replace = (type === 'pattern') ? { version, @@ -472,9 +473,15 @@ function configurePkgUnitTests(type, pkg, config) { .join(' ') } : { - version, - plugin: pkg, - Plugin: capitalize(pkg), + version, + plugin: pkg, + Plugin: capitalize(pkg), + peerdeps: Object.keys(peerdeps) + .map((dep) => dep + '@' + peerdeps[dep]) + .join(' '), + devdeps: Object.keys(devdeps) + .map((dep) => dep + '@' + devdeps[dep]) + .join(' ') } for (const file of ['shared.test.mjs']) {