From 37da165e7088fa54e1587e3f15b1f96a37d6de87 Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Tue, 29 Sep 2020 12:39:14 +0200 Subject: [PATCH 01/13] feat: universal file for github-actions --- packages/cli/src/lib/builder/config.ts | 17 ++++++++++++++++- plugins/github-actions/package.json | 3 ++- .../src/components/Cards/Cards.tsx | 2 +- .../github-actions/src/components/Router.tsx | 2 +- .../src/components/useProjectName.ts | 3 +-- plugins/github-actions/src/index.ts | 1 - plugins/github-actions/universal.js | 18 ++++++++++++++++++ .../scaffolder/stages/templater/cra/index.ts | 3 ++- 8 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 plugins/github-actions/universal.js diff --git a/packages/cli/src/lib/builder/config.ts b/packages/cli/src/lib/builder/config.ts index afcedaae59..44ccc85824 100644 --- a/packages/cli/src/lib/builder/config.ts +++ b/packages/cli/src/lib/builder/config.ts @@ -77,6 +77,21 @@ export const makeConfigs = async ( mainFields.unshift('browser'); } + const commonjsInclude: Array = [/node_modules/]; + + // Purpose of this file is + // to be bridge between + // frontend- and backend- + // plugins' code + const UNIVERSAL_FILE = 'universal.js'; + const universalPath = paths.resolveTarget(UNIVERSAL_FILE); + const universalFileExists = fs.existsSync(universalPath); + + if (universalFileExists) { + mainFields.push(UNIVERSAL_FILE); + commonjsInclude.push(UNIVERSAL_FILE); + } + configs.push({ input: 'src/index.ts', output, @@ -88,7 +103,7 @@ export const makeConfigs = async ( }), resolve({ mainFields }), commonjs({ - include: /node_modules/, + include: commonjsInclude, exclude: [/\/[^/]+\.(?:stories|test)\.[^/]+$/], }), postcss(), diff --git a/plugins/github-actions/package.json b/plugins/github-actions/package.json index 9d1538ce99..0000e07d23 100644 --- a/plugins/github-actions/package.json +++ b/plugins/github-actions/package.json @@ -50,6 +50,7 @@ "jest-fetch-mock": "^3.0.3" }, "files": [ - "dist" + "dist", + "universal.js" ] } diff --git a/plugins/github-actions/src/components/Cards/Cards.tsx b/plugins/github-actions/src/components/Cards/Cards.tsx index 28783efdea..f963be7569 100644 --- a/plugins/github-actions/src/components/Cards/Cards.tsx +++ b/plugins/github-actions/src/components/Cards/Cards.tsx @@ -32,7 +32,7 @@ import { useApi, } from '@backstage/core'; import ExternalLinkIcon from '@material-ui/icons/Launch'; -import { GITHUB_ACTIONS_ANNOTATION } from '../useProjectName'; +import { GITHUB_ACTIONS_ANNOTATION } from '../../../universal'; const useStyles = makeStyles({ externalLinkIcon: { diff --git a/plugins/github-actions/src/components/Router.tsx b/plugins/github-actions/src/components/Router.tsx index 7d340fb8b8..8314981ed6 100644 --- a/plugins/github-actions/src/components/Router.tsx +++ b/plugins/github-actions/src/components/Router.tsx @@ -19,7 +19,7 @@ import { Routes, Route } from 'react-router'; import { rootRouteRef, buildRouteRef } from '../plugin'; import { WorkflowRunDetails } from './WorkflowRunDetails'; import { WorkflowRunsTable } from './WorkflowRunsTable'; -import { GITHUB_ACTIONS_ANNOTATION } from './useProjectName'; +import { GITHUB_ACTIONS_ANNOTATION } from '../../universal'; import { WarningPanel } from '@backstage/core'; export const isPluginApplicableToEntity = (entity: Entity) => diff --git a/plugins/github-actions/src/components/useProjectName.ts b/plugins/github-actions/src/components/useProjectName.ts index ec7158bd27..226cc6c775 100644 --- a/plugins/github-actions/src/components/useProjectName.ts +++ b/plugins/github-actions/src/components/useProjectName.ts @@ -16,8 +16,7 @@ import { useAsync } from 'react-use'; import { Entity } from '@backstage/catalog-model'; - -export const GITHUB_ACTIONS_ANNOTATION = 'github.com/project-slug'; +import { GITHUB_ACTIONS_ANNOTATION } from '../../universal'; export const useProjectName = (entity: Entity) => { const { value, loading, error } = useAsync(async () => { diff --git a/plugins/github-actions/src/index.ts b/plugins/github-actions/src/index.ts index 24fe6fc90d..5c89c7f920 100644 --- a/plugins/github-actions/src/index.ts +++ b/plugins/github-actions/src/index.ts @@ -18,4 +18,3 @@ export { plugin } from './plugin'; export * from './api'; export { Router, isPluginApplicableToEntity } from './components/Router'; export * from './components/Cards'; -export { GITHUB_ACTIONS_ANNOTATION } from './components/useProjectName'; diff --git a/plugins/github-actions/universal.js b/plugins/github-actions/universal.js new file mode 100644 index 0000000000..a414b71749 --- /dev/null +++ b/plugins/github-actions/universal.js @@ -0,0 +1,18 @@ +/* + * Copyright 2020 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is shared between frontend and backend plugins +module.exports.GITHUB_ACTIONS_ANNOTATION = 'github.com/project-slug'; diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/cra/index.ts b/plugins/scaffolder-backend/src/scaffolder/stages/templater/cra/index.ts index e771ada8c3..61a7064dc0 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/templater/cra/index.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/templater/cra/index.ts @@ -19,7 +19,8 @@ import { TemplaterBase, TemplaterRunOptions } from '..'; import path from 'path'; import { TemplaterRunResult } from '../types'; import * as yaml from 'yaml'; -import { GITHUB_ACTIONS_ANNOTATION } from '@backstage/plugin-github-actions'; +// eslint-disable-next-line monorepo/no-internal-import +import { GITHUB_ACTIONS_ANNOTATION } from '@backstage/plugin-github-actions/universal'; export class CreateReactAppTemplater implements TemplaterBase { public async run(options: TemplaterRunOptions): Promise { From e3bb82deab77f656c935e234d0fa2c2e148a76fa Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Wed, 7 Oct 2020 16:29:32 +0200 Subject: [PATCH 02/13] refactor: universal folder, package.json --- packages/cli/src/lib/builder/config.ts | 10 +++++----- plugins/github-actions/package.json | 2 +- .../{universal.js => universal/index.js} | 6 +++++- plugins/github-actions/universal/package.json | 5 +++++ 4 files changed, 16 insertions(+), 7 deletions(-) rename plugins/github-actions/{universal.js => universal/index.js} (87%) create mode 100644 plugins/github-actions/universal/package.json 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" +} From 7b9abc0a10fa07cb482d1bbec3d085483c5e4dcb Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Wed, 7 Oct 2020 17:01:44 +0200 Subject: [PATCH 03/13] fix: import --- .../src/components/Cards/RecentWorkflowRunsCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx index e5bba7fad9..aa1fecba7d 100644 --- a/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx +++ b/plugins/github-actions/src/components/Cards/RecentWorkflowRunsCard.tsx @@ -15,7 +15,7 @@ */ import { Entity } from '@backstage/catalog-model'; import { errorApiRef, useApi } from '@backstage/core-api'; -import { GITHUB_ACTIONS_ANNOTATION } from '../useProjectName'; +import { GITHUB_ACTIONS_ANNOTATION } from '../../../universal'; import { useWorkflowRuns } from '../useWorkflowRuns'; import React, { useEffect } from 'react'; import { EmptyState, Table } from '@backstage/core'; From 9c3a03d20d45142bed11c126b744b971793400e9 Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Wed, 7 Oct 2020 17:13:32 +0200 Subject: [PATCH 04/13] fix: eslint --- .../scaffolder/src/components/JobStatusModal/JobStatusModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/scaffolder/src/components/JobStatusModal/JobStatusModal.tsx b/plugins/scaffolder/src/components/JobStatusModal/JobStatusModal.tsx index 6561e5153d..33fdb73b2e 100644 --- a/plugins/scaffolder/src/components/JobStatusModal/JobStatusModal.tsx +++ b/plugins/scaffolder/src/components/JobStatusModal/JobStatusModal.tsx @@ -53,7 +53,7 @@ export const JobStatusModal = ({ onComplete(job!); } else if (jobStatus === 'FAILED') setDialogTitle('Failed to create component'); - }, [jobStatus, onComplete, setDialogTitle]); + }, [jobStatus, onComplete, setDialogTitle]); // eslint-disable-line react-hooks/exhaustive-deps return ( From b314109c83bb4e6e0e33442c8ba564c57eb5f61e Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 28 Oct 2020 09:10:48 +0100 Subject: [PATCH 05/13] chore(lint): update to use the latest monorepo plugin --- packages/cli/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index c336684ba5..c855d86e04 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -58,7 +58,7 @@ "eslint": "^7.1.0", "eslint-formatter-friendly": "^7.0.0", "eslint-plugin-import": "^2.20.2", - "eslint-plugin-monorepo": "^0.2.1", + "eslint-plugin-monorepo": "^0.3.0", "fork-ts-checker-webpack-plugin": "^4.0.5", "fs-extra": "^9.0.0", "handlebars": "^4.7.3", diff --git a/yarn.lock b/yarn.lock index 9d7c53fb8c..3210ca0a83 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10784,10 +10784,10 @@ eslint-plugin-jsx-a11y@^6.2.1: has "^1.0.3" jsx-ast-utils "^2.2.1" -eslint-plugin-monorepo@^0.2.1: - version "0.2.1" - resolved "https://registry.npmjs.org/eslint-plugin-monorepo/-/eslint-plugin-monorepo-0.2.1.tgz#96cfc4af241077675f40d7017377897fb8ea537b" - integrity sha512-82JaAjuajVAsDT+pMvdt275H6F55H3MEofaMZbJurGqfXpPDT4eayTgYyyjfd1XR8VD1S+ORbuHCULnSqNyD9g== +eslint-plugin-monorepo@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/eslint-plugin-monorepo/-/eslint-plugin-monorepo-0.3.0.tgz#8bfab30713fbc543cb7bffae651ab37bf601a3b3" + integrity sha512-pg1Q37BSDDFh7XdKIsCAi+6/XtE/Kyltu6KokFRFsDe1vOa/R6+O9OVLmav012bBDPrChw8QzBDE7pvADg9+Jg== dependencies: eslint-module-utils "^2.1.1" get-monorepo-packages "^1.1.0" From 002e0eb1ef7a0ef4190e15bbc7d0976f6326833a Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 28 Oct 2020 09:36:18 +0100 Subject: [PATCH 06/13] chore(lint): bump again as there was a problem --- packages/cli/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index c855d86e04..f6b4ff20fc 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -58,7 +58,7 @@ "eslint": "^7.1.0", "eslint-formatter-friendly": "^7.0.0", "eslint-plugin-import": "^2.20.2", - "eslint-plugin-monorepo": "^0.3.0", + "eslint-plugin-monorepo": "^0.3.1", "fork-ts-checker-webpack-plugin": "^4.0.5", "fs-extra": "^9.0.0", "handlebars": "^4.7.3", diff --git a/yarn.lock b/yarn.lock index 3210ca0a83..18b0d93a2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10784,10 +10784,10 @@ eslint-plugin-jsx-a11y@^6.2.1: has "^1.0.3" jsx-ast-utils "^2.2.1" -eslint-plugin-monorepo@^0.3.0: - version "0.3.0" - resolved "https://registry.npmjs.org/eslint-plugin-monorepo/-/eslint-plugin-monorepo-0.3.0.tgz#8bfab30713fbc543cb7bffae651ab37bf601a3b3" - integrity sha512-pg1Q37BSDDFh7XdKIsCAi+6/XtE/Kyltu6KokFRFsDe1vOa/R6+O9OVLmav012bBDPrChw8QzBDE7pvADg9+Jg== +eslint-plugin-monorepo@^0.3.1: + version "0.3.1" + resolved "https://registry.npmjs.org/eslint-plugin-monorepo/-/eslint-plugin-monorepo-0.3.1.tgz#698a74b3ef2a3481faaefab6219184429a57e01e" + integrity sha512-Oz91zASwmNapr5IHP9MYh4mEmkb5ZQJ1XxXU6KFY5eLxD1+V+J4B+yYDiILkaQCf5Itz4LKgnCoiB59lD/X29A== dependencies: eslint-module-utils "^2.1.1" get-monorepo-packages "^1.1.0" From 41ed522afbb4bab16dd5c5a768d950b195f1d525 Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Wed, 28 Oct 2020 10:00:04 +0100 Subject: [PATCH 07/13] chore: bump eslint-plugin-monorepo --- packages/cli/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 8a330d861b..8aceb440d0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -65,7 +65,7 @@ "eslint-plugin-import": "^2.20.2", "eslint-plugin-jest": "^24.1.0", "eslint-plugin-jsx-a11y": "^6.2.1", - "eslint-plugin-monorepo": "^0.2.1", + "eslint-plugin-monorepo": "^0.3.1", "eslint-plugin-react": "^7.12.4", "eslint-plugin-react-hooks": "^4.0.0", "fork-ts-checker-webpack-plugin": "^4.0.5", diff --git a/yarn.lock b/yarn.lock index ef52ed9918..9bc6cf9efa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10912,10 +10912,10 @@ eslint-plugin-jsx-a11y@^6.2.1: has "^1.0.3" jsx-ast-utils "^2.2.1" -eslint-plugin-monorepo@^0.2.1: - version "0.2.1" - resolved "https://registry.npmjs.org/eslint-plugin-monorepo/-/eslint-plugin-monorepo-0.2.1.tgz#96cfc4af241077675f40d7017377897fb8ea537b" - integrity sha512-82JaAjuajVAsDT+pMvdt275H6F55H3MEofaMZbJurGqfXpPDT4eayTgYyyjfd1XR8VD1S+ORbuHCULnSqNyD9g== +eslint-plugin-monorepo@^0.3.1: + version "0.3.1" + resolved "https://registry.npmjs.org/eslint-plugin-monorepo/-/eslint-plugin-monorepo-0.3.1.tgz#698a74b3ef2a3481faaefab6219184429a57e01e" + integrity sha512-Oz91zASwmNapr5IHP9MYh4mEmkb5ZQJ1XxXU6KFY5eLxD1+V+J4B+yYDiILkaQCf5Itz4LKgnCoiB59lD/X29A== dependencies: eslint-module-utils "^2.1.1" get-monorepo-packages "^1.1.0" From 2ceb961f4ee5d40625881ca621e03a8a47b9b7aa Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Wed, 28 Oct 2020 10:08:01 +0100 Subject: [PATCH 08/13] chore: merge upstream --- packages/cli/package.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index de447b27b5..8aceb440d0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -38,11 +38,7 @@ "@rollup/plugin-json": "^4.0.2", "@rollup/plugin-node-resolve": "^9.0.0", "@rollup/plugin-yaml": "^2.1.1", -<<<<<<< HEAD - "@spotify/eslint-config-base": "^9.0.0", -======= "@spotify/eslint-config-base": "^8.0.0", ->>>>>>> 88203b2fdd686da88b4d9f5ebe3564be90bcdd37 "@spotify/eslint-config-react": "^8.0.0", "@spotify/eslint-config-typescript": "^8.0.0", "@sucrase/webpack-loader": "^2.0.0", @@ -67,15 +63,11 @@ "eslint-config-prettier": "^6.0.0", "eslint-formatter-friendly": "^7.0.0", "eslint-plugin-import": "^2.20.2", -<<<<<<< HEAD "eslint-plugin-jest": "^24.1.0", "eslint-plugin-jsx-a11y": "^6.2.1", "eslint-plugin-monorepo": "^0.3.1", "eslint-plugin-react": "^7.12.4", "eslint-plugin-react-hooks": "^4.0.0", -======= - "eslint-plugin-monorepo": "^0.3.1", ->>>>>>> 88203b2fdd686da88b4d9f5ebe3564be90bcdd37 "fork-ts-checker-webpack-plugin": "^4.0.5", "fs-extra": "^9.0.0", "handlebars": "^4.7.3", From a569f36ce8cd04b21d8164f7dd797df5263d3191 Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Wed, 28 Oct 2020 10:47:38 +0100 Subject: [PATCH 09/13] refactor: remove eslint-disable monorepo/internal-import --- packages/app/src/index.tsx | 3 +-- .../github-actions/{universal/index.js => universal.js} | 0 plugins/github-actions/universal/package.json | 5 ----- .../src/scaffolder/stages/templater/cra/index.ts | 6 ++++-- yarn.lock | 7 ------- 5 files changed, 5 insertions(+), 16 deletions(-) rename plugins/github-actions/{universal/index.js => universal.js} (100%) delete mode 100644 plugins/github-actions/universal/package.json diff --git a/packages/app/src/index.tsx b/packages/app/src/index.tsx index a38159a258..ed1637d2c2 100644 --- a/packages/app/src/index.tsx +++ b/packages/app/src/index.tsx @@ -14,8 +14,7 @@ * limitations under the License. */ -// eslint-disable-next-line monorepo/no-internal-import -import '@backstage/cli/asset-types'; +import '@backstage/cli/asset-types/asset-types'; import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; diff --git a/plugins/github-actions/universal/index.js b/plugins/github-actions/universal.js similarity index 100% rename from plugins/github-actions/universal/index.js rename to plugins/github-actions/universal.js diff --git a/plugins/github-actions/universal/package.json b/plugins/github-actions/universal/package.json deleted file mode 100644 index df593c690d..0000000000 --- a/plugins/github-actions/universal/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "main": "index.js", - "module": "index.js", - "description": "Provides code that can be shared between frontend- and backend-oriented packages" -} diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/templater/cra/index.ts b/plugins/scaffolder-backend/src/scaffolder/stages/templater/cra/index.ts index 61a7064dc0..7d27688c0b 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/templater/cra/index.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/templater/cra/index.ts @@ -19,8 +19,8 @@ import { TemplaterBase, TemplaterRunOptions } from '..'; import path from 'path'; import { TemplaterRunResult } from '../types'; import * as yaml from 'yaml'; -// eslint-disable-next-line monorepo/no-internal-import import { GITHUB_ACTIONS_ANNOTATION } from '@backstage/plugin-github-actions/universal'; +import { resolvePackagePath } from '@backstage/backend-common'; export class CreateReactAppTemplater implements TemplaterBase { public async run(options: TemplaterRunOptions): Promise { @@ -61,7 +61,9 @@ export class CreateReactAppTemplater implements TemplaterBase { await fs.promises.mkdir(`${finalDir}/.github`); await fs.promises.mkdir(`${finalDir}/.github/workflows`); await fs.promises.copyFile( - `${__dirname}/templates/.github/workflows/main.yml`, + `${resolvePackagePath( + '@backstage/plugin-scaffolder-backend', + )}/templates/.github/workflows/main.yml`, `${finalDir}/.github/workflows/main.yml`, ); diff --git a/yarn.lock b/yarn.lock index c31e12127d..9bc6cf9efa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3801,17 +3801,10 @@ dependencies: "@sinonjs/commons" "^1.7.0" -<<<<<<< HEAD -"@spotify/eslint-config-base@^8.1.0": - version "9.0.0" - resolved "https://registry.npmjs.org/@spotify/eslint-config-base/-/eslint-config-base-9.0.0.tgz#e122b2e6d1a11750170badc5be6774ded95953d2" - integrity sha512-LNGY6bBM0IlosvMIx9Ic5gqatpa5LPvrJhN4RnrUnP9oaXNLgPTKDE89p3eC5Tnh78ADdX4HD+rbHDSyP2tBgg== -======= "@spotify/eslint-config-base@^8.0.0": version "8.0.0" resolved "https://registry.npmjs.org/@spotify/eslint-config-base/-/eslint-config-base-8.0.0.tgz#c3d10d8a05ad9129d579952cb80063e4c4fa216e" integrity sha512-07Fo+KoTMl4AaZJPD6deFnYmG634wzgeqfFcWdFlIrOLAasvWSH8Lp6ZE9cJBKuffOAy8kuEE1SwFo34+5X8bQ== ->>>>>>> 88203b2fdd686da88b4d9f5ebe3564be90bcdd37 "@spotify/eslint-config-oss@^1.0.1": version "1.0.2" From fcee31f99a9bec113da137205e63de427a3e4100 Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Wed, 28 Oct 2020 11:18:57 +0100 Subject: [PATCH 10/13] fix: universal folder -> universal file --- packages/cli/src/lib/builder/config.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/lib/builder/config.ts b/packages/cli/src/lib/builder/config.ts index c305d248be..60b8ad20ba 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, join as joinPath } from 'path'; +import { relative as relativePath } from 'path'; import peerDepsExternal from 'rollup-plugin-peer-deps-external'; import commonjs from '@rollup/plugin-commonjs'; import resolve from '@rollup/plugin-node-resolve'; @@ -85,13 +85,13 @@ export const makeConfigs = async ( // to be bridge between // frontend- and backend- // plugins' code - const UNIVERSAL_FOLDER = 'universal'; - const universalPath = paths.resolveTarget(UNIVERSAL_FOLDER); + const UNIVERSAL_FILE = 'universal.js'; + const universalPath = paths.resolveTarget(UNIVERSAL_FILE); const universalFileExists = fs.existsSync(universalPath); if (universalFileExists) { - mainFields.push(UNIVERSAL_FOLDER); - commonjsInclude.push(joinPath(UNIVERSAL_FOLDER, '*.js')); + mainFields.push(UNIVERSAL_FILE); + commonjsInclude.push(UNIVERSAL_FILE); } configs.push({ From 67da53ab33839fd748a8d108134633913e3512e2 Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Tue, 3 Nov 2020 14:58:20 +0100 Subject: [PATCH 11/13] feat: add universal file to plugin template --- packages/cli/templates/default-plugin/package.json.hbs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/cli/templates/default-plugin/package.json.hbs b/packages/cli/templates/default-plugin/package.json.hbs index 41f942fb79..8afd3654df 100644 --- a/packages/cli/templates/default-plugin/package.json.hbs +++ b/packages/cli/templates/default-plugin/package.json.hbs @@ -46,6 +46,7 @@ "cross-fetch": "^3.0.6" }, "files": [ - "dist" + "dist", + "universal" ] } From c58fa2cb139b478c1808a5ac56420f0349d1ec89 Mon Sep 17 00:00:00 2001 From: Ivan Shmidt Date: Tue, 10 Nov 2020 15:10:41 +0100 Subject: [PATCH 12/13] fix: disable files field sync --- packages/cli/src/lib/diff/handlers.ts | 7 ++++++- packages/cli/templates/default-plugin/package.json.hbs | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/lib/diff/handlers.ts b/packages/cli/src/lib/diff/handlers.ts index 40e3d4c587..588ce2f45f 100644 --- a/packages/cli/src/lib/diff/handlers.ts +++ b/packages/cli/src/lib/diff/handlers.ts @@ -61,7 +61,12 @@ class PackageJsonHandler { await this.syncField('main:src'); } await this.syncField('types'); - await this.syncField('files'); + + // shmidt-i: Skipping `files` for now, + // need more info how to handle + // and what to allow + + // await this.syncField('files'); await this.syncScripts(); await this.syncPublishConfig(); await this.syncDependencies('dependencies'); diff --git a/packages/cli/templates/default-plugin/package.json.hbs b/packages/cli/templates/default-plugin/package.json.hbs index 6cfdc6530b..a3f924408a 100644 --- a/packages/cli/templates/default-plugin/package.json.hbs +++ b/packages/cli/templates/default-plugin/package.json.hbs @@ -46,7 +46,6 @@ "cross-fetch": "^3.0.6" }, "files": [ - "dist", - "universal" + "dist" ] } From f5339205e991a5b2e0c66074f9f41cef8ddcd555 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 15 Dec 2020 10:30:36 +0100 Subject: [PATCH 13/13] chore: bump to latest eslint monorepo plugin --- packages/cli/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 7477eef5d7..1e3bfeac1e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -65,7 +65,7 @@ "eslint-plugin-import": "^2.20.2", "eslint-plugin-jest": "^24.1.0", "eslint-plugin-jsx-a11y": "^6.2.1", - "eslint-plugin-monorepo": "^0.3.1", + "eslint-plugin-monorepo": "^0.3.2", "eslint-plugin-react": "^7.12.4", "eslint-plugin-react-hooks": "^4.0.0", "fork-ts-checker-webpack-plugin": "^4.0.5", diff --git a/yarn.lock b/yarn.lock index f8e0e00ae5..5ee42e7dd9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11023,10 +11023,10 @@ eslint-plugin-jsx-a11y@^6.2.1: has "^1.0.3" jsx-ast-utils "^2.2.1" -eslint-plugin-monorepo@^0.3.1: - version "0.3.1" - resolved "https://registry.npmjs.org/eslint-plugin-monorepo/-/eslint-plugin-monorepo-0.3.1.tgz#698a74b3ef2a3481faaefab6219184429a57e01e" - integrity sha512-Oz91zASwmNapr5IHP9MYh4mEmkb5ZQJ1XxXU6KFY5eLxD1+V+J4B+yYDiILkaQCf5Itz4LKgnCoiB59lD/X29A== +eslint-plugin-monorepo@^0.3.2: + version "0.3.2" + resolved "https://registry.npmjs.org/eslint-plugin-monorepo/-/eslint-plugin-monorepo-0.3.2.tgz#bc546cbe84b21ae6a7622f261bf9fe73b1524367" + integrity sha512-CypTAqHjTR05XxzqDj7x88oVu2GiqqQA/datD9kIwciHzpj0oE4YbTdyEFFKADgd7dbd21KliSlUpOvo626FBw== dependencies: eslint-module-utils "^2.1.1" get-monorepo-packages "^1.1.0"