refactor(build): replace staging/cp env hack with vite --mode per-environment
- Rename .env.staging → .env.dev (and .default template) - Add .env.test.default for the test tier (test-api.oneskyit.com) - build:staging → build:dev/test/prod using vite --mode <name> - deploy:staging → deploy:dev; add deploy:test - Dockerfile: ARG BUILD_MODE=dev; explicit .env.runtime copy per mode - .dockerignore: rewritten (deduped); allow .env.dev/.env.test/.env.prod - .gitignore: track .env.dev.default and .env.test.default - Remove dead PUBLIC_AE_* imports from ae_stores.ts (ACCOUNT_ID, EVENT_ID, NO_ACCOUNT_ID_TOKEN, SPONSORSHIP_CFG_ID); sponsorship_cfg_id defaults to null - Strip dead vars from .env.prod.default template (AE_CFG_ID, AE_APP_NODE_PORT, ACCOUNT_ID, EVENT_ID, SPONSORSHIP_CFG_ID, NO_ACCOUNT_ID_TOKEN) - GUIDE__Development.md: build:staging → build:dev Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,45 +1,47 @@
|
|||||||
.svelte-kit
|
# Build artifacts and local state
|
||||||
.vite
|
.svelte-kit/
|
||||||
node_modules
|
.vite/
|
||||||
dist
|
node_modules/
|
||||||
build
|
build/
|
||||||
.cache
|
dist/
|
||||||
.DS_Store
|
.cache/
|
||||||
.vscode
|
|
||||||
.idea
|
# VCS and IDE
|
||||||
.git
|
.git/
|
||||||
.gitignore
|
.gitignore
|
||||||
coverage
|
.vscode/
|
||||||
tests
|
.idea/
|
||||||
documentation
|
|
||||||
backups
|
# OS junk
|
||||||
|
.DS_Store
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Logs and temp files
|
||||||
*.log
|
*.log
|
||||||
*.bak
|
*.bak
|
||||||
*.tgz
|
*.tgz
|
||||||
.env
|
|
||||||
.env.*
|
|
||||||
npm-debug.log
|
|
||||||
package-lock.json.bak
|
|
||||||
yarn-error.log
|
|
||||||
/.cache
|
|
||||||
/.parcel-cachenode_modules/
|
|
||||||
build/
|
|
||||||
.svelte-kit/
|
|
||||||
.git/
|
|
||||||
.env
|
|
||||||
.env.*
|
|
||||||
!.env.staging
|
|
||||||
!.env.prod
|
|
||||||
npm_deploy/
|
|
||||||
test-results/
|
|
||||||
test_results/
|
|
||||||
documentation/
|
|
||||||
backups/
|
|
||||||
*.log
|
|
||||||
*.bak
|
|
||||||
.claude/
|
|
||||||
.vscode/
|
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
.pnpm-debug.log*
|
.pnpm-debug.log*
|
||||||
|
|
||||||
|
# Test output and dev-only dirs
|
||||||
|
tests/
|
||||||
|
test-results/
|
||||||
|
test_results/
|
||||||
|
coverage/
|
||||||
|
documentation/
|
||||||
|
backups/
|
||||||
|
.claude/
|
||||||
|
|
||||||
|
# Deployment artifacts
|
||||||
|
npm_deploy/
|
||||||
|
package-lock.json.bak
|
||||||
|
|
||||||
|
# Env files: exclude all live secrets, allow only the per-environment files needed for Docker builds.
|
||||||
|
# .env.local is workstation-only and must never enter a container image.
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.dev
|
||||||
|
!.env.test
|
||||||
|
!.env.prod
|
||||||
|
|||||||
17
.env.dev.default
Normal file
17
.env.dev.default
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# One Sky IT's Aether Framework and System — DEV template (dev-*.oneskyit.com)
|
||||||
|
# Copy to .env.dev and fill in real values.
|
||||||
|
|
||||||
|
|
||||||
|
# Aether API access
|
||||||
|
PUBLIC_AE_API_PROTOCOL=https
|
||||||
|
PUBLIC_AE_API_SERVER=dev-api.oneskyit.com
|
||||||
|
PUBLIC_AE_API_BAK_SERVER=test-api.oneskyit.com
|
||||||
|
PUBLIC_AE_API_PORT=443
|
||||||
|
PUBLIC_AE_API_PATH=
|
||||||
|
PUBLIC_AE_API_SECRET_KEY=XXXX
|
||||||
|
PUBLIC_AE_API_CRUD_SUPER_KEY=XXXX
|
||||||
|
# Bootstrap key: used only for the unauthenticated site-domain lookup on first load.
|
||||||
|
# Separate from the main API key — has limited permissions (no account_id required).
|
||||||
|
PUBLIC_AE_BOOTSTRAP_KEY=XXXX
|
||||||
|
PUBLIC_AE_NO_ACCOUNT_ID=No_Account_ID_Here
|
||||||
|
|
||||||
@@ -1,28 +1,14 @@
|
|||||||
# One Sky IT's Aether Framework and System — PRODUCTION template
|
# One Sky IT's Aether Framework and System — PROD template (api.oneskyit.com)
|
||||||
# Copy to .env.prod and fill in real values.
|
# Copy to .env.prod and fill in real values.
|
||||||
# AE_CFG_ID: 1=Default, 5=Home Dev, 7=Live Testing/Prod
|
|
||||||
|
|
||||||
# Shared config record (controls SMTP, API routing, external keys from DB)
|
|
||||||
AE_CFG_ID=7
|
|
||||||
|
|
||||||
# Aether API access
|
# Aether API access
|
||||||
PUBLIC_AE_API_PROTOCOL=https
|
PUBLIC_AE_API_PROTOCOL=https
|
||||||
PUBLIC_AE_API_SERVER=api.oneskyit.com
|
PUBLIC_AE_API_SERVER=api.oneskyit.com
|
||||||
PUBLIC_AE_API_BAK_SERVER=bak-api.oneskyit.com
|
PUBLIC_AE_API_BAK_SERVER=bak-api.oneskyit.com
|
||||||
PUBLIC_AE_API_PORT=443
|
PUBLIC_AE_API_PORT=443
|
||||||
PUBLIC_AE_API_PATH=
|
|
||||||
PUBLIC_AE_API_SECRET_KEY=XXXX
|
PUBLIC_AE_API_SECRET_KEY=XXXX
|
||||||
PUBLIC_AE_API_CRUD_SUPER_KEY=XXXX
|
PUBLIC_AE_API_CRUD_SUPER_KEY=XXXX
|
||||||
# Bootstrap key: used only for the unauthenticated site-domain lookup on first load.
|
# Bootstrap key: used only for the unauthenticated site-domain lookup on first load.
|
||||||
# Separate from the main API key — has limited permissions (no account_id required).
|
# Separate from the main API key — has limited permissions (no account_id required).
|
||||||
PUBLIC_AE_BOOTSTRAP_KEY=XXXX
|
PUBLIC_AE_BOOTSTRAP_KEY=XXXX
|
||||||
PUBLIC_AE_NO_ACCOUNT_ID=No_Account_ID_Here
|
PUBLIC_AE_NO_ACCOUNT_ID=No_Account_ID_Here
|
||||||
PUBLIC_AE_NO_ACCOUNT_ID_TOKEN=Nothing_to_see_here
|
|
||||||
|
|
||||||
# SvelteKit app config
|
|
||||||
AE_APP_NODE_PORT=3001
|
|
||||||
|
|
||||||
# Default demo/client context (set to the target account for this deployment)
|
|
||||||
PUBLIC_AE_ACCOUNT_ID=XXXX
|
|
||||||
PUBLIC_AE_EVENT_ID=XXXX
|
|
||||||
PUBLIC_AE_SPONSORSHIP_CFG_ID=XXXX
|
|
||||||
|
|||||||
14
.env.test.default
Normal file
14
.env.test.default
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# One Sky IT's Aether Framework and System — TEST template (test-api.oneskyit.com)
|
||||||
|
# Copy to .env.test and fill in real values.
|
||||||
|
|
||||||
|
# Aether API access
|
||||||
|
PUBLIC_AE_API_PROTOCOL=https
|
||||||
|
PUBLIC_AE_API_SERVER=test-api.oneskyit.com
|
||||||
|
PUBLIC_AE_API_BAK_SERVER=api.oneskyit.com
|
||||||
|
PUBLIC_AE_API_PORT=443
|
||||||
|
PUBLIC_AE_API_SECRET_KEY=XXXX
|
||||||
|
PUBLIC_AE_API_CRUD_SUPER_KEY=XXXX
|
||||||
|
# Bootstrap key: used only for the unauthenticated site-domain lookup on first load.
|
||||||
|
# Separate from the main API key — has limited permissions (no account_id required).
|
||||||
|
PUBLIC_AE_BOOTSTRAP_KEY=XXXX
|
||||||
|
PUBLIC_AE_NO_ACCOUNT_ID=No_Account_ID_Here
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,7 +8,8 @@ node_modules
|
|||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
!.env.prod.default
|
!.env.prod.default
|
||||||
!.env.staging.default
|
!.env.test.default
|
||||||
|
!.env.dev.default
|
||||||
vite.config.js.timestamp-*
|
vite.config.js.timestamp-*
|
||||||
vite.config.ts.timestamp-*
|
vite.config.ts.timestamp-*
|
||||||
|
|
||||||
|
|||||||
24
Dockerfile
24
Dockerfile
@@ -9,18 +9,32 @@ RUN npm install
|
|||||||
# Copy the rest of the source code.
|
# Copy the rest of the source code.
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build Argument to determine build environment (staging, prod, or production).
|
# Build Argument to determine build environment (dev, test, prod).
|
||||||
ARG BUILD_MODE=staging
|
ARG BUILD_MODE=dev
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
# Sync the SvelteKit project to generate ./.svelte-kit/tsconfig.json
|
# Sync the SvelteKit project to generate ./.svelte-kit/tsconfig.json
|
||||||
RUN npx svelte-kit sync
|
RUN npx svelte-kit sync
|
||||||
|
|
||||||
# Perform the build based on the BUILD_MODE argument.
|
# Perform the build based on the BUILD_MODE argument.
|
||||||
|
# Each script uses vite --mode <name>, which reads .env.<name> directly — no cp hack needed.
|
||||||
RUN if [ "$BUILD_MODE" = "prod" ] || [ "$BUILD_MODE" = "production" ]; then \
|
RUN if [ "$BUILD_MODE" = "prod" ] || [ "$BUILD_MODE" = "production" ]; then \
|
||||||
npm run build:prod; \
|
npm run build:prod; \
|
||||||
|
elif [ "$BUILD_MODE" = "test" ]; then \
|
||||||
|
npm run build:test; \
|
||||||
else \
|
else \
|
||||||
npm run build:staging; \
|
npm run build:dev; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy the source env file to .env.runtime for the deploy stage.
|
||||||
|
# PUBLIC_* vars are baked into the JS bundle by vite; non-PUBLIC vars (AE_CFG_ID,
|
||||||
|
# AE_APP_NODE_PORT) are read by the Node server at runtime and need this file.
|
||||||
|
RUN if [ "$BUILD_MODE" = "prod" ] || [ "$BUILD_MODE" = "production" ]; then \
|
||||||
|
cp .env.prod .env.runtime; \
|
||||||
|
elif [ "$BUILD_MODE" = "test" ]; then \
|
||||||
|
cp .env.test .env.runtime; \
|
||||||
|
else \
|
||||||
|
cp .env.dev .env.runtime; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stage 2: Final runtime image
|
# Stage 2: Final runtime image
|
||||||
@@ -35,8 +49,8 @@ COPY --from=builder /app/package-lock.json .
|
|||||||
# Install only production dependencies.
|
# Install only production dependencies.
|
||||||
RUN npm install --omit=dev
|
RUN npm install --omit=dev
|
||||||
|
|
||||||
# Copy the resulting .env.production file to .env.
|
# Copy the runtime env file (non-PUBLIC vars for the Node server).
|
||||||
COPY --from=builder /app/.env.production .env
|
COPY --from=builder /app/.env.runtime .env
|
||||||
|
|
||||||
# SvelteKit (via adapter-node) defaults to port 3000.
|
# SvelteKit (via adapter-node) defaults to port 3000.
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
- **Zero Tolerance:** If a task introduces even a single svelte-check warning or error, it must not be merged. Resolve all warnings before committing.
|
- **Zero Tolerance:** If a task introduces even a single svelte-check warning or error, it must not be merged. Resolve all warnings before committing.
|
||||||
2. **Type Safety:** Ensure interfaces in `src/lib/types/ae_types.ts` match backend schemas.
|
2. **Type Safety:** Ensure interfaces in `src/lib/types/ae_types.ts` match backend schemas.
|
||||||
3. **Reactivity Check:** Verify Svelte 5 runes (`$state`, `$derived`) are not creating race conditions with Dexie `liveQuery`.
|
3. **Reactivity Check:** Verify Svelte 5 runes (`$state`, `$derived`) are not creating race conditions with Dexie `liveQuery`.
|
||||||
4. **Build Check:** For major changes, run `npm run build:staging` to ensure no SSR or build-time failures.
|
4. **Build Check:** For major changes, run `npm run build:dev` to ensure no SSR or build-time failures.
|
||||||
5. **Integration Tests:** For changes to badge print, event layouts, or auth/store logic, run the relevant Playwright test file(s):
|
5. **Integration Tests:** For changes to badge print, event layouts, or auth/store logic, run the relevant Playwright test file(s):
|
||||||
```bash
|
```bash
|
||||||
npx playwright test tests/event_badge_render.test.ts tests/event_badge_attendee_workflow.test.ts
|
npx playwright test tests/event_badge_render.test.ts tests/event_badge_attendee_workflow.test.ts
|
||||||
|
|||||||
@@ -7,8 +7,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"build:prod": "cp .env.prod .env.production && vite build",
|
"build:dev": "vite build --mode dev",
|
||||||
"build:staging": "cp .env.staging .env.production && vite build",
|
"build:test": "vite build --mode test",
|
||||||
|
"build:prod": "vite build --mode prod",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "npm run test:integration && npm run test:unit",
|
"test": "npm run test:integration && npm run test:unit",
|
||||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||||
@@ -17,7 +18,8 @@
|
|||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"test:integration": "playwright test",
|
"test:integration": "playwright test",
|
||||||
"test:unit": "vitest",
|
"test:unit": "vitest",
|
||||||
"deploy:staging": "docker compose -f ../aether_container_env/docker-compose.yml build ae_app && docker compose -f ../aether_container_env/docker-compose.yml up -d ae_app",
|
"deploy:dev": "docker compose -f ../aether_container_env/docker-compose.yml build ae_app && docker compose -f ../aether_container_env/docker-compose.yml up -d ae_app",
|
||||||
|
"deploy:test": "docker compose -f ../aether_container_env/docker-compose.yml build --build-arg BUILD_MODE=test ae_app && docker compose -f ../aether_container_env/docker-compose.yml up -d ae_app",
|
||||||
"deploy:prod": "docker compose -f ../aether_container_env/docker-compose.yml build --build-arg BUILD_MODE=prod ae_app && docker compose -f ../aether_container_env/docker-compose.yml up -d --remove-orphans ae_app",
|
"deploy:prod": "docker compose -f ../aether_container_env/docker-compose.yml build --build-arg BUILD_MODE=prod ae_app && docker compose -f ../aether_container_env/docker-compose.yml up -d --remove-orphans ae_app",
|
||||||
"compose:down": "docker compose -f ../aether_container_env/docker-compose.yml --profile database down"
|
"compose:down": "docker compose -f ../aether_container_env/docker-compose.yml --profile database down"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ import {
|
|||||||
PUBLIC_AE_API_SECRET_KEY,
|
PUBLIC_AE_API_SECRET_KEY,
|
||||||
PUBLIC_AE_API_CRUD_SUPER_KEY,
|
PUBLIC_AE_API_CRUD_SUPER_KEY,
|
||||||
PUBLIC_AE_NO_ACCOUNT_ID,
|
PUBLIC_AE_NO_ACCOUNT_ID,
|
||||||
PUBLIC_AE_NO_ACCOUNT_ID_TOKEN,
|
// PUBLIC_AE_NO_ACCOUNT_ID_TOKEN,
|
||||||
PUBLIC_AE_ACCOUNT_ID,
|
// PUBLIC_AE_ACCOUNT_ID,
|
||||||
PUBLIC_AE_EVENT_ID,
|
// PUBLIC_AE_EVENT_ID,
|
||||||
PUBLIC_AE_SPONSORSHIP_CFG_ID
|
// PUBLIC_AE_SPONSORSHIP_CFG_ID
|
||||||
} from '$env/static/public';
|
} from '$env/static/public';
|
||||||
|
|
||||||
const api_server_fqdn = PUBLIC_AE_API_SERVER; // 'api.oneskyit.com'
|
const api_server_fqdn = PUBLIC_AE_API_SERVER; // 'api.oneskyit.com'
|
||||||
@@ -34,9 +34,9 @@ const api_crud_super_key = PUBLIC_AE_API_CRUD_SUPER_KEY;
|
|||||||
// const ae_account_id = PUBLIC_AE_ACCOUNT_ID;
|
// const ae_account_id = PUBLIC_AE_ACCOUNT_ID;
|
||||||
const ae_account_id: null | string = null;
|
const ae_account_id: null | string = null;
|
||||||
const ae_no_account_id = PUBLIC_AE_NO_ACCOUNT_ID;
|
const ae_no_account_id = PUBLIC_AE_NO_ACCOUNT_ID;
|
||||||
const ae_no_account_id_token = PUBLIC_AE_NO_ACCOUNT_ID_TOKEN;
|
// const ae_no_account_id_token = PUBLIC_AE_NO_ACCOUNT_ID_TOKEN;
|
||||||
const ae_event_id = PUBLIC_AE_EVENT_ID;
|
// const ae_event_id = PUBLIC_AE_EVENT_ID;
|
||||||
const ae_sponsorship_cfg_id = PUBLIC_AE_SPONSORSHIP_CFG_ID;
|
// const ae_sponsorship_cfg_id = PUBLIC_AE_SPONSORSHIP_CFG_ID;
|
||||||
|
|
||||||
// Loose bag-of-anything type used throughout the store. Once stores are broken into
|
// Loose bag-of-anything type used throughout the store. Once stores are broken into
|
||||||
// typed domain files, individual structs will have proper interfaces instead.
|
// typed domain files, individual structs will have proper interfaces instead.
|
||||||
@@ -174,7 +174,7 @@ const ae_app_local_data_defaults: key_val = {
|
|||||||
posts: {},
|
posts: {},
|
||||||
|
|
||||||
sponsorships: {
|
sponsorships: {
|
||||||
cfg_id: ae_sponsorship_cfg_id,
|
cfg_id: null,
|
||||||
|
|
||||||
for_type: null,
|
for_type: null,
|
||||||
for_id: null,
|
for_id: null,
|
||||||
@@ -350,7 +350,7 @@ const slct_obj_template: key_val = {
|
|||||||
sponsorship_id: null,
|
sponsorship_id: null,
|
||||||
sponsorship_obj: {},
|
sponsorship_obj: {},
|
||||||
sponsorship_obj_li: [],
|
sponsorship_obj_li: [],
|
||||||
sponsorship_cfg_id: ae_sponsorship_cfg_id,
|
sponsorship_cfg_id: null,
|
||||||
sponsorship_cfg_obj: {},
|
sponsorship_cfg_obj: {},
|
||||||
sponsorship_cfg_obj_li: [],
|
sponsorship_cfg_obj_li: [],
|
||||||
post_id: null,
|
post_id: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user