diff --git a/packages/cli/src/lib/builder/config.ts b/packages/cli/src/lib/builder/config.ts index 44ccc85824..b899fc98d3 100644 --- a/packages/cli/src/lib/builder/config.ts +++ b/packages/cli/src/lib/builder/config.ts @@ -16,7 +16,7 @@ import chalk from 'chalk'; import fs from 'fs-extra'; -import { relative as relativePath } from 'path'; +import { relative as relativePath, join as joinPath } from 'path'; import peerDepsExternal from 'rollup-plugin-peer-deps-external'; import commonjs from '@rollup/plugin-commonjs'; import resolve from '@rollup/plugin-node-resolve'; @@ -83,13 +83,13 @@ export const makeConfigs = async ( // to be bridge between // frontend- and backend- // plugins' code - const UNIVERSAL_FILE = 'universal.js'; - const universalPath = paths.resolveTarget(UNIVERSAL_FILE); + const UNIVERSAL_FOLDER = 'universal'; + const universalPath = paths.resolveTarget(UNIVERSAL_FOLDER); const universalFileExists = fs.existsSync(universalPath); if (universalFileExists) { - mainFields.push(UNIVERSAL_FILE); - commonjsInclude.push(UNIVERSAL_FILE); + mainFields.push(UNIVERSAL_FOLDER); + commonjsInclude.push(joinPath(UNIVERSAL_FOLDER, '*.js')); } configs.push({ diff --git a/plugins/github-actions/package.json b/plugins/github-actions/package.json index 0000e07d23..c4a6d8cc01 100644 --- a/plugins/github-actions/package.json +++ b/plugins/github-actions/package.json @@ -51,6 +51,6 @@ }, "files": [ "dist", - "universal.js" + "universal" ] } diff --git a/plugins/github-actions/universal.js b/plugins/github-actions/universal/index.js similarity index 87% rename from plugins/github-actions/universal.js rename to plugins/github-actions/universal/index.js index a414b71749..b101b61efc 100644 --- a/plugins/github-actions/universal.js +++ b/plugins/github-actions/universal/index.js @@ -1,3 +1,4 @@ +// @ts-check /* * Copyright 2020 Spotify AB * @@ -14,5 +15,8 @@ * limitations under the License. */ -// This file is shared between frontend and backend plugins +/** + * Annotation to define on the entity to enable the plugin + * @type {string} + */ module.exports.GITHUB_ACTIONS_ANNOTATION = 'github.com/project-slug'; diff --git a/plugins/github-actions/universal/package.json b/plugins/github-actions/universal/package.json new file mode 100644 index 0000000000..df593c690d --- /dev/null +++ b/plugins/github-actions/universal/package.json @@ -0,0 +1,5 @@ +{ + "main": "index.js", + "module": "index.js", + "description": "Provides code that can be shared between frontend- and backend-oriented packages" +}