Skip to content
This repository was archived by the owner on Apr 9, 2022. It is now read-only.

Commit 6a06ddf

Browse files
Merge pull request #1 from jakemcdermott/use-pipenv-and-yarn
use pipenv and yarn
2 parents 7ac2475 + e371b97 commit 6a06ddf

26 files changed

+8048
-84
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
server/db.sqlite3

Makefile

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
1-
clean:
2-
find . -name \*.pyc -o -name -delete
3-
find . -name \*.pyo -o -name -delete
4-
find . -name __pycache__ -o -name -delete
5-
find . -path "./server/server/api/migrations/*.py" -not -name "__init__.py" -o -name -delete
6-
rm -f server/db.sqlite3
1+
PYTHON_BIN = $(shell cd server && pipenv --venv)/bin/python
2+
3+
python_bin:
4+
pushd server; pipenv install --dev; popd;
75

8-
database:
9-
./server/manage.py makemigrations api --noinput
10-
./server/manage.py migrate --noinput
6+
database: python_bin
7+
$(PYTHON_BIN) ./server/manage.py makemigrations api --noinput
8+
$(PYTHON_BIN) ./server/manage.py migrate --noinput
119

12-
fixtures:
13-
./server/manage.py createsuperuser --username=root --email=root@example.com --noinput
14-
./server/manage.py create_fixtures
10+
fixtures: python_bin
11+
$(PYTHON_BIN) ./server/manage.py createsuperuser --username=root --email=root@example.com --noinput
12+
$(PYTHON_BIN) ./server/manage.py create_fixtures
13+
14+
server-dev: python_bin
15+
$(PYTHON_BIN) ./server/manage.py runserver --settings=server.settings
1516

1617
client/node_modules:
17-
npm --prefix=./client install
18+
yarn --cwd=./client install
1819

1920
client-dist: client/node_modules
20-
npm --prefix=./client run build
21+
yarn --cwd=./client run build
2122

22-
server-dev:
23-
./server/manage.py runserver --settings=server.settings
23+
clean:
24+
find . -name \*.pyc -o -name -delete
25+
find . -name \*.pyo -o -name -delete
26+
find . -name __pycache__ -o -name -delete
27+
find . -path "./server/server/api/migrations/*.py" -not -name "__init__.py" -o -name -delete
28+
rm -f server/db.sqlite3
2429

2530
all: clean database fixtures client-dist server-dev

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ An example [Vue.js](https://github.com/vuejs/vue) project featuring an unstyled
66
* [server](server)
77

88
#### Dependencies
9-
- python 3.5+
10-
- pip
9+
- python 3.6
10+
- pipenv 11.10.0
1111
- node 8.9.0
12-
- npm 5.6.0
12+
- yarn 1.6.0+

client/.eslintrc.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
module.exports = {
44
root: true,
5-
parser: 'babel-eslint',
65
parserOptions: {
7-
sourceType: 'module'
6+
parser: 'babel-eslint'
87
},
98
env: {
109
browser: true,
1110
},
12-
extends: 'airbnb-base',
11+
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
12+
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
13+
extends: ['plugin:vue/essential', 'airbnb-base'],
1314
// required to lint *.vue files
1415
plugins: [
15-
'html'
16+
'vue'
1617
],
1718
// check if imports actually resolve
1819
settings: {

client/.postcssrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
module.exports = {
44
"plugins": {
5-
// to edit target browsers: use "browserslist" field in package.json
65
"postcss-import": {},
6+
"postcss-url": {},
7+
// to edit target browsers: use "browserslist" field in package.json
78
"autoprefixer": {}
89
}
910
}

client/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
``` bash
44
# install dependencies
5-
npm install
5+
yarn install
66

77
# serve with auto-reload at localhost:8080
8-
npm run dev
8+
yarn run dev
99

1010
# build for production with minification
11-
npm run build
11+
yarn run build
1212

1313
# build for production and view the bundle analyzer report
14-
npm run build --report
14+
yarn run build --report
1515

1616
# run unit tests
17-
npm run unit
17+
yarn run unit
1818

1919
# run e2e tests
20-
npm run e2e
20+
yarn run e2e
2121

2222
# run all tests
23-
npm test
23+
yarn test
2424
```
2525

2626
For more details on the build setup see [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

client/build/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
2222
process.stdout.write(stats.toString({
2323
colors: true,
2424
modules: false,
25-
children: false, // if you are using ts-loader, setting this to true will make tyescript errors show up during build
25+
children: false, // if you are using ts-loader, setting this to true will make TypeScript errors show up during build
2626
chunks: false,
2727
chunkModules: false
2828
}) + '\n\n')

client/build/webpack.base.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = {
4949
{
5050
test: /\.js$/,
5151
loader: 'babel-loader',
52-
include: [resolve('src'), resolve('test')]
52+
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
5353
},
5454
{
5555
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,

client/build/webpack.dev.conf.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const utils = require('./utils')
33
const webpack = require('webpack')
44
const config = require('../config')
55
const merge = require('webpack-merge')
6+
const path = require('path')
67
const baseWebpackConfig = require('./webpack.base.conf')
8+
const CopyWebpackPlugin = require('copy-webpack-plugin')
79
const HtmlWebpackPlugin = require('html-webpack-plugin')
810
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
911
const portfinder = require('portfinder')
@@ -24,8 +26,13 @@ const devWebpackConfig = merge(baseWebpackConfig, {
2426
// these devServer options should be customized in /config/index.js
2527
devServer: {
2628
clientLogLevel: 'warning',
27-
historyApiFallback: true,
29+
historyApiFallback: {
30+
rewrites: [
31+
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
32+
],
33+
},
2834
hot: true,
35+
contentBase: false, // since we use CopyWebpackPlugin.
2936
compress: true,
3037
host: HOST || config.dev.host,
3138
port: PORT || config.dev.port,
@@ -53,6 +60,14 @@ const devWebpackConfig = merge(baseWebpackConfig, {
5360
template: 'index.html',
5461
inject: true
5562
}),
63+
// copy custom static assets
64+
new CopyWebpackPlugin([
65+
{
66+
from: path.resolve(__dirname, '../static'),
67+
to: config.dev.assetsSubDirectory,
68+
ignore: ['.*']
69+
}
70+
])
5671
]
5772
})
5873

client/build/webpack.prod.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const webpackConfig = merge(baseWebpackConfig, {
7878
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
7979
chunksSortMode: 'dependency'
8080
}),
81-
// keep module.id stable when vender modules does not change
81+
// keep module.id stable when vendor modules does not change
8282
new webpack.HashedModuleIdsPlugin(),
8383
// enable scope hoisting
8484
new webpack.optimize.ModuleConcatenationPlugin(),

0 commit comments

Comments
 (0)