From f78a3bd9a1bc28903191093ac61945622a987195 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 5 Apr 2020 15:21:12 +0200 Subject: [PATCH 1/5] packages/cli: move typescript build config to tsconfig --- packages/cli/package.json | 2 +- packages/cli/tsconfig.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index f1ca54ca1c..a430cc851c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -19,7 +19,7 @@ "main": "dist", "scripts": { "exec": "npx ts-node ./src", - "build": "backstage-cli build-cache -- tsc --outDir dist --noEmit false --module CommonJS", + "build": "backstage-cli build-cache -- tsc", "lint": "backstage-cli lint", "test": "backstage-cli test", "start": "nodemon ." diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 84b9319b94..e30150dda7 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -1,7 +1,9 @@ { - "extends": "@spotify/web-scripts/config/tsconfig.json", + "extends": "../../tsconfig.json", "include": ["src"], "compilerOptions": { + "outDir": "dist", + "module": "CommonJS", "baseUrl": "src", "paths": { "*": ["src/*"] From 38a4b96bd91d5e885ad7eb91b2a075c020e0d3a0 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 5 Apr 2020 15:22:00 +0200 Subject: [PATCH 2/5] packages/core/icons: fix circular dependency --- packages/core/src/icons/icons.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/icons/icons.tsx b/packages/core/src/icons/icons.tsx index a588a4a2a1..454a10c264 100644 --- a/packages/core/src/icons/icons.tsx +++ b/packages/core/src/icons/icons.tsx @@ -18,7 +18,7 @@ import { SvgIconProps } from '@material-ui/core'; import PeopleIcon from '@material-ui/icons/People'; import PersonIcon from '@material-ui/icons/Person'; import React, { FC } from 'react'; -import { useApp } from '../api'; +import { useApp } from '../api/app/AppContext'; import { IconComponent, SystemIconKey, SystemIcons } from './types'; export const defaultSystemIcons: SystemIcons = { From 41dff573c60a7c12f736273159160f6e458d5853 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 5 Apr 2020 15:23:47 +0200 Subject: [PATCH 3/5] packages/cli/commands/plugin: make package dependencies external too --- packages/cli/src/commands/plugin/rollup.config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/plugin/rollup.config.ts b/packages/cli/src/commands/plugin/rollup.config.ts index fc4b5e92ef..ec492d56a4 100644 --- a/packages/cli/src/commands/plugin/rollup.config.ts +++ b/packages/cli/src/commands/plugin/rollup.config.ts @@ -30,7 +30,9 @@ export default { format: 'cjs', }, plugins: [ - peerDepsExternal(), + peerDepsExternal({ + includeDependencies: true, + }), resolve({ mainFields: ['browser', 'module', 'main'], }), From 4e93e61e7ecdc7101656dac777624b30d78db6c6 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 5 Apr 2020 15:29:13 +0200 Subject: [PATCH 4/5] packages/cli/commands/plugin: include js in typescript compilation + exclude testUtils --- packages/cli/src/commands/plugin/rollup.config.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/plugin/rollup.config.ts b/packages/cli/src/commands/plugin/rollup.config.ts index ec492d56a4..ba2e95cb39 100644 --- a/packages/cli/src/commands/plugin/rollup.config.ts +++ b/packages/cli/src/commands/plugin/rollup.config.ts @@ -22,6 +22,7 @@ import postcss from 'rollup-plugin-postcss'; import imageFiles from 'rollup-plugin-image-files'; import json from '@rollup/plugin-json'; import { RollupWatchOptions } from 'rollup'; +import { paths } from '../../helpers/paths'; export default { input: 'src/index.ts', @@ -43,6 +44,9 @@ export default { postcss(), imageFiles(), json(), - typescript(), + typescript({ + include: `${paths.resolveTarget('src')}/**/*.{js,jsx,ts,tsx}`, + exclude: [paths.resolveTarget('src/testUtils/**')], + }), ], } as RollupWatchOptions; From 6bb0e0599899805c42a40d2ce9771b3a59c1c0b2 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 5 Apr 2020 15:29:36 +0200 Subject: [PATCH 5/5] packages/core: use plugin:build to build --- packages/core/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 897d828b8e..93c2e2fdf7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -16,11 +16,11 @@ "backstage" ], "license": "Apache-2.0", - "main": "dist/cjs/index.js", - "types": "dist/cjs/index.d.ts", + "main": "dist/index.cjs.js", + "types": "dist/index.d.ts", "scripts": { - "build:watch": "tsc --outDir dist/cjs --noEmit false --module CommonJS --watch", - "build": "backstage-cli build-cache -- tsc --outDir dist/cjs --noEmit false --module CommonJS", + "build:watch": "backstage-cli plugin:build --watch", + "build": "backstage-cli build-cache -- backstage-cli plugin:build", "lint": "backstage-cli lint", "test": "backstage-cli test" },