gatsby-codemods
Advanced tools
Comparing version 1.0.11 to 1.1.0
@@ -6,2 +6,6 @@ # Change Log | ||
# [1.1.0](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-codemods/compare/gatsby-codemods@1.0.11...gatsby-codemods@1.1.0) (2019-06-20) | ||
**Note:** Version bump only for package gatsby-codemods | ||
## [1.0.11](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-codemods/compare/gatsby-codemods@1.0.10...gatsby-codemods@1.0.11) (2019-04-23) | ||
@@ -8,0 +12,0 @@ |
{ | ||
"name": "gatsby-codemods", | ||
"version": "1.0.11", | ||
"version": "1.1.0", | ||
"description": "A collection of codemod scripts for use with JSCodeshift that help migrate to newer versions of Gatsby.", | ||
@@ -31,7 +31,10 @@ "main": "index.js", | ||
"@babel/core": "^7.0.0", | ||
"babel-preset-gatsby-package": "^0.1.4", | ||
"babel-preset-gatsby-package": "^0.2.0", | ||
"cross-env": "^5.0.5", | ||
"jscodeshift": "^0.5.1" | ||
}, | ||
"gitHead": "c35dab51ef9eaf41376579b314f607c683f20c37" | ||
"engines": { | ||
"node": ">=8.0.0" | ||
}, | ||
"gitHead": "90d9440bcd44c2b6d70c78bd30adc8c0eec90fc6" | ||
} |
@@ -7,4 +7,5 @@ "use strict"; | ||
/* eslint-disable */ | ||
const _require = require(`gatsby`), | ||
Link = _require.Link; | ||
const { | ||
Link | ||
} = require(`gatsby`); | ||
@@ -11,0 +12,0 @@ const query = graphql` |
@@ -7,5 +7,6 @@ "use strict"; | ||
/* eslint-disable */ | ||
const _require = require(`gatsby`), | ||
Link = _require.Link, | ||
graphql = _require.graphql; | ||
const { | ||
Link, | ||
graphql | ||
} = require(`gatsby`); | ||
@@ -12,0 +13,0 @@ const query = graphql` |
@@ -7,4 +7,5 @@ "use strict"; | ||
/* eslint-disable */ | ||
const _require = require(`gatsby`), | ||
graphql = _require.graphql; | ||
const { | ||
graphql | ||
} = require(`gatsby`); | ||
@@ -11,0 +12,0 @@ const Link = require("gatsby-link"); |
@@ -7,5 +7,6 @@ "use strict"; | ||
/* eslint-disable */ | ||
const _require = require(`gatsby`), | ||
graphql = _require.graphql, | ||
Link = _require.Link; | ||
const { | ||
graphql, | ||
Link | ||
} = require(`gatsby`); | ||
@@ -12,0 +13,0 @@ const query = graphql` |
@@ -9,4 +9,5 @@ "use strict"; | ||
const _require = require('gatsby-link'), | ||
navigateTo = _require.navigateTo; | ||
const { | ||
navigateTo | ||
} = require('gatsby-link'); | ||
@@ -13,0 +14,0 @@ function Example() { |
@@ -9,4 +9,5 @@ "use strict"; | ||
const _require = require('gatsby'), | ||
navigate = _require.navigate; | ||
const { | ||
navigate | ||
} = require('gatsby'); | ||
@@ -13,0 +14,0 @@ function Example() { |
"use strict"; | ||
const _require = require(`gatsby-source-filesystem`), | ||
createFilePath = _require.createFilePath; | ||
const { | ||
createFilePath | ||
} = require(`gatsby-source-filesystem`); | ||
@@ -11,3 +12,5 @@ exports.onCreateNode = ({ | ||
}) => { | ||
const createNodeField = boundActionCreators.createNodeField; | ||
const { | ||
createNodeField | ||
} = boundActionCreators; | ||
@@ -14,0 +17,0 @@ if (node.internal.type === `MarkdownRemark`) { |
"use strict"; | ||
const _require = require(`gatsby-source-filesystem`), | ||
createFilePath = _require.createFilePath; | ||
const { | ||
createFilePath | ||
} = require(`gatsby-source-filesystem`); | ||
@@ -11,3 +12,5 @@ exports.onCreateNode = ({ | ||
}) => { | ||
const createNodeField = actions.createNodeField; | ||
const { | ||
createNodeField | ||
} = actions; | ||
@@ -14,0 +17,0 @@ if (node.internal.type === `MarkdownRemark`) { |
"use strict"; | ||
const _require = require(`gatsby-source-filesystem`), | ||
createFilePath = _require.createFilePath; | ||
const { | ||
createFilePath | ||
} = require(`gatsby-source-filesystem`); | ||
exports.onCreateNode = arg => { | ||
const node = arg.node, | ||
getNode = arg.getNode; | ||
const { | ||
node, | ||
getNode | ||
} = arg; | ||
@@ -10,0 +13,0 @@ if (node.internal.type === `MarkdownRemark`) { |
"use strict"; | ||
const _require = require(`gatsby-source-filesystem`), | ||
createFilePath = _require.createFilePath; | ||
const { | ||
createFilePath | ||
} = require(`gatsby-source-filesystem`); | ||
exports.onCreateNode = arg => { | ||
const node = arg.node, | ||
getNode = arg.getNode; | ||
const { | ||
node, | ||
getNode | ||
} = arg; | ||
@@ -10,0 +13,0 @@ if (node.internal.type === `MarkdownRemark`) { |
@@ -53,3 +53,5 @@ "use strict"; | ||
if (namespace.length) { | ||
let name = namespace.get(0).node.local.name; | ||
let { | ||
name | ||
} = namespace.get(0).node.local; | ||
root.find(j.TaggedTemplateExpression, { | ||
@@ -68,3 +70,5 @@ tag: { | ||
let specifiers = existingImport.get(0).node.specifiers; | ||
let { | ||
specifiers | ||
} = existingImport.get(0).node; | ||
existingImport.get(`specifiers`, specifiers.length - 1).insertAfter(j.importSpecifier(j.identifier(IMPORT_NAME))); | ||
@@ -87,3 +91,5 @@ } | ||
if (!pattern.length) { | ||
let name = existingImport.get(`id`).node.name; | ||
let { | ||
name | ||
} = existingImport.get(`id`).node; | ||
root.find(j.TaggedTemplateExpression, { | ||
@@ -102,3 +108,5 @@ tag: { | ||
let properties = pattern.get(0).node.properties; | ||
let { | ||
properties | ||
} = pattern.get(0).node; | ||
let property = j.objectProperty(j.identifier(IMPORT_NAME), j.identifier(IMPORT_NAME)); | ||
@@ -105,0 +113,0 @@ property.shorthand = true; |
@@ -48,3 +48,5 @@ "use strict"; | ||
const firstNode = getFirstNode(j, root); | ||
const comments = firstNode.comments; | ||
const { | ||
comments | ||
} = firstNode; | ||
root.find(j.Program).get(`body`, 0).insertBefore(j.importDeclaration([j.importSpecifier(j.identifier(IMPORT_NAME))], j.literal(MODULE_NAME))); | ||
@@ -63,3 +65,5 @@ const newFirstNode = getFirstNode(j, root); | ||
if (namespace.length) { | ||
let name = namespace.get(0).node.local.name; | ||
let { | ||
name | ||
} = namespace.get(0).node.local; | ||
root.find(j.JSXIdentifier, { | ||
@@ -76,3 +80,5 @@ name: IMPORT_NAME | ||
let specifiers = existingImport.get(0).node.specifiers; | ||
let { | ||
specifiers | ||
} = existingImport.get(0).node; | ||
existingImport.get(`specifiers`, specifiers.length - 1).insertAfter(j.importSpecifier(j.identifier(IMPORT_NAME))); | ||
@@ -130,3 +136,5 @@ } | ||
if (!pattern.length) { | ||
let name = existingImport.get(`id`).node.name; | ||
let { | ||
name | ||
} = existingImport.get(`id`).node; | ||
root.find(j.JSXIdentifier, { | ||
@@ -143,3 +151,5 @@ name: IMPORT_NAME | ||
let properties = pattern.get(0).node.properties; | ||
let { | ||
properties | ||
} = pattern.get(0).node; | ||
let property = j.objectProperty(j.identifier(IMPORT_NAME), j.identifier(IMPORT_NAME)); | ||
@@ -146,0 +156,0 @@ property.shorthand = true; |
@@ -66,5 +66,3 @@ "use strict"; | ||
if (!gatsbyImport.length) { | ||
const _getFirstNode = getFirstNode(j, root), | ||
first = _getFirstNode[0]; | ||
const [first] = getFirstNode(j, root); | ||
let statement = j.importDeclaration([j.importSpecifier(j.identifier(METHOD))], j.literal(MODULE_NAME)); | ||
@@ -92,5 +90,3 @@ first.insertAfter(statement); | ||
if (!gatsbyRequire.length) { | ||
const _getFirstNode2 = getFirstNode(j, root), | ||
first = _getFirstNode2[0]; | ||
const [first] = getFirstNode(j, root); | ||
let statement = j.template.statement([`const { ${METHOD} } = require('${MODULE_NAME}');\n`]); | ||
@@ -97,0 +93,0 @@ first.insertAfter(statement); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
940
0
37930