create-blitzpack 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +176 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -555,7 +555,11 @@ import fs from "fs-extra";
|
|
|
555
555
|
import { downloadTemplate } from "giget";
|
|
556
556
|
import path2 from "path";
|
|
557
557
|
var GITHUB_REPO = "github:CarboxyDev/blitzpack";
|
|
558
|
-
var POST_DOWNLOAD_EXCLUDES = [
|
|
558
|
+
var POST_DOWNLOAD_EXCLUDES = [
|
|
559
|
+
"create-blitzpack",
|
|
560
|
+
"apps/marketing",
|
|
561
|
+
"CONTRIBUTING.md"
|
|
562
|
+
];
|
|
559
563
|
function getFeatureExclusions(features) {
|
|
560
564
|
const exclusions = [];
|
|
561
565
|
for (const [key, enabled] of Object.entries(features)) {
|
|
@@ -796,6 +800,166 @@ The web app uses Better Auth for authentication with modern patterns:
|
|
|
796
800
|
- \`logger.perf(message, metrics)\` - Performance metrics
|
|
797
801
|
`;
|
|
798
802
|
|
|
803
|
+
// src/ci-workflow-template.ts
|
|
804
|
+
var CI_WORKFLOW_TEMPLATE = `name: CI
|
|
805
|
+
|
|
806
|
+
on:
|
|
807
|
+
push:
|
|
808
|
+
branches: [main, development]
|
|
809
|
+
pull_request:
|
|
810
|
+
branches: [main, development]
|
|
811
|
+
|
|
812
|
+
# Cancel in-progress runs when a new commit is pushed
|
|
813
|
+
concurrency:
|
|
814
|
+
group: \${{ github.workflow }}-\${{ github.ref }}
|
|
815
|
+
cancel-in-progress: true
|
|
816
|
+
|
|
817
|
+
jobs:
|
|
818
|
+
# Fast checks that can run in parallel
|
|
819
|
+
lint:
|
|
820
|
+
runs-on: ubuntu-latest
|
|
821
|
+
steps:
|
|
822
|
+
- uses: actions/checkout@v4
|
|
823
|
+
|
|
824
|
+
- name: Setup pnpm
|
|
825
|
+
uses: pnpm/action-setup@v4
|
|
826
|
+
|
|
827
|
+
- name: Setup Node.js
|
|
828
|
+
uses: actions/setup-node@v4
|
|
829
|
+
with:
|
|
830
|
+
node-version: '20'
|
|
831
|
+
cache: 'pnpm'
|
|
832
|
+
|
|
833
|
+
- name: Install dependencies
|
|
834
|
+
run: pnpm install --frozen-lockfile
|
|
835
|
+
|
|
836
|
+
- name: Run lint
|
|
837
|
+
run: pnpm run lint
|
|
838
|
+
|
|
839
|
+
typecheck:
|
|
840
|
+
runs-on: ubuntu-latest
|
|
841
|
+
steps:
|
|
842
|
+
- uses: actions/checkout@v4
|
|
843
|
+
|
|
844
|
+
- name: Setup pnpm
|
|
845
|
+
uses: pnpm/action-setup@v4
|
|
846
|
+
|
|
847
|
+
- name: Setup Node.js
|
|
848
|
+
uses: actions/setup-node@v4
|
|
849
|
+
with:
|
|
850
|
+
node-version: '20'
|
|
851
|
+
cache: 'pnpm'
|
|
852
|
+
|
|
853
|
+
- name: Install dependencies
|
|
854
|
+
run: pnpm install --frozen-lockfile
|
|
855
|
+
|
|
856
|
+
- name: Run typecheck
|
|
857
|
+
run: pnpm run typecheck
|
|
858
|
+
env:
|
|
859
|
+
DATABASE_URL: postgresql://user:pass@localhost:5432/db
|
|
860
|
+
|
|
861
|
+
# @feature testing
|
|
862
|
+
# Tests and build run after lint/typecheck pass
|
|
863
|
+
test:
|
|
864
|
+
runs-on: ubuntu-latest
|
|
865
|
+
needs: [lint, typecheck]
|
|
866
|
+
|
|
867
|
+
# PostgreSQL service for integration tests
|
|
868
|
+
services:
|
|
869
|
+
postgres:
|
|
870
|
+
image: postgres:17-alpine
|
|
871
|
+
env:
|
|
872
|
+
POSTGRES_USER: postgres
|
|
873
|
+
POSTGRES_PASSWORD: postgres
|
|
874
|
+
POSTGRES_DB: app_dev_test
|
|
875
|
+
POSTGRES_HOST_AUTH_METHOD: trust
|
|
876
|
+
options: >-
|
|
877
|
+
--health-cmd "pg_isready -U postgres"
|
|
878
|
+
--health-interval 10s
|
|
879
|
+
--health-timeout 5s
|
|
880
|
+
--health-retries 5
|
|
881
|
+
ports:
|
|
882
|
+
- 5432:5432
|
|
883
|
+
|
|
884
|
+
env:
|
|
885
|
+
NODE_ENV: test
|
|
886
|
+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/app_dev
|
|
887
|
+
API_URL: http://localhost:8080
|
|
888
|
+
FRONTEND_URL: http://localhost:3000
|
|
889
|
+
PORT: 8080
|
|
890
|
+
LOG_LEVEL: minimal
|
|
891
|
+
COOKIE_SECRET: test-cookie-secret-for-ci
|
|
892
|
+
BETTER_AUTH_SECRET: test-secret-minimum-32-characters-long-for-ci
|
|
893
|
+
BETTER_AUTH_URL: http://localhost:8080
|
|
894
|
+
|
|
895
|
+
steps:
|
|
896
|
+
- uses: actions/checkout@v4
|
|
897
|
+
|
|
898
|
+
- name: Setup pnpm
|
|
899
|
+
uses: pnpm/action-setup@v4
|
|
900
|
+
|
|
901
|
+
- name: Setup Node.js
|
|
902
|
+
uses: actions/setup-node@v4
|
|
903
|
+
with:
|
|
904
|
+
node-version: '20'
|
|
905
|
+
cache: 'pnpm'
|
|
906
|
+
|
|
907
|
+
- name: Install dependencies
|
|
908
|
+
run: pnpm install --frozen-lockfile
|
|
909
|
+
|
|
910
|
+
- name: Generate Prisma Client
|
|
911
|
+
run: cd apps/api && npx prisma generate
|
|
912
|
+
|
|
913
|
+
- name: Run tests
|
|
914
|
+
run: pnpm run test
|
|
915
|
+
# @endfeature
|
|
916
|
+
|
|
917
|
+
build:
|
|
918
|
+
runs-on: ubuntu-latest
|
|
919
|
+
needs: [lint, typecheck]
|
|
920
|
+
steps:
|
|
921
|
+
- uses: actions/checkout@v4
|
|
922
|
+
|
|
923
|
+
- name: Setup pnpm
|
|
924
|
+
uses: pnpm/action-setup@v4
|
|
925
|
+
|
|
926
|
+
- name: Setup Node.js
|
|
927
|
+
uses: actions/setup-node@v4
|
|
928
|
+
with:
|
|
929
|
+
node-version: '20'
|
|
930
|
+
cache: 'pnpm'
|
|
931
|
+
|
|
932
|
+
- name: Install dependencies
|
|
933
|
+
run: pnpm install --frozen-lockfile
|
|
934
|
+
|
|
935
|
+
- name: Generate Prisma Client
|
|
936
|
+
run: pnpm --filter @repo/api db:generate
|
|
937
|
+
env:
|
|
938
|
+
DATABASE_URL: postgresql://user:pass@localhost:5432/db
|
|
939
|
+
|
|
940
|
+
- name: Setup Turborepo cache
|
|
941
|
+
uses: actions/cache@v4
|
|
942
|
+
with:
|
|
943
|
+
path: .turbo
|
|
944
|
+
key: \${{ runner.os }}-turbo-\${{ github.sha }}
|
|
945
|
+
restore-keys: |
|
|
946
|
+
\${{ runner.os }}-turbo-
|
|
947
|
+
|
|
948
|
+
- name: Build
|
|
949
|
+
run: pnpm run build
|
|
950
|
+
env:
|
|
951
|
+
NODE_ENV: production
|
|
952
|
+
API_URL: 'http://localhost:8080'
|
|
953
|
+
FRONTEND_URL: 'http://localhost:3000'
|
|
954
|
+
DATABASE_URL: 'postgresql://user:pass@localhost:5432/db'
|
|
955
|
+
PORT: '8080'
|
|
956
|
+
LOG_LEVEL: 'minimal'
|
|
957
|
+
COOKIE_SECRET: 'ci-test-secret-not-for-production'
|
|
958
|
+
BETTER_AUTH_SECRET: 'test-secret-minimum-32-characters-long-for-ci'
|
|
959
|
+
BETTER_AUTH_URL: 'http://localhost:8080'
|
|
960
|
+
NEXT_PUBLIC_API_URL: 'http://localhost:8080/api'
|
|
961
|
+
`;
|
|
962
|
+
|
|
799
963
|
// src/transform.ts
|
|
800
964
|
var TESTING_SCRIPTS = [
|
|
801
965
|
"test",
|
|
@@ -824,6 +988,7 @@ var TESTING_FILE_PATTERNS = [
|
|
|
824
988
|
];
|
|
825
989
|
var TS_CONFIG_FILE_PATTERN = /^tsconfig(?:\.[^.]+)?\.json$/;
|
|
826
990
|
var AGENT_DOC_TARGETS = ["CLAUDE.md", "AGENTS.md"];
|
|
991
|
+
var CI_WORKFLOW_RELATIVE_PATH = ".github/workflows/ci.yml";
|
|
827
992
|
var MARKER_FILES = [
|
|
828
993
|
"apps/api/src/app.ts",
|
|
829
994
|
"apps/api/src/plugins/services.ts",
|
|
@@ -835,10 +1000,10 @@ function stripFeatureBlocks(content, disabledFeatures) {
|
|
|
835
1000
|
let skipUntilEnd = false;
|
|
836
1001
|
for (const line of lines) {
|
|
837
1002
|
const featureStart = line.match(
|
|
838
|
-
/^\s*(
|
|
1003
|
+
/^\s*(?:\/\/|#|<!--)\s*@feature\s+(\w+)\s*(?:-->)?\s*$/
|
|
839
1004
|
);
|
|
840
1005
|
const featureEnd = line.match(
|
|
841
|
-
/^\s*(
|
|
1006
|
+
/^\s*(?:\/\/|#|<!--)\s*@endfeature\s*(?:-->)?\s*$/
|
|
842
1007
|
);
|
|
843
1008
|
if (featureStart) {
|
|
844
1009
|
const feature = featureStart[1];
|
|
@@ -1011,6 +1176,7 @@ async function applyFeatureTransforms(targetDir, features) {
|
|
|
1011
1176
|
if (!features.testing) {
|
|
1012
1177
|
await transformForNoTesting(targetDir);
|
|
1013
1178
|
}
|
|
1179
|
+
await transformCiWorkflow(targetDir, disabledFeatures);
|
|
1014
1180
|
await transformAgentDocs(targetDir, disabledFeatures);
|
|
1015
1181
|
}
|
|
1016
1182
|
async function transformForNoTesting(targetDir) {
|
|
@@ -1177,6 +1343,13 @@ async function transformAgentDocs(targetDir, disabledFeatures) {
|
|
|
1177
1343
|
await fs2.writeFile(filePath, fileContent, "utf-8");
|
|
1178
1344
|
}
|
|
1179
1345
|
}
|
|
1346
|
+
async function transformCiWorkflow(targetDir, disabledFeatures) {
|
|
1347
|
+
const workflowPath = path3.join(targetDir, CI_WORKFLOW_RELATIVE_PATH);
|
|
1348
|
+
await fs2.ensureDir(path3.dirname(workflowPath));
|
|
1349
|
+
let content = stripFeatureBlocks(CI_WORKFLOW_TEMPLATE, disabledFeatures);
|
|
1350
|
+
content = cleanEmptyLines(content).trimEnd() + "\n";
|
|
1351
|
+
await fs2.writeFile(workflowPath, content, "utf-8");
|
|
1352
|
+
}
|
|
1180
1353
|
|
|
1181
1354
|
// src/commands/create.ts
|
|
1182
1355
|
var ENV_FILES = [
|