All Projects → kvz → invig

kvz / invig

Licence: MIT license
🌿 Invig automatically converts ES5 & CoffeeScript codebases to ES6 with Aligned JavaScript Standard Style

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
shell
77523 projects
HTML
75241 projects
Makefile
30231 projects
coffeescript
4710 projects

Projects that are alternatives of or similar to invig

Prettier Tslint
Code ➡️ prettier ➡️ tslint --fix ➡️ Formatted Code ✨
Stars: ✭ 221 (+256.45%)
Mutual labels:  prettier
Typescript Express Starter
🚀 TypeScript Express Starter
Stars: ✭ 238 (+283.87%)
Mutual labels:  prettier
eslint-config-ns
ESLint config ready to be used in multiple projects. Based on Airbnb's code style with prettier, jest and react support.
Stars: ✭ 27 (-56.45%)
Mutual labels:  prettier
Prettier Plugin Csharp
Prettier C# Plugin
Stars: ✭ 224 (+261.29%)
Mutual labels:  prettier
Typescript Starter
Quickly create and configure a new library or Node.js project
Stars: ✭ 2,953 (+4662.9%)
Mutual labels:  prettier
S2s
Coding time Compile. A tool to write code fastest.
Stars: ✭ 254 (+309.68%)
Mutual labels:  prettier
React Luo
React Automatically - 保持最新技术 react17 hooks router5 webpack5 babel7 antd4
Stars: ✭ 211 (+240.32%)
Mutual labels:  prettier
webpack-boilerplate
Webpack 4 boilerplate (babel, eslint, prettier, jest, sass, postcss, hmr, browsersync)
Stars: ✭ 33 (-46.77%)
Mutual labels:  prettier
Prettyhtml
💅 The formatter for the modern web https://prettyhtml.netlify.com/
Stars: ✭ 241 (+288.71%)
Mutual labels:  prettier
handwritten-digit-recognition-tensorflowjs
In-Browser Digit recognition with Tensorflow.js and React using Mnist dataset
Stars: ✭ 40 (-35.48%)
Mutual labels:  prettier
React Starter Kit
React, Redux, Webpack, Material UI, Boostrap 4, Code Splitting, HMR
Stars: ✭ 229 (+269.35%)
Mutual labels:  prettier
Typescript Lib Starter
Typescript library starter
Stars: ✭ 235 (+279.03%)
Mutual labels:  prettier
TypeScript-in-Nodejs-Starter
A starter kit for Node.js project written with TypeScript.
Stars: ✭ 39 (-37.1%)
Mutual labels:  prettier
Prettier Plugin Organize Imports
Make Prettier organize your imports using the TypeScript language service API.
Stars: ✭ 222 (+258.06%)
Mutual labels:  prettier
microbundle-ts-pkg
A TypeScript npm package skeleton/starter project with microbundle, node:test and prettier
Stars: ✭ 20 (-67.74%)
Mutual labels:  prettier
Modern Node
All-in-one development toolkit for creating node modules with Jest, Prettier, ESLint, and Standard
Stars: ✭ 216 (+248.39%)
Mutual labels:  prettier
Prettier Github
Format code in GitHub comments with Prettier
Stars: ✭ 244 (+293.55%)
Mutual labels:  prettier
Dilettantes-Guide-to-Linting
Setting up ESLint, Prettier, VS Code, and the AirBnB style guide in beautiful harmony.
Stars: ✭ 18 (-70.97%)
Mutual labels:  prettier
ultimate-hot-boilerplate
🚀 node-react universal app boilerplate with everything on hot reload, SSR, GraphQL, Flow included
Stars: ✭ 35 (-43.55%)
Mutual labels:  prettier
spec
🐣 easy to use eslint/stylelint/tslint/prettier/...
Stars: ✭ 60 (-3.23%)
Mutual labels:  prettier

Build Status

Here's another one of my more upsetting projects 👌

🌿 Invig

Breathes new life into legacy code bases by automatically:

  • Transpiling CoffeeScript to ES6
  • Transpiling ES5 to ES6 (without the stuff that recent Node hasn't nailed yet (e.g. we stick to require vs import for now))
  • Applying Standard linting with colon alignment for enhanced readability
  • Adding the necessary linting and building run-script boilerplate that the project can later independently use
  • Optionally checking for outdated or unused dependencies

Invig does this in a highly opinionated, non-configurable, and destructive way.

Let's have some fun breathing new life into your legacy project 😚 💨 🌿

Why

I'm dealing with an ever-growing number of projects that each have a slightly different setup, and I got pretty tired of context switching between ES5, ES6, CoffeeScript, and different code conventions across those projects.

The tools are there now to automate all difference away - it's just a matter of picking defaults and stringing those tools together. That's what Invig does. After successfully running Invig on your codebase, you can put your brain at ease thanks to uniformity, focus more on the work at hand, have a better time doing so thanks to syntactical goodness, while producing less bugs thanks to ESlint.

Why ditch ES5?

ES6 let's you express yourself in more powerful ways, typically meaning less boilerplate and more readable code.

Why ditch CoffeeScript?

While CoffeeScript lovers might agree already that uniform styling is pleasant and that ES6 is an upgrade over ES5, they might feel there are still a number of syntactical advantages CoffeeScript offers, missing from ES6. Our benchmark demo even results in lengthier ES6 code(!). While that may be true:

  • The syntactical sugar argument is losing ground with every ECMA iteration (1 a year now)
  • The ES6 ecosystem is vast. This results in more resources online, being able to attract more developers to help with your project, and linters like Flow and ESLint that can prevent more possible bugs and errors than CoffeeLint can.
  • If you can refrain from using import and async (Invig won't leverage these), recent Node.js can run your code without any transpiling. Meaning quicker developer iterations and less headaches.

Demo

Let's take a look at installing Invig at converting CoffeeScript to Standard compatible ES6 via STDIN

Install

Invig is meant to be run on a code base once (or a few times in one session). That's why it should not be used as a dependency but be installed globally instead.

npm install invig --global 

Use

⚠️ WARNING Changes are made in-place, make sure your code is protected by version control before using Invig.

Recursively port CoffeeScript/ES5 files to ES6 in-place:

invig -s ./src

Command line arguments

Usage: invig [options]

Options:

  -h, --help       output usage information
  -V, --version    output the version number
  -s, --src <dir>  Directory, file or pattern to convert
  -b, --bail       Abort on the first error instead of continuing to port next file
  -c, --check      When done, hunt for unused and un-updated dependencies
  -q, --quiet      Hide any output

More Examples

Port one ES5 file to ES6:

invig --src old-file.js

Port one CoffeeScript file to ES6 (deleting the old .coffee file.):

invig --src old-file.coffee

Optionally check for outdated or unused dependencies after the conversion completes:

invig --src src/ --check

Bail out as soon as Invig hits an error. By default Invig will continue processing the next file

invig --src src/ --bail

Do a dry run without changing any files (don't trust me, keep your stuff safe in Git):

invig --src src/ --dryrun

Apply Invig on a pattern (use quotes!)

invig --src 'src/**.js'

Transpile from STDIN

cat old-file.coffee | invig --src -

Workflow

The recommended way to use Invig is to:

  1. Be in master and have a clean Git working tree first
  2. git checkout -b es6
  3. Run Invig on your repo, point it to wherever your legacy sources live
  4. Apply manual fixes where the automation falls short (Invig and your build & test suite will tell you)
  5. Inspect the Git diff (I recommend the GitHub Desktop app for inspecting Invig's changes, even if you are a cli-god. Can't stress this enough) and repeat step 3 & 4
  6. Commit, push, send a PR for your es6 branch
  7. Have someone review the PR and merge it
  8. Let's celebrate that your codebase is now very much 2017 🍸

State

Invig is young, but as long as your code is in Git, feel free to have some fun with it, Invig has already ported some very large codebases.

Pre-1.0.0, we're allowing ourselves to make breaking changes at any release.

Gotchas

  • It's recommended to first make sure all CoffeeLint errors and warnings are fixed before porting your project.
  • Although Invig is destructive in nature, it currently leaves your build run script alone if you have already defined it. If you currently have CoffeeScript build tasks, remove them first, so that Invig can write the new one. The same goes for the lint, fix, and build:watch scripts, as well as the .eslintrc, and .babelrc files. The advantage of this that you can run Invig multiple times even though you have customized these components that are used in the modern setup.
  • ⚠️ WARNING Invig needs a sense of a project so that it can add ESLint config and similar, so from the first file you point it to, it traverses upwards to find a package.json, and modifies this in-place also.

Thanks to

I deserve no credit, Invig is just a tiny wrapper around these mastodons:

Invig in the Wild

Projects where Invig is used to breathe new life into old codebases:

Todo & Changelog

Please see CHANGELOG.md.

Contributing

Please see CONTRIBUTING.md.

Social Media

Welcoming discussion on:

Links

Authors & Contributors

License

Copyright (c) 2017 Kevin van Zonneveld. Licenses under MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].