@backstage/plugin-scaffolder-backend-module-yeoman 0.4.24-next.0 → 0.4.24-next.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,13 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-yeoman
2
2
 
3
+ ## 0.4.24-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5e92512: Fixed compatibility with yeoman-environment v4+, which is ESM-only. The previous require() call throws ERR_REQUIRE_ESM; replaced with dynamic import() and updated registration to match the v4+ API.
8
+ - Updated dependencies
9
+ - @backstage/backend-plugin-api@1.9.3-next.1
10
+
3
11
  ## 0.4.24-next.0
4
12
 
5
13
  ### Patch Changes
@@ -1,10 +1,17 @@
1
1
  'use strict';
2
2
 
3
+ var node_url = require('node:url');
4
+
3
5
  async function yeomanRun(workspace, namespace, args, opts) {
4
- const yeoman = require("yeoman-environment");
5
- const generator = yeoman.lookupGenerator(namespace);
6
- const env = yeoman.createEnv(void 0, { cwd: workspace });
7
- env.register(generator, namespace);
6
+ const { createEnv, lookupGenerator } = await import('yeoman-environment');
7
+ const env = createEnv({ cwd: workspace });
8
+ const generatorResult = lookupGenerator(namespace);
9
+ const generatorFile = Array.isArray(generatorResult) ? generatorResult[0] : generatorResult;
10
+ if (!generatorFile) {
11
+ throw new Error(`No Yeoman generator found for namespace "${namespace}"`);
12
+ }
13
+ const absoluteFile = generatorFile.startsWith("file://") ? node_url.fileURLToPath(generatorFile) : generatorFile;
14
+ env.register(absoluteFile, { namespace });
8
15
  const yeomanArgs = [namespace, ...args ?? []];
9
16
  await env.run(yeomanArgs, opts);
10
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"yeomanRun.cjs.js","sources":["../../../src/actions/run/yeomanRun.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject } from '@backstage/types';\n\n/*\n * This module should use '@types/yeoman-environment' eventually as soon as '@types/yeoman-environment' supports\n * the latest version of Yeoman -> 3.x. Then it will be possible to test this module with jest.\n */\n\nexport async function yeomanRun(\n workspace: string,\n namespace: string,\n args?: string[],\n opts?: JsonObject,\n) {\n const yeoman = require('yeoman-environment');\n const generator = yeoman.lookupGenerator(namespace);\n const env = yeoman.createEnv(undefined, { cwd: workspace });\n env.register(generator, namespace);\n const yeomanArgs = [namespace, ...(args ?? [])];\n await env.run(yeomanArgs, opts);\n}\n"],"names":[],"mappings":";;AAuBA,eAAsB,SAAA,CACpB,SAAA,EACA,SAAA,EACA,IAAA,EACA,IAAA,EACA;AACA,EAAA,MAAM,MAAA,GAAS,QAAQ,oBAAoB,CAAA;AAC3C,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,eAAA,CAAgB,SAAS,CAAA;AAClD,EAAA,MAAM,MAAM,MAAA,CAAO,SAAA,CAAU,QAAW,EAAE,GAAA,EAAK,WAAW,CAAA;AAC1D,EAAA,GAAA,CAAI,QAAA,CAAS,WAAW,SAAS,CAAA;AACjC,EAAA,MAAM,aAAa,CAAC,SAAA,EAAW,GAAI,IAAA,IAAQ,EAAG,CAAA;AAC9C,EAAA,MAAM,GAAA,CAAI,GAAA,CAAI,UAAA,EAAY,IAAI,CAAA;AAChC;;;;"}
1
+ {"version":3,"file":"yeomanRun.cjs.js","sources":["../../../src/actions/run/yeomanRun.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject } from '@backstage/types';\nimport { fileURLToPath } from 'node:url';\n\nexport async function yeomanRun(\n workspace: string,\n namespace: string,\n args?: string[],\n opts?: JsonObject,\n) {\n // Use dynamic import for yeoman-environment v4+ ESM compatibility\n const { createEnv, lookupGenerator } = await import('yeoman-environment');\n const env = createEnv({ cwd: workspace });\n const generatorResult = lookupGenerator(namespace);\n const generatorFile = Array.isArray(generatorResult)\n ? generatorResult[0]\n : generatorResult;\n\n if (!generatorFile) {\n throw new Error(`No Yeoman generator found for namespace \"${namespace}\"`);\n }\n\n // Convert file:// URL to absolute path if needed (v6 returns file:// URLs for absolute paths)\n const absoluteFile = generatorFile.startsWith('file://')\n ? fileURLToPath(generatorFile)\n : generatorFile;\n\n env.register(absoluteFile, { namespace });\n\n const yeomanArgs = [namespace, ...(args ?? [])];\n await env.run(yeomanArgs, opts);\n}\n"],"names":["fileURLToPath"],"mappings":";;;;AAmBA,eAAsB,SAAA,CACpB,SAAA,EACA,SAAA,EACA,IAAA,EACA,IAAA,EACA;AAEA,EAAA,MAAM,EAAE,SAAA,EAAW,eAAA,EAAgB,GAAI,MAAM,OAAO,oBAAoB,CAAA;AACxE,EAAA,MAAM,GAAA,GAAM,SAAA,CAAU,EAAE,GAAA,EAAK,WAAW,CAAA;AACxC,EAAA,MAAM,eAAA,GAAkB,gBAAgB,SAAS,CAAA;AACjD,EAAA,MAAM,gBAAgB,KAAA,CAAM,OAAA,CAAQ,eAAe,CAAA,GAC/C,eAAA,CAAgB,CAAC,CAAA,GACjB,eAAA;AAEJ,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,yCAAA,EAA4C,SAAS,CAAA,CAAA,CAAG,CAAA;AAAA,EAC1E;AAGA,EAAA,MAAM,eAAe,aAAA,CAAc,UAAA,CAAW,SAAS,CAAA,GACnDA,sBAAA,CAAc,aAAa,CAAA,GAC3B,aAAA;AAEJ,EAAA,GAAA,CAAI,QAAA,CAAS,YAAA,EAAc,EAAE,SAAA,EAAW,CAAA;AAExC,EAAA,MAAM,aAAa,CAAC,SAAA,EAAW,GAAI,IAAA,IAAQ,EAAG,CAAA;AAC9C,EAAA,MAAM,GAAA,CAAI,GAAA,CAAI,UAAA,EAAY,IAAI,CAAA;AAChC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-yeoman",
3
- "version": "0.4.24-next.0",
3
+ "version": "0.4.24-next.1",
4
4
  "backstage": {
5
5
  "role": "backend-plugin-module",
6
6
  "pluginId": "scaffolder",
@@ -47,17 +47,17 @@
47
47
  "prepack": "backstage-cli package prepack",
48
48
  "postpack": "backstage-cli package postpack",
49
49
  "start": "backstage-cli package start",
50
- "test": "backstage-cli package test"
50
+ "test": "NODE_OPTIONS=--experimental-vm-modules backstage-cli package test"
51
51
  },
52
52
  "dependencies": {
53
- "@backstage/backend-plugin-api": "1.9.3-next.0",
53
+ "@backstage/backend-plugin-api": "1.9.3-next.1",
54
54
  "@backstage/plugin-scaffolder-node": "0.13.5-next.0",
55
55
  "@backstage/plugin-scaffolder-node-test-utils": "0.3.13-next.0",
56
56
  "@backstage/types": "1.2.2",
57
57
  "yaml": "^2.0.0",
58
- "yeoman-environment": "^3.9.1"
58
+ "yeoman-environment": "^6.1.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@backstage/cli": "0.36.4-next.0"
61
+ "@backstage/cli": "0.36.4-next.2"
62
62
  }
63
63
  }