Skip to content

Commit

Permalink
Merge branch 'staging' into translate-cookie-consent
Browse files Browse the repository at this point in the history
  • Loading branch information
budak7273 authored Nov 15, 2023
2 parents 3266737 + a24c165 commit b6e59b7
Show file tree
Hide file tree
Showing 102 changed files with 2,465 additions and 11,996 deletions.
13 changes: 13 additions & 0 deletions .devcontainer/create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# Add as a safe git directory
git config --global --add safe.directory "/workspaces/smr_frontend"

# Install packages
bun install

# Source those environment variables for translation script
source .devcontainer/env.sh staging

# Download translations
bun run translations
42 changes: 42 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "Bun & SvelteKit",

"image": "mcr.microsoft.com/devcontainers/base:ubuntu",

"features": {
"ghcr.io/shyim/devcontainers-features/bun:0": {},
"./ficsit-feature": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000],

// Consistently name the folder so that it can be added as a git safe directory inside the container
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/smr_frontend,type=bind",
"workspaceFolder": "/workspaces/smr_frontend",

"onCreateCommand": "./.devcontainer/create.sh",

"customizations": {
"vscode": {
"extensions": [
"ms-vscode.vscode-typescript-next",
"svelte.svelte-vscode",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"csstools.postcss",
"mquandalle.graphql",
"GraphQL.vscode-graphql-execution",
"GraphQL.vscode-graphql",
"GraphQL.vscode-graphql-syntax",
"streetsidesoftware.code-spell-checker",
"vunguyentuan.vscode-postcss"
]
}
},

"remoteEnv": {
"NODE_ENV": "staging"
}
}
5 changes: 5 additions & 0 deletions .devcontainer/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

export NODE_ENV=$1

set -o allexport; source .env.$NODE_ENV; set +o allexport
5 changes: 5 additions & 0 deletions .devcontainer/ficsit-feature/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "ficsit",
"id": "ficsit",
"version": "0.0.1"
}
18 changes: 18 additions & 0 deletions .devcontainer/ficsit-feature/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# Install watchman
sudo apt-get update && sudo apt-get install -y watchman

# Append bashrc
echo "
alias fenv=\"source .devcontainer/env.sh\"
echo -e \"\e[1;32mWelcome to smr-frontend devcontainer\e[0m\"
echo
echo -e \"\e[31mPlease execute the following command to load the environment:\e[0m\"
echo -e \"\e[1m\$\e[0m fenv staging\"
echo
echo -e \"\e[31mTo start the dev server execute:\e[0m\"
echo -e \"\e[1m\$\e[0m bun run dev\"
echo
" >> $_REMOTE_USER_HOME/.bashrc
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
55 changes: 0 additions & 55 deletions .eslintrc.cjs

This file was deleted.

5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Auto detect text files and perform LF normalization
# This keeps unix/windows machines from wanting to change every file
# from the other because of the line ending (\r vs \r\n)
* text=auto
*.sh text eol=lf
95 changes: 22 additions & 73 deletions .github/workflows/push-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ on:
type: string

env:
NODE_VERSION: "18"
PNPM_VERSION: "8.6.1"
BUN_VERSION: "1.0.11"

jobs:
build:
Expand All @@ -20,69 +19,39 @@ jobs:
matrix:
action: [ "build:node", "build:static" ]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup nodejs
uses: actions/setup-node@v1
- uses: oven-sh/setup-bun@v1
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.NODE_VERSION }}-
bun-version: ${{ env.BUN_VERSION }}

- name: Install dependencies
uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
run_install: true
run: bun install

- name: Build
run: |
set -o allexport; source .env.${{ inputs.env }}; set +o allexport
pnpm graphql-codegen && pnpm run translations && pnpm ${{ matrix.action }}
bun run graphql-codegen && bun run translations && bun run ${{ matrix.action }}
env:
NODE_ENV: ${{ inputs.env }}

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup nodejs
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/checkout@v3

- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
- uses: oven-sh/setup-bun@v1
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.NODE_VERSION }}-
bun-version: ${{ env.BUN_VERSION }}

- name: Install dependencies
uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
run_install: true
run: bun install

- name: Lint
run: |
set -o allexport; source .env.${{ inputs.env }}; set +o allexport
pnpm exec svelte-kit sync && pnpm graphql-codegen && pnpm check && pnpm lint
bun run postinstall && bun run graphql-codegen && bun run check && bun run lint
env:
NODE_ENV: ${{ inputs.env }}

Expand All @@ -94,37 +63,21 @@ jobs:
- lint
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup nodejs
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/checkout@v3

- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
- uses: oven-sh/setup-bun@v1
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ env.NODE_VERSION }}-
bun-version: ${{ env.BUN_VERSION }}

- name: Install dependencies
uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
run_install: true
run: bun install

- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- uses: rlespinasse/[email protected]

- name: Build
run: |
set -o allexport; source .env.${{ inputs.env }}; set +o allexport
pnpm graphql-codegen && pnpm run translations && pnpm build:static
bun run graphql-codegen && bun run translations && bun run build:static
env:
SVELTE_BASE_PATH: "/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}/${{ env.GITHUB_REF_SLUG }}"
NODE_ENV: ${{ inputs.env }}
Expand All @@ -143,26 +96,22 @@ jobs:
- build
- lint
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
- id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=false
- name: Build and push
uses: docker/build-push-action@v2
- uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -304,5 +304,5 @@ $RECYCLE.BIN/
/schema.graphql
/graphql.schema.json
/.svelte-kit
/static/smui.css
/.pnpm-store
/.pnpm-store
.direnv
2 changes: 1 addition & 1 deletion .husky/commit-msg
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm exec commitlint -e $1
bunx commitlint -e $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint && pnpm check
bun run lint && bun run check
5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static
.env.production
.env.staging
.eslintignore
.eslintrc.cjs
eslint.config.js
.gitignore
.graphqlconfig
.prettierignore
Expand All @@ -31,4 +31,5 @@ svelte.config.js
tailwind.config.cjs
tsconfig.json
.pnpm-store
src/i18n
src/i18n
.devcontainer/devcontainer.json
8 changes: 3 additions & 5 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"printWidth": 120,
"quoteProps": "as-needed",
"singleQuote": true,
"svelteAllowShorthand": true,
"svelteIndentScriptAndStyle": true,
"svelteStrictMode": false,
"trailingComma": "none",
"useTabs": false
}
"useTabs": false,
"plugins": ["prettier-plugin-svelte"]
}
Loading

0 comments on commit b6e59b7

Please sign in to comment.