-
-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ast(parser): add #456
ast(parser): add #456
Conversation
Split these up to PR's for Add, update and remove respectively. |
if (node.size() !== 0) { | ||
// push to existing key | ||
return ast; | ||
// select node with existing key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Abstract this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use findRootNodesByName
util method.
packages/utils/recursive-parser.js
Outdated
) | ||
); | ||
} else if (action === "remove") { | ||
j(p).remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not enough, just worry about the update feature for now
b2cb7c8
to
d3ed32c
Compare
packages/utils/recursive-parser.js
Outdated
return utils.findRootNodesByName( | ||
j, root, key | ||
) | ||
.forEach(p => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is p
? Could we choose a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p
refers to Path or NodePaths. Using variable p
is a common convention with jscodeshift codemods. And we use it everywhere. A similar conventions goes for variable j
which refers to jscodeshift API.
I do believe we can have a better name. @ev1stensberg WDYT? Should we change this to something like path
everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But p
has a different meaning based on where it is used. We have JSDoc that helps us already. At least let's give something to the developers, so when they land to the code they know what that variable is meant for.
Here's it could stay, but inside the function updateProperty
, it could have a name that means something. This is my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p is alright
// get module.exports prop | ||
const root = ast | ||
.find(j.ObjectExpression) | ||
.filter(p => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
packages/utils/ast-utils.js
Outdated
* @returns {Node} - the updated ast | ||
*/ | ||
|
||
function updateProperty(j, p, key, value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here, p
means nothing. We could call it propertyToAdd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p is fine, it's an ast node, we don't really care about the type of the node as long as we're updating its properties ( see the name of the function )
packages/utils/ast-utils.js
Outdated
*/ | ||
|
||
function updateProperty(j, p, key, value) { | ||
let valForNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valForNode
can be moved after the if
. There's no need to declare it if we exist from the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can move it below if (!p) { return; }
check, but not inside if block as it's getting assigned in every if else condition which will make variable declarations redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can move it below if (!p) { return; } check
Yes, that's what I meant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First rule of recursion is to have an exit condition, but for this function it needs to exit gracefully, as it's expected to return a node
packages/utils/ast-utils.js
Outdated
return; | ||
} | ||
if (Array.isArray(value)) { | ||
let arrExp = j.arrayExpression([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arrExp
can have different name. Maybe valueForNodeAsArray
? Or something like that means something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the name. arrExp
will be either a blank/new ArrayExpression node or existing ArrayExpression node in case of existing array properties like plugins. The final value (right-hand part) will be stored in valForNode
variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I get that. I am more up for names that mean something based on the context of the operation. Just that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a comment will do, if you follow common sense we check if the value is an array exp, so we want to create an array node
packages/utils/ast-utils.js
Outdated
addProperty(j, arrExp, null, val); | ||
}); | ||
valForNode = arrExp; | ||
} else if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have comment here where we explain what kind of check we're doing? That __paths
sounds like an internal thing, so it would be better to explain why
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ev1stensberg This check is to avoid AST nodes during the recursion, right? So, this will pass only object values from webpack config and avoid AST node objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a node has __paths
, it's a regexp which cannot be resolved into a regular literal or identifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth leaving a comment inside the code
packages/utils/ast-utils.js
Outdated
} | ||
let pushVal; | ||
if (key) { | ||
pushVal = j.property("init", j.identifier(key), valForNode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do you have this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost every case. What happens is that we compute the right-hand part of a particular property (for instance development or production) and store it in valForNode
variable. We then push this value to the key (mode in this case). Similarly, valForNode
can be a Literal (mode), ArrayExpression (plugins) or ObjectExpression(output).
The else part of this check happens when we recursively add something. For instance, we have an array of objects (rules). We will recursively add every object to an ArrayExpression. In this case, there is no key
. We just have to keep adding objects inside the array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few names to change plus questions
packages/utils/recursive-parser.js
Outdated
return utils.findRootNodesByName( | ||
j, root, key | ||
) | ||
.forEach(p => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p is alright
packages/utils/recursive-parser.js
Outdated
return root.forEach(p => { | ||
if (key === "topScope") { | ||
utils.parseTopScope(j, p, value); | ||
} else if (key === "merge") { | ||
utils.parseMerge(j, p, value); | ||
} else { | ||
// init, add new property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment right after conditional if you're gonna comment it. Also, I think it's clear what we are doing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part would be used in add command in cases when a property doesn't exist. For instance, when someone tries to add mode
property which isn't present in config, node.size()
will be 0 and this addProperty()
would be called. And in cases when mode
is already present and we're overwriting it by updateProperty()
. Basically, add and update commands would work same.
That's why want to make super clear that this part of the code is getting used in init and add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can just have three options: add
(renamed from init), update
and remove
packages/utils/ast-utils.js
Outdated
!(value.__paths || value instanceof RegExp) | ||
) { | ||
let objectExp = j.objectExpression([]); | ||
if (safeTraverse(p, [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll have to check the entire key/val operation. Not sure if this is enough, let me test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some tests. Let me know if you run into any issues here.
packages/utils/ast-utils.js
Outdated
*/ | ||
|
||
function updateProperty(j, p, key, value) { | ||
let valForNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First rule of recursion is to have an exit condition, but for this function it needs to exit gracefully, as it's expected to return a node
packages/utils/ast-utils.js
Outdated
* @returns {Node} - the updated ast | ||
*/ | ||
|
||
function updateProperty(j, p, key, value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p is fine, it's an ast node, we don't really care about the type of the node as long as we're updating its properties ( see the name of the function )
|
||
module.exports = { | ||
entry: { | ||
ed: 'index.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really ed Sheeran
ha ha 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He's a good singer though! 😆
@dhruvdutt could you do a rebase? |
Rebased. PTAL @ev1stensberg |
} | ||
} | ||
], | ||
nice: "':)'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also adda a Promise
to the test? Just to make sure that we cover every case
{
foo: Promise.resolve()
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added! 👍
@@ -25,3 +25,55 @@ defineTest( | |||
}, | |||
"init" | |||
); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it behave if you tried to add property that already exists? Could you define a test for this case please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ Otherwise this would just be the init
feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entry
was already present in the input fixture. I've added mode
as well to make it clearer.
packages/utils/ast-utils.js
Outdated
/** | ||
* | ||
* Traverse safely and return `type` for path object with value.value property | ||
* @param {Node} path - pathNode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to AST node in description
packages/utils/ast-utils.js
Outdated
@@ -415,6 +444,11 @@ function addProperty(j, p, key, value) { | |||
} else { | |||
pushVal = valForNode; | |||
} | |||
|
|||
// incase of _add_ or while updating a property, | |||
// we only return the generated pushVal which will be replace the node path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep this, discard the other comment
packages/utils/ast-utils.test.js
Outdated
expect(ast.toSource()).toMatchSnapshot(); | ||
}); | ||
|
||
it("add entry property while add", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using
not while
packages/utils/ast-utils.test.js
Outdated
}); | ||
|
||
describe("addProperty", () => { | ||
it("add entry property while init", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while
-> using
packages/utils/ast-utils.test.js
Outdated
} | ||
} | ||
}; | ||
const require = utils.safeTraverseAndGetType(p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vague naming, please change to descriptive names
packages/utils/ast-utils.test.js
Outdated
} | ||
}; | ||
const require = utils.safeTraverseAndGetType(p); | ||
expect(require).toEqual(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not a valid test, you're testing the node against itself. Give it a real path to check. p
, foo
, bar
.
packages/utils/ast-utils.test.js
Outdated
const ast = j("module.exports = {}"); | ||
const propertyValue = { | ||
objects: "are", | ||
super: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can trim this down so it doesn't get overbloated
packages/utils/ast-utils.test.js
Outdated
super: [ | ||
"op", | ||
{ | ||
test: new RegExp(/\.(wasm|c)$/), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
less props
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nearly there @dhruvdutt
packages/utils/ast-utils.test.js
Outdated
const p = { | ||
value: { | ||
value: VALUE | ||
value: type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the props to foo
, bar
, we're not testing props, we're testing the AST values. This would confuse people looking at the tests
packages/utils/ast-utils.test.js
Outdated
} | ||
}; | ||
const require = utils.safeTraverse(p, ["value", "value"]); | ||
expect(require).toEqual(VALUE); | ||
expect(require).toEqual(type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type is not descriptive, give it a mock name, like testObject
} | ||
} | ||
}; | ||
const typeValue = utils.safeTraverseAndGetType(p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
se the prev comment on a proper test case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are hardcoding value.value
inside safeTraverseAndGetType()
, so the test has to be in that shape only.
Should we add an optional second arg for pathValues inputs and fall back to values.values
when second arg is not present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 more thing.
* chore(monorepo): move to lerna * chore(monorepo): use commands as normal instead of package * fix(revert): packagejson * chore(monorepo): prune files and update eslint rules * chore(monorepo): fix the no-missing-require error * chore(monorepo): fix typo * chore(monorepo): fix typo * chore(monorepo): prune package json * chore(monorepo): merge package lock json * chore(monorepo): updated package.json * chore(monorepo): fix plugin package.json * chore(cli): move to lerna and scoped packages (#434) * fix(loader,plugin): fix generators path bug * cli(refactor): improve folder structure (#371) * cli(refactor): improve folder structure * chore(linting): fix linter errors * cli(filepath): use local import instead * cli(migrate): refactor error handling * chore(review): fix review comments * chore(review): fix review comments * chore(review): fix review comments * chore(version): v.2.0.14 * Add break as commit type and listed the type of commit in the documentation (#379) * docs(commits): listed the list of type of commits available * cli(init): mode support to config (#364) * cli(init): mode support to config * cli(bugfix): Allow mode "none" in CLI (#381) * cli(init): use extractMiniCSSPlugin (#363) * cli(init): skip redundant question * cli(init): use mini-css-extract-plugin * Retrieve information for CLI option from webpack schema options file (#392) * cli(refactor): fetch available modes directly from webpack options schema * cli(refactor): Retrieve information from webpackOptionSchema * cli(add): write configuration to yeoman file (#348) * misc(add): variable parity, prettify * cli(add): write config to yeoman-rc * misc(add): improve generator questions * fix(init): output file name for single output (#403) improved output filename * cli(migrate): Update migration question (#402) * cli(init): webpack4 ready (#356) * cli(init): webpack4 ready * cli(init): remove unused variable, still @next on etwp * cli(init): Allow to use default entry in `init` * cli(init): Fix typo in comment * cli(init): Optimization transform and tests * cli(init): Fix non-optimized option for splitChunks * cli(init): Add cachingGroup per entry, don't show name in prod * cli(init): Add cachingGroup's defaults, fix entry * cli(init): Add a link to where the defaults live * cli(init): Remove default caching group definition from example * Add NoEmitOnErrorsPlugin transformation (#399) * ast(migrate): handle no emit on error * ast(migrate): handle module concatenation and named modules * ast(migrate): handle module concatenation and named modules * fix(ast): checks validity of an identifier (#360) added test cases for validate identifier * cli(entry): quotes sanitization (#337) * chore: minor doc fixes * cli(entry): quotes sanitization * tests(entry): add test case for double quotes * tests(entry): update snapshots * misc(utils): entry - variable parity * misc(prop-types): sort * cli(entry): multiple entries quotes sanitization * chore(versioning): v 2.0.15 * chore(versioning): push new package version * cli(fix): remove reference to specific version during migration (#410) * fix: remove reference to specific version during migration * fix: rephrase update message * chore(docs): updated old references to the extract text plugin (#412) * chore(dev): added break to the list of type of commit * init(fix): removed references to extract text plugin * fix(commit): rollback * cli(migration): update UglifyJS transformation (#416) * cli(migration): Update UglifyJS migration file to fit webpack4 configuration * cli(migration): Add cases where require variable does not need to exist * cli(migration): Add transformation for usage of webpack.otimization.UglifyPlugin * cli(tests): Update test snapshots after updating transformation * cli(fix): fix expressionContent being null * cli(refactor): remove plugins array if empty Created function on ast-utils so every other transformation can use this. * tests: add tests for new ast-utils method * fix: fix test names and jsdoc * fix: update maxSize for utils folder * ast(cli): Recursively parse AST (#341) * ast(refactor): wip refactor * ast(refactor): wip refactor * ast(init): refactor * test(refactor): refactor test suite * tests(define): swap args * ast(parsing): refactor stuff * ast(init): refactor * ast(init): refactor tests * chore(tests): remove some unneeded tests * chore(pkg): update package.json * chore(project): clear up project structure * chore(cli): remove unneded files * chore(git): add gitignore to yeoman file * chore(deps): update pkg.json * tests(snapshots): update snapshots * tests(jest): use empty module for snapshots * tests(snap): only test one prop * chore(publishing): add semantic-release (#415) * chore(release): [WIP] add semantic-release * test(ci): wip * test(ci): add node versions * test(ci): remove extra test * tests(ci): revise * tests(ci): only push to npm on master * tests(ci): use matrix on jobs * tests(ci): revise * tests(ci): update * tests(ci): test * tests(ci): test * tests(ci): p * tests(ci): update travis.yml * chore(release): revise travis * misc(yeoman): update yeoman * chore(travis): revise travis * misc(travis): revise travis.yml * chore(travis): remove redundant code * chore(pkg): add keywords * 2.1.1 * 2.1.2 * cli(cmds): revise yargs command (#422) * use yargs.command instead of yargs.option for sub-commands * cli(node): Add node flags to CLI (#377) * feat: add support for node flags * tests: Fix node-flags test * misc: Fix test failing due to not-found webpack-cli * misc: remove comment * misc: refactor removing unecessary args * tests: add more tests to prevent argument collision * cli(cmds): remove strict * fix(node): remove node option for now * chore(lerna): refactor * chore(lerna): refactor * chore(refactor): refactor stuff * chore(package): update pkg.lock * chore(templates): Update issue templates (#432) Adds fancy templates * ast(init): add topScope prop * ast(merge): re-add merge prop * cli(lerna): refactor * chore(lerna): refactor * chore(lerna): update * chore(lint): revise * chore(refactor): refactor * chore(tests): use lerna for tests * chore(travis): don't cache me outside * chore(pkg): remove prefer global * chore(release): v.2.1.3 * chore(package.lock): update pkg.lock * fix(loader,plugin): fix generators path bug * chore(version): v.2.0.14 * Add break as commit type and listed the type of commit in the documentation (#379) * docs(commits): listed the list of type of commits available * cli(bugfix): Allow mode "none" in CLI (#381) * cli(init): use extractMiniCSSPlugin (#363) * cli(init): skip redundant question * cli(init): use mini-css-extract-plugin * Retrieve information for CLI option from webpack schema options file (#392) * cli(refactor): fetch available modes directly from webpack options schema * cli(refactor): Retrieve information from webpackOptionSchema * cli(add): write configuration to yeoman file (#348) * misc(add): variable parity, prettify * cli(add): write config to yeoman-rc * misc(add): improve generator questions * fix(init): output file name for single output (#403) improved output filename * cli(migrate): Update migration question (#402) * fix(ast): checks validity of an identifier (#360) added test cases for validate identifier * chore(versioning): v 2.0.15 * chore(versioning): push new package version * cli(fix): remove reference to specific version during migration (#410) * fix: remove reference to specific version during migration * fix: rephrase update message * chore(docs): updated old references to the extract text plugin (#412) * chore(dev): added break to the list of type of commit * init(fix): removed references to extract text plugin * fix(commit): rollback * misc(yeoman): update yeoman * cli(cmds): revise yargs command (#422) * use yargs.command instead of yargs.option for sub-commands * cli(node): Add node flags to CLI (#377) * feat: add support for node flags * tests: Fix node-flags test * misc: Fix test failing due to not-found webpack-cli * misc: remove comment * misc: refactor removing unecessary args * tests: add more tests to prevent argument collision * cli(cmds): remove strict * fix(node): remove node option for now * chore(templates): Update issue templates (#432) Adds fancy templates * cli(lerna): refactor * chore(lerna): refactor * chore(pkg): remove prefer global * chore(travis): Add encrypted private ssh key * fix(pkg): test auto setup * cli(init): revise installation steps (#441) * cli(init): revise installation steps * chore(formatting): format code * cli(tests): refactor tests * chore(travis): run lockfile cmds on tests (#444) * Update dependencies to enable Greenkeeper 🌴 (#443) chore(greenkeeper): Update dependencies to enable Greenkeeper 🌴 * chore(docs): update readme * chore(travis): add Node.js 10 (#425) * chore(travis): move npm ci to install task (#424) * chore(travis): move npm ci to install task * chore: trigger new build * chore: upgrade Node.js for Appveyor to 8 * chore: remove redundanct npm install command * chore(linting): resolve linter errors * chore(linting): fix linting errors * chore(linting): resolve linting * chore(linting): resolve linting * chore(scaffold): move addons to scaffold * chore(scaffold): fix linting errors * cli(prompt): initial comment for prompt file * cli(prompt): wip * fix(monorepo): fix lint errors * fix(monorepo): fix cross spawn versions * fix(monorepo): update lock files * fix(monorepo): fix versions in pacakges * chore(rebase): refactor stuff * cli(pkgs): re-add entries * chore(v): revise pkg * v0.0.1 * chore(v): revise some deps * v0.0.2 * v0.0.3 * chore(v): back to v1 * v0.0.2 * v0.0.3 * v0.0.4 * chore(deps): update deps * chore(prompt): revise prompt cmd * v0.0.5 * cli(path): resolve better * v0.0.6 * chore(v.6): update init * chore(pkg): v.6 on next * chore(monorepo): add bootstrap to run chore(monorepo): add bootstrap to ci * chore(monorepo): fix appveyor build * chore(monorepo): fix appveyor build * chore(monorepo): add eslint-plugin-prettier * chore(monorepo): fix appveyor build chore(monorepo): fix appveyor build chore(monorepo): add eslint-plugin-prettier chore(monorepo): use nohoist * chore(monorepo): fix versions and use clean bootstrap * chore(monorepo): add rimraf globally chore(monorepo): revert back * chore(monorepo): fix windows build * cli(color): don't use color on non-tty (#452) * Added yarn lock file to gitignore (#455) * chore(next): dev version bump * chore(monorepo): fix windows build * cli(symlinks): Fix paths (#453) * cli(symlinks): fix symlinks * chore(linting): resolve linting errors * chore(rebase): remove old file * cli(init): Better defaults (#451) * cli(init): set default generator name * cli(init): better defaults * chore(rebase): remove old commit * cli(init): fix broken ast and merge scaffolds * chore(docs): better defaults * chore(lint): fix linting errors * chore(deps): remove path from dep installation * chore(resolve): resolve conflicts * fix(vulnerabilities): vulnerabilities patch for v3 (#460) * chore(dependencies): fix vulnerabilities * misc(scripts): update clean:all script * chore(dependencies): fix vulnerabilities * tests(parser): fix recursive-tests signature (#470) * chore(deps): add lerna * tests(coverage): fix coverage (#473) * test(coverage): fix coverage * test(binTestCases): run bintestcases on upper-repo * tests(travis): add node 10 * tests(cov): use regular nyc on tests * chore(lockfile): update pkglock * chore(semantic): configure plugins (#475) * fix(cli): show help flag when defaults fail (#466) * fixed test cases * remove unwanted console * fix(254) - addressed PR comments * fix(254) - added requested changes at right place * fix(254) - exit after error exit webpack if defaults are not found fix test cases for no options * fix: require chalk * refactor - addressed PR comments * refactor - addressed PR comments * refactor : remove unwanted keywords * chore(review): format * tests(no-options): refactor tests * ast(parser): add (#456) * ast(parser): add, update, remove - literal node support * ast(parser): add command * ast(util): update property, early exit * tests(add): resursive add ast * tests(add): update recursive parser snaps * misc(conflicts): resolve conflicts * tests(parser): update tests, inputs * chore(review): fix some things * ast(utils): add ast-path safe traverse and type support * ast(utils): merge update property with add property * tests(ast): add tests for safe traversals * misc(fixes): review comments * tests(ast): add tests for addProperty * misc(fixes): review comments * misc(fixes): review comments * misc(fixes): review comments * cli(add): re-add add command
* ast(parser): add, update, remove - literal node support * ast(parser): add command * ast(util): update property, early exit * tests(add): resursive add ast * tests(add): update recursive parser snaps * misc(conflicts): resolve conflicts * tests(parser): update tests, inputs * chore(review): fix some things * ast(utils): add ast-path safe traverse and type support * ast(utils): merge update property with add property * tests(ast): add tests for safe traversals * misc(fixes): review comments * tests(ast): add tests for addProperty * misc(fixes): review comments * misc(fixes): review comments * misc(fixes): review comments
What kind of change does this PR introduce?
Feature
Did you add tests for your changes?
Yes
If relevant, did you update the documentation?
No
Summary
Adds AST support for add command.
Does this PR introduce a breaking change?
No