ember-bootstrap-codemods
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -7,5 +7,3 @@ #!/usr/bin/env node | ||
process.argv[2] /* transform name */, | ||
process.argv.slice(3) /* paths or globs */, | ||
undefined, | ||
'template' | ||
process.argv.slice(3) /* paths or globs */ | ||
); |
{ | ||
"name": "ember-bootstrap-codemods", | ||
"description": "Codemods to ease upgrading of ember-bootstrap", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Simon Ihmig <simon.ihmig@kaliber5.de", | ||
@@ -23,3 +23,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"codemod-cli": "simonihmig/codemod-cli#template-support" | ||
"codemod-cli": "rwjblue/codemod-cli#1e080835dd8ffecb1e0795a897e6b3b0d1da281d" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
@@ -61,18 +61,14 @@ // https://astexplorer.net/#/gist/c10a1686d9bb15c5135fc243e8667e08/2897125cac87f759ace2248d481d9d45ebb6e047 | ||
function isFormElement(node, elementStack) { | ||
function componentYieldedBy(node, elementStack) { | ||
if (node.type !== 'ElementNode') { | ||
return false; | ||
return null; | ||
} | ||
let [yieldName, propery] = node.tag.split('.'); | ||
let [yieldName, property] = node.tag.split('.'); | ||
if (propery !== 'element') { | ||
return false; | ||
} | ||
if (elementStack.length < 2) { | ||
return false; | ||
return null; | ||
} | ||
const parentYield = elementStack | ||
let parentYield = elementStack | ||
.slice() | ||
@@ -82,9 +78,13 @@ .reverse() | ||
if (!parentYield || parentYield.tag !== 'BsForm') { | ||
return false; | ||
} | ||
return parentYield ? `${parentYield.tag}::${property}` : null; | ||
} | ||
return true; | ||
function isButtonInButtonGroup(node, elementStack) { | ||
return componentYieldedBy(node, elementStack) === 'BsButtonGroup::button'; | ||
} | ||
function isFormElement(node, elementStack) { | ||
return componentYieldedBy(node, elementStack) === 'BsForm::element'; | ||
} | ||
function visitor(env) { | ||
@@ -99,4 +99,8 @@ const b = env.syntax.builders; | ||
elementStack.push(node); | ||
const deprecatedArguments = simpleDeprecations[node.tag]; | ||
let deprecatedArguments = simpleDeprecations[node.tag]; | ||
if (isButtonInButtonGroup(node, elementStack)) { | ||
deprecatedArguments = simpleDeprecations.BsButton; | ||
} | ||
if ( | ||
@@ -172,1 +176,3 @@ deprecatedArguments && | ||
}; | ||
module.exports.type = 'hbs'; |
@@ -6,4 +6,3 @@ 'use strict'; | ||
runTransformTest({ | ||
type: 'template', | ||
name: 'deprecated-attribute-arguments', | ||
}); |
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
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
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
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
13364
12
154