-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from Siemienik/82/xlsx-renderer-cli
Issue 82: Added xlsx-renderer-cli
- Loading branch information
Showing
12 changed files
with
1,314 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: xlsx-renderer-cli | ||
|
||
on: [push, pull_request] # todo path limitation | ||
|
||
defaults: | ||
run: | ||
working-directory: ./packages/xlsx-renderer-cli | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
# node-version: [8.x, 9.x, 10.x, 11.x, 12.x, 13.x, 14.x] # version 8 and 9 isn't supported in ExcelJS as default - may I resolve it further (or ignore) | ||
node-version: [10.x, 11.x, 12.x, 13.x, 14.x] | ||
|
||
steps: | ||
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # @v2.3.4; Using hash for security purposes | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@c6fd00ceb9747fb23ffdf72987450a2664414867 # @v2.1.2; Using hash for security purposes | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm install | ||
run: npm ci | ||
- name: Check lint | ||
run: npm run lint | ||
- name: Check build | ||
run: npm run build | ||
|
||
# @see https://github.com/Siemienik/XToolset/issues/102 | ||
# - name: Check unit & integration tests with coverage | ||
# run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
lib/ | ||
node_modules/ | ||
coverage/ | ||
.nyc_output/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"printWidth": 120, | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"tabWidth": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Siemienik Paweł | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
[![NPM](https://img.shields.io/npm/l/xlsx-renderer)![npm](https://img.shields.io/npm/v/sxr)](https://www.npmjs.com/package/sxr) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/siemienik/xtoolset/xlsx-renderer-cli)](https://github.com/Siemienik/xtoolset/actions) | ||
|
||
[![Join the chat at https://gitter.im/Siemienik/community](https://badges.gitter.im/Siemienik/community.svg)](https://gitter.im/Siemienik/community) | ||
|
||
# XLSX-Renderer-CLI: | ||
|
||
Command line of [xlsx-renderer](../xlsx-renderer). Generates spreadsheet files based on the template with view model. | ||
|
||
## Global installation | ||
|
||
``` | ||
# Install globally: | ||
npm i -g sxr | ||
# Usages: | ||
sxr --model vm.json template.xlsx > output.xlsx | ||
``` | ||
|
||
## Local installation | ||
|
||
1. Install package | ||
|
||
``` | ||
# install globally: | ||
npm i --save sxr | ||
# usages: | ||
node_modules/.bin/sxr --model vm.json template.xlsx > output.xlsx | ||
``` | ||
|
||
2. Additionally, able to use with packages.json scripts: | ||
|
||
`package.json:` | ||
```js | ||
scripts:{ | ||
"generate-xlsx":"sxr --model vm.json template.xlsx > output.xlsx" | ||
} | ||
``` | ||
|
||
bash: | ||
``` | ||
npm run generate-xlsx | ||
``` | ||
|
||
# Examples: | ||
|
||
``` | ||
cat vm.json | sxr template.xlsx > output.xlsx | ||
sxr template.xlsx "{\"jsonData\":true}" > output.xlsx | ||
sxr --model vm.json template.xlsx > output.xlsx | ||
sxr --model vm.json -o output.xlsx template.xlsx | ||
sxr -o output.xlsx template.xlsx "{\"jsonData\":true}" | ||
``` | ||
|
||
# Command body: | ||
|
||
`sxr [options] <template> [model]` | ||
|
||
|
||
## Arguments | ||
|
||
* `<template>` indicate the template file, | ||
* `[model]` view model as a json used to generate a spreadsheet, | ||
|
||
## Options | ||
|
||
* `-o --output <filename>` write to filename | ||
* `-m --model <filename>` read filename as a `[model]` (using both is denied) | ||
* `-o --output <filename>` write result into filename | ||
|
||
## Output | ||
|
||
`sxr` out-of-a-box pushes generated files into `stdout`, to save it into a file please to append ` > filename.xlsx`. | ||
|
||
Library allowing also save output into file by using option `-o --output <filename>` | ||
|
||
It is also allowed using pipe parameter to forward generated file into another command. | ||
|
||
# The template file | ||
|
||
The template structure inherit from `xlsx-renderer`. Please use link below for more information: | ||
|
||
[**Documentation**](https://github.com/Siemienik/XToolset/tree/master/packages/xlsx-renderer#documentation) | ||
|
||
--- | ||
|
||
[LICENSE](LICENSE) |
Oops, something went wrong.