Skip to content

Commit 881a2c4

Browse files
authored
New Plugin: Flux (#4844)
* Added changeset Signed-off-by: Florian JUDITH <[email protected]> * Initial Flux plugin workspace creation Signed-off-by: Florian JUDITH <[email protected]> * Add Backstage app for flux plugins local development Signed-off-by: Florian JUDITH <[email protected]> * Initial Flux frontend plugin commit Signed-off-by: Florian JUDITH <[email protected]> * Bump framework version 1.41.1 Signed-off-by: Florian JUDITH <[email protected]> * Fixed tsc:full errors Signed-off-by: Florian JUDITH <[email protected]> * Updated dependency `cross-fetch` to `^4.0.0` Signed-off-by: Florian JUDITH <[email protected]> * Fixed React 18 related errors Signed-off-by: Florian JUDITH <[email protected]> * removed remanent changeset Signed-off-by: Florian JUDITH <[email protected]> * Fixed React 18 related errors Signed-off-by: Florian JUDITH <[email protected]> * Added api-report Signed-off-by: Florian JUDITH <[email protected]> * Added workspace to Flux plugin Signed-off-by: Florian JUDITH <[email protected]> * Reduced workspace size Signed-off-by: Florian JUDITH <[email protected]> * Added support for kubernetes permissions Signed-off-by: Florian JUDITH <[email protected]> * Bump framework version 1.42.5 Signed-off-by: Florian JUDITH <[email protected]> * Remove publishing script Signed-off-by: Florian JUDITH <[email protected]> * Removed dependencies on internal theme Signed-off-by: Florian JUDITH <[email protected]> * Fixed CODEOWNERS Signed-off-by: Florian JUDITH <[email protected]> * Deduplicated useStyle function Signed-off-by: Florian JUDITH <[email protected]> * Removed catalog-info at workspace root Signed-off-by: Florian JUDITH <[email protected]> * Removed plugin specific LICENSE to adhere to the common repository one Signed-off-by: Florian JUDITH <[email protected]> * Updated configuration schema Signed-off-by: Florian JUDITH <[email protected]> * Fix jsx transform warnings Signed-off-by: Florian JUDITH <[email protected]> * Aligned dependencies with repo-tools template Signed-off-by: Florian JUDITH <[email protected]> * Replaced dynamic Flex components by declarative Box components Signed-off-by: Florian JUDITH <[email protected]> * Updated plugin documentation Signed-off-by: Florian JUDITH <[email protected]> * Updated tests Signed-off-by: Florian JUDITH <[email protected]> * Backstage version bump to v1.43.3 Signed-off-by: Florian JUDITH <[email protected]> * Fixed non deeplink name rendering Signed-off-by: Florian JUDITH <[email protected]> * Removed plugin license references Signed-off-by: Florian JUDITH <[email protected]> --------- Signed-off-by: Florian JUDITH <[email protected]>
1 parent ff113c2 commit 881a2c4

File tree

103 files changed

+32735
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+32735
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ yarn.lock @backsta
4848
/workspaces/explore @backstage/community-plugins-maintainers @backstage/sda-se-reviewers
4949
/workspaces/feedback @backstage/community-plugins-maintainers @riginoommen @deshmukhmayur @yashoswalyo
5050
/workspaces/firehydrant @backstage/community-plugins-maintainers
51+
/workspaces/flux @backstage/community-plugins-maintainers @fjudith @fleveillee
5152
/workspaces/fossa @backstage/community-plugins-maintainers @backstage/sda-se-reviewers
5253
/workspaces/gcalendar @backstage/community-plugins-maintainers
5354
/workspaces/gcp-projects @backstage/community-plugins-maintainers
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"privatePackages": {
11+
"tag": false,
12+
"version": false
13+
}
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@backstage-community/plugin-flux': minor
3+
---
4+
5+
Initial port of the Flux plugin from Weaveworks

workspaces/flux/.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.git
2+
.yarn/cache
3+
.yarn/install-state.gz
4+
node_modules
5+
packages/*/src
6+
packages/*/node_modules
7+
plugins
8+
*.local.yaml

workspaces/flux/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
playwright.config.ts

workspaces/flux/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../../.eslintrc.cjs');

workspaces/flux/.gitignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# macOS
2+
.DS_Store
3+
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
12+
# Coverage directory generated when running tests with coverage
13+
coverage
14+
15+
# Dependencies
16+
node_modules/
17+
18+
# Yarn 3 files
19+
.pnp.*
20+
.yarn/*
21+
!.yarn/patches
22+
!.yarn/plugins
23+
!.yarn/releases
24+
!.yarn/sdks
25+
!.yarn/versions
26+
27+
# Node version directives
28+
.nvmrc
29+
30+
# dotenv environment variables file
31+
.env
32+
.env.test
33+
34+
# Build output
35+
dist
36+
dist-types
37+
38+
# Temporary change files created by Vim
39+
*.swp
40+
41+
# MkDocs build output
42+
site
43+
44+
# Local configuration files
45+
*.local.yaml
46+
47+
# Sensitive credentials
48+
*-credentials.yaml
49+
50+
# vscode database functionality support files
51+
*.session.sql
52+
53+
# E2E test reports
54+
e2e-test-report/

workspaces/flux/.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist
2+
dist-types
3+
coverage
4+
.vscode
5+
.eslintrc.js
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable */
2+
//prettier-ignore
3+
module.exports = {
4+
name: "@yarnpkg/plugin-backstage",
5+
factory: function (require) {
6+
"use strict";var plugin=(()=>{var Q=Object.create;var R=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var p=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var te=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),oe=(e,r)=>{for(var t in r)R(e,t,{get:r[t],enumerable:!0})},W=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Z(r))!re.call(e,o)&&o!==t&&R(e,o,{get:()=>r[o],enumerable:!(n=X(r,o))||n.enumerable});return e};var O=(e,r,t)=>(t=e!=null?Q(ee(e)):{},W(r||!e||!e.__esModule?R(t,"default",{value:e,enumerable:!0}):t,e)),ne=e=>W(R({},"__esModule",{value:!0}),e);var z=te((Te,F)=>{"use strict";var B=class e extends Error{constructor(r){super(e._prepareSuperMessage(r)),Object.defineProperty(this,"name",{value:"NonError",configurable:!0,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(this,e)}static _prepareSuperMessage(r){try{return JSON.stringify(r)}catch{return String(r)}}},ie=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0}],D=Symbol(".toJSON called"),ce=e=>{e[D]=!0;let r=e.toJSON();return delete e[D],r},T=({from:e,seen:r,to_:t,forceEnumerable:n,maxDepth:o,depth:a})=>{let i=t||(Array.isArray(e)?[]:{});if(r.push(e),a>=o)return i;if(typeof e.toJSON=="function"&&e[D]!==!0)return ce(e);for(let[s,f]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(f)){i[s]="[object Buffer]";continue}if(typeof f!="function"){if(!f||typeof f!="object"){i[s]=f;continue}if(!r.includes(e[s])){a++,i[s]=T({from:e[s],seen:r.slice(),forceEnumerable:n,maxDepth:o,depth:a});continue}i[s]="[Circular]"}}for(let{property:s,enumerable:f}of ie)typeof e[s]=="string"&&Object.defineProperty(i,s,{value:e[s],enumerable:n?!0:f,configurable:!0,writable:!0});return i},pe=(e,r={})=>{let{maxDepth:t=Number.POSITIVE_INFINITY}=r;return typeof e=="object"&&e!==null?T({from:e,seen:[],forceEnumerable:!0,maxDepth:t,depth:0}):typeof e=="function"?`[Function: ${e.name||"anonymous"}]`:e},fe=(e,r={})=>{let{maxDepth:t=Number.POSITIVE_INFINITY}=r;if(e instanceof Error)return e;if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let n=new Error;return T({from:e,seen:[],to_:n,maxDepth:t,depth:0}),n}return new B(e)};F.exports={serializeError:pe,deserializeError:fe}});var be={};oe(be,{default:()=>Ee});var P=p("@yarnpkg/core");var E=p("@yarnpkg/core");var U=O(p("assert")),K=p("semver"),v=p("@yarnpkg/fslib");var d=O(p("fs")),g=p("path");function M(e,r){let t=e;for(let n=0;n<1e3;n++){let o=(0,g.resolve)(t,"package.json");if(d.default.existsSync(o)&&r(o))return t;let i=(0,g.dirname)(t);if(i===t)return;t=i}throw new Error(`Iteration limit reached when searching for root package.json at ${e}`)}function se(e){let r=M(e,()=>!0);if(!r)throw new Error(`No package.json found while searching for package root of ${e}`);return r}function ae(e){if(!d.default.existsSync((0,g.resolve)(e,"src")))throw new Error("Tried to access monorepo package root dir outside of Backstage repository");return(0,g.resolve)(e,"../..")}function S(e){let r=se(e),t=d.default.realpathSync(process.cwd()).replace(/^[a-z]:/,s=>s.toLocaleUpperCase("en-US")),n="",o=()=>(n||(n=ae(r)),n),a="",i=()=>(a||(a=M(t,s=>{try{let f=d.default.readFileSync(s,"utf8");return!!JSON.parse(f).workspaces}catch(f){throw new Error(`Failed to parse package.json file while searching for root, ${f}`)}})??t),a);return{ownDir:r,get ownRoot(){return o()},targetDir:t,get targetRoot(){return i()},resolveOwn:(...s)=>(0,g.resolve)(r,...s),resolveOwnRoot:(...s)=>(0,g.resolve)(o(),...s),resolveTarget:(...s)=>(0,g.resolve)(t,...s),resolveTargetRoot:(...s)=>(0,g.resolve)(i(),...s)}}var $="backstage.json";function m(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let r=e;return!(typeof r.name!="string"||r.name===""||typeof r.message!="string")}var H=O(z());function _(e){if(m(e)){let r=String(e);return r!=="[object Object]"?r:`${e.name}: ${e.message}`}return`unknown error '${e}'`}var x=class extends Error{cause;constructor(r,t){let n=r;if(t!==void 0){let o=_(t);n?n+=`; caused by ${o}`:n=`caused by ${o}`}super(n),Error.captureStackTrace?.(this,this.constructor),(!this.name||this.name==="Error")&&this.constructor.name!=="Error"&&(this.name=this.constructor.name),this.cause=m(t)?t:void 0}};var k=class extends x{constructor(r,t){super(r,t),this.name=m(t)?t.name:"Error"}};var J=e=>{let r=!1,t;return()=>(r||(t=e(),r=!0),t)};var y=p("@yarnpkg/fslib");var G=()=>y.npath.toPortablePath(S(y.npath.fromPortablePath(y.ppath.cwd())).targetRoot);var h=J(()=>{let e=v.ppath.join(G(),$),r=null;try{let t=v.xfs.readJsonSync(e).version;(0,U.default)(t!==void 0,"Version field is missing"),r=(0,K.valid)(t),(0,U.default)(r!==null,"Version exists but is not valid semver")}catch(t){throw new k("Valid version string not found in backstage.json",t)}return r});var w=p("@yarnpkg/core");var ge="https://versions.backstage.io",le="https://raw.githubusercontent.com/backstage/versions/main";function ue(e,r){return new Promise((t,n)=>{let o=setTimeout(()=>{r.aborted||t()},e);r.addEventListener("abort",()=>{clearTimeout(o),n(new Error("Aborted"))})})}async function me(e,r,t){let n=new AbortController,o=new AbortController,a=e(n.signal).then(s=>(o.abort(),s)),i=ue(t,o.signal).then(()=>r(o.signal)).then(s=>(n.abort(),s));return Promise.any([a,i]).catch(()=>a)}async function j(e){let r=encodeURIComponent(e.version),t=e.fetch??fetch,n=e.versionsBaseUrl??ge,o=e.gitHubRawBaseUrl??le,a=await me(i=>t(`${n}/v1/releases/${r}/manifest.json`,{signal:i}),i=>t(`${o}/v1/releases/${r}/manifest.json`,{signal:i}),500);if(a.status===404)throw new Error(`No release found for ${e.version} version`);if(a.status!==200)throw new Error(`Unexpected response status ${a.status} when fetching release from ${a.url}.`);return a.json()}var c="backstage:";var u=async(e,r)=>{let t=w.structUtils.stringifyIdent(e),n=w.structUtils.parseRange(e.range);if(n.protocol!==c)throw new Error(`Unsupported version protocol in version range "${e.range}" for package ${t}`);if(n.selector!=="^")throw new Error(`Unexpected version selector "${n.selector}" for package ${t}`);let o=h(),i=(await j({version:o,fetch:async s=>{let f=await w.httpUtils.get(s,{configuration:r,jsonResponse:!0});return{status:200,url:s,json:()=>f}}})).packages.find(s=>s.name===t);if(!i)throw new Error(`Package ${t} not found in manifest for Backstage v${o}. This means the specified package is not included in this Backstage release. This may imply the package has been replaced with an alternative - please review the documentation for the package. If you need to continue using this package, it will be necessary to switch to manually managing its version.`);return i.version};var de=e=>E.structUtils.parseRange(e).protocol===c,ke=(e,r,t)=>e!=="dependencies"?e:t.manifest.ensureDependencyMeta(E.structUtils.makeDescriptor(r,"unknown")).optional?"optionalDependencies":e,A=async(e,r)=>{for(let t of["dependencies","devDependencies"]){let n=Array.from(e.manifest.getForScope(t).values()).filter(o=>o.range.startsWith(c));for(let o of n){let a=E.structUtils.stringifyIdent(o);if(E.structUtils.parseRange(o.range).selector!=="^")throw new Error(`Unexpected version range "${o.range}" for dependency on "${a}"`);let s=ke(t,o,e);r[s][a]=`^${await u(o,e.project.configuration)}`}}if(["dependencies","devDependencies","optionalDependencies"].some(t=>Object.values(r[t]??{}).some(de)))throw new Error(`Failed to replace all "backstage:" ranges in manifest for ${r.name}`)};var L=p("@yarnpkg/core");var C=async(e,r)=>{let t=L.structUtils.parseRange(e.range);if(t.protocol!==c)return e;if(t.selector!=="^")throw new Error(`Invalid backstage: version range found: ${e.range}`);return L.structUtils.bindDescriptor(e,{backstage:h(),npm:await u(e,r.configuration)})};var Y=p("@yarnpkg/core");var V=async(e,r,t,n)=>{let o=Y.structUtils.parseRange(t.range);if(t.scope==="backstage"&&o.protocol!==c){let a=t.range;try{t.range=`${c}^`,await u(t,e.project.configuration),console.info(`Setting ${t.scope}/${t.name} to ${c}^`)}catch{t.range=a}}};var q=p("@yarnpkg/core");var N=async(e,r,t,n)=>{let o=q.structUtils.parseRange(n.range);n.scope==="backstage"&&o.protocol!==c&&console.warn(`${n.name} should be set to "${c}^" instead of "${n.range}". Make sure this change is intentional and not a mistake.`)};var l=p("@yarnpkg/core"),I=p("@yarnpkg/plugin-npm");var b=class e{static protocol=c;supportsDescriptor=r=>r.range.startsWith(e.protocol);async getCandidates(r,t,n){let o=l.structUtils.parseRange(r.range).params?.npm;if(!o||Array.isArray(o))throw new Error(`Missing npm parameter on backstage: range "${r.range}"`);return new I.NpmSemverResolver().getCandidates(l.structUtils.makeDescriptor(r,`npm:^${o}`),t,n)}getResolutionDependencies(r){let t=l.structUtils.parseRange(r.range).params?.npm;if(!t)throw new Error(`Missing npm parameter on backstage: range "${r.range}".`);return{[l.structUtils.stringifyIdent(r)]:l.structUtils.makeDescriptor(r,`npm:^${t}`)}}async getSatisfying(r,t,n,o){let a=r,i=l.structUtils.parseRange(a.range);if(i.protocol===c){let s=i.params?.npm;a=l.structUtils.makeDescriptor(r,`npm:^${s}`)}return new I.NpmSemverResolver().getSatisfying(a,t,n,o)}bindDescriptor=r=>r;supportsLocator=()=>!1;shouldPersistResolution=()=>{throw new Error("Unreachable: BackstageNpmResolver should never persist resolution as it uses npm: protocol")};resolve=async()=>{throw new Error("Unreachable: BackstageNpmResolver should never resolve as it uses npm: protocol")}};var ye="\x1B[31;1m",he="\x1B[0m";P.semverUtils.satisfiesWithPrereleases(P.YarnVersion,"^4.1.1")||(console.error(),console.error(`${ye}Unsupported yarn version${he}: The Backstage yarn plugin only works with yarn ^4.1.1. Please upgrade yarn, or remove this plugin with "yarn plugin remove @yarnpkg/plugin-backstage".`),console.error());var we={hooks:{afterWorkspaceDependencyAddition:V,afterWorkspaceDependencyReplacement:N,reduceDependency:C,beforeWorkspacePacking:A},resolvers:[b]},Ee=we;return ne(be);})();
7+
return plugin;
8+
}
9+
};

0 commit comments

Comments
 (0)