Glavin001 / atom-beautify

:mega: Help Wanted - Looking for Maintainer: https://github.com/Glavin001/atom-beautify/issues/2572 | :lipstick: Universal beautification package for Atom editor (:warning: Currently migrating to https://github.com/Unibeautify/ and have very limited bandwidth for Atom-Beautify Issues. Thank you for your patience and understanding :heart: )
http://unibeautify.com/
MIT License
1.5k stars 453 forks source link

Pretty Diff v2 and NPM #881

Closed prettydiff closed 7 years ago

prettydiff commented 8 years ago

Pretty Diff v2 is about 1-2 weeks away. V2 will not be published to NPM though :(

For more information please see:

Pretty Diff will continue to publish to Bower, Github, and http://prettydiff.com and additional package managers are being investigated. Due to time limitations between this enhancement, my two jobs, and preparation for attendance at WOCS v2 will be released before additional publication and package management options are supported.

Glavin001 commented 8 years ago

If Pretty Diff v2 is not published to NPM then I am not sure how Atom-Beautify will go about it.

  1. I do not want to be adding another package manager, Bower (or any other that is not standard for an Atom package), as a dependency of Atom-Beautify to install dependencies that should otherwise be handled by NPM. However, in light of recent events, this may need to happen regardless of the trouble it will cause :wink:.
  2. There were packages that were not published to NPM and I added their GitHub link directly in package.json, and then many users experienced Atom-Beautify installation failing to install and caused a lot of (too much) headache. To list just a few:

    This ended up being a huge, unnecessary, PITA. I am uninterested in doing that again.

So, unfortunately, I have no immediate solution for how to use Pretty Diff v2 if it is not available on NPM.

I am definitely surprised about the recent events regarding NPM and the conduct of its managers, however until there is an accepted and well adopted alternative Atom-Beautify will continue to use NPM, if only by extension through Atom's package manager, apm.

Please let me know your thoughts and potential solutions/workarounds. Thank you.

prettydiff commented 8 years ago

Once I get version 2 ready for publication I will experiment with registering and publishing directly to the apm repository.

prettydiff commented 8 years ago

I am ready to publish Pretty Diff v2, but I am having trouble publishing to APM.

When I try:

apm publish prettydiff

I get:

Preparing and tagging a new version ✗
npm ERR! npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
npm ERR! (run in package dir)
npm ERR! 'npm -v' or 'npm --version' to print npm version (2.13.3)
npm ERR! 'npm view <pkg> version' to view a package's published version
npm ERR! 'npm ls' to inspect current package/dependency versions

I am working through this now, and plan to have this up on APM as soon as I can and be free from NPM.

Glavin001 commented 8 years ago

Quick note: apm is only for Atom packages. npm is for all Node.js packages.

Glavin001 commented 8 years ago

@prettydiff how about making the next Pretty Diff -- which will be distributed over biddle -- a CLI beautifier for Atom-Beautify? Thus, biddle can be the requested installer for users who wish to user Pretty Diff and Atom-Beautify does not use an alternative package manager in its build step, etc.

Furthermore, if biddle can install packages globally, like npm, then maybe there is a way to still require Pretty Diff as a Node.js package instead of CLI with something similar to requireg for biddle.

This implementation would reside in https://github.com/Unibeautify/beautifier-prettydiff and be released along with Unibeautify version of Atom-Beautify.

prettydiff commented 8 years ago

Yep, this is the goal. I just moved biddle from alpha status to beta status. Not ready for prime time, but good enough for evaluation and to start collecting error reports. I still owe technical documentation and plan to provide it tomorrow.

prettydiff commented 7 years ago

I have a variant of Pretty Diff for CLI only and the zip file is 173,476 bytes which is a pretty considerable reduction from the nearly 30mb uncompressed full application that was sent to NPM. biddle is still in beta. More work needs to be done to find defects, but the minimal viable product is there and it seems stable.

http://prettydiff.com/downloads/prettydiff/

prettydiff commented 7 years ago

Keeping everybody informed I have fixed biddle. Check it out now - https://github.com/prettydiff/biddle

I will republish Pretty Diff using biddle in production tomorrow. I am not ready to give it to Atom Beautify just yet though. I actually need users to play around with this thing for a bit so that I can get a sense of where the pain points are and just how bad it works for fails for other people. I wrote a getting started document at https://github.com/prettydiff/biddle/blob/master/documentation/gettingstarted.md

The documentation might be easier to read from the command line though as I included a markdown to CLI parser in biddle. The number at the end defines the word wrap limit:

node biddle markdown documentation/gettingstarted.md 80
prettydiff commented 7 years ago

Once I complete these two issues biddle will be ready for Atom Beautify:

Glavin001 commented 7 years ago

Any updates?

prettydiff commented 7 years ago

I am working on this right now. I want to have it complete within the next two weeks.

Glavin001 commented 7 years ago

I think Atom-Beautify will be able to support Pretty Diff as an external beautifier (not automatically installed via npm/apm). Users could install biddle and then install prettydiff and configure a path for Pretty Diff for Atom-Beautify to use. @prettydiff does this approach sound correct? If so, please submit a Pull Request to Atom-Beautify when you are ready. I think we will keep the old Pretty Diff and add a second one for Pretty Diff 2 or something along those lines. Pretty Diff 1 support in Atom-Beautify because Node.js installed via npm, and Pretty Diff 2 being a CLI beautifier installed by user. Thus we will be backwards compatible with current users while allowing other users to install Pretty Diff 2 as needed.

prettydiff commented 7 years ago

My eventual hope would be that other packages might also use biddle so that we can collect dependencies and have everything packaged and configured before a user downloads the software. biddle is OS agnostic and language agnostic. This way things remain up to date from our end and we catch problems related to dependencies before they hit user land. It also means less risk of failure from missing packages via apm/npm.

The only major external difference between Pretty Diff 1 and 2 is NPM. Although there are a lot of internal differences the API is still completely backwards compatible. Both execute from the command line in the very same way.

prettydiff commented 7 years ago

Status update.

Sorry for the long delay. I wrapped up (long overdue) work to write a new diff algorithm for Pretty Diff. I followed that up with writing a secondary hidden module system for biddle so that biddle itself can be enhanced with dependencies in a way that does not interfere with a user's installed application management or cause circular dependency resolution.

biddle advanced to version 1.0.0 and is production ready, https://github.com/prettydiff/biddle/issues/34

I am working on an enhancement to biddle right now with a new command update. It will execute biddle's status command to determine if an installed application is behind the latest published version and only then fetch/install the updated application over the existing application. My goal is to publish this enhancement tonight.

Upon publishing this enhancement I plan to prepare a video demo using the https://asciinema.org/ tool to introduce biddle and explain how to use it with examples.

I will finally begin enhancements to Pretty Diff's test/validation build to tear out git submodule support and then rely upon biddle for its one dependency. My goal is to have this work complete before end of tomorrow.

If all goes well then on Sunday morning biddle/Pretty Diff will be ready for inclusion into Atom Beautify for evaluation by third parties.

prettydiff commented 7 years ago

I have not finished this yet like I promised, but I am close. I believe the biddle part is done and here is a video demo: https://asciinema.org/a/118428

prettydiff commented 7 years ago

Pretty Diff 2x is ready for inclusion to Atom Beautify via biddle.

prettydiff commented 7 years ago

Hold on with taking action just yet. I will mostly work this to complete for Atom-Beautify. I failed to include the one dependency with Pretty Diff, but it will be there in the next release soon. Here is how this is going to work:

  1. biddle will only need to be present on systems that modify, publish, or republish Pretty Diff. That means Glavin will probably need biddle on his own system, but the users won't need it. I plan to directly embed the smallest form of Pretty Diff (178kb) directly into the Atom-Beautify code base. This way the users never have to worry about this... seamless.
  2. To keep Pretty Diff current it only needs to be updated as Atom-Beautify is updated, so a build step will need to be added to check for status updates biddle status prettydiff and if a later version is present then overwrite the existing app biddle update prettydiff.
  3. Currently biddle allows publishers to distribute applications from any location using HTTP. This is great and positive design decision away from a single authority of global control, but I found something better. In the next version of biddle I plan to switch to IPFS for application distribution and retain HTTP only for meta-data and management information. This will be some minimal disruptions with this change, and so it will mean biddle 2.0.

Why?

I believe the distribution model used by NPM favors convenience of publishers without regard for user convenience. The goal of biddle is to invert that model as much as possible.... put the risk and sweat on the publishers so the users can just download 1 application that is always stable.

Glavin001 commented 7 years ago

Pretty Diff v2 can be supported with the upcoming Executables+Docker installation features: https://github.com/Glavin001/atom-beautify/issues/1687

Step 1. Add a Docker image to https://github.com/Unibeautify/docker-beautifiers for Pretty Diff v2 Step 2. Add support for Pretty Diff v2's Docker image once Atom-Beautify's Executables+Docker features are complete. Step 3. Profit!

😄


Update: However, do note that this means Pretty Diff v2 will be treated as a CLI beautifier, instead of a Node.js beautifier. Therefore options will need to be passed down as CLI arguments, as well as any performance impacts because it is not run with the same Node.js process.

Glavin001 commented 7 years ago

Published to v0.30.6