Skip to content

Commit 8e233ab

Browse files
committed
chore(app): add building for dev
1 parent 53f2871 commit 8e233ab

6 files changed

Lines changed: 11 additions & 8 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"start-live": "webpack-dev-server --content-base src --progress --colors",
99
"start": "webpack --watch --content-base src --progress --colors",
1010
"build": "webpack --content-base src --progress",
11+
"build-dev": "set NODE_ENV=dev&&webpack --content-base src --progress",
1112
"test": "echo OK"
1213
},
1314
"devDependencies": {

src/components/toolbar/toolbar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function controller($mdToast, $state, $window, WikiService, wikidata) {
3030
$mdToast.show($mdToast.simple()
3131
.position('top right')
3232
.textContent(`${item.label} is not an architectural structure or territorial entity`)
33-
.hideDelay(3000000));
33+
.hideDelay(2000));
3434
}
3535
});
3636
}
@@ -44,11 +44,11 @@ function controller($mdToast, $state, $window, WikiService, wikidata) {
4444

4545
function login() {
4646
vm.loading = true;
47-
$window.location.pathname = '/login';
47+
$window.location.pathname = `${$window.__env.baseUrl}/login`;
4848
}
4949

5050
function logout() {
51-
$window.location.pathname = '/logout';
51+
$window.location.pathname = `${$window.__env.baseUrl}/logout`;
5252
}
5353
}
5454

src/index_dev.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
(function (window) {
1212
window.__env = window.__env || {};
1313
window.__env.name = 'dev';
14+
window.__env.baseUrl = '/monumental';
1415
}(this));
1516
</script>
1617
</body>

src/index_local.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
(function (window) {
1212
window.__env = window.__env || {};
1313
window.__env.name = 'local';
14+
window.__env.baseUrl = '';
1415
}(this));
1516
</script>
1617
</body>

src/services/wiki.service.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _ from 'lodash';
22

3-
const WikiService = function ($http, $httpParamSerializerJQLike, $q, wikidata) {
3+
const WikiService = function ($http, $httpParamSerializerJQLike, $q, $window, wikidata) {
44
const service = {
55
addCategory,
66
getArticleHeader,
@@ -131,7 +131,7 @@ const WikiService = function ($http, $httpParamSerializerJQLike, $q, wikidata) {
131131
}
132132

133133
function getToken() {
134-
return $http.get('/api', {
134+
return $http.get(`${$window.__env.baseUrl}/api`, {
135135
params: {
136136
action: 'query',
137137
meta: 'tokens',
@@ -148,7 +148,7 @@ const WikiService = function ($http, $httpParamSerializerJQLike, $q, wikidata) {
148148
function setClaim(params) {
149149
return $http({
150150
method: 'POST',
151-
url: '/api',
151+
url: `${$window.__env.baseUrl}/api`,
152152
data: $httpParamSerializerJQLike(angular.extend({ use_auth: true }, params)),
153153
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
154154
}).then((response) => {

webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ var config = {
5959
var ENV = process.env.NODE_ENV;
6060
if (ENV === 'prod' || ENV === 'dev') {
6161
config.output = {
62-
path: path.join(__dirname, 'app', 'dist'),
63-
publicPath: 'dist/',
62+
path: path.join(__dirname, 'monumental', 'static', 'assets'),
63+
publicPath: 'assets/',
6464
filename: 'bundle.min.js?v=' + package.version
6565
};
6666
config.plugins = [

0 commit comments

Comments
 (0)