commit
5eec050360
7 changed files with 11 additions and 63 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
|||
node_modules
|
||||
bower_components
|
||||
composer.phar
|
||||
composer.lock
|
||||
.env.*.php
|
||||
|
|
|
@ -44,16 +44,16 @@ Prerequisite
|
|||
|
||||
- Node.js 4.x or up (test up to 6.7.0)
|
||||
- Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8`
|
||||
- npm and bower
|
||||
- npm
|
||||
|
||||
Get started
|
||||
---
|
||||
|
||||
1. Download a release and unzip or clone into a directory
|
||||
2. Enter the directory and type `bin/setup`, which will install npm/bower dependencies and create configs. The setup script is written in Bash, you would need bash as a prerequisite.
|
||||
2. Enter the directory and type `bin/setup`, which will install npm dependencies and create configs. The setup script is written in Bash, you would need bash as a prerequisite.
|
||||
3. Setup the configs, see more below
|
||||
4. Setup environment variables which will overwrite the configs
|
||||
5. Build front-end bundle by `npm run build` (use `npm run dev` if you are in development)
|
||||
5. Build front-end bundle by `npm run build:prod` (use `npm run build:dev` if you are in development)
|
||||
6. Run the server as you like (node, forever, pm2)
|
||||
|
||||
Upgrade guide
|
||||
|
@ -63,7 +63,7 @@ If you are upgrading HackMD from an older version, follow these steps:
|
|||
|
||||
1. Fully stop your old server first (important)
|
||||
2. `git pull` or do whatever that updates the files
|
||||
3. `npm install && bower install` to update dependencies
|
||||
3. `npm install` to update dependencies
|
||||
4. Modify the file named `.sequelizerc`, change the value of the variable `url` with your db connection string
|
||||
For example: `postgres://username:password@localhost:5432/hackmd`
|
||||
5. Run `node_modules/.bin/sequelize db:migrate`, this step will migrate your db to the latest schema
|
||||
|
|
1
app.js
1
app.js
|
@ -113,7 +113,6 @@ app.use(i18n.init);
|
|||
// routes without sessions
|
||||
// static files
|
||||
app.use('/', express.static(__dirname + '/public', { maxAge: config.staticcachetime }));
|
||||
app.use('/vendor/', express.static(__dirname + '/bower_components', { maxAge: config.staticcachetime }));
|
||||
|
||||
//session
|
||||
app.use(session({
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
set -e
|
||||
|
||||
if [ "$BUILD_ASSETS" = true ]; then
|
||||
BUILD_ASSETS=false npm install && npm run assets:install
|
||||
BUILD_ASSETS=false npm install
|
||||
|
||||
# setup config files
|
||||
cat << EOF > .sequelizerc
|
||||
|
@ -31,5 +31,5 @@ EOF
|
|||
cp public/js/config.js.example public/js/config.js
|
||||
|
||||
# build app
|
||||
npm run build
|
||||
npm run build:prod
|
||||
fi
|
||||
|
|
10
bin/setup
10
bin/setup
|
@ -16,12 +16,6 @@ EOF
|
|||
exit 0
|
||||
fi
|
||||
|
||||
if ! type bower > /dev/null
|
||||
then
|
||||
echo "bower is not installed, install via npm"
|
||||
npm install -g bower
|
||||
fi
|
||||
|
||||
echo "copy config files"
|
||||
if [ ! -f config.json ]; then
|
||||
cp config.json.example config.json
|
||||
|
@ -35,8 +29,8 @@ if [ ! -f .sequelizerc ]; then
|
|||
cp .sequelizerc.example .sequelizerc
|
||||
fi
|
||||
|
||||
echo "install npm and bower packages"
|
||||
BUILD_ASSETS=false npm install && bower install
|
||||
echo "install npm packages"
|
||||
BUILD_ASSETS=false npm install
|
||||
|
||||
cat << EOF
|
||||
|
||||
|
|
40
bower.json
40
bower.json
|
@ -1,40 +0,0 @@
|
|||
{
|
||||
"name": "hackmd",
|
||||
"description": "Realtime collaborative markdown notes on all platforms.",
|
||||
"main": "app.js",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/hackmdio/hackmd",
|
||||
"moduleType": [
|
||||
"node"
|
||||
],
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"bootstrap": "~3.3.7",
|
||||
"font-awesome": "~4.6.3",
|
||||
"Ionicons": "ionicons#~2.0.1",
|
||||
"reveal.js": "~3.3.0",
|
||||
"spin.js": "~2.3.2",
|
||||
"moment": "~2.15.1",
|
||||
"handlebars": "~4.0.5",
|
||||
"js-yaml": "~3.6.1",
|
||||
"raphael": "~2.2.6",
|
||||
"mermaid": "^6.0.0",
|
||||
"MathJax": "^2.7.0",
|
||||
"octicons": "~3.5.0",
|
||||
"velocity": "^1.3.1",
|
||||
"randomcolor": "randomColor#^0.4.4",
|
||||
"Idle.Js": "idle.js#^1.0.0",
|
||||
"gist-embed": "*",
|
||||
"emojify.js": "^1.1.0",
|
||||
"select2": "3.5.4"
|
||||
},
|
||||
"resolutions": {
|
||||
"jquery": "~3.1.1"
|
||||
}
|
||||
}
|
|
@ -5,9 +5,8 @@
|
|||
"main": "app.js",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "webpack --config webpack.config.js --progress --colors --watch & nodemon --delay 1 app.js",
|
||||
"build": "webpack --config webpack.production.js --progress --colors",
|
||||
"assets:install": "bower install",
|
||||
"build:dev": "webpack --config webpack.config.js --progress --colors --watch",
|
||||
"build:prod": "webpack --config webpack.production.js --progress --colors",
|
||||
"postinstall": "bin/heroku",
|
||||
"start": "node app.js"
|
||||
},
|
||||
|
@ -142,8 +141,6 @@
|
|||
"devDependencies": {
|
||||
"babel-core": "^6.17.0",
|
||||
"babel-loader": "^6.2.5",
|
||||
"bower": "^1.7.9",
|
||||
"bower-webpack-plugin": "^0.1.9",
|
||||
"copy-webpack-plugin": "^4.0.1",
|
||||
"css-loader": "^0.25.0",
|
||||
"ejs-loader": "^0.3.0",
|
||||
|
@ -156,7 +153,6 @@
|
|||
"json-loader": "^0.5.4",
|
||||
"less": "^2.7.1",
|
||||
"less-loader": "^2.2.3",
|
||||
"nodemon": "^1.11.0",
|
||||
"optimize-css-assets-webpack-plugin": "^1.3.0",
|
||||
"script-loader": "^0.7.0",
|
||||
"style-loader": "^0.13.1",
|
||||
|
|
Loading…
Reference in a new issue