@adriankulik/create-fullstack-app 1.4.0 → 1.6.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 (68) hide show
  1. package/README.md +16 -6
  2. package/cli/index.js +46 -19
  3. package/package.json +21 -4
  4. package/templates/backend/dotnet/Tests/Tests.csproj +2 -2
  5. package/templates/backend/dotnet/dotnet.csproj +1 -1
  6. package/templates/backend/dotnet/lint.sh +1 -0
  7. package/templates/backend/dotnet/start.sh +1 -0
  8. package/templates/backend/dotnet/test.sh +1 -0
  9. package/templates/backend/fastapi/lint.sh +1 -0
  10. package/templates/backend/fastapi/requirements.txt +1 -1
  11. package/templates/backend/fastapi/start.sh +1 -0
  12. package/templates/backend/fastapi/test.sh +1 -0
  13. package/templates/backend/flask/lint.sh +1 -0
  14. package/templates/backend/flask/requirements.txt +1 -1
  15. package/templates/backend/flask/start.sh +1 -0
  16. package/templates/backend/flask/test.sh +1 -0
  17. package/templates/backend/nodejs/eslint.config.js +15 -0
  18. package/templates/backend/nodejs/lint.sh +1 -0
  19. package/templates/backend/nodejs/package-lock.json +1121 -2112
  20. package/templates/backend/nodejs/package.json +7 -7
  21. package/templates/backend/nodejs/start.sh +1 -0
  22. package/templates/backend/nodejs/test.sh +1 -0
  23. package/templates/base/.editorconfig +18 -0
  24. package/templates/base/.github/workflows/test.yml +26 -10
  25. package/templates/base/gitignore +4 -0
  26. package/templates/frontend/angular/angular.json +6 -0
  27. package/templates/frontend/angular/eslint.config.js +35 -0
  28. package/templates/frontend/angular/lint.sh +1 -0
  29. package/templates/frontend/angular/package-lock.json +1420 -488
  30. package/templates/frontend/angular/package.json +9 -2
  31. package/templates/frontend/angular/src/app/app.component.html +32 -0
  32. package/templates/frontend/angular/src/app/app.component.ts +12 -35
  33. package/templates/frontend/angular/start.sh +1 -0
  34. package/templates/frontend/angular/test.sh +1 -0
  35. package/templates/frontend/nextjs/__tests__/page.test.tsx +4 -4
  36. package/templates/frontend/nextjs/app/page.tsx +8 -2
  37. package/templates/frontend/nextjs/eslint.config.mjs +7 -0
  38. package/templates/frontend/nextjs/lint.sh +1 -0
  39. package/templates/frontend/nextjs/package-lock.json +1336 -872
  40. package/templates/frontend/nextjs/package.json +11 -10
  41. package/templates/frontend/nextjs/start.sh +1 -0
  42. package/templates/frontend/nextjs/test.sh +1 -0
  43. package/templates/frontend/nextjs/tsconfig.json +2 -1
  44. package/templates/frontend/svelte/eslint.config.js +29 -0
  45. package/templates/frontend/svelte/lint.sh +1 -0
  46. package/templates/frontend/svelte/package-lock.json +1676 -3482
  47. package/templates/frontend/svelte/package.json +14 -13
  48. package/templates/frontend/svelte/src/App.spec.ts +7 -7
  49. package/templates/frontend/svelte/src/App.svelte +14 -7
  50. package/templates/frontend/svelte/start.sh +1 -0
  51. package/templates/frontend/svelte/test.sh +1 -0
  52. package/templates/frontend/svelte/vite.config.ts +2 -2
  53. package/templates/frontend/vue/eslint.config.js +26 -0
  54. package/templates/frontend/vue/lint.sh +1 -0
  55. package/templates/frontend/vue/package-lock.json +1598 -2755
  56. package/templates/frontend/vue/package.json +13 -13
  57. package/templates/frontend/vue/src/App.vue +30 -9
  58. package/templates/frontend/vue/src/__tests__/App.spec.ts +4 -4
  59. package/templates/frontend/vue/start.sh +1 -0
  60. package/templates/frontend/vue/test.sh +1 -0
  61. package/templates/frontend/vue/tsconfig.json +13 -5
  62. package/templates/frontend/vue/vite.config.ts +0 -1
  63. package/cli/package-lock.json +0 -1338
  64. package/cli/package.json +0 -23
  65. package/templates/backend/nodejs/.eslintrc.json +0 -15
  66. package/templates/frontend/nextjs/.eslintrc.json +0 -3
  67. package/templates/frontend/svelte/.eslintrc.cjs +0 -27
  68. package/templates/frontend/vue/.eslintrc.cjs +0 -18
@@ -7,24 +7,25 @@
7
7
  "build": "vite build",
8
8
  "preview": "vite preview",
9
9
  "test": "vitest run",
10
- "lint": "eslint . --ext .svelte,.js,.ts,.cjs,.mjs --fix --ignore-path ../.gitignore"
10
+ "lint": "eslint . --fix"
11
11
  },
12
12
  "devDependencies": {
13
- "@sveltejs/vite-plugin-svelte": "^4.0.0",
14
- "@testing-library/svelte": "^4.1.0",
15
- "@testing-library/jest-dom": "^6.4.2",
13
+ "@eslint/js": "^10.0.1",
14
+ "@sveltejs/vite-plugin-svelte": "^7.1.2",
15
+ "@testing-library/jest-dom": "^6.9.1",
16
+ "@testing-library/svelte": "^5.3.1",
16
17
  "@tsconfig/svelte": "^5.0.2",
17
- "@typescript-eslint/eslint-plugin": "^7.1.0",
18
- "@typescript-eslint/parser": "^7.1.0",
19
- "eslint": "^8.57.0",
20
- "eslint-plugin-svelte": "^2.35.1",
21
- "jsdom": "^24.0.0",
18
+ "eslint": "^10.4.0",
19
+ "eslint-plugin-svelte": "^3.17.1",
20
+ "globals": "^17.6.0",
21
+ "jsdom": "^29.1.1",
22
22
  "prettier": "^3.2.5",
23
- "svelte": "^5.55.5",
23
+ "svelte": "^5.55.7",
24
24
  "svelte-check": "^3.6.7",
25
25
  "tslib": "^2.6.2",
26
- "typescript": "^5.4.2",
27
- "vite": "^5.1.6",
28
- "vitest": "^1.4.0"
26
+ "typescript": "^5.9.0",
27
+ "typescript-eslint": "^8.59.3",
28
+ "vite": "^8.0.13",
29
+ "vitest": "^4.1.6"
29
30
  }
30
31
  }
@@ -2,16 +2,16 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'
2
2
  import { render, fireEvent, waitFor } from '@testing-library/svelte/svelte5'
3
3
  import App from './App.svelte'
4
4
 
5
- global.fetch = vi.fn(() =>
5
+ globalThis.fetch = vi.fn(() =>
6
6
  Promise.resolve({
7
7
  ok: true,
8
8
  json: () => Promise.resolve({ result: 10 }),
9
- })
10
- )
9
+ } as unknown as Response)
10
+ ) as typeof fetch
11
11
 
12
12
  describe('App', () => {
13
13
  beforeEach(() => {
14
- fetch.mockClear()
14
+ (fetch as ReturnType<typeof vi.fn>).mockClear()
15
15
  })
16
16
 
17
17
  it('renders a heading', () => {
@@ -21,15 +21,15 @@ describe('App', () => {
21
21
 
22
22
  it('submits a number and displays the result', async () => {
23
23
  const { getByLabelText, getByText, getByRole } = render(App)
24
-
24
+
25
25
  const input = getByLabelText(/Enter a number/i)
26
26
  const button = getByRole('button', { name: /Multiply by 2/i })
27
27
 
28
28
  await fireEvent.input(input, { target: { value: '5' } })
29
- await fireEvent.click(button)
29
+ await fireEvent.submit(button.closest('form')!)
30
30
 
31
31
  expect(fetch).toHaveBeenCalledTimes(1)
32
-
32
+
33
33
  await waitFor(() => expect(getByText(/Result:/i)).toBeInTheDocument())
34
34
  expect(getByText('10')).toBeInTheDocument()
35
35
  })
@@ -1,14 +1,21 @@
1
1
  <script lang="ts">
2
- let number: string = '';
3
- let result: number | null = null;
4
- let error: string | null = null;
2
+ interface MultiplyResponse {
3
+ result: number;
4
+ }
5
+
6
+ let number: string = $state('');
7
+ let result: number | null = $state(null);
8
+ let error: string | null = $state(null);
9
+
10
+ const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:8000';
5
11
 
6
- async function handleSubmit() {
12
+ async function handleSubmit(e: Event) {
13
+ e.preventDefault();
7
14
  error = null;
8
15
  result = null;
9
16
 
10
17
  try {
11
- const response = await fetch('http://localhost:8000/api/multiply', {
18
+ const response = await fetch(`${apiUrl}/api/multiply`, {
12
19
  method: 'POST',
13
20
  headers: {
14
21
  'Content-Type': 'application/json',
@@ -20,7 +27,7 @@
20
27
  throw new Error('Network response was not ok');
21
28
  }
22
29
 
23
- const data = await response.json();
30
+ const data: MultiplyResponse = await response.json();
24
31
  result = data.result;
25
32
  } catch (err: unknown) {
26
33
  error = (err as Error).message;
@@ -30,7 +37,7 @@
30
37
 
31
38
  <main style="padding: 2rem; font-family: sans-serif;">
32
39
  <h1>Multiplier App (Svelte)</h1>
33
- <form on:submit|preventDefault={handleSubmit} style="margin-bottom: 1rem;">
40
+ <form onsubmit={handleSubmit} style="margin-bottom: 1rem;">
34
41
  <label for="numberInput" style="display: block; margin-bottom: 0.5rem;">
35
42
  Enter a number:
36
43
  </label>
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env bash
2
+ set -e
2
3
  npm run dev
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env bash
2
+ set -e
2
3
  npm run test
@@ -1,9 +1,9 @@
1
- /// <reference types="vitest" />
2
1
  import { defineConfig } from 'vitest/config'
3
2
  import { svelte } from '@sveltejs/vite-plugin-svelte'
3
+ import { svelteTesting } from '@testing-library/svelte/vite'
4
4
 
5
5
  export default defineConfig({
6
- plugins: [svelte()],
6
+ plugins: [svelte(), svelteTesting()],
7
7
  test: {
8
8
  environment: 'jsdom',
9
9
  globals: true,
@@ -0,0 +1,26 @@
1
+ import js from '@eslint/js'
2
+ import pluginVue from 'eslint-plugin-vue'
3
+ import tseslint from 'typescript-eslint'
4
+ import globals from 'globals'
5
+
6
+ export default [
7
+ js.configs.recommended,
8
+ ...tseslint.configs.recommended,
9
+ ...pluginVue.configs['flat/recommended'],
10
+ {
11
+ languageOptions: {
12
+ globals: {
13
+ ...globals.browser,
14
+ ...globals.node
15
+ }
16
+ }
17
+ },
18
+ {
19
+ files: ['**/*.vue'],
20
+ languageOptions: {
21
+ parserOptions: {
22
+ parser: tseslint.parser
23
+ }
24
+ }
25
+ }
26
+ ]
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env bash
2
+ set -e
2
3
  npm run lint
3
4
  npx prettier --write .