create-blitzpack 0.1.16 → 0.1.18

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.
Files changed (2) hide show
  1. package/dist/index.js +245 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -229,7 +229,8 @@ var FEATURE_EXCLUSIONS = {
229
229
  "apps/api/.dockerignore",
230
230
  "apps/api/Dockerfile",
231
231
  "apps/web/Dockerfile",
232
- "deploy/docker"
232
+ "deploy/docker",
233
+ ".github/workflows/docker-build.yml"
233
234
  ],
234
235
  ciCd: [".github/workflows/cd.yml"]
235
236
  };
@@ -555,7 +556,11 @@ import fs from "fs-extra";
555
556
  import { downloadTemplate } from "giget";
556
557
  import path2 from "path";
557
558
  var GITHUB_REPO = "github:CarboxyDev/blitzpack";
558
- var POST_DOWNLOAD_EXCLUDES = ["create-blitzpack", "apps/marketing"];
559
+ var POST_DOWNLOAD_EXCLUDES = [
560
+ "create-blitzpack",
561
+ "apps/marketing",
562
+ "CONTRIBUTING.md"
563
+ ];
559
564
  function getFeatureExclusions(features) {
560
565
  const exclusions = [];
561
566
  for (const [key, enabled] of Object.entries(features)) {
@@ -796,6 +801,219 @@ The web app uses Better Auth for authentication with modern patterns:
796
801
  - \`logger.perf(message, metrics)\` - Performance metrics
797
802
  `;
798
803
 
804
+ // src/ci-workflow-template.ts
805
+ var CI_WORKFLOW_TEMPLATE = `name: CI
806
+
807
+ on:
808
+ push:
809
+ branches: [main, development]
810
+ pull_request:
811
+ branches: [main, development]
812
+
813
+ # Cancel in-progress runs when a new commit is pushed
814
+ concurrency:
815
+ group: \${{ github.workflow }}-\${{ github.ref }}
816
+ cancel-in-progress: true
817
+
818
+ jobs:
819
+ # Fast checks that can run in parallel
820
+ lint:
821
+ runs-on: ubuntu-latest
822
+ steps:
823
+ - uses: actions/checkout@v4
824
+
825
+ - name: Setup pnpm
826
+ uses: pnpm/action-setup@v4
827
+
828
+ - name: Setup Node.js
829
+ uses: actions/setup-node@v4
830
+ with:
831
+ node-version: '20'
832
+ cache: 'pnpm'
833
+
834
+ - name: Install dependencies
835
+ run: pnpm install --frozen-lockfile
836
+
837
+ - name: Run lint
838
+ run: pnpm run lint
839
+
840
+ typecheck:
841
+ runs-on: ubuntu-latest
842
+ steps:
843
+ - uses: actions/checkout@v4
844
+
845
+ - name: Setup pnpm
846
+ uses: pnpm/action-setup@v4
847
+
848
+ - name: Setup Node.js
849
+ uses: actions/setup-node@v4
850
+ with:
851
+ node-version: '20'
852
+ cache: 'pnpm'
853
+
854
+ - name: Install dependencies
855
+ run: pnpm install --frozen-lockfile
856
+
857
+ - name: Run typecheck
858
+ run: pnpm run typecheck
859
+ env:
860
+ DATABASE_URL: postgresql://user:pass@localhost:5432/db
861
+
862
+ # @feature testing
863
+ # Tests and build run after lint/typecheck pass
864
+ test:
865
+ runs-on: ubuntu-latest
866
+ needs: [lint, typecheck]
867
+
868
+ # PostgreSQL service for integration tests
869
+ services:
870
+ postgres:
871
+ image: postgres:17-alpine
872
+ env:
873
+ POSTGRES_USER: postgres
874
+ POSTGRES_PASSWORD: postgres
875
+ POSTGRES_DB: app_dev_test
876
+ POSTGRES_HOST_AUTH_METHOD: trust
877
+ options: >-
878
+ --health-cmd "pg_isready -U postgres"
879
+ --health-interval 10s
880
+ --health-timeout 5s
881
+ --health-retries 5
882
+ ports:
883
+ - 5432:5432
884
+
885
+ env:
886
+ NODE_ENV: test
887
+ DATABASE_URL: postgresql://postgres:postgres@localhost:5432/app_dev
888
+ API_URL: http://localhost:8080
889
+ FRONTEND_URL: http://localhost:3000
890
+ PORT: 8080
891
+ LOG_LEVEL: minimal
892
+ COOKIE_SECRET: test-cookie-secret-for-ci
893
+ BETTER_AUTH_SECRET: test-secret-minimum-32-characters-long-for-ci
894
+ BETTER_AUTH_URL: http://localhost:8080
895
+
896
+ steps:
897
+ - uses: actions/checkout@v4
898
+
899
+ - name: Setup pnpm
900
+ uses: pnpm/action-setup@v4
901
+
902
+ - name: Setup Node.js
903
+ uses: actions/setup-node@v4
904
+ with:
905
+ node-version: '20'
906
+ cache: 'pnpm'
907
+
908
+ - name: Install dependencies
909
+ run: pnpm install --frozen-lockfile
910
+
911
+ - name: Generate Prisma Client
912
+ run: cd apps/api && npx prisma generate
913
+
914
+ - name: Run tests
915
+ run: pnpm run test
916
+ # @endfeature
917
+
918
+ build:
919
+ runs-on: ubuntu-latest
920
+ needs: [lint, typecheck]
921
+ steps:
922
+ - uses: actions/checkout@v4
923
+
924
+ - name: Setup pnpm
925
+ uses: pnpm/action-setup@v4
926
+
927
+ - name: Setup Node.js
928
+ uses: actions/setup-node@v4
929
+ with:
930
+ node-version: '20'
931
+ cache: 'pnpm'
932
+
933
+ - name: Install dependencies
934
+ run: pnpm install --frozen-lockfile
935
+
936
+ - name: Generate Prisma Client
937
+ run: pnpm --filter @repo/api db:generate
938
+ env:
939
+ DATABASE_URL: postgresql://user:pass@localhost:5432/db
940
+
941
+ - name: Setup Turborepo cache
942
+ uses: actions/cache@v4
943
+ with:
944
+ path: .turbo
945
+ key: \${{ runner.os }}-turbo-\${{ github.sha }}
946
+ restore-keys: |
947
+ \${{ runner.os }}-turbo-
948
+
949
+ - name: Build
950
+ run: pnpm run build
951
+ env:
952
+ NODE_ENV: production
953
+ API_URL: 'http://localhost:8080'
954
+ FRONTEND_URL: 'http://localhost:3000'
955
+ DATABASE_URL: 'postgresql://user:pass@localhost:5432/db'
956
+ PORT: '8080'
957
+ LOG_LEVEL: 'minimal'
958
+ COOKIE_SECRET: 'ci-test-secret-not-for-production'
959
+ BETTER_AUTH_SECRET: 'test-secret-minimum-32-characters-long-for-ci'
960
+ BETTER_AUTH_URL: 'http://localhost:8080'
961
+ NEXT_PUBLIC_API_URL: 'http://localhost:8080/api'
962
+
963
+ `;
964
+
965
+ // src/docker-ci-workflow-template.ts
966
+ var DOCKER_CI_WORKFLOW_TEMPLATE = `name: Docker Build
967
+
968
+ on:
969
+ pull_request:
970
+ branches: [main, development]
971
+ push:
972
+ branches: [main]
973
+
974
+ # Cancel in-progress runs when a new commit is pushed
975
+ concurrency:
976
+ group: \${{ github.workflow }}-\${{ github.ref }}
977
+ cancel-in-progress: true
978
+
979
+ jobs:
980
+ build-api:
981
+ runs-on: ubuntu-latest
982
+ steps:
983
+ - uses: actions/checkout@v4
984
+
985
+ - name: Set up Docker Buildx
986
+ uses: docker/setup-buildx-action@v3
987
+
988
+ - name: Build API image
989
+ uses: docker/build-push-action@v6
990
+ with:
991
+ context: .
992
+ file: ./apps/api/Dockerfile
993
+ push: false
994
+ cache-from: type=gha
995
+ cache-to: type=gha,mode=max
996
+
997
+ build-web:
998
+ runs-on: ubuntu-latest
999
+ steps:
1000
+ - uses: actions/checkout@v4
1001
+
1002
+ - name: Set up Docker Buildx
1003
+ uses: docker/setup-buildx-action@v3
1004
+
1005
+ - name: Build Web image
1006
+ uses: docker/build-push-action@v6
1007
+ with:
1008
+ context: .
1009
+ file: ./apps/web/Dockerfile
1010
+ push: false
1011
+ build-args: |
1012
+ NEXT_PUBLIC_API_URL=http://localhost:8080/api
1013
+ cache-from: type=gha
1014
+ cache-to: type=gha,mode=max
1015
+ `;
1016
+
799
1017
  // src/transform.ts
800
1018
  var TESTING_SCRIPTS = [
801
1019
  "test",
@@ -824,6 +1042,8 @@ var TESTING_FILE_PATTERNS = [
824
1042
  ];
825
1043
  var TS_CONFIG_FILE_PATTERN = /^tsconfig(?:\.[^.]+)?\.json$/;
826
1044
  var AGENT_DOC_TARGETS = ["CLAUDE.md", "AGENTS.md"];
1045
+ var CI_WORKFLOW_RELATIVE_PATH = ".github/workflows/ci.yml";
1046
+ var DOCKER_CI_WORKFLOW_RELATIVE_PATH = ".github/workflows/docker-build.yml";
827
1047
  var MARKER_FILES = [
828
1048
  "apps/api/src/app.ts",
829
1049
  "apps/api/src/plugins/services.ts",
@@ -835,10 +1055,10 @@ function stripFeatureBlocks(content, disabledFeatures) {
835
1055
  let skipUntilEnd = false;
836
1056
  for (const line of lines) {
837
1057
  const featureStart = line.match(
838
- /^\s*(?:\/\/|<!--)\s*@feature\s+(\w+)\s*(?:-->)?\s*$/
1058
+ /^\s*(?:\/\/|#|<!--)\s*@feature\s+(\w+)\s*(?:-->)?\s*$/
839
1059
  );
840
1060
  const featureEnd = line.match(
841
- /^\s*(?:\/\/|<!--)\s*@endfeature\s*(?:-->)?\s*$/
1061
+ /^\s*(?:\/\/|#|<!--)\s*@endfeature\s*(?:-->)?\s*$/
842
1062
  );
843
1063
  if (featureStart) {
844
1064
  const feature = featureStart[1];
@@ -1011,6 +1231,8 @@ async function applyFeatureTransforms(targetDir, features) {
1011
1231
  if (!features.testing) {
1012
1232
  await transformForNoTesting(targetDir);
1013
1233
  }
1234
+ await transformCiWorkflow(targetDir, disabledFeatures);
1235
+ await transformDockerCiWorkflow(targetDir, features);
1014
1236
  await transformAgentDocs(targetDir, disabledFeatures);
1015
1237
  }
1016
1238
  async function transformForNoTesting(targetDir) {
@@ -1177,6 +1399,25 @@ async function transformAgentDocs(targetDir, disabledFeatures) {
1177
1399
  await fs2.writeFile(filePath, fileContent, "utf-8");
1178
1400
  }
1179
1401
  }
1402
+ async function transformCiWorkflow(targetDir, disabledFeatures) {
1403
+ const workflowPath = path3.join(targetDir, CI_WORKFLOW_RELATIVE_PATH);
1404
+ await fs2.ensureDir(path3.dirname(workflowPath));
1405
+ let content = stripFeatureBlocks(CI_WORKFLOW_TEMPLATE, disabledFeatures);
1406
+ content = cleanEmptyLines(content).trimEnd() + "\n";
1407
+ await fs2.writeFile(workflowPath, content, "utf-8");
1408
+ }
1409
+ async function transformDockerCiWorkflow(targetDir, features) {
1410
+ const workflowPath = path3.join(targetDir, DOCKER_CI_WORKFLOW_RELATIVE_PATH);
1411
+ if (!features.dockerDeploy) {
1412
+ if (await fs2.pathExists(workflowPath)) {
1413
+ await fs2.remove(workflowPath);
1414
+ }
1415
+ return;
1416
+ }
1417
+ await fs2.ensureDir(path3.dirname(workflowPath));
1418
+ const content = DOCKER_CI_WORKFLOW_TEMPLATE.trimEnd() + "\n";
1419
+ await fs2.writeFile(workflowPath, content, "utf-8");
1420
+ }
1180
1421
 
1181
1422
  // src/commands/create.ts
1182
1423
  var ENV_FILES = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-blitzpack",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Create a new Blitzpack project - full-stack TypeScript monorepo with Next.js and Fastify",
5
5
  "type": "module",
6
6
  "bin": {