From 4d62220db9b9916a78bdfcf19c3081aaaafb9213 Mon Sep 17 00:00:00 2001 From: Geequlim Date: Sun, 24 May 2020 19:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9E=84=E5=BB=BA=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E5=91=BD=E4=BB=A4=20=E6=9B=B4=E6=96=B0=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + README.md | 15 ++++++++++----- package.json | 6 ++++-- tools/build.js | 3 +++ 转表.bat | 2 +- 转表.sh | 2 +- 6 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 tools/build.js diff --git a/.gitignore b/.gitignore index 0e393f0..e97b349 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ dist/ node_modules/ yarn.lock +package-lock.json *.xlsl \ No newline at end of file diff --git a/README.md b/README.md index e79e026..d4258d9 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,18 @@ * 空(`null`) * 该工具设计原则是简单易用,表格字段可由策划自由调整,不支持数据引用,暂不支持结构体 -## Windows 安装 -安装 NodeJS, 注意勾选将 Node 添加到环境变量 `PATH` 中 +## 安装 +- 安装 NodeJS 和 NPM, 注意将 Node 和 NPM 添加到环境变量 `PATH` 中 +- 执行下面的命令构建项目,将生成的 `dist` 复制到到您的项目中 +``` +npm run build +``` ## 使用 - 修改配置表 - 修改 excel-exporter.json 修改工具配置 - 双击 转表.bat 执行转换工作 +- 按照上面介绍的规则填写 Excel 配置表 +- 修改 `excel-exporter.json` 修改工具配置,配置要读取的 Excel 文件列表,配置你需要的导出器 +- Windows 下双击 `转表.bat` 执行转换工作 +- Linux/macOS 下执行 `转表.sh` 执行转换工作 ### 配置示例 diff --git a/package.json b/package.json index 1a08588..53694c9 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,15 @@ "name": "tiny-nodejs-starter-kit", "version": "1.0.0", "main": "index.js", - "license": "MIT", + "license": "BSD", "scripts": { "dev": "node_modules/.bin/webpack --config webpack.config.js --watch", - "compile": "node_modules/.bin/webpack --config webpack.config.js --env.production" + "compile": "node_modules/.bin/webpack --config webpack.config.js --env.production", + "build": "node ./tools/build.js" }, "devDependencies": { "@types/node": "^14.0.1", + "shelljs": "^0.8.4", "ts-loader": "^7.0.4", "tsconfig-paths-webpack-plugin": "^3.2.0", "typescript": "^3.9.2", diff --git a/tools/build.js b/tools/build.js new file mode 100644 index 0000000..65be6fc --- /dev/null +++ b/tools/build.js @@ -0,0 +1,3 @@ +const shell = require("shelljs"); +shell.exec("npm install && npm run compile") +shell.cp(["转表.bat", "转表.sh", "excel-exporter.json"], "dist") \ No newline at end of file diff --git a/转表.bat b/转表.bat index 525a60f..bf41784 100644 --- a/转表.bat +++ b/转表.bat @@ -1,2 +1,2 @@ -call node ./dist/binary.js ./excel-exporter.json +call node ./binary.js ./excel-exporter.json pause \ No newline at end of file diff --git a/转表.sh b/转表.sh index c99699b..878b5e3 100644 --- a/转表.sh +++ b/转表.sh @@ -1,2 +1,2 @@ #!/bin/bash -node ./dist/binary.js ./excel-exporter.json \ No newline at end of file +node ./binary.js ./excel-exporter.json \ No newline at end of file