Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[refactoring] Use `fs` instead of `path` for node v0.8.x

  • Loading branch information...
commit a0b590bf219f2ce15f660ba961e71ec749573519 1 parent c1bde33
ben ben-lin authored
Showing with 6 additions and 7 deletions.
  1. +6 −7 lib/utils.js
13 lib/utils.js
View
@@ -8,7 +8,6 @@
*/
var fs = require( 'fs' );
-var path = require( 'path' );
var mkdirp = require( 'mkdirp' );
var rmdir = require( 'rmdir' );
var color = require( 'cli-color' );
@@ -51,13 +50,13 @@ module.exports = {
var is_dir = output_dir === output_path;
// tgt is a dir, if its not there create it
- if( is_dir && !path.existsSync( output_dir )){
+ if( is_dir && !fs.existsSync( output_dir )){
mkdirp.sync( output_dir, '0755' );
return console.log( color.green( 'created ' ), output_dir );
}
// tgt is a file, check for parent dir existance, if its not there create it
- if( !path.existsSync( output_dir )){
+ if( !fs.existsSync( output_dir )){
mkdirp.sync( output_dir, '0755' );
console.log( color.green( 'created ' ), output_dir );
}
@@ -76,7 +75,7 @@ module.exports = {
}
// create
- if( !path.existsSync( output_path )){
+ if( !fs.existsSync( output_path )){
fs.writeFileSync( output_path , tpl );
return console.log( color.green( 'created ' ), output_path )
}
@@ -91,7 +90,7 @@ module.exports = {
},
remove : function ( output_dir ){
- if( path.existsSync( output_dir )){
+ if( fs.existsSync( output_dir )){
rmdir( output_dir, function ( err, dirs, files ){
console.log( color.gray( 'removed ' ), output_dir );
});
@@ -109,12 +108,12 @@ module.exports = {
output_dir += '/';
}
- if( !path.existsSync( input_dir )){
+ if( !fs.existsSync( input_dir )){
console.log( color.red( 'error ' ), 'input dir does not exist at ' + input_dir );
return process.exit( 0 );
}
- if( !path.existsSync( output_dir )){
+ if( !fs.existsSync( output_dir )){
mkdirp.sync( output_dir, '0755' );
console.log( color.green( 'created ' ), output_dir );
}
Please sign in to comment.
Something went wrong with that request. Please try again.