npm-text-auto
Automatically convert your text files to unix style line ending before publishing your module.
Last updated 4 years ago by benpage .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install npm-text-auto 
SYNC missed versions from official npm registry.

I'm no longer developing npm-text-auto. I have decided it's better to disable autocrlf and stick to LF line endings on all platforms. I highly recommend you do that same.

This module has not been completely tested and should be considered a beta. It's intended to modify your source files, so use with caution. Bug reports and pull request are welcome.

Features

Before publishing, npm-text-auto converts text files to Unix style line endings (\n). After publishing, it converts them back to the default line ending for your OS (ie. \r\n for Windows).

This acts like having * text=auto in your .gitattributes file, only for npm publish.

Usage

npm-text-auto can be used as a local module or run from the command line.

Local Module

  1. Install as a development dependency

    npm install npm-text-auto --save-dev
    
  2. Add hook scripts to package.json

    "scripts": {
      "prepublish": "npm-text-auto",
      "postpublish": "npm-text-auto"
    }
    
  3. Publish

Command Line

  1. Install as a global module

    npm install npm-text-auto -g
    
  2. Run the hook manually:

    npm-text-auto prepublish
    npm-text-auto postpublish
    

Details

  • On systems where the default EOL is \n, npm-text-auto does not modify any files.
  • The binary file detection method as the same as GIT. It checks the first 8000 bytes for the presence of a null byte.
  • File modified timestamp is preserved.
  • Files with mixed EOL styles are convert to the correct EOL.
  • The .npmignore (or .gitignore) file are processed using the same module as npm. Excluded files will not have their EOL modified.
  • package.json , files in node_modules, and files in version control directories files ( .git .hg .svn CVS) are never modified.
  • .gitattributes is not supported. If enough people need this, I may add it.

Current Tags

  • 0.1.6                                ...           latest (4 years ago)

7 Versions

  • 0.1.6                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (1)
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2016 © taobao.org |