@adriankulik/create-fullstack-app 1.0.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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +84 -0
  3. package/cli/index.js +170 -0
  4. package/cli/package-lock.json +1338 -0
  5. package/cli/package.json +23 -0
  6. package/package.json +40 -0
  7. package/templates/backend/fastapi/lint.sh +9 -0
  8. package/templates/backend/fastapi/main.py +28 -0
  9. package/templates/backend/fastapi/requirements.txt +5 -0
  10. package/templates/backend/fastapi/start.sh +7 -0
  11. package/templates/backend/fastapi/test.sh +7 -0
  12. package/templates/backend/fastapi/test_main.py +19 -0
  13. package/templates/backend/flask/lint.sh +9 -0
  14. package/templates/backend/flask/main.py +24 -0
  15. package/templates/backend/flask/requirements.txt +5 -0
  16. package/templates/backend/flask/start.sh +7 -0
  17. package/templates/backend/flask/test.sh +7 -0
  18. package/templates/backend/flask/test_main.py +21 -0
  19. package/templates/base/.github/workflows/test.yml +36 -0
  20. package/templates/base/.vscode/extensions.json +8 -0
  21. package/templates/base/GEMINI.md +65 -0
  22. package/templates/base/README.md +37 -0
  23. package/templates/base/gitignore +13 -0
  24. package/templates/base/lint.sh +10 -0
  25. package/templates/base/start.sh +13 -0
  26. package/templates/base/test.sh +10 -0
  27. package/templates/frontend/angular/angular.json +84 -0
  28. package/templates/frontend/angular/karma.conf.js +45 -0
  29. package/templates/frontend/angular/lint.sh +2 -0
  30. package/templates/frontend/angular/package-lock.json +16204 -0
  31. package/templates/frontend/angular/package.json +40 -0
  32. package/templates/frontend/angular/src/app/app.component.spec.ts +24 -0
  33. package/templates/frontend/angular/src/app/app.component.ts +73 -0
  34. package/templates/frontend/angular/src/favicon.ico +0 -0
  35. package/templates/frontend/angular/src/index.html +12 -0
  36. package/templates/frontend/angular/src/main.ts +5 -0
  37. package/templates/frontend/angular/src/styles.css +1 -0
  38. package/templates/frontend/angular/start.sh +2 -0
  39. package/templates/frontend/angular/test.sh +2 -0
  40. package/templates/frontend/angular/tsconfig.app.json +16 -0
  41. package/templates/frontend/angular/tsconfig.json +32 -0
  42. package/templates/frontend/angular/tsconfig.spec.json +14 -0
  43. package/templates/frontend/nextjs/.eslintrc.json +3 -0
  44. package/templates/frontend/nextjs/__tests__/page.test.tsx +39 -0
  45. package/templates/frontend/nextjs/app/layout.tsx +18 -0
  46. package/templates/frontend/nextjs/app/page.tsx +69 -0
  47. package/templates/frontend/nextjs/jest.config.js +16 -0
  48. package/templates/frontend/nextjs/jest.setup.js +1 -0
  49. package/templates/frontend/nextjs/lint.sh +3 -0
  50. package/templates/frontend/nextjs/next.config.js +4 -0
  51. package/templates/frontend/nextjs/package-lock.json +9631 -0
  52. package/templates/frontend/nextjs/package.json +31 -0
  53. package/templates/frontend/nextjs/start.sh +2 -0
  54. package/templates/frontend/nextjs/test.sh +2 -0
  55. package/templates/frontend/nextjs/tsconfig.json +27 -0
  56. package/templates/frontend/svelte/.eslintrc.cjs +27 -0
  57. package/templates/frontend/svelte/index.html +12 -0
  58. package/templates/frontend/svelte/lint.sh +3 -0
  59. package/templates/frontend/svelte/package-lock.json +6129 -0
  60. package/templates/frontend/svelte/package.json +30 -0
  61. package/templates/frontend/svelte/src/App.spec.ts +36 -0
  62. package/templates/frontend/svelte/src/App.svelte +61 -0
  63. package/templates/frontend/svelte/src/main.ts +8 -0
  64. package/templates/frontend/svelte/src/setupTests.ts +1 -0
  65. package/templates/frontend/svelte/src/svelte-env.d.ts +2 -0
  66. package/templates/frontend/svelte/start.sh +2 -0
  67. package/templates/frontend/svelte/svelte.config.js +5 -0
  68. package/templates/frontend/svelte/test.sh +2 -0
  69. package/templates/frontend/svelte/tsconfig.json +9 -0
  70. package/templates/frontend/svelte/vite.config.ts +15 -0
  71. package/templates/frontend/vue/.eslintrc.cjs +18 -0
  72. package/templates/frontend/vue/index.html +12 -0
  73. package/templates/frontend/vue/lint.sh +3 -0
  74. package/templates/frontend/vue/package-lock.json +5110 -0
  75. package/templates/frontend/vue/package.json +30 -0
  76. package/templates/frontend/vue/src/App.vue +61 -0
  77. package/templates/frontend/vue/src/__tests__/App.spec.ts +37 -0
  78. package/templates/frontend/vue/src/main.ts +4 -0
  79. package/templates/frontend/vue/src/vite-env.d.ts +7 -0
  80. package/templates/frontend/vue/start.sh +2 -0
  81. package/templates/frontend/vue/test.sh +2 -0
  82. package/templates/frontend/vue/tsconfig.json +12 -0
  83. package/templates/frontend/vue/vite.config.ts +14 -0
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "frontend-vue",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "vite build",
8
+ "preview": "vite preview",
9
+ "test": "vitest run",
10
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx --fix --ignore-path ../.gitignore"
11
+ },
12
+ "dependencies": {
13
+ "vue": "^3.5.33"
14
+ },
15
+ "devDependencies": {
16
+ "@vitejs/plugin-vue": "^5.0.4",
17
+ "@vue/test-utils": "^2.4.4",
18
+ "@vue/tsconfig": "^0.5.1",
19
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
20
+ "@typescript-eslint/parser": "^7.1.0",
21
+ "@vue/eslint-config-typescript": "^13.0.0",
22
+ "eslint": "^8.57.0",
23
+ "eslint-plugin-vue": "^9.23.0",
24
+ "jsdom": "^24.0.0",
25
+ "prettier": "^3.2.5",
26
+ "typescript": "^5.4.2",
27
+ "vite": "^5.1.6",
28
+ "vitest": "^1.4.0"
29
+ }
30
+ }
@@ -0,0 +1,61 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+
4
+ const number = ref<string>('')
5
+ const result = ref<number | null>(null)
6
+ const error = ref<string | null>(null)
7
+
8
+ const handleSubmit = async () => {
9
+ error.value = null
10
+ result.value = null
11
+
12
+ try {
13
+ const response = await fetch('http://localhost:8000/api/multiply', {
14
+ method: 'POST',
15
+ headers: {
16
+ 'Content-Type': 'application/json',
17
+ },
18
+ body: JSON.stringify({ number: parseFloat(number.value) }),
19
+ })
20
+
21
+ if (!response.ok) {
22
+ throw new Error('Network response was not ok')
23
+ }
24
+
25
+ const data = await response.json()
26
+ result.value = data.result
27
+ } catch (err: unknown) {
28
+ error.value = (err as Error).message
29
+ }
30
+ }
31
+ </script>
32
+
33
+ <template>
34
+ <main style="padding: 2rem; font-family: sans-serif;">
35
+ <h1>Multiplier App (Vue)</h1>
36
+ <form @submit.prevent="handleSubmit" style="margin-bottom: 1rem;">
37
+ <label for="numberInput" style="display: block; margin-bottom: 0.5rem;">
38
+ Enter a number:
39
+ </label>
40
+ <input
41
+ id="numberInput"
42
+ type="number"
43
+ step="any"
44
+ v-model="number"
45
+ required
46
+ style="padding: 0.5rem; margin-right: 0.5rem;"
47
+ />
48
+ <button type="submit" style="padding: 0.5rem 1rem;">
49
+ Multiply by 2
50
+ </button>
51
+ </form>
52
+
53
+ <div v-if="result !== null" style="margin-top: 1rem; padding: 1rem; background-color: #e0ffe0; border: 1px solid #00cc00;">
54
+ <strong>Result:</strong> {{ result }}
55
+ </div>
56
+
57
+ <div v-if="error" style="margin-top: 1rem; padding: 1rem; background-color: #ffe0e0; border: 1px solid #cc0000;">
58
+ <strong>Error:</strong> {{ error }}
59
+ </div>
60
+ </main>
61
+ </template>
@@ -0,0 +1,37 @@
1
+ import { describe, it, expect, vi, beforeEach } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import App from '../App.vue'
4
+
5
+ global.fetch = vi.fn(() =>
6
+ Promise.resolve({
7
+ ok: true,
8
+ json: () => Promise.resolve({ result: 10 }),
9
+ })
10
+ )
11
+
12
+ describe('App', () => {
13
+ beforeEach(() => {
14
+ fetch.mockClear()
15
+ })
16
+
17
+ it('renders a heading', () => {
18
+ const wrapper = mount(App)
19
+ expect(wrapper.find('h1').text()).toBe('Multiplier App (Vue)')
20
+ })
21
+
22
+ it('submits a number and displays the result', async () => {
23
+ const wrapper = mount(App)
24
+
25
+ const input = wrapper.find('#numberInput')
26
+ await input.setValue('5')
27
+
28
+ await wrapper.find('form').trigger('submit')
29
+
30
+ expect(fetch).toHaveBeenCalledTimes(1)
31
+
32
+ // Wait for the next tick for the UI to update
33
+ await new Promise(resolve => setTimeout(resolve, 0))
34
+
35
+ expect(wrapper.text()).toContain('Result: 10')
36
+ })
37
+ })
@@ -0,0 +1,4 @@
1
+ import { createApp } from 'vue'
2
+ import App from './App.vue'
3
+
4
+ createApp(App).mount('#app')
@@ -0,0 +1,7 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module '*.vue' {
4
+ import type { DefineComponent } from 'vue'
5
+ const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, unknown>
6
+ export default component
7
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ npm run dev
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bash
2
+ npm run test
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
4
+ "compilerOptions": {
5
+ "composite": true,
6
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
7
+ "moduleResolution": "bundler",
8
+ "paths": {
9
+ "@/*": ["./src/*"]
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,14 @@
1
+ /// <reference types="vitest" />
2
+ import { defineConfig } from 'vitest/config'
3
+ import vue from '@vitejs/plugin-vue'
4
+
5
+ export default defineConfig({
6
+ plugins: [vue()],
7
+ test: {
8
+ environment: 'jsdom',
9
+ globals: true
10
+ },
11
+ server: {
12
+ host: '127.0.0.1'
13
+ }
14
+ })