-
Notifications
You must be signed in to change notification settings - Fork 529
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 #140 from tanliyuan/feature/package_npm
Feature/package npm
- Loading branch information
Showing
10 changed files
with
172 additions
and
77 deletions.
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 |
---|---|---|
@@ -1,3 +1 @@ | ||
.idea | ||
.DS_Store | ||
node_modules | ||
* |
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,29 @@ | ||
## ArtiPub 后端模块 | ||
从 0.1.6 开始前后端分开打包, 对应前端包 [artipub-frontend](https://www.npmjs.com/package/artipub-frontend) | ||
|
||
## 启动命令 | ||
|
||
```bash | ||
//全局安装 | ||
npm i -g artipub-backend | ||
|
||
//默认启动 http://localhost:3000, 确保本地 mongodb 已经启动在 27017 端口 | ||
artipub-be start | ||
|
||
//查看其他配置参数 | ||
artipub-be --help | ||
``` | ||
|
||
```bash | ||
//非全局安装 | ||
npm i artipub-backend | ||
|
||
//安装目录下执行, 确保npm 5+, 有npx命令 | ||
npx artipub-be start | ||
|
||
//或者 | ||
./node_modules/.bin/artipub-be start | ||
|
||
//查看其他配置参数 | ||
npx artipub-be --help | ||
``` |
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,32 @@ | ||
#!/usr/bin/env node | ||
const { version }= require('./package.json'); | ||
const program = require('commander') | ||
|
||
program | ||
.version(version) | ||
.command('start') | ||
.description('Start ArtiPub backend server') | ||
.option('-H, --host <host>', 'mongodb host name', '127.0.0.1') | ||
.option('-p, --port <port>', 'port number', 27017) | ||
.option('-d, --dbname <dbname>', 'database name', 'artipub') | ||
.option('-u, --username <username>', 'mongodb username', '') | ||
.option('-P, --password <password>', 'mongodb password', '') | ||
.action((options) => { | ||
|
||
const host = options.host || 'localhost' | ||
const port = options.port || '27017' | ||
const db = options.dbname || 'artipub' | ||
const username = options.username || '' | ||
const password = options.password || '' | ||
|
||
process.env.MONGO_HOST = host | ||
process.env.MONGO_PORT = port | ||
process.env.MONGO_DB = db | ||
process.env.MONGO_USERNAME = username | ||
process.env.MONGO_PASSWORD = password | ||
|
||
// 开启后段服务 | ||
require('./server') | ||
}) | ||
|
||
program.parse(process.argv) |
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 |
---|---|---|
@@ -1,25 +1,37 @@ | ||
{ | ||
"name": "backend", | ||
"version": "1.0.0", | ||
"name": "artipub-backend", | ||
"version": "0.1.6", | ||
"description": "", | ||
"main": "server.js", | ||
"scripts": { | ||
"start": "node server.js" | ||
"start": "node server.js", | ||
"prerelease": "npm version prerelease --preid=alpha" | ||
}, | ||
"author": "Marvin Zhang", | ||
"contributors": [ | ||
{ | ||
"name": "tanliyuan", | ||
"email": "[email protected]", | ||
"url": "https://juejin.cn/user/3843548383021127/posts" | ||
} | ||
], | ||
"bin": { | ||
"artipub-be": "cli.js" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"async-lock": "^1.2.2", | ||
"axios": "^0.20.0", | ||
"body-parser": "^1.19.0", | ||
"cheerio": "^1.0.0-rc.3", | ||
"clipboardy": "^2.1.0", | ||
"commander": "^7.1.0", | ||
"cron": "^1.7.1", | ||
"express": "^4.17.1", | ||
"log4js": "^5.1.0", | ||
"mongoose": "^5.6.12", | ||
"morgan": "^1.9.1", | ||
"puppeteer-chromium-resolver": "^5.2.0", | ||
"cheerio": "^1.0.0-rc.3", | ||
"request": "^2.88.0", | ||
"request-promise-native": "^1.0.7", | ||
"showdown": "^1.9.0" | ||
|
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 @@ | ||
* |
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,29 @@ | ||
## ArtiPub 前端模块 | ||
从 0.1.6 开始前后端分开打包, 对应后端包 [artipub-backend](https://www.npmjs.com/package/artipub-backend) | ||
|
||
## 启动命令 | ||
|
||
```bash | ||
//全局安装 | ||
npm i -g artipub-frontend | ||
|
||
//默认启动 http://localhost:8000 | ||
artipub-fe start | ||
|
||
//查看其他配置参数 | ||
artipub-fe --help | ||
``` | ||
|
||
```bash | ||
//非全局安装 | ||
npm i artipub-frontend | ||
|
||
//安装目录下执行, 确保npm 5+, 有npx命令 | ||
npx artipub-fe start | ||
|
||
//或者 | ||
./node_modules/.bin/artipub-fe start | ||
|
||
//查看其他配置参数 | ||
npx artipub-fe --help | ||
``` |
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,26 @@ | ||
#!/usr/bin/env node | ||
const { version }= require('./package.json'); | ||
const path = require('path'); | ||
const exec = require('child_process').exec | ||
const program = require('commander') | ||
|
||
const distDir = path.join( | ||
__dirname, './dist' | ||
); | ||
|
||
program | ||
.version(version) | ||
.command('start') | ||
.description('Start ArtiPub frontend server') | ||
.option('-h, --host <host>', 'host name', '127.0.0.1') | ||
.option('-p, --port <port>', 'port number', 8000) | ||
.action((options) => { | ||
const setUpCmd = `npx http-server ${distDir} -a ${options.host} -p ${options.port}`; | ||
|
||
// 开启前端服务 | ||
console.log(`启动命令:${setUpCmd}`) | ||
console.log(`访问:http://127.0.0.1:${options.port} `) | ||
exec(setUpCmd, { shell: true }) | ||
}) | ||
|
||
program.parse(process.argv) |
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
{ | ||
"name": "artipub", | ||
"version": "0.1.4", | ||
"name": "artipub-frontend", | ||
"version": "0.1.6", | ||
"description": "Article publishing platform that automatically distributes your articles to various media channels", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node cli.js start", | ||
"start:frontend": "umi dev", | ||
"prod": "http-server ./dist", | ||
"dev": "umi dev", | ||
"build": "umi build", | ||
"prerelease": "npm version prerelease --preid=alpha", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"bin": { | ||
"artipub": "./cli.js" | ||
"artipub-fe": "cli.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -25,7 +25,18 @@ | |
"post", | ||
"puppeteer" | ||
], | ||
"files": [ | ||
"dist/", | ||
"cli.js" | ||
], | ||
"author": "Marvin Zhang", | ||
"contributors": [ | ||
{ | ||
"name": "tanliyuan", | ||
"email": "[email protected]", | ||
"url": "https://juejin.cn/user/3843548383021127/posts" | ||
} | ||
], | ||
"license": "BSD-3-Clause", | ||
"bugs": { | ||
"url": "https://github.com/crawlab-team/artipub/issues" | ||
|
@@ -39,7 +50,9 @@ | |
"antd": "^3.20.0", | ||
"classnames": "^2.2.6", | ||
"codemirror": "^5.48.2", | ||
"commander": "^7.1.0", | ||
"dva": "^2.4.1", | ||
"http-server": "^0.12.3", | ||
"lodash": "^4.17.11", | ||
"markdown-it": "^10.0.0", | ||
"moment": "^2.24.0", | ||
|