New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-upgrade

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-upgrade - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

fixtures/jest.json

3

package.json
{
"name": "babel-upgrade",
"version": "0.0.8",
"version": "0.0.9",
"description": "Upgrade tool for Babel",

@@ -15,2 +15,3 @@ "bin": "./bin/babel-upgrade",

"dependencies": {
"globby": "^8.0.1",
"json5": "^0.5.1",

@@ -17,0 +18,0 @@ "pify": "^3.0.0",

@@ -9,5 +9,4 @@ # babel-upgrade

> Update dependencies, config file, files that require babel directly
> Update dependencies, config files, and maybe JavaScript files that require babel packages directly
- [ ] auto run npm or yarn
- [x] Update `package.json`: `dependencies` and `devDependencies` to the "latest supported" version.

@@ -19,7 +18,10 @@ - This includes doing all package renames

- [x] throw/warn if engines is < node 4 or current node is < 4?
- [x] use `"babel-core": "^7.0.0-bridge-0"` if jest is a dependency
- [x] add new `@babel/node` package if `babel-node` is used
- [ ] log when replacing out preset-es2015,16,17,latest as FYI
- [ ] if `babel-node` is used, import `@babel/node`?
- [ ] Auto run npm or yarn after updating dependencies
- [ ] Update the babel config file(s).
- [x] `.babelrc`
- [ ] `.babelrc.js`
- [ ] `.babelrc.js` and other js files with a config like presets, `webpack.config.js`
- [x] `package.json babel key`

@@ -36,6 +38,7 @@ - [x] handle `env`

- Update the use of the Babel API (plugins, integrations)
- [ ] Misc files as we go (`karma.conf.js`, `mocha.opts`)
- [ ] Modify misc files as we go (`karma.conf.js`, `mocha.opts`)
- [ ] Add to the upgrade guide which parts are autofixable and the command (if we care enough to make this individually runnable too infrastructure wise)
- [ ] May need to add a warning on any 3rd party plugins since they might not be compatible
- [ ] later: work on node 4
- [ ] Handle the differences in plugins in v7 for default/loose/spec
- [ ] Later: work on node 4
- [ ] Should certain parts be generic (replace the string `babel-register` with `@babel/register`)? Could be in a Makefile or somewhere else, but it's just find replace.

@@ -42,0 +45,0 @@

const { updatePackageJSON } = require('../');
const upgradeDeps = require('../upgradeDeps');
const babelCoreFixture = require('../../fixtures/babel-core');
const jestFixture = require('../../fixtures/jest');
const depsFixture = require('../../fixtures/deps');
const depsFixtureEarlierBeta = require('../../fixtures/deps-earlier-beta.json');
const scriptsFixture = require('../../fixtures/script');
const scriptsMochaFixture = require('../../fixtures/scripts-mocha');
const scriptsBabelNodeFixture = require('../../fixtures/scripts-babel-node');

@@ -13,3 +15,4 @@ test('packages', () => {

test('scripts', () => {
expect(updatePackageJSON(scriptsFixture)).toMatchSnapshot();
expect(updatePackageJSON(scriptsMochaFixture)).toMatchSnapshot();
expect(updatePackageJSON(scriptsBabelNodeFixture)).toMatchSnapshot();
});

@@ -21,4 +24,8 @@

test('jest babel-core bridge', () => {
expect(updatePackageJSON(jestFixture)).toMatchSnapshot();
});
test('packages - earlier v7', () => {
expect(upgradeDeps(depsFixtureEarlierBeta, "7.0.0-beta.39")).toMatchSnapshot();
});

@@ -38,7 +38,26 @@ const path = require('path');

if (pkg.scripts) {
pkg.scripts = upgradeScripts(pkg.scripts);
if (Object.values(pkg.scripts).some(s => s.includes('babel-node'))) {
if (pkg.devDependencies) {
pkg.devDependencies["@babel/node"] = getLatestVersion();
}
}
}
if (pkg.devDependencies) {
pkg.devDependencies = sortKeys(upgradeDeps(
pkg.devDependencies = upgradeDeps(
pkg.devDependencies,
getLatestVersion()
));
);
const devDeps = Object.keys(pkg.devDependencies);
// use babel-bridge for jest
// maybe should do this for other tools?
if (devDeps.includes("jest") && !devDeps.includes("babel-core")) {
pkg.devDependencies["babel-core"] = "^7.0.0-bridge.0";
}
pkg.devDependencies = sortKeys(pkg.devDependencies);
}

@@ -53,6 +72,2 @@

if (pkg.scripts) {
pkg.scripts = upgradeScripts(pkg.scripts);
}
return pkg;

@@ -91,3 +106,3 @@ }

if (json) {
console.log("Updating ./.babelrc config");
console.log(`Updating .babelrc config at ${configPath}`);
json = upgradeConfig(json);

@@ -94,0 +109,0 @@ await writeJsonFile(configPath, json, { detectIndent: true });

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc