Skip to content

Commit

Permalink
fix(cli): add default scalprum config (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyperkid123 authored Nov 6, 2023
1 parent ea603a2 commit d74fc72
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 97 deletions.
29 changes: 24 additions & 5 deletions packages/cli/src/commands/export-dynamic-plugin/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,31 @@ export async function frontend(
_: PackageRoleInfo,
__: OptionValues,
): Promise<void> {
const { name, version, scalprum } = await fs.readJson(
paths.resolveTarget('package.json'),
);
const {
name,
version,
scalprum: scalprumExternal,
} = await fs.readJson(paths.resolveTarget('package.json'));

let scalprum = scalprumExternal;
if (scalprum === undefined) {
throw new Error(
`Package doesn't seem to support dynamic loading. It should have a 'scalprum' key in 'package.json' containing the dynamic loading entrypoints.`,
let scalprumName;
if (name.includes('/')) {
const fragments = name.split('/');
scalprumName = `${fragments[0].replace('@', '')}.${fragments[1]}`;
} else {
scalprumName = name;
}
scalprum = {
name: scalprumName,
exposedModules: {
PluginRoot: './src/index.ts',
},
};
console.log(`No scalprum config. Using default dynamic UI configuration:`);
console.log(JSON.stringify(scalprum, null, 2));
console.log(
`If you wish to change the defaults, add "scalprum" configuration to plugin "package.json" file.`,
);
}

Expand Down
8 changes: 1 addition & 7 deletions plugins/acr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-acr",
"exposedModules": {
"AcrPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
10 changes: 1 addition & 9 deletions plugins/dynamic-frontend-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,7 @@
},
"devDependencies": {
"@backstage/cli": "0.22.9",
"@janus-idp/cli": "1.3.0",
"@janus-idp/cli": "1.3.2",
"http-server": "14.1.1"
},
"scalprum": {
"name": "janus.dynamic-frontend-plugin",
"exposedModules": {
"TechRadar": "./src/remotes/TechRadarPage",
"UserSettings": "./src/remotes/UserSettingsLegacy",
"Scaffolder": "./src/remotes/Scaffolder"
}
}
}
8 changes: 1 addition & 7 deletions plugins/jfrog-artifactory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-jfrog-artifactory",
"exposedModules": {
"JfrogArtifactoryPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
8 changes: 1 addition & 7 deletions plugins/kiali/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-kiali",
"exposedModules": {
"KialiPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
8 changes: 1 addition & 7 deletions plugins/matomo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-matomo",
"exposedModules": {
"MatomoPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
8 changes: 1 addition & 7 deletions plugins/nexus-repository-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-nexus-repository-manager",
"exposedModules": {
"NexusRepositoryManagerPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
8 changes: 1 addition & 7 deletions plugins/ocm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-ocm",
"exposedModules": {
"OcmPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
8 changes: 1 addition & 7 deletions plugins/openshift-image-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,5 @@
"dist-scalprum",
"config.d.ts"
],
"configSchema": "config.d.ts",
"scalprum": {
"name": "janus-idp.backstage-plugin-openshift-image-registry",
"exposedModules": {
"OpenshiftImageRegistryPlugin": "./src/index.ts"
}
}
"configSchema": "config.d.ts"
}
8 changes: 1 addition & 7 deletions plugins/quay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-quay",
"exposedModules": {
"QuayPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
8 changes: 1 addition & 7 deletions plugins/rbac/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-rbac",
"exposedModules": {
"RbacPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
8 changes: 1 addition & 7 deletions plugins/tekton/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-tekton",
"exposedModules": {
"TektonPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
8 changes: 1 addition & 7 deletions plugins/topology/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,5 @@
"plugin"
],
"homepage": "https://janus-idp.io/",
"bugs": "https://github.com/janus-idp/backstage-plugins/issues",
"scalprum": {
"name": "janus-idp.backstage-plugin-topology",
"exposedModules": {
"TopologyPlugin": "./src/index.ts"
}
}
"bugs": "https://github.com/janus-idp/backstage-plugins/issues"
}
6 changes: 0 additions & 6 deletions plugins/web-terminal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,5 @@
"setupFiles": [
"jest-canvas-mock"
]
},
"scalprum": {
"name": "janus-idp.backstage-plugin-web-terminal",
"exposedModules": {
"WebTerminalPlugin": "./src/index.ts"
}
}
}

0 comments on commit d74fc72

Please sign in to comment.