create-jsc-vite-react-ts 1.2.5 → 1.3.0

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 (32) hide show
  1. package/bin/cli.js +0 -3
  2. package/package.json +1 -1
  3. package/template/.github/workflows/build.yml +199 -0
  4. package/template/etc/docker/Dockerfile +16 -0
  5. package/template/etc/docker/nginx.conf +54 -0
  6. package/template/{package.json → frontend/package.json} +2 -1
  7. /package/template/{.prettierrc → frontend/.prettierrc} +0 -0
  8. /package/template/{README.md → frontend/README.md} +0 -0
  9. /package/template/{eslint.config.js → frontend/eslint.config.js} +0 -0
  10. /package/template/{gitignore → frontend/gitignore} +0 -0
  11. /package/template/{index.html → frontend/index.html} +0 -0
  12. /package/template/{public → frontend/public}/vite.svg +0 -0
  13. /package/template/{scripts → frontend/scripts}/create-tag.sh +0 -0
  14. /package/template/{scripts → frontend/scripts}/get-tag.sh +0 -0
  15. /package/template/{scripts → frontend/scripts}/update-version.sh +0 -0
  16. /package/template/{src → frontend/src}/App.test.tsx +0 -0
  17. /package/template/{src → frontend/src}/App.tsx +0 -0
  18. /package/template/{src → frontend/src}/app.css +0 -0
  19. /package/template/{src → frontend/src}/components/Footer.test.tsx +0 -0
  20. /package/template/{src → frontend/src}/components/Footer.tsx +0 -0
  21. /package/template/{src → frontend/src}/components/ThemeToggle.test.tsx +0 -0
  22. /package/template/{src → frontend/src}/components/ThemeToggle.tsx +0 -0
  23. /package/template/{src → frontend/src}/contexts/ThemeContext.tsx +0 -0
  24. /package/template/{src → frontend/src}/contexts/theme.ts +0 -0
  25. /package/template/{src → frontend/src}/hooks/useTheme.test.tsx +0 -0
  26. /package/template/{src → frontend/src}/hooks/useTheme.ts +0 -0
  27. /package/template/{src → frontend/src}/main.tsx +0 -0
  28. /package/template/{src → frontend/src}/test/setup.ts +0 -0
  29. /package/template/{tsconfig.app.json → frontend/tsconfig.app.json} +0 -0
  30. /package/template/{tsconfig.json → frontend/tsconfig.json} +0 -0
  31. /package/template/{tsconfig.node.json → frontend/tsconfig.node.json} +0 -0
  32. /package/template/{vite.config.ts → frontend/vite.config.ts} +0 -0
package/bin/cli.js CHANGED
@@ -105,9 +105,6 @@ const run = async () => {
105
105
  console.log(chalk.bold.green("\n✨ Success! Your project is ready.\n"));
106
106
  console.log(chalk.bold("Next steps:\n"));
107
107
  console.log(chalk.cyan(` cd ${projectName}`));
108
- console.log(chalk.cyan(` git init`));
109
- console.log(chalk.cyan(` git add .`));
110
- console.log(chalk.cyan(` git commit -m "Initial commit"`));
111
108
  console.log(chalk.cyan(` ${packageManager} dev`));
112
109
  console.log();
113
110
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-jsc-vite-react-ts",
3
- "version": "1.2.5",
3
+ "version": "1.3.0",
4
4
  "description": "Create a modern React app with TypeScript, Vite, Tailwind CSS, and Vitest",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,199 @@
1
+ name: Build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "main"
7
+ release:
8
+ types: [published]
9
+
10
+ env:
11
+ IMAGE_NAME: jsc-vite-test
12
+ IMAGE_TITLE: Default JSC Vite React TS Image
13
+ IMAGE_DESCRIPTION: This is the image for JSC's Vite React TS template.
14
+ SRC_PATH: frontend/
15
+ DOCKERFILE_PATH: etc/docker/Dockerfile
16
+ NODE_VERSION: "24"
17
+
18
+ jobs:
19
+ install:
20
+ name: Build source code
21
+ runs-on: ubuntu-24.04
22
+
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@v6
26
+
27
+ - name: Set up Node.js
28
+ uses: actions/setup-node@v6
29
+ with:
30
+ node-version: ${{ env.NODE_VERSION }}
31
+
32
+ - name: Install Dependencies
33
+ run: yarn --cwd ${{ env.SRC_PATH }} install
34
+
35
+ - name: Create tarball
36
+ run: tar -czf ${{ env.IMAGE_NAME }}.tar.gz -C ${{ env.SRC_PATH }} node_modules
37
+
38
+ - name: Upload common artifacts
39
+ uses: actions/upload-artifact@v6
40
+ with:
41
+ name: ${{ env.IMAGE_NAME }}
42
+ retention-days: 1
43
+ path: ${{ env.IMAGE_NAME }}.tar.gz
44
+
45
+ lint:
46
+ name: Run ESlint on source code
47
+ runs-on: ubuntu-24.04
48
+ needs: install
49
+
50
+ steps:
51
+ - name: Checkout
52
+ uses: actions/checkout@v6
53
+
54
+ - name: Set up Node.js
55
+ uses: actions/setup-node@v6
56
+ with:
57
+ node-version: ${{ env.NODE_VERSION }}
58
+
59
+ - name: Download artifact
60
+ uses: actions/download-artifact@v6
61
+ with:
62
+ name: ${{ env.IMAGE_NAME }}
63
+
64
+ - name: Untar common Dependencies
65
+ run: tar -xzf ${{ env.IMAGE_NAME }}.tar.gz -C ./${{ env.SRC_PATH }}
66
+
67
+ - name: Run ESLint
68
+ run: |
69
+ yarn --cwd ${{ env.SRC_PATH }} lint
70
+
71
+ test:
72
+ name: Run tests on source code
73
+ runs-on: ubuntu-24.04
74
+ needs: install
75
+
76
+ steps:
77
+ - name: Checkout
78
+ uses: actions/checkout@v6
79
+
80
+ - name: Set up Node.js
81
+ uses: actions/setup-node@v6
82
+ with:
83
+ node-version: ${{ env.NODE_VERSION }}
84
+
85
+ - name: Download artifact
86
+ uses: actions/download-artifact@v6
87
+ with:
88
+ name: ${{ env.IMAGE_NAME }}
89
+
90
+ - name: Untar Dependencies
91
+ run: tar -xzf ${{ env.IMAGE_NAME }}.tar.gz -C ./${{ env.SRC_PATH }}
92
+
93
+ - name: Run Tests
94
+ run: |
95
+ mkdir -p ${{ env.SRC_PATH }}coverage
96
+ HAVE_TEST=$(find ${{ env.SRC_PATH }} -name "*.test.ts" | wc -l)
97
+ if [ $HAVE_TEST -ne 0 ];
98
+ then
99
+ yarn --cwd ${{ env.SRC_PATH }} test:coverage
100
+ fi
101
+ echo "HAVE_TEST=${HAVE_TEST}" > ${{ env.SRC_PATH }}coverage/have_test.txt
102
+
103
+ - name: Upload Coverage Report
104
+ uses: actions/upload-artifact@v6
105
+ with:
106
+ name: coverage-report-${{ env.IMAGE_NAME }}
107
+ retention-days: 1
108
+ path: ${{ env.SRC_PATH }}coverage/
109
+
110
+ upload-coverage:
111
+ name: Upload Coverage to Codecov
112
+ runs-on: ubuntu-24.04
113
+ needs: test
114
+
115
+ steps:
116
+ - name: Checkout
117
+ uses: actions/checkout@v6
118
+
119
+ - name: Download artifact
120
+ uses: actions/download-artifact@v6
121
+ with:
122
+ name: coverage-report-${{ env.IMAGE_NAME }}
123
+ path: ${{ env.SRC_PATH }}coverage
124
+
125
+ - name: Set environment variable
126
+ run: |
127
+ cat ${{ env.SRC_PATH }}coverage/have_test.txt >> $GITHUB_ENV
128
+
129
+ - name: Upload coverage to Codecov
130
+ uses: codecov/codecov-action@v5
131
+ if: env.HAVE_TEST != 0
132
+ with:
133
+ token: ${{ secrets.CODECOV_TOKEN }}
134
+ files: ./${{ env.SRC_PATH }}coverage/*.json
135
+ flags: unittests
136
+ name: code-coverage
137
+ fail_ci_if_error: true
138
+
139
+ build-image:
140
+ name: Build image and push to Docker Hub
141
+ runs-on: ubuntu-24.04
142
+ needs:
143
+ - lint
144
+ - upload-coverage
145
+ if: startsWith(github.ref, 'refs/tags/v')
146
+
147
+ steps:
148
+ - name: Checkout
149
+ uses: actions/checkout@v6
150
+ with:
151
+ fetch-depth: 0
152
+
153
+ - name: Set environment variable
154
+ run: |
155
+ if [ -f ${{ env.SRC_PATH }}/.env.production ]; then
156
+ cat ${{ env.SRC_PATH }}/.env.production >> $GITHUB_ENV
157
+ else
158
+ cat ${{ env.SRC_PATH }}/.env.example >> $GITHUB_ENV
159
+ fi
160
+
161
+ - name: Docker meta
162
+ id: meta
163
+ uses: docker/metadata-action@v5
164
+ with:
165
+ images: |
166
+ ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
167
+ tags: |
168
+ type=semver,pattern={{version}}
169
+ labels: |
170
+ org.opencontainers.image.title=${{ env.IMAGE_TITLE }}
171
+ org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
172
+
173
+ - name: Login to Docker Hub
174
+ uses: docker/login-action@v3
175
+ with:
176
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
177
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
178
+ - name: Set up QEMU
179
+ uses: docker/setup-qemu-action@v3
180
+
181
+ - name: Set up Docker Buildx
182
+ uses: docker/setup-buildx-action@v3
183
+
184
+ - name: Build and push
185
+ uses: docker/build-push-action@v6
186
+ with:
187
+ context: .
188
+ file: ${{ env.DOCKERFILE_PATH }}
189
+ platforms: linux/arm64
190
+ push: true
191
+ tags: ${{ steps.meta.outputs.tags }}
192
+ labels: ${{ steps.meta.outputs.labels }}
193
+ build-args: |
194
+ VITE_APP_NAME=${{ env.IMAGE_TITLE }}
195
+ VITE_APP_VERSION=${{ github.ref_name}}
196
+ VITE_FACEBOOK_APP_ID=${{ env.VITE_FACEBOOK_APP_ID }}
197
+ VITE_DESCRIPTION=${{ env.VITE_DESCRIPTION }}
198
+ VITE_APP_URL=${{ env.VITE_APP_URL }}
199
+ VITE_APP_IMAGE=${{ env.VITE_APP_IMAGE }}
@@ -0,0 +1,16 @@
1
+ FROM node:24-alpine AS builder
2
+
3
+ WORKDIR /app
4
+ COPY frontend/ ./
5
+
6
+ ARG VITE_APP_NAME ${VITE_APP_NAME}
7
+ ARG VITE_APP_VERSION ${VITE_APP_VERSION}
8
+
9
+ RUN yarn --cwd frontend install
10
+ RUN yarn --cwd frontend build
11
+
12
+ FROM nginx:alpine
13
+
14
+ COPY --from=builder /app/dist /usr/share/nginx/html
15
+ COPY etc/docker/nginx.conf /etc/nginx/
16
+ EXPOSE 80
@@ -0,0 +1,54 @@
1
+ user nginx;
2
+ worker_processes auto;
3
+
4
+ error_log /var/log/nginx/error.log notice;
5
+ pid /var/run/nginx.pid;
6
+
7
+
8
+ events {
9
+ worker_connections 1024;
10
+ }
11
+
12
+
13
+ http {
14
+ include /etc/nginx/mime.types;
15
+ default_type application/octet-stream;
16
+
17
+ log_format json_combined escape=json '{'
18
+ '"@timestamp": "$time_iso8601", '
19
+ '"remote_addr": "$remote_addr", '
20
+ '"remote_user": "$remote_user", '
21
+ '"request_id": "$request_id", '
22
+ '"body_bytes_sent": $body_bytes_sent, '
23
+ '"bytes_sent": $bytes_sent, '
24
+ '"connection": "$connection", '
25
+ '"connection_requests": $connection_requests, '
26
+ '"content_type": "$sent_http_content_type", '
27
+ '"msec": $msec, '
28
+ '"pipe": "$pipe", '
29
+ '"request_time": $request_time, '
30
+ '"status": $status, '
31
+ '"http_referrer": "$http_referer", '
32
+ '"http_user_agent": "$http_user_agent", '
33
+ '"http_x_forwarded_for": "$http_x_forwarded_for", '
34
+ '"http_host": "$http_host", '
35
+ '"request_length": $request_length, '
36
+ '"request_method": "$request_method", '
37
+ '"request_uri": "$request_uri", '
38
+ '"scheme": "$scheme", '
39
+ '"server_addr": "$server_addr", '
40
+ '"server_name": "$server_name", '
41
+ '"server_port": $server_port'
42
+ '}';
43
+
44
+ access_log /var/log/nginx/access.log json_combined;
45
+
46
+ sendfile on;
47
+ #tcp_nopush on;
48
+
49
+ keepalive_timeout 65;
50
+
51
+ #gzip on;
52
+
53
+ include /etc/nginx/conf.d/*.conf;
54
+ }
@@ -14,7 +14,8 @@
14
14
  "format": "prettier --write .",
15
15
  "update-version": "./scripts/update-version.sh",
16
16
  "create-tag": "./scripts/create-tag.sh",
17
- "full-tag": "yarn update-version && yarn create-tag"
17
+ "full-tag": "yarn update-version && yarn create-tag",
18
+ "prepare": "git init"
18
19
  },
19
20
  "dependencies": {
20
21
  "react": "^19.2.0",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes