@backstage/cli 0.34.0 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @backstage/cli
2
2
 
3
+ ## 0.34.1
4
+
5
+ ### Patch Changes
6
+
7
+ - f470192: Fixed the `new-frontend-plugin` template that was incorrectly passing `id` instead of `pluginId` to `createFrontendPlugin` and unnecessarily importing `React`.
8
+ - d778acb: Fixed an issue that could cause conflicts of detected modules in workspaces with multiple apps.
9
+
3
10
  ## 0.34.0
4
11
 
5
12
  ### Minor Changes
@@ -70,22 +70,24 @@ async function detectPackages(targetPath, { include, exclude }) {
70
70
  });
71
71
  }
72
72
  const writeQueue = new PQueue__default.default({ concurrency: 1 });
73
- async function writeDetectedPackagesModule(pkgs) {
73
+ async function writeDetectedPackagesModule(targetPath, pkgs) {
74
74
  const requirePackageScript = pkgs?.map(
75
75
  (pkg) => `{ name: ${JSON.stringify(pkg.name)}, export: ${JSON.stringify(
76
76
  pkg.export
77
77
  )}, default: require('${pkg.import}').default }`
78
78
  ).join(",");
79
- await writeQueue.add(
80
- () => fs__default.default.writeFile(
81
- path.join(
82
- paths.paths.targetRoot,
83
- "node_modules",
84
- `${DETECTED_MODULES_MODULE_NAME}.js`
85
- ),
79
+ await writeQueue.add(async () => {
80
+ const detectedModulesPath = path.join(
81
+ targetPath,
82
+ "node_modules",
83
+ `${DETECTED_MODULES_MODULE_NAME}.js`
84
+ );
85
+ await fs__default.default.ensureDir(path.dirname(detectedModulesPath));
86
+ await fs__default.default.writeFile(
87
+ detectedModulesPath,
86
88
  `window['__@backstage/discovered__'] = { modules: [${requirePackageScript}] };`
87
- )
88
- );
89
+ );
90
+ });
89
91
  }
90
92
  async function createDetectedModulesEntryPoint(options) {
91
93
  const { config, watch, targetPath } = options;
@@ -93,16 +95,26 @@ async function createDetectedModulesEntryPoint(options) {
93
95
  if (!detectionConfig) {
94
96
  return [];
95
97
  }
98
+ const legacyDetectedModulesPath = path.join(
99
+ paths.paths.targetRoot,
100
+ "node_modules",
101
+ `${DETECTED_MODULES_MODULE_NAME}.js`
102
+ );
103
+ if (await fs__default.default.pathExists(legacyDetectedModulesPath)) {
104
+ await fs__default.default.remove(legacyDetectedModulesPath);
105
+ }
96
106
  if (watch) {
97
107
  const watcher = chokidar__default.default.watch(path.resolve(targetPath, "package.json"));
98
108
  watcher.on("change", async () => {
99
109
  await writeDetectedPackagesModule(
110
+ targetPath,
100
111
  await detectPackages(targetPath, detectionConfig)
101
112
  );
102
113
  watch();
103
114
  });
104
115
  }
105
116
  await writeDetectedPackagesModule(
117
+ targetPath,
106
118
  await detectPackages(targetPath, detectionConfig)
107
119
  );
108
120
  return [DETECTED_MODULES_MODULE_NAME];
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "0.34.0";
3
+ var version = "0.34.1";
4
4
  var dependencies = {
5
5
  "@backstage/catalog-model": "workspace:^",
6
6
  "@backstage/cli-common": "workspace:^",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/cli",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "description": "CLI for developing Backstage plugins and apps",
5
5
  "backstage": {
6
6
  "role": "cli"
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import {
3
2
  createFrontendPlugin,
4
3
  PageBlueprint,
@@ -18,7 +17,7 @@ export const page = PageBlueprint.make({
18
17
  });
19
18
 
20
19
  export const {{ pluginVar }} = createFrontendPlugin({
21
- id: '{{pluginId}}',
20
+ pluginId: '{{pluginId}}',
22
21
  extensions: [page],
23
22
  routes: {
24
23
  root: rootRouteRef,