Coder Social home page Coder Social logo

bradparks / decaffeinate__convert-your-coffeescript-source-to-modern-javascript-with-decaffeinate. Goto Github PK

View Code? Open in Web Editor NEW

This project forked from decaffeinate/decaffeinate

0.0 2.0 0.0 5.5 MB

Goodbye CoffeeScript, hello JavaScript!

Home Page: http://decaffeinate-project.org/repl/

License: MIT License

JavaScript 97.47% TypeScript 2.53%

decaffeinate__convert-your-coffeescript-source-to-modern-javascript-with-decaffeinate.'s Introduction

decaffeinate Build Status npm Greenkeeper badge

Goodbye CoffeeScript, hello JavaScript!

JavaScript is the future, in part thanks to CoffeeScript. Now that it has served its purpose, it's time to move on. Convert your CoffeeScript source to modern JavaScript with decaffeinate.

Installation and usage

$ npm install -g decaffeinate
$ decaffeinate input.coffee
input.coffee โ†’ input.js

Alternatively, paste code into the online repl to immediately see the output.

For real-world use cases, you'll likely want to spend some time understanding the different options and nuances of the decaffeinate tool. You'll also likely want to run decaffeinate using the bulk-decaffeinate wrapper tool, or write your own wrapper script. See the Conversion Guide for more information and advice on running decaffeinate on real-world code.

Status

Complete. The project is stable enough for production use, and has been used to convert tens of thousands of lines of production code. The conversion process has been extensively tested and there are few or no known correctness bugs, although no guarantees are made.

Here are some popular open source CoffeeScript projects and their current status when run through decaffeinate. Each project has a decaffeinate-specific fork that is re-created from the original repo once per day.

Project Lines of CoffeeScript Conversion status Test status
chroma.js 3.3K chromajs-conversion-status chromajs-test-status
hubot [1] 3.7K hubot-conversion-status hubot-test-status
autoprefixer [1] 4.8K autoprefixer-conversion-status autoprefixer-test-status
coffeelint 8.8K coffeelint-conversion-status coffeelint-test-status
vimium 11K vimium-conversion-status vimium-test-status
coffeescript [2] 17K coffeescript-conversion-status coffeescript-test-status
atom 51K atom-conversion-status atom-test-status
atom-org 170K atom-org-conversion-status atom-org-test-status
codecombat 230K codecombat-conversion-status codecombat-test-status

Project builder status: Build Status

Notes:

  1. Hubot and Autoprefixer have fully moved to JavaScript using decaffeinate. This build runs on the last commit before the switch to JS.
  2. Some CoffeeScript tests are disabled because they are difficult to fix and test cases that do not seem to come up in real-world code. See How decaffeinate approaches correctness for full details.

To contribute to this list, send a pull request to the decaffeinate-examples project.

In addition, decaffeinate has been used on private codebases within various companies, such as Square, Benchling, and Bugsnag. See this blog post from Bugsnag to read about their experiences using decaffeinate.

If you run into crashes or correctness issues, or you have suggestions on how decaffeinate could be improved, feel free to file an issue on the issues page.

Goals

  • Fully automated conversion of the CoffeeScript language to modern JavaScript.
  • Preserve whitespace, formatting, and comments as much as possible to allow a full one-time conversion of your CoffeeScript source code.
  • Focus on correctness as the first priority, with some options to generate nicer code at the expense of 100% correctness.
  • Provide helpful error messages when it encounters an unsupported language construct.

Options

  • --modernize-js: Treat the input as JavaScript and only run the JavaScript-to-JavaScript transforms, modifying the file(s) in-place.
  • --literate: Treat the input file as Literate CoffeeScript.
  • --keep-commonjs: Do not convert require and module.exports to import and export.
  • --force-default-export: When converting to export, use a single export default rather than trying to generate named imports where possible.
  • --safe-import-function-identifiers: Comma-separated list of function names that may safely be in the import/require section of the file. All other function calls will disqualify later requires from being converted to imports.
  • --prefer-const: Use const when possible in output code.
  • --loose-default-params: Convert CS default params to JS default params.
  • --loose-for-expressions: Do not wrap expression loop targets in Array.from.
  • --loose-for-of: Do not wrap JS for...of loop targets in Array.from.
  • --loose-includes: Do not wrap in Array.from when converting in to includes.
  • --loose-comparison-negation: Allow unsafe simplifications like !(a > b) to a <= b.
  • --allow-invalid-constructors: Don't error when constructors use this before super or omit the super call in a subclass.
  • --enable-babel-constructor-workaround: Use a hacky Babel-specific workaround to allow this before super in constructors. Also works when using TypeScript.

For more usage details, see the output of decaffeinate --help.

decaffeinate__convert-your-coffeescript-source-to-modern-javascript-with-decaffeinate.'s People

Contributors

alangpierce avatar bhvaleri avatar dolzenko avatar eden-sun avatar edi9999 avatar ef4 avatar eventualbuddha avatar flying-sheep avatar greenkeeper[bot] avatar greenkeeperio-bot avatar iainb avatar madskonradsen avatar marcmenn avatar mattms avatar netei avatar readmecritic avatar refack avatar sandstrom avatar tbonemalone avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.