jscodeshift
Advanced tools
Comparing version 17.0.0 to 17.1.0
@@ -10,2 +10,13 @@ # Changelog | ||
## [17.1.0] 2024-10-30 | ||
### Added | ||
- `pkg.pr.new` will now be used to build an npm pakage for each commit to the repo, allowing you to more easily test changes or use new features before an official release is cut. (#622, @Aslemammad) | ||
### Changed | ||
- Replaced `temp` library with `tmp` (#633, @r4zendev) | ||
### Fixed | ||
- Removed old `docs` command from `package.json` since the new docs are in the `website` folder, which has instructions in its README. | ||
## [17.0.0] 2024-08-06 | ||
@@ -16,3 +27,3 @@ | ||
### Fixed | ||
- Node.js 16 is now explicitly specified as the minimum required version. It was *already* (#607, @trivikr) | ||
- Node.js 16 is now explicitly specified as the minimum required version. It was *already* implicitly required due to some dependencies requiring it, but this wasn't explicitly specified until now. (#607, @trivikr) | ||
@@ -19,0 +30,0 @@ ### Added |
@@ -160,2 +160,11 @@ | ||
if ( | ||
(types.JSXOpeningElement.check(parent) || types.JSXClosingElement.check(parent)) && | ||
parent.name === path.node && | ||
/^[a-z]/.test(path.node.name) | ||
) { | ||
// <oldName></oldName> | ||
return false; | ||
} | ||
return true; | ||
@@ -162,0 +171,0 @@ }) |
@@ -17,5 +17,7 @@ | ||
const https = require('https'); | ||
const temp = require('temp'); | ||
const ignores = require('./ignoreFiles'); | ||
const tmp = require('tmp'); | ||
tmp.setGracefulCleanup(); | ||
const availableCpus = Math.max(require('os').cpus().length - 1, 1); | ||
@@ -164,3 +166,2 @@ const CHUNK_SIZE = 50; | ||
function run(transformFile, paths, options) { | ||
let usedRemoteScript = false; | ||
const cpus = options.cpus ? Math.min(availableCpus, options.cpus) : availableCpus; | ||
@@ -184,3 +185,2 @@ const extensions = | ||
if (/^http/.test(transformFile)) { | ||
usedRemoteScript = true; | ||
return new Promise((resolve, reject) => { | ||
@@ -196,9 +196,9 @@ // call the correct `http` or `https` implementation | ||
const ext = path.extname(transformFile); | ||
temp.open({ prefix: 'jscodeshift', suffix: ext }, (err, info) => { | ||
tmp.file({ prefix: 'jscodeshift', postfix: ext }, (err, path, fd) => { | ||
if (err) return reject(err); | ||
fs.write(info.fd, contents, function (err) { | ||
fs.write(fd, contents, function (err) { | ||
if (err) return reject(err); | ||
fs.close(info.fd, function(err) { | ||
fs.close(fd, function(err) { | ||
if (err) return reject(err); | ||
transform(info.path).then(resolve, reject); | ||
transform(path).then(resolve, reject); | ||
}); | ||
@@ -317,5 +317,2 @@ }); | ||
} | ||
if (usedRemoteScript) { | ||
temp.cleanupSync(); | ||
} | ||
return Object.assign({ | ||
@@ -322,0 +319,0 @@ stats: statsCounter, |
{ | ||
"name": "jscodeshift", | ||
"version": "17.0.0", | ||
"version": "17.1.0", | ||
"description": "A toolkit for JavaScript codemods", | ||
@@ -13,4 +13,3 @@ "repository": { | ||
"prepare": "cp -R src/ dist/", | ||
"test": "jest --bail", | ||
"docs": "rm -rf docs && jsdoc -d docs -R README.md src/collections/* src/core.js src/Collection.js" | ||
"test": "jest --bail" | ||
}, | ||
@@ -38,3 +37,2 @@ "bin": { | ||
"@babel/register": "^7.24.6", | ||
"picocolors": "^1.0.1", | ||
"flow-parser": "0.*", | ||
@@ -44,4 +42,5 @@ "graceful-fs": "^4.2.4", | ||
"neo-async": "^2.5.0", | ||
"picocolors": "^1.0.1", | ||
"recast": "^0.23.9", | ||
"temp": "^0.9.4", | ||
"tmp": "^0.2.3", | ||
"write-file-atomic": "^5.0.1" | ||
@@ -48,0 +47,0 @@ }, |
@@ -30,2 +30,4 @@ # [jscodeshift](https://jscodeshift.com/) [![Support Ukraine](https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat&labelColor=005BBB)](https://opensource.fb.com/support-ukraine) [![Build Status](https://img.shields.io/github/checks-status/facebook/jscodeshift/main?label=build)](https://github.com/facebook/jscodeshift/actions/workflows/test.yml?query=branch%3Amain) | ||
See [the website](https://jscodeshift.com/) for full documentation. | ||
The CLI provides the following options: | ||
@@ -32,0 +34,0 @@ |
@@ -160,2 +160,11 @@ | ||
if ( | ||
(types.JSXOpeningElement.check(parent) || types.JSXClosingElement.check(parent)) && | ||
parent.name === path.node && | ||
/^[a-z]/.test(path.node.name) | ||
) { | ||
// <oldName></oldName> | ||
return false; | ||
} | ||
return true; | ||
@@ -162,0 +171,0 @@ }) |
@@ -17,5 +17,7 @@ | ||
const https = require('https'); | ||
const temp = require('temp'); | ||
const ignores = require('./ignoreFiles'); | ||
const tmp = require('tmp'); | ||
tmp.setGracefulCleanup(); | ||
const availableCpus = Math.max(require('os').cpus().length - 1, 1); | ||
@@ -164,3 +166,2 @@ const CHUNK_SIZE = 50; | ||
function run(transformFile, paths, options) { | ||
let usedRemoteScript = false; | ||
const cpus = options.cpus ? Math.min(availableCpus, options.cpus) : availableCpus; | ||
@@ -184,3 +185,2 @@ const extensions = | ||
if (/^http/.test(transformFile)) { | ||
usedRemoteScript = true; | ||
return new Promise((resolve, reject) => { | ||
@@ -196,9 +196,9 @@ // call the correct `http` or `https` implementation | ||
const ext = path.extname(transformFile); | ||
temp.open({ prefix: 'jscodeshift', suffix: ext }, (err, info) => { | ||
tmp.file({ prefix: 'jscodeshift', postfix: ext }, (err, path, fd) => { | ||
if (err) return reject(err); | ||
fs.write(info.fd, contents, function (err) { | ||
fs.write(fd, contents, function (err) { | ||
if (err) return reject(err); | ||
fs.close(info.fd, function(err) { | ||
fs.close(fd, function(err) { | ||
if (err) return reject(err); | ||
transform(info.path).then(resolve, reject); | ||
transform(path).then(resolve, reject); | ||
}); | ||
@@ -317,5 +317,2 @@ }); | ||
} | ||
if (usedRemoteScript) { | ||
temp.cleanupSync(); | ||
} | ||
return Object.assign({ | ||
@@ -322,0 +319,0 @@ stats: statsCounter, |
@@ -13,3 +13,3 @@ | ||
const path = require('path'); | ||
const temp = require('temp'); | ||
const tmp = require('tmp'); | ||
@@ -25,4 +25,4 @@ function renameFileTo(oldPath, newFilename, extension = '') { | ||
function createTempFileWith(content, filename, extension) { | ||
const info = temp.openSync({ suffix: extension }); | ||
let filePath = info.path; | ||
const info = tmp.fileSync({ postfix: extension }); | ||
let filePath = info.name; | ||
fs.writeSync(info.fd, content); | ||
@@ -29,0 +29,0 @@ fs.closeSync(info.fd); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
467676
92
7934
671
+ Addedtmp@^0.2.3
+ Addedtmp@0.2.3(transitive)
- Removedtemp@^0.9.4
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrimraf@2.6.3(transitive)
- Removedtemp@0.9.4(transitive)
- Removedwrappy@1.0.2(transitive)