Skip to content

Commit

Permalink
Set version through process.env
Browse files Browse the repository at this point in the history
  • Loading branch information
robbevp committed Sep 5, 2024
1 parent 8827435 commit 47cf383
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/store/auth.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Vue from "vue";
import api from "@/api";
import { fetchAll } from "./actions";
import { APPLICATION_VERSION } from "../version";

export default {
namespaced: true,
Expand Down Expand Up @@ -58,7 +57,9 @@ export default {
async login({ commit }, data) {
try {
const result = await api.auth_tokens.create({
auth_token: { application: APPLICATION_VERSION },
auth_token: {
application: process.env.APPLICATION_VERSION,
},
...data,
});
commit("login", result);
Expand Down
1 change: 0 additions & 1 deletion src/version.js

This file was deleted.

15 changes: 13 additions & 2 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const version = require("./package.json").version;
const webpack = require("webpack");

module.exports = {
pluginOptions: {
i18n: {
Expand All @@ -16,6 +19,14 @@ module.exports = {
},
configureWebpack: (config) => {
config.cache = process.env.SKIP_CACHE !== "true";
config.plugins.push(
new webpack.DefinePlugin({
"process.env": {
// When building, this value will just be printed without quotes, so we add them explicitly
APPLICATION_VERSION: `"Accentor Web v${version}"`,
},
}),
);
},
chainWebpack: (config) => {
config.module
Expand All @@ -24,7 +35,7 @@ module.exports = {
.tap((opt) =>
Object.assign(opt, {
cacheDirectory: process.env.SKIP_CACHE !== "true",
}),
})

Check warning on line 38 in vue.config.js

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
);
config
.plugin("eslint")
Expand All @@ -39,7 +50,7 @@ module.exports = {
.tap((opt) =>
Object.assign(opt, {
additionalData: `@import '~@/sass/main.scss';`,
}),
})

Check warning on line 53 in vue.config.js

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
);
});
},
Expand Down

0 comments on commit 47cf383

Please sign in to comment.