-
Notifications
You must be signed in to change notification settings - Fork 566
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
Fix errors and improve error messaging #158
Conversation
…d testing suite to reflect new test.
@didoo @davixyz @dbanksdesign Would love feedback on this, especially the mechanism I'm using to try to catch groups of errors at once. |
lib/extend.js
Outdated
} else if (options.log === 'error') { | ||
throw new Error(str); | ||
} | ||
var ERROR_TYPE = 'Property Value Collisions'; |
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 declare the ERROR_TYPE on top as in lib/exportPlatform.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.
Maybe instead of these ERROR_TYPE strings we could actually subclass Error to have actually different Error types.
https://gist.github.com/justmoon/15511f92e5216fa2624b
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.
Doing what Danny suggested for subclassing.
Also, I'm leaving the declaration in mid-code here because it doesn't apply to the whole file - just the calls immediately below it. Instead, I'm moving the declaration of the error group in exportPlatform to be only next to the areas it is used. It is actually the fact that it is defined the same in exportPlatform and in resolveObject that it works as expected. Let me know if you think that I should make this more clear somehow / pass this information in?
lib/extend.js
Outdated
}); | ||
|
||
if(handleErrors.count(ERROR_TYPE)) { | ||
handleErrors.flush(ERROR_TYPE, options.log === 'error' ? chalk.bold.red : chalk.bold.orange); |
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.
no strong opinions here, just an idea: do you think it would be more readable as:
if(handleErrors.count(ERROR_TYPE)) {
if (options.log === 'error') {
handleErrors.flush(ERROR_TYPE, chalk.bold.red);
throw new Error('Collisions detected');
} else {
handleErrors.flush(ERROR_TYPE, chalk.bold.orange);
}
}
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 like @didoo's comment, and maybe we should put this code in the handleErrors class itself so we don't have to copy and paste that code every time.
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 we could add the count of errors in throw new Error('Collisions detected')
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 was trying to decide what to do about this actually. This is the ONLY place we use options.log.
I thought maybe we should delete it. I doubt anyone is using it as I don't think it is documented anywhere. We do have tests for it, which is why I left it in.
I'm also happy to go the route of options.log = error causing this interaction if thats what we deem as what should happen across the board. We might consider renaming the option as it makes me think of "log_level" which doesn't cause the execution to stop but only changes the level of output.
I think this is important to get settled before we call this work complete. Please let me know what you guys think.
test/utils/resolveObject.js
Outdated
resolveObject = require('../../lib/utils/resolveObject'); | ||
|
||
resolveObject = require('../../lib/utils/resolveObject'), | ||
handleErrors = require('../../lib/utils/handleErrors'); |
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.
regarding these tests, how do we do to "convert" them in the Jest branch?
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'm not sure... I agree that will definitely be a problem. Let me know if you have suggestions...
Otherwise, during that merge I assume there will be conflicts to resolve. I'll have to add the corresponding jest tests at that time?
lib/utils/handleErrors.js
Outdated
} | ||
}, | ||
|
||
add: function (arg1, arg2) { |
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, I just noticed that it's always called with both the arguments, so this means that you always have a thread, so you don't need to have this double handling of errors
and unsavedErrors
(but maybe I am missing something)
@chazzmoney I've reviewed the PR code, and added some comments. Overall I understand the intent, and I'm ok with it, but at times I was struggling to follow the code of |
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 briefly went over the changes and it is a bit hard to understand what is going on. I left some comments though. Have we also thought about adding custom errors by extending the Error
class? Some links for that:
https://gist.github.com/justmoon/15511f92e5216fa2624b
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
https://rclayton.silvrback.com/custom-errors-in-node-js
lib/exportPlatform.js
Outdated
transformObject(this.properties, platformConfig) | ||
); | ||
|
||
if(handleErrors.count(ERROR_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.
Do we need to check for the type of error? If there are other errors wouldn't we want to show them anyways?
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.
The intent of this code is to provide a grouping mechanism for errors. If there are other errors, they will be thrown immediately in the code executed much more deeply. If we make it out to this point, it suggests that we didn't have other errors so we should take our collected errors and display them all at once and then throw.
I could see how this looks like how we should handle errors in general. If thats the case I should rework ALL other times we spit out errors. Probably needs to be resolved in relationship to the options.log = error conversation as well.
lib/extend.js
Outdated
} else if (options.log === 'error') { | ||
throw new Error(str); | ||
} | ||
var ERROR_TYPE = 'Property Value Collisions'; |
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 instead of these ERROR_TYPE strings we could actually subclass Error to have actually different Error types.
https://gist.github.com/justmoon/15511f92e5216fa2624b
lib/extend.js
Outdated
}); | ||
|
||
if(handleErrors.count(ERROR_TYPE)) { | ||
handleErrors.flush(ERROR_TYPE, options.log === 'error' ? chalk.bold.red : chalk.bold.orange); |
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 like @didoo's comment, and maybe we should put this code in the handleErrors class itself so we don't have to copy and paste that code every time.
lib/extend.js
Outdated
}); | ||
|
||
if(handleErrors.count(ERROR_TYPE)) { | ||
handleErrors.flush(ERROR_TYPE, options.log === 'error' ? chalk.bold.red : chalk.bold.orange); |
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 we could add the count of errors in throw new Error('Collisions detected')
Thanks @didoo and @dbanksdesign! Will take a look at all your feedback and create another cut at this overall. |
@didoo @dbanksdesign Let me know what you think of this revision. There are some notes I put in to conversations that are now marked as outdated, but would love feedback on. |
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.
Some comments/questions
bin/style-dictionary
Outdated
ErrorHandler.flush(); | ||
} | ||
catch (e) { | ||
ErrorHandler.flush(); |
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.
Can all this stuff and the below in this file be removed? Should the style dictionary node module already flush out all the errors? If not it probably should so using the node module and the CLI should behave the same.
lib/utils/errorHandler.js
Outdated
var chalk = require('chalk'); | ||
|
||
var errors = []; | ||
var unsavedErrors = {}; |
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 still don't quite get the difference between errors and unsavedErrors
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.
From the grouping POV, unsavedErrors are still being grouped and errors have already been grouped.
There is a bit more to it than that, e.g. handling errors that don't need grouping but you want to wait to output. But its just a generalization of the above case where group size is 1.
if (foundCircArr.indexOf(reference)!==-1) { | ||
// If the current reference is a member of a circular reference, do nothing | ||
} | ||
else if(stack.indexOf(reference)!==-1) { |
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.
It's weird to have an empty body to part of a conditional, this could be rewritten as
if (stack.indexOf(reference) !== -1) {
} else if (foundCircArr.indexOf(reference) === -1) {
}
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.
Yeah. We may want to do something in the future. I think we had something there before but I removed it. I like having the comment in there to be clear that we are intentionally not doing something there.
Alternatively, I could refactor the logic. Let me know if you think that would be better.
@didoo Let me know if this is better at all. |
…e flush on uncaught exceptions to prevent confusion
Ok @didoo and @dbanksdesign I think we are almost there. I spent some time thinking and decided that this isn't an error handler, it is an error grouper. Based on the idea that grouping is useful only for specific situations, I reworked the naming schemes and usage. It should make more sense now, especially in terms of specificity of use. Let me know your thoughts; would like to get this merged prior to #152 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.
@chazzmoney I have added a few comments, and a couple of things that I would change/simplify. let me know if you agree (I know this ticket has gone a long way now, I'm sorry for that)
"prop3" : { "value": "{prop1.value}" }, | ||
"prop4" : { "value": "{prop3.value}" }, | ||
"prop12" : { "value": "{prop1.value}, {prop2.value} and some extra stuff" }, | ||
"prop124" : { "value": "{prop1.value}, {prop2.value} and {prop4.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.
:)
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 for the examples!
|
||
var obj = resolveObject(helpers.fileToJSON(__dirname + '/../__json_files/not_circular.json')); | ||
expect(GroupErrors.count(PROPERTY_REFERENCE_ERRORS)).toBe(0); | ||
expect(JSON.stringify(obj)).toBe(JSON.stringify({ |
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 about this ticket, but just an occasion to show you one of my perplexities, which is clearly visible here: I am still unsure why the "input" of the tests is stored in a separate file (__json_files/..
) while the "output" is in the test itself. I think there must be a better way :) (but let's discuss in a separate future ticket)
|
||
resolveObject(helpers.fileToJSON(__dirname + '/../__json_files/multiple_reference_errors.json')); | ||
expect(GroupErrors.count(PROPERTY_REFERENCE_ERRORS)).toBe(3); | ||
expect(JSON.stringify(GroupErrors.fetchMessages(PROPERTY_REFERENCE_ERRORS))).toBe(JSON.stringify([ |
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.
do you think there should be a similar test for "multiple circular references" errors too? no idea, just asking.
lib/utils/resolveObject.js
Outdated
// Add our found circular reference to the end of the cycle and output to error | ||
circStack.push(reference); | ||
var err = new CustomError( | ||
'Circular definition cycle: ' + circStack.join(', '), |
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 use a template literal syntax here, as you did above?
lib/utils/resolveObject.js
Outdated
@@ -142,16 +161,14 @@ function selfRef(string, obj) { | |||
// If the reference doesn't change then it means | |||
// we didn't find it in the object | |||
if (ref === obj) { | |||
throw new Error('Reference doesn\'t exist: ' + context + ' tries to reference ' + string + ', which is not defined'); | |||
var err = new CustomError( | |||
'Reference doesn\'t exist: ' + context + ' tries to reference ' + string + ', which is not defined', |
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 use a template literal syntax here, as you did above?
lib/utils/groupErrors.js
Outdated
}, | ||
|
||
flush: function (errorGroup, chalkType) { | ||
if(errorGroup) { |
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 don't understand why we need this test. In the code, I see no case in which it is called without the errorGroup argument. Also, it would also be strange to see a declaration like this:
GroupErrors.flush(,chalk.bold.red);
(or am I missing something?)
also, see the comment above on how to possibly refactor this function
lib/utils/groupErrors.js
Outdated
}, | ||
|
||
clear: function (errorGroup) { | ||
if (errorGroup) { |
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 here is better:
if (errorGroup && groupedErrors[errorGroup]) {
delete groupedErrors[errorGroup];
}
(you used the proposed syntax above, so it's also more consistent)
lib/utils/groupErrors.js
Outdated
return groupedErrors[errorGroup] ? groupedErrors[errorGroup].length : 0; | ||
}, | ||
|
||
fetchMessages: function (errorGroup) { |
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 function is used only in the tests. is there a way to declare it only in the context of the tests, and not here?
lib/utils/groupErrors.js
Outdated
|
||
var groupedErrors = {}; | ||
|
||
var getFinalGroupErrors = function(errorGroup) { |
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 function is used only once. and is doing two things in one: is "getting the list of all the errors as a 'kind of' array" and "preparing the formatting of the output messages" (see when you add a double newline at the end). in the same way, consoleOutputErrArr
is similar. I think it would be better to move these two pieces of code where they are actually used. I understand it may increase the complexity there, but is not that moving the code in another place under a function solves the problem :)
I have tried to refactor the code, removing the extra functions and simplifying the logic. see how it looks in this way:
https://gist.github.com/didoo/2b681bee9e5f1a6a4327d6278e35fa09
(if you want to use it, test it anyway, I've just refactored inside a text editor, not actually tested, ok?)
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.
Yeah, before the refactor they were used in multiple places. I thought about redoing as a single func but thought that there were two reasons to keep it. Clarity of use and that if people wanted the other functionality back it would be nice. It seems like you and Danny both are telling me to stop engineering ahead and just focus on immediate task. I'll remove the functions.
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.
Yeah, before the refactor they were used in multiple places. I thought about redoing as a single func but thought that there were two reasons to keep it. Clarity of use and that if people wanted the other functionality back it would be nice. It seems like you and Danny both are telling me to stop engineering ahead and just focus on immediate task. I'll remove the functions.
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.
Yeah, before the refactor they were used in multiple places. I thought about redoing as a single func but thought that there were two reasons to keep it. Clarity of use and that if people wanted the other functionality back it would be nice. It seems like you and Danny both are telling me to stop engineering ahead and just focus on immediate task. I'll remove the functions.
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.
Yeah, before the refactor they were used in multiple places. I thought about redoing as a single function but thought that there were two reasons to keep it. Clarity of use and that if people wanted the other functionality back it would be nice. It seems like you and Danny both are telling me to stop engineering ahead and just focus on immediate task. I'll remove the functions.
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.
Yeah, before the refactor they were used in multiple places. I thought about redoing as a single function but thought that there were two reasons to keep it. Clarity of use and that if people wanted the other functionality back it would be nice. It seems like you and Danny both are telling me to stop engineering ahead and just focus on immediate task. I'll remove the functions.
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.
Yeah, before the refactor they were used in multiple places. I thought about redoing as a single function but thought that there were two reasons to keep it. Clarity of use and that if people wanted the other functionality back it would be nice. It seems like you and Danny both are telling me to stop engineering ahead and just focus on immediate task. I'll remove the functions.
@didoo Let me know what you think of latest changes. I need to make a couple more minor updates, but I think you'll like it better. |
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.
herk, why does github think I'm reviewing myself?
lib/utils/groupErrors.js
Outdated
|
||
var groupedErrors = {}; | ||
|
||
var getFinalGroupErrors = function(errorGroup) { |
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.
Yeah, before the refactor they were used in multiple places. I thought about redoing as a single function but thought that there were two reasons to keep it. Clarity of use and that if people wanted the other functionality back it would be nice. It seems like you and Danny both are telling me to stop engineering ahead and just focus on immediate task. I'll remove the functions.
My other laptop is having major problems with github. Will have an updated version for you in ~11 hours @didoo |
1 similar comment
My other laptop is having major problems with github. Will have an updated version for you in ~11 hours @didoo |
… fixed issues with simplified GroupMessages
@didoo Sorry for the delay, lots of isssues with github. (looks like travis-ci isn't running yet either). This is the final version of the updates that I had mentioned. |
@chazzmoney I think is much better and clearer now, no? to me looks good :) |
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.
Just one more comment
catch (e) { | ||
errors.push(e); | ||
} | ||
obj[key] = compile_value( obj[key], [current_context.join('.')] ); |
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.
Either we are not testing something properly or the code isn't working as expected. If you change this line back and run the tests, only one test fails and it only because the message string is different:
utils › resolveObject › should gracefully handle circular references
expect(received).toBe(expected) // Object.is equality
Expected: "[\"Circular definition cycle: a.b.c, j, a.b.c\"]"
Received: "[\"Circular definition cycle: j, a.b.c, j\"]"
* improved error messages for registerTemplate * updated error message * Introduce option to control the generation of the "Do not edit" header (#132) * stage #1 - formats.js * stage #2 - templates * reset changes to template + simplified changes to formats (now the “options” object is assigned to the “file” element) * fixed wrong parameter passed to fileHeader function * updated documentation * updates after PR comments * removing the confusing static-style-guide stuff (#157) * Fixes #72 * handle no command and invalid commands with friendly console output (#156) * Add json5 support (#165) * Removing unnecessary backticks (#172) * Merge Jest Branch (#169) * Jest testing (#133) * moved all the existing tests to Jest * finalised Jest tests for “utils” removing assert dependency * finalised Jest tests for “register” removing assert dependency + moved tests under correct folder * finalised Jest tests for “transform” removing assert dependency + moved tests under correct folder + removed extra file * updated path for “service” files/folders * removed output folder * updated the paths to ignore in the Jest config in package.json * finalised Jest tests for “clean” removing assert dependency + other small changes * added “__output” to the list of folders ignored by Jest * some tunings + more tests * more tests cleanup * fixed test for exportPlatform * fixed last tests, and now all tests are green! * Added first snapshot tests! Yay! * added mock for dates to avoid failing snapshots tests * updated tests * first attempt to fix the UTC date problem on CI (reference: boblauer/MockDate#9) * second attempt to fix the UTC date problem on CI * removed the TZ=UTC env environment to test if is really needed * updated all the occurrences of new Date in the templates * restored linting before running the tests suite * code style fix * fixed wrong porting of the test for buildAllPlatforms * test(all): Fix for all tests to match the date and remove of mockdate (#148) inspiration jestjs/jest#2234 * test(javascript/es6): Add test for es6 (#149) * test: add registerTemplate (#147) * add tests for transform object (#151) * add tests for transform object * split up complex test in multiple smaller tests * Jest flatten props (#163) * Adding tests for lib/utils/flattenProperties.js (#146) * Adding tests for lib/utils/flattenProperties.js * update to use lodash sortby function * update to use lodash sortby function * Add babel-jest (#173) * feat(json-nested): Add JSON nested transform (#167) Added JSON nested transform, Added test for it and Documentation update re #139 * Fix errors and improve error messaging (#158) * updated error messaging. Fixes for issues with references. * adding in didoo's test from #118 * cleanup of terminology * fixed resolveObject to correctly replace multiple references. modified testing suite to reflect new test. * updates per comments by didoo and dbanksdesign * case sensitive, oops. * case sensitive, oops. * minor updates based on PR feedback * merging with develop to ensure we stay synched * removing cli error handling and moving to module * removing per dannys comments * making constants for group errors per Dannys comments * switch to error grouping mindset and naming * switch to error grouping mindset and naming * per danny's comment * fix flush to execute across all groups if called with no group; remove flush on uncaught exceptions to prevent confusion * simplify, simplify, simplify * changed out error naming to message mindset, cleaned out console.log, fixed issues with simplified GroupMessages * sepearate circular reference tests into separate expects * avoid using string so we dont get it confused with String * Deprecating templates (#152) * Displaying a warning when using templates in the config or registerTemplate * Moving built-in templates to formats * Porting over a stragler test (#190) * 2.5.0
* improved error messages for registerTemplate * updated error message * Introduce option to control the generation of the "Do not edit" header (#132) * stage #1 - formats.js * stage #2 - templates * reset changes to template + simplified changes to formats (now the “options” object is assigned to the “file” element) * fixed wrong parameter passed to fileHeader function * updated documentation * updates after PR comments * removing the confusing static-style-guide stuff (#157) * Fixes #72 * handle no command and invalid commands with friendly console output (#156) * Add json5 support (#165) * Removing unnecessary backticks (#172) * Merge Jest Branch (#169) * Jest testing (#133) * moved all the existing tests to Jest * finalised Jest tests for “utils” removing assert dependency * finalised Jest tests for “register” removing assert dependency + moved tests under correct folder * finalised Jest tests for “transform” removing assert dependency + moved tests under correct folder + removed extra file * updated path for “service” files/folders * removed output folder * updated the paths to ignore in the Jest config in package.json * finalised Jest tests for “clean” removing assert dependency + other small changes * added “__output” to the list of folders ignored by Jest * some tunings + more tests * more tests cleanup * fixed test for exportPlatform * fixed last tests, and now all tests are green! * Added first snapshot tests! Yay! * added mock for dates to avoid failing snapshots tests * updated tests * first attempt to fix the UTC date problem on CI (reference: boblauer/MockDate#9) * second attempt to fix the UTC date problem on CI * removed the TZ=UTC env environment to test if is really needed * updated all the occurrences of new Date in the templates * restored linting before running the tests suite * code style fix * fixed wrong porting of the test for buildAllPlatforms * test(all): Fix for all tests to match the date and remove of mockdate (#148) inspiration jestjs/jest#2234 * test(javascript/es6): Add test for es6 (#149) * test: add registerTemplate (#147) * add tests for transform object (#151) * add tests for transform object * split up complex test in multiple smaller tests * Jest flatten props (#163) * Adding tests for lib/utils/flattenProperties.js (#146) * Adding tests for lib/utils/flattenProperties.js * update to use lodash sortby function * update to use lodash sortby function * Add babel-jest (#173) * feat(json-nested): Add JSON nested transform (#167) Added JSON nested transform, Added test for it and Documentation update re #139 * Fix errors and improve error messaging (#158) * updated error messaging. Fixes for issues with references. * adding in didoo's test from #118 * cleanup of terminology * fixed resolveObject to correctly replace multiple references. modified testing suite to reflect new test. * updates per comments by didoo and dbanksdesign * case sensitive, oops. * case sensitive, oops. * minor updates based on PR feedback * merging with develop to ensure we stay synched * removing cli error handling and moving to module * removing per dannys comments * making constants for group errors per Dannys comments * switch to error grouping mindset and naming * switch to error grouping mindset and naming * per danny's comment * fix flush to execute across all groups if called with no group; remove flush on uncaught exceptions to prevent confusion * simplify, simplify, simplify * changed out error naming to message mindset, cleaned out console.log, fixed issues with simplified GroupMessages * sepearate circular reference tests into separate expects * avoid using string so we dont get it confused with String * Deprecating templates (#152) * Displaying a warning when using templates in the config or registerTemplate * Moving built-in templates to formats * Porting over a stragler test (#190) * 2.5.0 * Added 'json/flat' format (#192) * Fix: #195 (#196) * updating contributing to reflect the package manager and testing suite correctly (#197) * Add Sass maps formats (#193) * added ‘sass/map-flat’ and ‘sass/map-deep’ formats + updated tests * fixed inconsistend newlines in templates for sass maps * improved recursive processJsonNode function * updated snapshots tests * removed unused function * Better examples (#164) * changed folder structure * removed table in Readme of Basic example (not clear and probably also some cells were wrong) * small update for the Basic example to make it more clear how aliases are referenced * renamed the “npm” example to “npm module” * updated “npm” example to use the same config and properties as the “basic” example * removed license (no sense here) and updated package.json * updated the s3 example making it more similar to other examples and adding some more assets to be uploaded and linked/embedded in tokens * updated logo in main Readme in example folder * updated the Readme for the S3 example * tried to re-organise the “react” folder in two separate folders the web app doesn’t compile * removed spaces from “example” sub-folder * renamed “example” folder to “examples” * removed numbers from “examples” sub-folder names * removed space in sub-folder names * added advanced example on how to use a watcher to auto-rebuild see: #171 * small update to Readme for “auto-rebuild-watcher” * added advanced example on how to have a multi-platform multi-brand suite * added advanced example on how to use custom templates * fixed “watch” npm script declaration * moved packages under “devDependencies” for “custom templates” package * added a comment in an example of the lodash templating syntax * remove invisible characters from Readme * added “clean” npm script call where missing in examples package.json * added .gitignore file where was missing in examples folder * updated the config file for the “npm module” example * added a comment to explain better how the “formatter” function works * updated the “init” command to expose only the possible/meaningful options + updated documentation for the “examples” page * added comment about collecting more examples * updated the Readme for the “examples” folder * updated “version.js” script as per Danny suggestion * added advanced example on how to use custom transforms * updated basic example to use “format” instead of “template” to avoid the alert in console * added advanced example about referencing/aliasing * updated example to show reference to an “object-like” value * removed the advanced examples for react and react native * added a “create react app” example (with Sass) * better config for S3 example * simplified the example for “S3” * re-introduced android + ios in S3 example * added a “assets-base64-embed” example * finalised the “assets-base64-embed” example * updated Readme for “npm” example + fixed the “prepublishOnly” script option (previous one was deprecated) * removed the “create-react-app-sass” example (I’ll add it later in a separate ticket) * updated the documentation * New cut at documentation PR using current develop branch (#198) * New cut at documentation PR using current develop branch * Apply @didoo's suggestions from code review Co-Authored-By: chazzmoney <charles@pgina.org> * updates based on didoo's thoughts * Updating the architecture documentation page (#200) * updates per didoo and dbanks * typo * generation differences * minor fixes and updates * making sure sd init command documentation is correct, for now * updates for clarity around properties and references * fixing up another alias piece * Addressing some comments in architecture diagram (#204) * Final touches on build diagram and architecture (#206) * Final touches on build diagram and architecture * Updating build diagram * Updating build diagram * Configuration doc update * fixing snapshot whitespace issues, discovered actual failing test on merge... * Fixing merge conflict issues * v2.6.0 release (#210)
Description of changes:
This will be fun to merge with the jest branch... 😬
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.