-
Notifications
You must be signed in to change notification settings - Fork 182
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
Implement sourcemap CLI command #530
Conversation
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.
Neat! It would be great if there were some snapshot tests highlighting the output
Co-authored-by: JohnnyMorganz <johnnymorganz@outlook.com>
Co-authored-by: JohnnyMorganz <johnnymorganz@outlook.com>
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 PR and sorry for the delay in getting it reviewed!
I pushed a couple changes onto the branch. Changes fell into a couple categories:
- Small interface changes:
recurse_create_node
now accepts a filter function instead of a bool and passes referents instead of instances. This cut down the code a little and made it a little easier to read. - Rust-y things: Accepting
&Path
and&RojoTree
, using an emptyVec<T>
instead ofOption<Vec<T>>
. Nothing major here, functionally very similar. - Minor formatting
With CI passing, this should be good to go. Great idea and submission!
* Initial implementation of sourcemap CLI command * Update src/cli/sourcemap.rs Co-authored-by: JohnnyMorganz <johnnymorganz@outlook.com> * Update src/cli/sourcemap.rs Co-authored-by: JohnnyMorganz <johnnymorganz@outlook.com> * Tidy up sourcemap command * Update CHANGELOG Co-authored-by: JohnnyMorganz <johnnymorganz@outlook.com> Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
PR summary
This PR implements a new
sourcemap
command which produces an instance tree in JSON format in the following shape:This enables new & interesting use cases, as well as consistency in other tools/apps when using Rojo.
Initial implementation / design details
The command takes a project file as input or defaults to
default.project.json
just like other CLI commands.The json data will either be written to a file specified by the
--output
parameter, similar to thebuild
command, or if omitted will usestdout
so that other tools do not have to write to and read a file as a proxy.A flag
--include-non-scripts
determines if all instances should be included in the sourcemap, or just scripts. This can greatly reduce sourcemap size if the Rojo project is fully managed. If the flag is not provided, only scripts will be included in the source map. NOTE: Might need a better name or default here?