Skip to content

Commit

Permalink
replaced hardcoded versions in the app
Browse files Browse the repository at this point in the history
  • Loading branch information
br41nslug authored and rijkvanzanten committed Dec 20, 2023
1 parent c3211fc commit a5a1c26
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
2 changes: 0 additions & 2 deletions app/env.d.ts
@@ -1,4 +1,2 @@
/// <reference types="vite/client" />
/// <reference types="@histoire/plugin-vue/components" />

declare const __DIRECTUS_VERSION__: string;
8 changes: 1 addition & 7 deletions app/src/main.ts
Expand Up @@ -17,19 +17,13 @@ import { registerViews } from './views/register';
init();

async function init() {
const version = __DIRECTUS_VERSION__;

console.log(DIRECTUS_LOGO);

console.info(
`Hey! Interested in helping build this open-source data management platform?\nIf so, join our growing team of contributors at: https://directus.chat`,
);

if (import.meta.env.DEV) {
console.info(`%c🐰 Starting Directus v${version}...`, 'color:Green');
} else {
console.info(`%c🐰 Starting Directus...`, 'color:Green');
}
console.info(`%c🐰 Starting Directus...`, 'color:Green');

console.time('🕓 Application Loaded');

Expand Down
6 changes: 3 additions & 3 deletions app/src/modules/settings/components/navigation.vue
@@ -1,10 +1,10 @@
<script setup lang="ts">
import { useServerStore } from '@/stores/server';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
const version = __DIRECTUS_VERSION__;
const { t } = useI18n();
const { info } = useServerStore();
const dataItems = [
{
Expand Down Expand Up @@ -103,7 +103,7 @@ const externalItems = computed(() => {
<v-list-item href="https://github.com/directus/directus/releases" class="version">
<v-list-item-icon><v-icon name="directus" /></v-list-item-icon>
<v-list-item-content>
<v-text-overflow class="version" :text="`Directus ${version}`" />
<v-text-overflow class="version" :text="`Directus ${info.version}`" />
</v-list-item-content>
</v-list-item>
</v-list>
Expand Down
2 changes: 2 additions & 0 deletions app/src/stores/server.ts
Expand Up @@ -43,6 +43,7 @@ export type Info = {
default: number;
max: number;
};
version?: string;
};

export type Auth = {
Expand Down Expand Up @@ -83,6 +84,7 @@ export const useServerStore = defineStore('serverStore', () => {

info.project = serverInfoResponse.data.data?.project;
info.queryLimit = serverInfoResponse.data.data?.queryLimit;
info.version = serverInfoResponse.data.data?.version;

auth.providers = authResponse.data.data;
auth.disableDefault = authResponse.data.disableDefault;
Expand Down
4 changes: 0 additions & 4 deletions app/vite.config.js
Expand Up @@ -18,16 +18,12 @@ import fs from 'node:fs';
import path from 'node:path';
import { searchForWorkspaceRoot } from 'vite';
import { defineConfig } from 'vitest/config';
import { version } from '../directus/package.json';

const API_PATH = path.join('..', 'api');
const EXTENSIONS_PATH = path.join(API_PATH, 'extensions');

// https://vitejs.dev/config/
export default defineConfig({
define: {
__DIRECTUS_VERSION__: JSON.stringify(version),
},
plugins: [
directusExtensions(),
vue(),
Expand Down

0 comments on commit a5a1c26

Please sign in to comment.