Merge pull request #274 from hackmdio/drop-bower

Drop bower
This commit is contained in:
Max Wu 2016-12-11 23:22:17 +08:00 committed by GitHub
commit 5eec050360
7 changed files with 11 additions and 63 deletions

1
.gitignore vendored
View file

@ -1,5 +1,4 @@
node_modules node_modules
bower_components
composer.phar composer.phar
composer.lock composer.lock
.env.*.php .env.*.php

View file

@ -44,16 +44,16 @@ Prerequisite
- Node.js 4.x or up (test up to 6.7.0) - Node.js 4.x or up (test up to 6.7.0)
- Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8` - Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8`
- npm and bower - npm
Get started Get started
--- ---
1. Download a release and unzip or clone into a directory 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 3. Setup the configs, see more below
4. Setup environment variables which will overwrite the configs 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) 6. Run the server as you like (node, forever, pm2)
Upgrade guide 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) 1. Fully stop your old server first (important)
2. `git pull` or do whatever that updates the files 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 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` 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 5. Run `node_modules/.bin/sequelize db:migrate`, this step will migrate your db to the latest schema

1
app.js
View file

@ -113,7 +113,6 @@ app.use(i18n.init);
// routes without sessions // routes without sessions
// static files // static files
app.use('/', express.static(__dirname + '/public', { maxAge: config.staticcachetime })); app.use('/', express.static(__dirname + '/public', { maxAge: config.staticcachetime }));
app.use('/vendor/', express.static(__dirname + '/bower_components', { maxAge: config.staticcachetime }));
//session //session
app.use(session({ app.use(session({

View file

@ -3,7 +3,7 @@
set -e set -e
if [ "$BUILD_ASSETS" = true ]; then if [ "$BUILD_ASSETS" = true ]; then
BUILD_ASSETS=false npm install && npm run assets:install BUILD_ASSETS=false npm install
# setup config files # setup config files
cat << EOF > .sequelizerc cat << EOF > .sequelizerc
@ -31,5 +31,5 @@ EOF
cp public/js/config.js.example public/js/config.js cp public/js/config.js.example public/js/config.js
# build app # build app
npm run build npm run build:prod
fi fi

View file

@ -16,12 +16,6 @@ EOF
exit 0 exit 0
fi fi
if ! type bower > /dev/null
then
echo "bower is not installed, install via npm"
npm install -g bower
fi
echo "copy config files" echo "copy config files"
if [ ! -f config.json ]; then if [ ! -f config.json ]; then
cp config.json.example config.json cp config.json.example config.json
@ -35,8 +29,8 @@ if [ ! -f .sequelizerc ]; then
cp .sequelizerc.example .sequelizerc cp .sequelizerc.example .sequelizerc
fi fi
echo "install npm and bower packages" echo "install npm packages"
BUILD_ASSETS=false npm install && bower install BUILD_ASSETS=false npm install
cat << EOF cat << EOF

View file

@ -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"
}
}

View file

@ -5,9 +5,8 @@
"main": "app.js", "main": "app.js",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "webpack --config webpack.config.js --progress --colors --watch & nodemon --delay 1 app.js", "build:dev": "webpack --config webpack.config.js --progress --colors --watch",
"build": "webpack --config webpack.production.js --progress --colors", "build:prod": "webpack --config webpack.production.js --progress --colors",
"assets:install": "bower install",
"postinstall": "bin/heroku", "postinstall": "bin/heroku",
"start": "node app.js" "start": "node app.js"
}, },
@ -142,8 +141,6 @@
"devDependencies": { "devDependencies": {
"babel-core": "^6.17.0", "babel-core": "^6.17.0",
"babel-loader": "^6.2.5", "babel-loader": "^6.2.5",
"bower": "^1.7.9",
"bower-webpack-plugin": "^0.1.9",
"copy-webpack-plugin": "^4.0.1", "copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.25.0", "css-loader": "^0.25.0",
"ejs-loader": "^0.3.0", "ejs-loader": "^0.3.0",
@ -156,7 +153,6 @@
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"less": "^2.7.1", "less": "^2.7.1",
"less-loader": "^2.2.3", "less-loader": "^2.2.3",
"nodemon": "^1.11.0",
"optimize-css-assets-webpack-plugin": "^1.3.0", "optimize-css-assets-webpack-plugin": "^1.3.0",
"script-loader": "^0.7.0", "script-loader": "^0.7.0",
"style-loader": "^0.13.1", "style-loader": "^0.13.1",