@backstage/codemods 0.1.53 → 0.1.54-next.0
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 +8 -0
- package/bin/backstage-codemods +4 -2
- package/dist/action.cjs.js +4 -4
- package/dist/action.cjs.js.map +1 -1
- package/dist/package.json.cjs.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/bin/backstage-codemods
CHANGED
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
const path = require('path');
|
|
18
|
+
const path = require('node:path');
|
|
19
19
|
|
|
20
20
|
// Figure out whether we're running inside the backstage repo or as an installed dependency
|
|
21
21
|
/* eslint-disable-next-line no-restricted-syntax */
|
|
22
|
-
const isLocal = require('fs').existsSync(
|
|
22
|
+
const isLocal = require('node:fs').existsSync(
|
|
23
|
+
path.resolve(__dirname, '../src'),
|
|
24
|
+
);
|
|
23
25
|
|
|
24
26
|
if (!isLocal) {
|
|
25
27
|
require('..');
|
package/dist/action.cjs.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var node_path = require('node:path');
|
|
4
4
|
var cliCommon = require('@backstage/cli-common');
|
|
5
|
-
var
|
|
5
|
+
var node_os = require('node:os');
|
|
6
6
|
|
|
7
7
|
const paths = cliCommon.findPaths(__dirname);
|
|
8
8
|
function createCodemodAction(name) {
|
|
9
9
|
return async (dirs, opts) => {
|
|
10
|
-
const transformPath =
|
|
10
|
+
const transformPath = node_path.relative(
|
|
11
11
|
process.cwd(),
|
|
12
12
|
paths.resolveOwn("transforms", `${name}.js`)
|
|
13
13
|
);
|
|
@@ -28,7 +28,7 @@ function createCodemodAction(name) {
|
|
|
28
28
|
}
|
|
29
29
|
console.log(`Running jscodeshift with these arguments: ${args.join(" ")}`);
|
|
30
30
|
let commandArgs;
|
|
31
|
-
if (
|
|
31
|
+
if (node_os.platform() === "win32") {
|
|
32
32
|
commandArgs = ["jscodeshift", ...args];
|
|
33
33
|
} else {
|
|
34
34
|
commandArgs = [
|
package/dist/action.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.cjs.js","sources":["../src/action.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { relative as relativePath } from 'path';\nimport { OptionValues } from 'commander';\nimport { findPaths, run } from '@backstage/cli-common';\nimport { platform } from 'os';\n\n// eslint-disable-next-line no-restricted-syntax\nconst paths = findPaths(__dirname);\n\nexport function createCodemodAction(name: string) {\n return async (dirs: string[], opts: OptionValues) => {\n const transformPath = relativePath(\n process.cwd(),\n paths.resolveOwn('transforms', `${name}.js`),\n );\n\n const args = [\n '--parser=tsx',\n '--extensions=tsx,js,ts,tsx',\n '--transform',\n transformPath,\n '--ignore-pattern=**/node_modules/**',\n ];\n\n if (opts.dry) {\n args.push('--dry');\n }\n\n if (dirs.length) {\n args.push(...dirs);\n } else {\n args.push('.');\n }\n\n console.log(`Running jscodeshift with these arguments: ${args.join(' ')}`);\n\n let commandArgs: string[];\n if (platform() === 'win32') {\n commandArgs = ['jscodeshift', ...args];\n } else {\n // jscodeshift ships a slightly broken bin script with windows\n // line endings so we need to execute it using node rather than\n // letting the `#!/usr/bin/env node` take care of it\n commandArgs = [\n process.argv0,\n require.resolve('.bin/jscodeshift'),\n ...args,\n ];\n }\n\n await run(commandArgs, {\n env: {\n ...process.env,\n FORCE_COLOR: 'true',\n },\n }).waitForExit();\n };\n}\n"],"names":["findPaths","relativePath","platform","run"],"mappings":";;;;;;AAsBA,MAAM,KAAA,GAAQA,oBAAU,SAAS,CAAA;AAE1B,SAAS,oBAAoB,IAAA,EAAc;AAChD,EAAA,OAAO,OAAO,MAAgB,IAAA,KAAuB;AACnD,IAAA,MAAM,aAAA,GAAgBC,
|
|
1
|
+
{"version":3,"file":"action.cjs.js","sources":["../src/action.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { relative as relativePath } from 'node:path';\nimport { OptionValues } from 'commander';\nimport { findPaths, run } from '@backstage/cli-common';\nimport { platform } from 'node:os';\n\n// eslint-disable-next-line no-restricted-syntax\nconst paths = findPaths(__dirname);\n\nexport function createCodemodAction(name: string) {\n return async (dirs: string[], opts: OptionValues) => {\n const transformPath = relativePath(\n process.cwd(),\n paths.resolveOwn('transforms', `${name}.js`),\n );\n\n const args = [\n '--parser=tsx',\n '--extensions=tsx,js,ts,tsx',\n '--transform',\n transformPath,\n '--ignore-pattern=**/node_modules/**',\n ];\n\n if (opts.dry) {\n args.push('--dry');\n }\n\n if (dirs.length) {\n args.push(...dirs);\n } else {\n args.push('.');\n }\n\n console.log(`Running jscodeshift with these arguments: ${args.join(' ')}`);\n\n let commandArgs: string[];\n if (platform() === 'win32') {\n commandArgs = ['jscodeshift', ...args];\n } else {\n // jscodeshift ships a slightly broken bin script with windows\n // line endings so we need to execute it using node rather than\n // letting the `#!/usr/bin/env node` take care of it\n commandArgs = [\n process.argv0,\n require.resolve('.bin/jscodeshift'),\n ...args,\n ];\n }\n\n await run(commandArgs, {\n env: {\n ...process.env,\n FORCE_COLOR: 'true',\n },\n }).waitForExit();\n };\n}\n"],"names":["findPaths","relativePath","platform","run"],"mappings":";;;;;;AAsBA,MAAM,KAAA,GAAQA,oBAAU,SAAS,CAAA;AAE1B,SAAS,oBAAoB,IAAA,EAAc;AAChD,EAAA,OAAO,OAAO,MAAgB,IAAA,KAAuB;AACnD,IAAA,MAAM,aAAA,GAAgBC,kBAAA;AAAA,MACpB,QAAQ,GAAA,EAAI;AAAA,MACZ,KAAA,CAAM,UAAA,CAAW,YAAA,EAAc,CAAA,EAAG,IAAI,CAAA,GAAA,CAAK;AAAA,KAC7C;AAEA,IAAA,MAAM,IAAA,GAAO;AAAA,MACX,cAAA;AAAA,MACA,4BAAA;AAAA,MACA,aAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,IAAI,KAAK,GAAA,EAAK;AACZ,MAAA,IAAA,CAAK,KAAK,OAAO,CAAA;AAAA,IACnB;AAEA,IAAA,IAAI,KAAK,MAAA,EAAQ;AACf,MAAA,IAAA,CAAK,IAAA,CAAK,GAAG,IAAI,CAAA;AAAA,IACnB,CAAA,MAAO;AACL,MAAA,IAAA,CAAK,KAAK,GAAG,CAAA;AAAA,IACf;AAEA,IAAA,OAAA,CAAQ,IAAI,CAAA,0CAAA,EAA6C,IAAA,CAAK,IAAA,CAAK,GAAG,CAAC,CAAA,CAAE,CAAA;AAEzE,IAAA,IAAI,WAAA;AACJ,IAAA,IAAIC,gBAAA,OAAe,OAAA,EAAS;AAC1B,MAAA,WAAA,GAAc,CAAC,aAAA,EAAe,GAAG,IAAI,CAAA;AAAA,IACvC,CAAA,MAAO;AAIL,MAAA,WAAA,GAAc;AAAA,QACZ,OAAA,CAAQ,KAAA;AAAA,QACR,OAAA,CAAQ,QAAQ,kBAAkB,CAAA;AAAA,QAClC,GAAG;AAAA,OACL;AAAA,IACF;AAEA,IAAA,MAAMC,cAAI,WAAA,EAAa;AAAA,MACrB,GAAA,EAAK;AAAA,QACH,GAAG,OAAA,CAAQ,GAAA;AAAA,QACX,WAAA,EAAa;AAAA;AACf,KACD,EAAE,WAAA,EAAY;AAAA,EACjB,CAAA;AACF;;;;"}
|
package/dist/package.json.cjs.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/codemods",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.54-next.0",
|
|
4
4
|
"description": "A collection of codemods for Backstage projects",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "cli"
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"watch": "./src"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@backstage/cli-common": "
|
|
46
|
+
"@backstage/cli-common": "0.1.18-next.0",
|
|
47
47
|
"chalk": "^4.0.0",
|
|
48
48
|
"commander": "^12.0.0",
|
|
49
49
|
"jscodeshift": "^0.16.0",
|
|
50
50
|
"jscodeshift-add-imports": "^1.0.10"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@backstage/cli": "
|
|
53
|
+
"@backstage/cli": "0.35.3-next.0",
|
|
54
54
|
"@types/jscodeshift": "^0.12.0",
|
|
55
55
|
"@types/node": "^22.13.14"
|
|
56
56
|
}
|