Skip to content

Commit

Permalink
Updated dependencies and created version v1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisEnMarroquin committed Oct 9, 2020
1 parent 5f63d74 commit a358245
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 142 deletions.
2 changes: 0 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"**/yarn.lock": true
},
"files.exclude": {
"dist/": true,
"index.js": true,
"**/.DS_Store": true,
"**/.directory": true,
"**/desktop.ini": true,
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,14 @@ This are my files used for development, remember to change:
## Publish to NPM and create tag
Will publish the following files:
* LICENSE
* index.js
* README.md
* package.json
Remember to change version number first
```shell
gac New commit # Git add and commit + message
npm login # Login to npm registry
yarn compile # TypeScript compile and uglify code
npm publish # Publish package to NPM
git tag -a -m "Published v1.1.5" v1.1.5 # Tag your release
git tag -a -m "Published v1.1.6" v1.1.6 # Tag your release
git push --follow-tags # Push commit and tags
```
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "json-as-xlsx",
"version": "1.1.5",
"version": "1.1.6",
"license": "MIT",
"main": "index.js",
"files": [
Expand Down Expand Up @@ -29,14 +29,14 @@
"xlsx-from-json"
],
"dependencies": {
"xlsx": "^0.16.6"
"xlsx": "^0.16.8"
},
"devDependencies": {
"@types/node": "^14.6.4",
"@vue/cli-service": "^4.3.0",
"@types/node": "^14.11.8",
"@vue/cli-service": "^4.5.7",
"express": "^4.17.1",
"typescript": "^4.0.2",
"uglify-js": "^3.10.2",
"uglify-js": "^3.11.1",
"vue": "^2.6.11",
"vue-template-compiler": "^2.6.11"
},
Expand Down
37 changes: 24 additions & 13 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
const { writeFileSync } = require('fs')
const xlsx = require('./index.js')
const express = require('express')
const app = express()
const port = 7070

var columns = [
{ label: 'Email', value: 'email' },
{ label: 'Age', value: row => (row.age + ' years') },
{ label: 'Password', value: row => (row.hidden ? row.hidden.password : '') }
]

var content = [
{ email: 'Ana', age: 16, hidden: { password: '11111111' } },
{ email: 'Luis', age: 19, hidden: { password: '12345678' } }
]

var settings = {
sheetName: 'First sheet',
fileName: 'Users'
}

app.get('/', (req, res) => {
var columns = [
{ label: 'Email', value: 'email' },
{ label: 'Age', value: row => (row.age + ' years') },
{ label: 'Password', value: row => (row.hidden ? row.hidden.password : '') }
]
var content = [
{ email: 'Ana', age: 16, hidden: { password: '11111111' } },
{ email: 'Luis', age: 19, hidden: { password: '12345678' } }
]
var settings = {
sheetName: 'First sheet',
fileName: 'Users'
}
var buffer = xlsx(columns, content, settings, false)
res.writeHead(200, {
'Content-Type': 'application/octet-stream',
Expand All @@ -25,6 +29,13 @@ app.get('/', (req, res) => {
res.end(buffer)
})

app.get('/local', (req, res) => {
var buffer = xlsx(columns, content, settings, false)
const homedir = require('os').homedir()
writeFileSync(`${homedir}/Postman/mySheet.xlsx`, buffer)
res.status(200).send('xd')
})

app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
Loading

0 comments on commit a358245

Please sign in to comment.