@aternus/csv-to-xlsx
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -16,2 +16,9 @@ # Changelog | ||
## [1.0.9] - 2019-06-05 | ||
### Changed | ||
- Refactored for loops. | ||
### Security | ||
- Updated npm dependencies. | ||
## [1.0.8] - 2018-11-27 | ||
@@ -18,0 +25,0 @@ ### Security |
#!/usr/bin/env node | ||
"use strict";const path=require("path");const fs=require("fs-extra");const program=require("commander");const convertCsvToXlsx=require("./convertCsvToXlsx");if(module.parent){module.exports=convertCsvToXlsx}else{const pkg=require("../package");program.version(pkg.version,"-v, --version").option("-i, --input-dir [dir]","Input directory that has the CSV files","csv").option("-o, --output-dir [dir]","Output directory for the XLSX files","xlsx");program.on("--help",function(){console.log(``);console.log(`Created by: ${pkg.author.name}`);console.log(`Please report bugs at: ${pkg.bugs.url}`)});program.parse(process.argv);const csvPath=path.join(process.cwd(),program.inputDir);const xlsxPath=path.join(process.cwd(),program.outputDir);if(!fs.existsSync(csvPath)){console.error(`Invalid input directory: ${csvPath}\n`);process.exitCode=1;program.help()}if(!fs.existsSync(xlsxPath)){console.info(`Creating output directory: ${xlsxPath}`);fs.mkdirpSync(xlsxPath)}const csvFiles=fs.readdirSync(csvPath);for(let file of csvFiles){const fileObject=path.parse(file);if(fileObject.ext!==".csv"){continue}console.info(`Converting: ${fileObject.name}`);try{convertCsvToXlsx(path.join(csvPath,file),path.join(xlsxPath,`${fileObject.name}.xlsx`))}catch(e){console.info(`${e.toString()}`)}}console.info(`Complete.`)} | ||
"use strict";const path=require("path");const fs=require("fs-extra");const program=require("commander");const convertCsvToXlsx=require("./convertCsvToXlsx");if(module.parent){module.exports=convertCsvToXlsx}else{const pkg=require("../package");program.version(pkg.version,"-v, --version").option("-i, --input-dir [dir]","Input directory that has the CSV files","csv").option("-o, --output-dir [dir]","Output directory for the XLSX files","xlsx");program.on("--help",function(){console.log(``);console.log(`Created by: ${pkg.author.name}`);console.log(`Please report bugs at: ${pkg.bugs.url}`)});program.parse(process.argv);const csvPath=path.join(process.cwd(),program.inputDir);const xlsxPath=path.join(process.cwd(),program.outputDir);if(!fs.existsSync(csvPath)){console.error(`Invalid input directory: ${csvPath}\n`);process.exitCode=1;program.help()}if(!fs.existsSync(xlsxPath)){console.info(`Creating output directory: ${xlsxPath}`);fs.mkdirpSync(xlsxPath)}const csvFiles=fs.readdirSync(csvPath);for(const file of csvFiles){const fileObject=path.parse(file);if(fileObject.ext!==".csv"){continue}console.info(`Converting: ${fileObject.name}`);try{convertCsvToXlsx(path.join(csvPath,file),path.join(xlsxPath,`${fileObject.name}.xlsx`))}catch(e){console.info(`${e.toString()}`)}}console.info(`Complete.`)} |
{ | ||
"name": "@aternus/csv-to-xlsx", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Convert CSV files to XLSX (Excel 2007+ XML Format) files via Node.js CLI or API.", | ||
@@ -54,22 +54,22 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/cli": "^7.1.5", | ||
"@babel/core": "^7.1.6", | ||
"@babel/preset-env": "^7.1.6", | ||
"@babel/cli": "^7.4.4", | ||
"@babel/core": "^7.4.5", | ||
"@babel/preset-env": "^7.4.5", | ||
"@types/chai": "^4.1.7", | ||
"@types/fs-extra": "^5.0.4", | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "^8.10.38", | ||
"@types/fs-extra": "^7.0.0", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^8.10.49", | ||
"chai": "^4.2.0", | ||
"eslint": "^5.9.0", | ||
"eslint-config-google": "^0.11.0", | ||
"mocha": "^5.2.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-google": "^0.13.0", | ||
"mocha": "^6.1.4", | ||
"npm-run-all": "^4.1.5", | ||
"pkg": "^4.3.4" | ||
"pkg": "^4.4.0" | ||
}, | ||
"dependencies": { | ||
"commander": "^2.19.0", | ||
"csv-parse": "^4.0.1", | ||
"fs-extra": "^7.0.1", | ||
"xlsx": "^0.14.1" | ||
"commander": "^2.20.0", | ||
"csv-parse": "^4.4.3", | ||
"fs-extra": "^8.0.1", | ||
"xlsx": "^0.14.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
151978277
+ Addedfs-extra@8.1.0(transitive)
- Removedfs-extra@7.0.1(transitive)
Updatedcommander@^2.20.0
Updatedcsv-parse@^4.4.3
Updatedfs-extra@^8.0.1
Updatedxlsx@^0.14.3