From fa97d2fbfb23a4ba42e272269eff1a31fb22b1a3 Mon Sep 17 00:00:00 2001 From: Fidel Coria Date: Thu, 23 Jul 2020 20:51:34 -0500 Subject: [PATCH 1/6] failing yaml import --- plugins/welcome/src/components/WelcomePage/WelcomePage.tsx | 3 ++- plugins/welcome/src/components/WelcomePage/test.yaml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 plugins/welcome/src/components/WelcomePage/test.yaml diff --git a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx index 272297ed45..509ffb6562 100644 --- a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx +++ b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx @@ -37,12 +37,13 @@ import { useApi, configApiRef, } from '@backstage/core'; +import work from './test.yaml' const WelcomePage = () => { const appTitle = useApi(configApiRef).getOptionalString('app.title') ?? 'Backstage'; const profile = { givenName: '' }; - +console.log(work); return (
Date: Thu, 23 Jul 2020 20:54:38 -0500 Subject: [PATCH 2/6] feat(build): rollup yaml files for import tested importing yaml file to welcome plugin: yarn build with this commit the build succeeded --- packages/cli/package.json | 1 + packages/cli/src/lib/builder/config.ts | 2 ++ packages/cli/src/types.d.ts | 2 ++ yarn.lock | 16 +++++++++++++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index ed7ae9725b..e333cd460e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -37,6 +37,7 @@ "@rollup/plugin-commonjs": "^13.0.0", "@rollup/plugin-json": "^4.0.2", "@rollup/plugin-node-resolve": "^8.1.0", + "@rollup/plugin-yaml": "^2.1.1", "@spotify/eslint-config": "^7.0.1", "@sucrase/webpack-loader": "^2.0.0", "@svgr/plugin-jsx": "4.3.x", diff --git a/packages/cli/src/lib/builder/config.ts b/packages/cli/src/lib/builder/config.ts index 5987290604..e62e1fc6cd 100644 --- a/packages/cli/src/lib/builder/config.ts +++ b/packages/cli/src/lib/builder/config.ts @@ -26,6 +26,7 @@ import imageFiles from 'rollup-plugin-image-files'; import svgr from '@svgr/rollup'; import dts from 'rollup-plugin-dts'; import json from '@rollup/plugin-json'; +import yaml from '@rollup/plugin-yaml'; import { RollupOptions, OutputOptions } from 'rollup'; import { BuildOptions, Output } from './types'; @@ -93,6 +94,7 @@ export const makeConfigs = async ( postcss(), imageFiles({ exclude: '**/*.icon.svg' }), json(), + yaml(), svgr({ include: '**/*.icon.svg', template: svgrTemplate, diff --git a/packages/cli/src/types.d.ts b/packages/cli/src/types.d.ts index 8cb5a1e7df..94136f1dbc 100644 --- a/packages/cli/src/types.d.ts +++ b/packages/cli/src/types.d.ts @@ -27,3 +27,5 @@ declare module 'rollup-plugin-image-files' { declare module '@svgr/rollup' { export default function svgr(options?: any): any; } + +declare module '@rollup/plugin-yaml'; diff --git a/yarn.lock b/yarn.lock index 6c0ff99388..182d6ddbaa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2509,7 +2509,16 @@ is-module "^1.0.0" resolve "^1.14.2" -"@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0": +"@rollup/plugin-yaml@^2.1.1": + version "2.1.1" + resolved "https://registry.npmjs.org/@rollup/plugin-yaml/-/plugin-yaml-2.1.1.tgz#6c864adee22004eb325d53bc4ee5553828e056d8" + integrity sha512-CnGD3dbDhP+JeKFX7kJuaBOa7jVzXpl3G8lXp1hasB87cDYOz7qNWd4cFPmYbxMsT/8OCVsceIpRtQ+cj9uxBw== + dependencies: + "@rollup/pluginutils" "^3.0.1" + js-yaml "^3.13.1" + tosource "^1.0.0" + +"@rollup/pluginutils@^3.0.1", "@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0": version "3.1.0" resolved "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg== @@ -18294,6 +18303,11 @@ toposort@^2.0.2: resolved "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz#ae21768175d1559d48bef35420b2f4962f09c330" integrity sha1-riF2gXXRVZ1IvvNUILL0li8JwzA= +tosource@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/tosource/-/tosource-1.0.0.tgz#42d88dd116618bcf00d6106dd5446f3427902ff1" + integrity sha1-QtiN0RZhi88A1hBt1URvNCeQL/E= + touch@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b" From 2c5044215d6fb2dd0a9d3d8ec53b21b716c74fcf Mon Sep 17 00:00:00 2001 From: Fidel Coria Date: Thu, 23 Jul 2020 20:54:55 -0500 Subject: [PATCH 3/6] Revert "failing yaml import" This reverts commit fa97d2fbfb23a4ba42e272269eff1a31fb22b1a3. --- plugins/welcome/src/components/WelcomePage/WelcomePage.tsx | 3 +-- plugins/welcome/src/components/WelcomePage/test.yaml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 plugins/welcome/src/components/WelcomePage/test.yaml diff --git a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx index 509ffb6562..272297ed45 100644 --- a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx +++ b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx @@ -37,13 +37,12 @@ import { useApi, configApiRef, } from '@backstage/core'; -import work from './test.yaml' const WelcomePage = () => { const appTitle = useApi(configApiRef).getOptionalString('app.title') ?? 'Backstage'; const profile = { givenName: '' }; -console.log(work); + return (
Date: Fri, 24 Jul 2020 07:31:10 -0500 Subject: [PATCH 4/6] restore test: confirmed that yarn tsc fails --- plugins/welcome/src/components/WelcomePage/WelcomePage.tsx | 3 ++- plugins/welcome/src/components/WelcomePage/test.yaml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 plugins/welcome/src/components/WelcomePage/test.yaml diff --git a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx index 272297ed45..48292ae858 100644 --- a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx +++ b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx @@ -37,12 +37,13 @@ import { useApi, configApiRef, } from '@backstage/core'; +import uaml from './test.yaml' const WelcomePage = () => { const appTitle = useApi(configApiRef).getOptionalString('app.title') ?? 'Backstage'; const profile = { givenName: '' }; - +console.log(uaml); return (
Date: Fri, 24 Jul 2020 07:35:02 -0500 Subject: [PATCH 5/6] fix yarn tsc for yaml import --- packages/cli/asset-types/asset-types.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/cli/asset-types/asset-types.d.ts b/packages/cli/asset-types/asset-types.d.ts index 1763d256f5..28c1fde9e3 100644 --- a/packages/cli/asset-types/asset-types.d.ts +++ b/packages/cli/asset-types/asset-types.d.ts @@ -50,6 +50,11 @@ declare module '*.webp' { export default src; } +declare module '*.yaml' { + const src: string; + export default src; +} + declare module '*.icon.svg' { import { ComponentType } from 'react'; import { SvgIconProps } from '@material-ui/core'; From c3927c82d819900e50c00874f3e45267e64ea4c7 Mon Sep 17 00:00:00 2001 From: Fidel Coria Date: Fri, 24 Jul 2020 07:35:19 -0500 Subject: [PATCH 6/6] Revert "restore test: confirmed that yarn tsc fails" This reverts commit 69a188e61324bab4de0ae3ef8a078ff9fb8008c6. --- plugins/welcome/src/components/WelcomePage/WelcomePage.tsx | 3 +-- plugins/welcome/src/components/WelcomePage/test.yaml | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 plugins/welcome/src/components/WelcomePage/test.yaml diff --git a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx index 48292ae858..272297ed45 100644 --- a/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx +++ b/plugins/welcome/src/components/WelcomePage/WelcomePage.tsx @@ -37,13 +37,12 @@ import { useApi, configApiRef, } from '@backstage/core'; -import uaml from './test.yaml' const WelcomePage = () => { const appTitle = useApi(configApiRef).getOptionalString('app.title') ?? 'Backstage'; const profile = { givenName: '' }; -console.log(uaml); + return (