Skip to content

Commit 5eec050

Browse files
authored
Merge pull request #274 from hackmdio/drop-bower
Drop bower
2 parents ecb956f + 9e6fd50 commit 5eec050

7 files changed

Lines changed: 11 additions & 63 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
node_modules
2-
bower_components
32
composer.phar
43
composer.lock
54
.env.*.php

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ Prerequisite
4444

4545
- Node.js 4.x or up (test up to 6.7.0)
4646
- Database (PostgreSQL, MySQL, MariaDB, SQLite, MSSQL) use charset `utf8`
47-
- npm and bower
47+
- npm
4848

4949
Get started
5050
---
5151

5252
1. Download a release and unzip or clone into a directory
53-
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.
53+
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.
5454
3. Setup the configs, see more below
5555
4. Setup environment variables which will overwrite the configs
56-
5. Build front-end bundle by `npm run build` (use `npm run dev` if you are in development)
56+
5. Build front-end bundle by `npm run build:prod` (use `npm run build:dev` if you are in development)
5757
6. Run the server as you like (node, forever, pm2)
5858

5959
Upgrade guide
@@ -63,7 +63,7 @@ If you are upgrading HackMD from an older version, follow these steps:
6363

6464
1. Fully stop your old server first (important)
6565
2. `git pull` or do whatever that updates the files
66-
3. `npm install && bower install` to update dependencies
66+
3. `npm install` to update dependencies
6767
4. Modify the file named `.sequelizerc`, change the value of the variable `url` with your db connection string
6868
For example: `postgres://username:password@localhost:5432/hackmd`
6969
5. Run `node_modules/.bin/sequelize db:migrate`, this step will migrate your db to the latest schema

app.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ app.use(i18n.init);
113113
// routes without sessions
114114
// static files
115115
app.use('/', express.static(__dirname + '/public', { maxAge: config.staticcachetime }));
116-
app.use('/vendor/', express.static(__dirname + '/bower_components', { maxAge: config.staticcachetime }));
117116

118117
//session
119118
app.use(session({
@@ -479,7 +478,7 @@ app.post('/uploadimage', function (req, res) {
479478
} else {
480479
if (config.debug)
481480
logger.info('SERVER received uploadimage: ' + JSON.stringify(files.image));
482-
481+
483482
try {
484483
switch (config.imageUploadType) {
485484
case 'filesystem':

bin/heroku

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
if [ "$BUILD_ASSETS" = true ]; then
6-
BUILD_ASSETS=false npm install && npm run assets:install
6+
BUILD_ASSETS=false npm install
77

88
# setup config files
99
cat << EOF > .sequelizerc
@@ -31,5 +31,5 @@ EOF
3131
cp public/js/config.js.example public/js/config.js
3232

3333
# build app
34-
npm run build
34+
npm run build:prod
3535
fi

bin/setup

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ EOF
1616
exit 0
1717
fi
1818

19-
if ! type bower > /dev/null
20-
then
21-
echo "bower is not installed, install via npm"
22-
npm install -g bower
23-
fi
24-
2519
echo "copy config files"
2620
if [ ! -f config.json ]; then
2721
cp config.json.example config.json
@@ -35,8 +29,8 @@ if [ ! -f .sequelizerc ]; then
3529
cp .sequelizerc.example .sequelizerc
3630
fi
3731

38-
echo "install npm and bower packages"
39-
BUILD_ASSETS=false npm install && bower install
32+
echo "install npm packages"
33+
BUILD_ASSETS=false npm install
4034

4135
cat << EOF
4236

bower.json

Lines changed: 0 additions & 40 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
"main": "app.js",
66
"license": "MIT",
77
"scripts": {
8-
"dev": "webpack --config webpack.config.js --progress --colors --watch & nodemon --delay 1 app.js",
9-
"build": "webpack --config webpack.production.js --progress --colors",
10-
"assets:install": "bower install",
8+
"build:dev": "webpack --config webpack.config.js --progress --colors --watch",
9+
"build:prod": "webpack --config webpack.production.js --progress --colors",
1110
"postinstall": "bin/heroku",
1211
"start": "node app.js"
1312
},
@@ -142,8 +141,6 @@
142141
"devDependencies": {
143142
"babel-core": "^6.17.0",
144143
"babel-loader": "^6.2.5",
145-
"bower": "^1.7.9",
146-
"bower-webpack-plugin": "^0.1.9",
147144
"copy-webpack-plugin": "^4.0.1",
148145
"css-loader": "^0.25.0",
149146
"ejs-loader": "^0.3.0",
@@ -156,7 +153,6 @@
156153
"json-loader": "^0.5.4",
157154
"less": "^2.7.1",
158155
"less-loader": "^2.2.3",
159-
"nodemon": "^1.11.0",
160156
"optimize-css-assets-webpack-plugin": "^1.3.0",
161157
"script-loader": "^0.7.0",
162158
"style-loader": "^0.13.1",

0 commit comments

Comments
 (0)