├── .editorconfig ├── .gitattributes ├── .gitignore ├── .jshintrc ├── .verb.md ├── LICENSE ├── README.md ├── cli.js ├── index.js └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [test/fixtures/*] 16 | insert_final_newline = false 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | *.* text eol=lf 3 | *.css text eol=lf 4 | *.html text eol=lf 5 | *.js text eol=lf 6 | *.json text eol=lf 7 | *.less text eol=lf 8 | *.md text eol=lf 9 | *.yml text eol=lf 10 | 11 | *.jpg binary 12 | *.gif binary 13 | *.png binary 14 | *.jpeg binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_store 2 | *.sublime-* 3 | _gh_pages 4 | actual 5 | bower_components 6 | node_modules 7 | npm-debug.log 8 | temp 9 | test/actual 10 | tmp 11 | TODO.md 12 | vendor 13 | fixtures 14 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi": false, 3 | "boss": true, 4 | "curly": true, 5 | "eqeqeq": true, 6 | "eqnull": true, 7 | "esnext": true, 8 | "immed": true, 9 | "latedef": true, 10 | "laxcomma": false, 11 | "newcap": true, 12 | "noarg": true, 13 | "node": true, 14 | "sub": true, 15 | "undef": "var", 16 | "unused": true, 17 | "mocha": true 18 | } -------------------------------------------------------------------------------- /.verb.md: -------------------------------------------------------------------------------- 1 | # {%= name %} {%= badge("fury") %} 2 | 3 | > {%= description %} 4 | 5 | {%= include("install-global") %} 6 | 7 | ## Usage 8 | 9 | Changes to single quotes by default: 10 | 11 | ```bash 12 | change-quotes foo.js 13 | ``` 14 | 15 | To specify the `type`, single or double: 16 | 17 | ```bash 18 | change-quotes foo.js --type double 19 | ``` 20 | 21 | To specify a dest file: 22 | 23 | ```bash 24 | change-quotes foo.js --dest bar.js 25 | ``` 26 | 27 | 28 | ## Contributing 29 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %}) 30 | 31 | ## Author 32 | {%= include("author") %} 33 | 34 | ## License 35 | {%= copyright() %} 36 | {%= license() %} 37 | 38 | *** 39 | 40 | {%= include("footer") %} 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Jon Schlinkert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # change-quotes [![NPM version](https://badge.fury.io/js/change-quotes.svg)](http://badge.fury.io/js/change-quotes) 2 | 3 | > CLI to change quotes in a file from single to double, or double to single. 4 | 5 | ## Install globally with [npm](npmjs.org): 6 | 7 | ```bash 8 | npm i -g change-quotes 9 | ``` 10 | 11 | ## Usage 12 | 13 | Changes to single quotes by default: 14 | 15 | ```bash 16 | change-quotes foo.js 17 | ``` 18 | 19 | To specify the `type`, single or double: 20 | 21 | ```bash 22 | change-quotes foo.js --type double 23 | ``` 24 | 25 | To specify a dest file: 26 | 27 | ```bash 28 | change-quotes foo.js --dest bar.js 29 | ``` 30 | 31 | 32 | ## Contributing 33 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/change-quotes/issues) 34 | 35 | ## Author 36 | 37 | **Jon Schlinkert** 38 | 39 | + [github/jonschlinkert](https://github.com/jonschlinkert) 40 | + [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 41 | 42 | ## License 43 | Copyright (c) 2015 Jon Schlinkert 44 | Released under the MIT license 45 | 46 | *** 47 | 48 | _This file was generated by [verb](https://github.com/assemble/verb) on February 05, 2015._ 49 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var fs = require('fs'); 4 | var path = require('path'); 5 | var chalk = require('chalk'); 6 | var symbol = require('log-symbols'); 7 | var argv = require('minimist')(process.argv.slice(2)); 8 | var change = require('./'); 9 | 10 | var src = argv.s || argv.src || argv._[0]; 11 | var dest = argv.d || argv.dest || src; 12 | var type = argv.t || argv.type || 'single'; 13 | 14 | 15 | if (!src) { 16 | var msg = chalk.red(' please specify a src file as the first arg, or with ') 17 | + chalk.bold('-s') + chalk.red(' or ') 18 | + chalk.bold('--src') + '.'; 19 | console.log(); 20 | console.log(msg); 21 | } 22 | 23 | function typeMsg() { 24 | var msg = chalk.red(' please specify a valid type with ') 25 | + chalk.bold('-t') + chalk.red(' or ') 26 | + chalk.bold('--type') + '.\n'; 27 | + 'Valid types are `single` and `double`.'; 28 | console.log(); 29 | console.log(msg); 30 | } 31 | 32 | 33 | var fp = path.join(process.cwd(), src); 34 | if (!fs.existsSync(fp)) { 35 | console.log(chalk.red(' ' + fp + ' does not exist.')); 36 | } 37 | if (!change.hasOwnProperty(type)) { 38 | typeMsg(); 39 | } 40 | var str = fs.readFileSync(fp, 'utf8'); 41 | str = change[type](str); 42 | fs.writeFileSync(dest, str); 43 | console.log(); 44 | console.log(' ' + symbol.success, 'Changed', chalk.bold(src), 'to have', type, 'quotes.'); 45 | 46 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * change-quotes 3 | * 4 | * Copyright (c) 2015 Jon Schlinkert, contributors. 5 | * Licensed under the MIT license. 6 | */ 7 | 8 | exports.single = require('to-single-quotes'); 9 | exports.double = require('to-double-quotes'); 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "change-quotes", 3 | "description": "CLI to change quotes in a file from single to double, or double to single.", 4 | "version": "0.1.0", 5 | "homepage": "https://github.com/jonschlinkert/change-quotes", 6 | "author": { 7 | "name": "Jon Schlinkert", 8 | "url": "https://github.com/jonschlinkert" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/jonschlinkert/change-quotes.git" 13 | }, 14 | "bugs": { 15 | "url": "https://github.com/jonschlinkert/change-quotes/issues" 16 | }, 17 | "license": { 18 | "type": "MIT", 19 | "url": "https://github.com/jonschlinkert/change-quotes/blob/master/LICENSE" 20 | }, 21 | "files": [ 22 | "index.js", 23 | "cli.js" 24 | ], 25 | "preferGlobal": true, 26 | "bin": { 27 | "change-quotes": "./cli.js" 28 | }, 29 | "main": "index.js", 30 | "engines": { 31 | "node": ">=0.10.0" 32 | }, 33 | "scripts": { 34 | "test": "mocha" 35 | }, 36 | "dependencies": { 37 | "chalk": "^0.5.1", 38 | "log-symbols": "^1.0.1", 39 | "minimist": "^1.1.0", 40 | "to-double-quotes": "^1.0.0", 41 | "to-single-quotes": "^1.0.1" 42 | }, 43 | "devDependencies": { 44 | "mocha": "*", 45 | "should": "*" 46 | }, 47 | "keywords": [ 48 | "double", 49 | "double-quotes", 50 | "quotation", 51 | "quotes", 52 | "single", 53 | "single-quotes" 54 | ] 55 | } 56 | --------------------------------------------------------------------------------