@aternus/csv-to-xlsx
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -16,2 +16,6 @@ # Changelog | ||
## [1.0.3] - 2018-09-18 | ||
### Fixed | ||
- Updated the structure of package.json to avoid a bug with author name. | ||
## [1.0.2] - 2018-09-18 | ||
@@ -18,0 +22,0 @@ ### Added |
#!/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}`);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.log(`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(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.log(`Complete.`)} |
{ | ||
"name": "@aternus/csv-to-xlsx", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Command-line tool and a Node.js library to convert CSV files to XLSX (Excel 2007+ XML Format) files.", | ||
@@ -32,3 +32,5 @@ "keywords": [ | ||
}, | ||
"author": "Kiril Reznik", | ||
"author": { | ||
"name": "Kiril Reznik" | ||
}, | ||
"license": "MIT", | ||
@@ -35,0 +37,0 @@ "homepage": "https://github.com/Aternus/csv-to-xlsx", |
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
132150042