Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
efed40e
feat: generate base analog app
DDonochVA Mar 10, 2026
032fd73
feat: transition bff to api routes
DDonochVA Mar 10, 2026
ab68ce7
chore: update wrangler
DDonochVA Mar 16, 2026
8618b5d
feat: handle types generation
DDonochVA Mar 16, 2026
d28f42e
feat: handle workerd env simulation
DDonochVA Mar 16, 2026
cc3bf0e
feat: handle legacy redirects
DDonochVA Mar 16, 2026
aef7434
feat: handle cf env
DDonochVA Mar 16, 2026
f99f47c
fix: translation loader
DDonochVA Mar 17, 2026
75f800d
fix: move favicon to public root
DDonochVA Mar 17, 2026
5aaf72e
fix: icons loading
DDonochVA Mar 17, 2026
c88f812
refactor: move route rules to a separate file
DDonochVA Mar 17, 2026
e6dac6a
fix: missing cf context
DDonochVA Mar 17, 2026
0479b6c
fix: optional cloudflare request in database init
DDonochVA Mar 17, 2026
65d114c
feat: add cf assets fetcher
DDonochVA Mar 17, 2026
9e04f38
fix: fonts
DDonochVA Mar 17, 2026
4ca4399
chore: upgrade tailwind
DDonochVA Mar 17, 2026
b3244bf
feat: add tailwindcss vite plugin
DDonochVA Mar 17, 2026
59eb30a
feat: handle redirects by file
DDonochVA Mar 17, 2026
4118591
refactor: use middleware to forward cloudflare context for database c…
DDonochVA Mar 17, 2026
414948f
feat: handle dynamic sitemap
DDonochVA Mar 17, 2026
7ffb495
fix: remove sitemap authors limit
DDonochVA Mar 17, 2026
32f63c2
feat: handle banners by kv
DDonochVA Mar 18, 2026
d1660ed
feat: add tracking provider
DDonochVA Mar 18, 2026
83dc745
fix: remove postcss file
DDonochVA Mar 18, 2026
0c308dc
fix: update title
DDonochVA Mar 18, 2026
d9c8832
refactor: patch analog's req context interceptor
DDonochVA Mar 18, 2026
a4b455d
updates to deploy pipeline
hoadaniellipniacki Mar 23, 2026
dfa6540
fix jenkins
hoadaniellipniacki Mar 23, 2026
3f88021
fix preview url
hoadaniellipniacki Mar 23, 2026
a7679d5
fix: bring back postcss config
DDonochVA Mar 23, 2026
531299d
fix: add api prefix
DDonochVA Mar 23, 2026
8803a54
fix: requests hijack
DDonochVA Mar 31, 2026
a9fd1a4
fix: handle traling slash redirect
DDonochVA Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"sourceTag": "scope:bff",
"onlyDependOnLibsWithTags": ["scope:bff", "scope:shared"]
},
{
"sourceTag": "scope:client-analog",
"onlyDependOnLibsWithTags": ["scope:client", "scope:bff", "scope:shared"]
},
{
"sourceTag": "scope:shared",
"onlyDependOnLibsWithTags": ["scope:shared"]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ Thumbs.db
.env.*
.cursor/rules/nx-rules.mdc
.github/instructions/nx.instructions.md

vite.config.*.timestamp*
vitest.config.*.timestamp*
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"nrwl.angular-console",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner",
"dbaeumer.vscode-eslint"
"dbaeumer.vscode-eslint",
"ms-playwright.playwright"
]
}
126 changes: 52 additions & 74 deletions Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ pipeline {
TURSO_EU_AUTH_TOKEN=credentials('turso-eu-auth-token')
TURSO_US_WEST_AUTH_TOKEN=credentials('turso-us-west-auth-token')
TURSO_US_EAST_AUTH_TOKEN=credentials('turso-us-east-auth-token')
WP_REST_API_BASE_URL="https://wp.angular.love"
WP_REST_API_TOKEN=credentials('al-wp-token')
AL_ALGOLIA_API_KEY=credentials('al_angolia_api_key')
AL_ALGOLIA_APPLICATION_ID=credentials('al_angolia_app_id')
AL_ALGOLIA_INDEX_NAME=credentials('al_angolia_index_name')
AL_GISCUS_CATEGORY=credentials('al_giscus_category')
AL_GISCUS_CATEGORY_ID=credentials('al_giscus_category_id')
AL_GISCUS_REPO=credentials('al_giscus_repo')
AL_GISCUS_REPO_ID=credentials('al_giscus_repo_id')
VITE_AL_API_URL="/api"
VITE_WP_REST_API_BASE_URL="https://wp.angular.love"
VITE_WP_REST_API_TOKEN=credentials('al-wp-token')
VITE_AL_ALGOLIA_API_KEY=credentials('al_angolia_api_key')
VITE_AL_ALGOLIA_APPLICATION_ID=credentials('al_angolia_app_id')
VITE_AL_ALGOLIA_INDEX_NAME=credentials('al_angolia_index_name')
VITE_AL_GISCUS_CATEGORY=credentials('al_giscus_category')
VITE_AL_GISCUS_CATEGORY_ID=credentials('al_giscus_category_id')
VITE_AL_GISCUS_REPO=credentials('al_giscus_repo')
VITE_AL_GISCUS_REPO_ID=credentials('al_giscus_repo_id')
}

stages {
Expand All @@ -46,7 +47,7 @@ pipeline {
script {
sh """
corepack enable && corepack prepare pnpm@10.6.2 --activate
pnpm install
pnpm install
"""
}
}
Expand All @@ -57,24 +58,24 @@ pipeline {
env.USE_BRANCH_NAME = env.BRANCH_NAME
env.IS_PR = "FALSE"
env.ENVIRONMENT = 'dev'
env.WORKER_DOMAIN_END = '-blog-bff-dev.contact-ef8.workers.dev'
env.WORKER_DOMAIN_END = '-blog-analog-dev.contact-ef8.workers.dev'
if (env.BRANCH_NAME == 'main') {
env.ENVIRONMENT = 'prod'
env.WORKER_DOMAIN_END = '-blog-bff.contact-ef8.workers.dev'
env.WORKER_DOMAIN_END = '-blog-analog.contact-ef8.workers.dev'
}

if (env.CHANGE_ID) {
echo "CHANGE_ID: $CHANGE_ID"
env.IS_PR = "TRUE"
}

// DOn't rember how it worked so for safety for now , todo remove later
// DOn't rember how it worked so for safety for now , todo remove later
if (env.IS_PR == "TRUE" && env.CHANGE_BRANCH != env.BRANCH_NAME) {
echo "Banch missmatch in pr"
echo "CHANGE_BRANCH: $CHANGE_BRANCH"
echo "CHANGE_BRANCH: $CHANGE_BRANCH"
echo "BRANCH_NAME: $BRANCH_NAME"
env.ENVIRONMENT = 'dev'
env.WORKER_DOMAIN_END = '-blog-bff-dev.contact-ef8.workers.dev'
env.WORKER_DOMAIN_END = '-blog-bff-dev.contact-ef8.workers.dev'
env.USE_BRANCH_NAME = env.CHANGE_BRANCH
}

Expand All @@ -87,17 +88,17 @@ pipeline {
stage("Select master db") {
steps {
script {
env.USE_PARAMS_DB="false"
env.USE_PARAMS_DB="false"
def setCount = 0
if (params.DB_MAIN_EU != "") setCount++
if (params.DB_MAIN_US_WEST != "") setCount++
if (params.DB_MAIN_US_EAST != "") setCount++
if (setCount > 0 && setCount < 3) {
error("Only some main db params are set. Please set all or none.")
}
if (setCount == 3) {


if (setCount == 3) {
echo "Using params db"
env.USE_PARAMS_DB = "true"
}
Expand All @@ -115,7 +116,7 @@ pipeline {
if (env.BRANCH_HASH.length() > 5) {
env.BRANCH_HASH = env.BRANCH_HASH.substring(0, 5)
}

def branchNameForDB = env.USE_BRANCH_NAME
if (env.USE_BRANCH_NAME.length() > 30) {
echo "Branch name is too long, truncating to 30 characters"
Expand All @@ -129,7 +130,7 @@ pipeline {
if (env.DB_BRANCH_NAME.length() > 46) { // 46 since we will be adding the group name to the db name
error("DB branch name is too long")
}
withCredentials([string(credentialsId: 'tursor_api_token', variable: 'TURSO_API_TOKEN')]) {
withCredentials([string(credentialsId: 'tursor_api_token', variable: 'TURSO_API_TOKEN')]) {
echo "prams status $USE_PARAMS_DB"
if (env.USE_PARAMS_DB == "true") {
echo "Using params db"
Expand All @@ -147,10 +148,10 @@ pipeline {
turso db create usw-${DB_BRANCH_NAME} --from-db $TURSO_US_WEST_DB --group blog-us-west
turso db create use-${DB_BRANCH_NAME} --from-db $TURSO_US_EAST_DB --group blog-us-east
"""

}


sh """
turso org switch angular-love
turso db list -g blog-eu | grep -q "eu-${DB_BRANCH_NAME}" || { echo "EU database not found after creation"; exit 1; }
Expand All @@ -171,19 +172,33 @@ pipeline {
[$class: 'BooleanParameterValue', name: 'dryRun', value: false]], wait: false)

}


}
}
stage("Build blog analog") {
steps {
sh """
npx nx run blog-analog:build --no-tui
"""
}
}
stage("Deploy bff prod") {
stages {
stage("Prepare secrets") {
steps {
sh """
sed -i "s/<kv_dev_namespace_id>/$KV_DEV/g" apps/blog-bff/wrangler.toml
sed -i "s/<kv_prod_namespace_id>/$KV_PROD/g" apps/blog-bff/wrangler.toml
sed -i "s/<kv_dev_namespace_id>/$KV_DEV/g" apps/blog-analog/wrangler.jsonc
sed -i "s/<kv_prod_namespace_id>/$KV_PROD/g" apps/blog-analog/wrangler.jsonc
echo "{
\\"WP_REST_API_BASE_URL\\":\\"$WP_REST_API_BASE_URL\\",
\\"WP_REST_API_TOKEN\\":\\"$WP_REST_API_TOKEN\\",
\\"VITE_WP_REST_API_BASE_URL\\":\\"$VITE_WP_REST_API_BASE_URL\\",
\\"VITE_WP_REST_API_TOKEN\\":\\"$VITE_WP_REST_API_TOKEN\\",
\\"VITE_AL_ALGOLIA_API_KEY\\":\\"$VITE_AL_ALGOLIA_API_KEY\\",
\\"VITE_AL_ALGOLIA_APPLICATION_ID\\":\\"$VITE_AL_ALGOLIA_APPLICATION_ID\\",
\\"VITE_AL_ALGOLIA_INDEX_NAME\\":\\"$VITE_AL_ALGOLIA_INDEX_NAME\\",
\\"VITE_AL_GISCUS_CATEGORY\\":\\"$VITE_AL_GISCUS_CATEGORY\\",
\\"VITE_AL_GISCUS_CATEGORY_ID\\":\\"$VITE_AL_GISCUS_CATEGORY_ID\\",
\\"VITE_AL_GISCUS_REPO\\":\\"$VITE_AL_GISCUS_REPO\\",
\\"VITE_AL_GISCUS_REPO_ID\\":\\"$VITE_AL_GISCUS_REPO_ID\\",
\\"TURSO_EU_CONNECTION_URL\\":\\"$TURSO_EU_CONNECTION_URL\\",
\\"TURSO_EU_AUTH_TOKEN\\":\\"$TURSO_EU_AUTH_TOKEN\\",
\\"TURSO_US_EAST_CONNECTION_URL\\":\\"$TURSO_US_EAST_CONNECTION_URL\\",
Expand All @@ -200,7 +215,7 @@ pipeline {
]) {
script {
output = sh(returnStdout: true, script: """
npx wrangler versions upload --config apps/blog-bff/wrangler.toml --env $ENVIRONMENT
npx wrangler versions upload --config apps/blog-analog/wrangler.jsonc --env $ENVIRONMENT
""")
echo "Output: $output"
}
Expand All @@ -214,7 +229,7 @@ pipeline {
]) {
script {
output = sh(returnStdout: true, script: """
npx wrangler versions secret bulk new-secrets-bff --config apps/blog-bff/wrangler.toml --env $ENVIRONMENT
npx wrangler versions secret bulk new-secrets-bff --config apps/blog-analog/wrangler.jsonc --env $ENVIRONMENT
""")
echo "Output: $output"
def versionId = (output =~ /Created version ([^\s]+)/)[0][1]
Expand All @@ -223,10 +238,10 @@ pipeline {

def previewUrl = versionId.substring(0, 8) + env.WORKER_DOMAIN_END
env.PREVIEW_URL = "https://" + previewUrl
env.AL_API_URL = "https://" + previewUrl
env.DEPLOY_URL = "https://" + previewUrl
echo "Preview URL: $PREVIEW_URL"
}
}
}
}
}
stage ("Wrangler deploy bff") {
Expand All @@ -235,43 +250,8 @@ pipeline {
usernamePassword(credentialsId: 'cf-workers-creds', usernameVariable: 'CLOUDFLARE_ACCOUNT_ID', passwordVariable: 'CLOUDFLARE_API_TOKEN'),
]) {
sh """
npx wrangler versions deploy --config apps/blog-bff/wrangler.toml --env $ENVIRONMENT $VERSION_ID@100 -y
"""
}
}
}
}
}
stage("sleep") {
steps {
sleep 10
}
}
stage("Build blog") {
steps {
sh """
pnpm run prerender
"""
}
}
stage("Deploy blog prod") {
steps {
script {
withCredentials([
usernamePassword(credentialsId: 'cf-workers-creds', usernameVariable: 'CLOUDFLARE_ACCOUNT_ID', passwordVariable: 'CLOUDFLARE_API_TOKEN'),
]) {
output = sh(returnStdout: true, script: """
npx wrangler pages deploy dist/apps/blog/browser --project-name angular-love-client --branch ${USE_BRANCH_NAME}
""")
echo "Output: $output"
def deploy_url = (output =~ /Take a peek over at ([^\s]+)/)[0][1]
echo "Deploy URL: $deploy_url"
env.DEPLOY_URL = deploy_url
env.ALIAS_URL = "No alias on main branch"
if (env.IS_PR == "TRUE") {
def alias_url = (output =~ /Deployment alias URL: ([^\s]+)/)[0][1]
echo "Alias URL: $alias_url"
env.ALIAS_URL = alias_url
npx wrangler versions deploy --config apps/blog-analog/wrangler.jsonc --env $ENVIRONMENT $VERSION_ID@100 -y
"""
}
}
}
Expand All @@ -288,9 +268,7 @@ pipeline {
pullRequest.comment("""
Deployed to $ENVIRONMENT environment
Branch: $USE_BRANCH_NAME
BFF URL: $AL_API_URL
Deploy URL: $DEPLOY_URL
Alias URL: $ALIAS_URL
""")
}
}
Expand All @@ -306,9 +284,9 @@ Alias URL: $ALIAS_URL
if (env.IS_PR == "TRUE") {
pullRequest.comment("""
Deploy failed, please check the logs in jenkins for more details.
""")
""")
}
}
}
}
}
}
22 changes: 22 additions & 0 deletions apps/blog-analog-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": ["plugin:playwright/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["src/**/*.{ts,js,tsx,jsx}"],
"rules": {}
}
]
}
68 changes: 68 additions & 0 deletions apps/blog-analog-e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { workspaceRoot } from '@nx/devkit';
import { nxE2EPreset } from '@nx/playwright/preset';
import { defineConfig, devices } from '@playwright/test';

// For CI, you may want to set BASE_URL to the deployed application.
const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
...nxE2EPreset(__filename, { testDir: './src' }),
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Run your local dev server before starting the tests */
webServer: {
command: 'pnpm exec nx run blog-analog:serve',
url: 'http://localhost:4200',
reuseExistingServer: true,
cwd: workspaceRoot,
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

// Uncomment for mobile browsers support
/* {
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
}, */

// Uncomment for branded browsers
/* {
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' },
},
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
} */
],
});
19 changes: 19 additions & 0 deletions apps/blog-analog-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "blog-analog-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/blog-analog-e2e/src",
"implicitDependencies": ["blog-analog"],
"targets": {
"e2e": {
"executor": "@nx/playwright:playwright",
"outputs": ["{workspaceRoot}/dist/.playwright/apps/blog-analog-e2e"],
"options": {
"config": "apps/blog-analog-e2e/playwright.config.ts"
}
},
"lint": {
"executor": "@nx/eslint:lint"
}
}
}
Loading