Skip to content

Commit

Permalink
Merge pull request #474 from fdm-monster/feat/prepare-gitflow
Browse files Browse the repository at this point in the history
Feat/prepare gitflow
  • Loading branch information
davidzwa authored Oct 27, 2024
2 parents 502dc54 + 662d6f1 commit 98bea41
Show file tree
Hide file tree
Showing 67 changed files with 3,701 additions and 1,728 deletions.
6 changes: 5 additions & 1 deletion .eslintrc-auto-import.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
"watch": true,
"watchEffect": true,
"watchPostEffect": true,
"watchSyncEffect": true
"watchSyncEffect": true,
"onWatcherCleanup": true,
"useId": true,
"useModel": true,
"useTemplateRef": true
}
}
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github: [davidzwa, fdm-monster] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
# patreon: davidzwa # Replace with a single Patreon username
ko_fi: davidzwa
94 changes: 94 additions & 0 deletions .github/workflows/release-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Dist Release
on:
push:
branches:
- 'develop'
- 'main'
- 'release/*' # Add this line to include all release branches

jobs:
checkversion:
runs-on: ubuntu-latest
outputs:
foundClientVersion: ${{ steps.init.outputs.foundClientVersion }}
steps:
- uses: actions/checkout@v4
- name: get-client-version
# https://gist.github.com/DarrenN/8c6a5b969481725a4413?permalink_comment_id=3863317#gistcomment-3863317
run: |
echo "CLIENT_VERSION=$(npm pkg get version | sed 's/"//g')" >> $GITHUB_ENV
- uses: mukunku/[email protected]
id: checkTag
with:
tag: ${{ env.CLIENT_VERSION }}
- run: echo ${{ steps.checkTag.outputs.exists }}
- name: Environment variables to output
id: init
run: |
echo "foundClientVersion=${{ steps.checkTag.outputs.exists }}" >> $GITHUB_OUTPUT
publish:
needs: checkversion
runs-on: ubuntu-latest
environment: npm-release
if: needs.checkversion.outputs.foundClientVersion == 'false'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x

# https://stackoverflow.com/questions/57968497/how-do-i-set-an-env-var-with-a-bash-expression-in-github-actions
- name: get-client-version
# https://gist.github.com/DarrenN/8c6a5b969481725a4413?permalink_comment_id=3863317#gistcomment-3863317
run: |
echo "CLIENT_VERSION=$(npm pkg get version | sed 's/"//g')" >> $GITHUB_ENV
# Build bundle
- run: yarn set version berry
- run: yarn install --immutable
- run: yarn run build

# Clear fields that make installing harder
- name: Replace JSON Value
run: |
jq '.dependencies = {}' package.json > tmp.json && mv tmp.json package.json
jq '.devDependencies = {}' package.json > tmp.json && mv tmp.json package.json
- name: Output package.json
run: |
cat package.json
# Publish to NPM
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
package: package.json

# Create GitHub release
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: ${{ contains(env.CLIENT_VERSION, 'rc') || contains(env.CLIENT_VERSION, 'unstable') }}
release_name: "fdm-monster-client-next ${{ env.CLIENT_VERSION }}"
tag_name: ${{ env.CLIENT_VERSION }}
body: "Release notes not added" # ${{ steps.build_changelog.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: action-zip
uses: montudor/[email protected]
with:
args: zip -qq -r dist-client-${{ env.CLIENT_VERSION }}.zip dist ./package.json

- name: Upload client bundle zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist-client-${{ env.CLIENT_VERSION }}.zip
asset_name: dist-client-${{ env.CLIENT_VERSION }}.zip
asset_content_type: application/zip

26 changes: 26 additions & 0 deletions .github/workflows/vue-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Vue publish
on:
pull_request:
push:
branches:
- 'main'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'

- run: yarn set version berry
- run: yarn install --immutable
- run: yarn run build
- run: yarn run test:unit
- uses: JS-DevTools/npm-publish@v3
if: ${{ github.repository.name == 'fdm-monster-client' }}
with:
dry-run: true
token: ${{ secrets.NPM_TOKEN }}
package: package.json
Empty file added .yarn/cache/.gitignore
Empty file.
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.1.1.cjs

This file was deleted.

934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.1.cjs
yarnPath: .yarn/releases/yarn-4.5.1.cjs
27 changes: 16 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "fdm-monster-client",
"name": "@fdm-monster/client-next",
"version": "0.0.0",
"scripts": {
"dev": "vite",
Expand All @@ -22,32 +22,37 @@
"@sentry/tracing": "7.114.0",
"@sentry/vite-plugin": "2.22.6",
"@sentry/vue": "8.35.0",
"@tanstack/vue-query": "^5.28.13",
"@types/node": "20.17.1",
"@tanstack/vue-query": "5.59.16",
"@testing-library/vue": "8.1.0",
"@types/jsdom": "21.1.7",
"@types/node": "22.8.1",
"@types/semver": "7.5.8",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@typescript-eslint/eslint-plugin": "8.0.0",
"@typescript-eslint/parser": "8.0.0",
"@vitejs/plugin-vue": "5.1.4",
"@vitest/ui": "2.1.3",
"@vitest/web-worker": "2.1.3",
"@vue/eslint-config-typescript": "14.1.3",
"@vue/test-utils": "2.4.6",
"@vueuse/core": "11.1.0",
"@vueuse/integrations": "11.1.0",
"axios": "1.7.7",
"axios-mock-adapter": "2.1.0",
"c8": "10.1.2",
"chart.js": "4.4.5",
"eslint": "9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-n": "17.11.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-promise": "7.1.0",
"eslint-plugin-vue": "9.29.1",
"eslint-plugin-vuetify": "2.4.0",
"jwt-decode": "3.1.2",
"jsdom": "25.0.1",
"jwt-decode": "4.0.0",
"pinia": "2.2.4",
"prettier": "^3.2.5",
"prettier": "3.2.5",
"sass": "1.80.4",
"selective-object-reuse": "1.0.6",
"semver": "7.6.3",
Expand All @@ -59,10 +64,10 @@
"vite": "5.4.10",
"vite-plugin-vuetify": "2.0.4",
"vitest": "2.1.3",
"vue-axios": "3.5.2",
"vue-chartjs": "5.3.1",
"vue-router": "4.4.5",
"vue-tsc": "2.1.8",
"vuedraggable": "4.1.0"
}
},
"packageManager": "[email protected]"
}
27 changes: 16 additions & 11 deletions src/AppLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ import { useProfileStore } from '@/store/profile.store'
import { sleep } from '@/utils/time.utils'
import { RouteNames } from '@/router/route-names'
import { AppService } from '@/backend/app.service'
import { AUTH_ERROR_REASON } from '@/shared/auth.constants'
import {
AUTH_ERROR_REASON,
PermissionDeniedEvent
} from '@/shared/auth.constants'
import { SocketIoService } from '@/shared/socketio.service'
const authStore = useAuthStore()
Expand All @@ -128,9 +131,9 @@ const overlay = ref(false)
const router = useRouter()
const overlayMessage = ref('')
const loading = ref(true)
const errorCaught = ref(null)
const errorUrl = ref(null)
const errorResponse = ref(null)
const errorCaught = ref()
const errorUrl = ref()
const errorResponse = ref()
const snackbar = useSnackbar()
const socketIoClient: SocketIoService = new SocketIoService()
Expand Down Expand Up @@ -185,15 +188,17 @@ async function loadAppWithAuthenticationReady() {
}
// In use (shared/http-client.ts)
const authPermissionDeniedKey = useEventBus('auth:permission-denied')
const authPermissionDeniedKey = useEventBus<PermissionDeniedEvent>(
'auth:permission-denied'
)
authPermissionDeniedKey.on(async (event) => {
console.log('[AppLoader] Permission denied, going to permission denied page')
setOverlay(true, 'Permission denied')
await router.push({
name: RouteNames.PermissionDenied,
query: {
roles: event?.roles,
page: router.currentRoute.name,
page: String(router.currentRoute.value.name),
permissions: event?.permissions,
error: event?.error,
url: event?.url
Expand All @@ -210,7 +215,7 @@ authFailKey.on(async (event: any) => {
)
setOverlay(true, 'Authentication failed, going back to login')
if (router.currentRoute.name !== RouteNames.Login) {
if (router.currentRoute.value.name !== RouteNames.Login) {
await router.push({ name: RouteNames.Login })
}
setOverlay(false)
Expand Down Expand Up @@ -239,7 +244,7 @@ accountNotVerifiedEventKey.on(async () => {
true,
'Account not verified, please ask an administrator to verify your account.'
)
if (router.currentRoute.name !== RouteNames.Login) {
if (router.currentRoute.value.name !== RouteNames.Login) {
await router.push({ name: RouteNames.Login })
}
setOverlay(false)
Expand All @@ -255,7 +260,7 @@ passwordChangeRequiredEventKey.on(async () => {
)
snackbar.error('Password change required, please change your password.')
setOverlay(true, 'Password change required, please change your password.')
if (router.currentRoute.name !== RouteNames.Login) {
if (router.currentRoute.value.name !== RouteNames.Login) {
await router.push({ name: RouteNames.Login })
}
setOverlay(false)
Expand Down Expand Up @@ -306,7 +311,7 @@ onBeforeMount(async () => {
if (!wizardState.wizardCompleted) {
console.debug('[AppLoader] Wizard not completed, going to wizard')
await authStore.logout(false)
if (router.currentRoute.name !== RouteNames.FirstTimeSetup) {
if (router.currentRoute.value.name !== RouteNames.FirstTimeSetup) {
await router.replace({ name: RouteNames.FirstTimeSetup })
}
setOverlay(false)
Expand Down Expand Up @@ -344,7 +349,7 @@ onBeforeMount(async () => {
setOverlay(true, 'Login expired, going back to login')
await sleep(500)
if (router.currentRoute.name !== RouteNames.Login) {
if (router.currentRoute.value.name !== RouteNames.Login) {
await router.push({ name: RouteNames.Login })
}
setOverlay(false)
Expand Down
Loading

0 comments on commit 98bea41

Please sign in to comment.