@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.
- package/LICENSE +21 -0
- package/README.md +84 -0
- package/cli/index.js +170 -0
- package/cli/package-lock.json +1338 -0
- package/cli/package.json +23 -0
- package/package.json +40 -0
- package/templates/backend/fastapi/lint.sh +9 -0
- package/templates/backend/fastapi/main.py +28 -0
- package/templates/backend/fastapi/requirements.txt +5 -0
- package/templates/backend/fastapi/start.sh +7 -0
- package/templates/backend/fastapi/test.sh +7 -0
- package/templates/backend/fastapi/test_main.py +19 -0
- package/templates/backend/flask/lint.sh +9 -0
- package/templates/backend/flask/main.py +24 -0
- package/templates/backend/flask/requirements.txt +5 -0
- package/templates/backend/flask/start.sh +7 -0
- package/templates/backend/flask/test.sh +7 -0
- package/templates/backend/flask/test_main.py +21 -0
- package/templates/base/.github/workflows/test.yml +36 -0
- package/templates/base/.vscode/extensions.json +8 -0
- package/templates/base/GEMINI.md +65 -0
- package/templates/base/README.md +37 -0
- package/templates/base/gitignore +13 -0
- package/templates/base/lint.sh +10 -0
- package/templates/base/start.sh +13 -0
- package/templates/base/test.sh +10 -0
- package/templates/frontend/angular/angular.json +84 -0
- package/templates/frontend/angular/karma.conf.js +45 -0
- package/templates/frontend/angular/lint.sh +2 -0
- package/templates/frontend/angular/package-lock.json +16204 -0
- package/templates/frontend/angular/package.json +40 -0
- package/templates/frontend/angular/src/app/app.component.spec.ts +24 -0
- package/templates/frontend/angular/src/app/app.component.ts +73 -0
- package/templates/frontend/angular/src/favicon.ico +0 -0
- package/templates/frontend/angular/src/index.html +12 -0
- package/templates/frontend/angular/src/main.ts +5 -0
- package/templates/frontend/angular/src/styles.css +1 -0
- package/templates/frontend/angular/start.sh +2 -0
- package/templates/frontend/angular/test.sh +2 -0
- package/templates/frontend/angular/tsconfig.app.json +16 -0
- package/templates/frontend/angular/tsconfig.json +32 -0
- package/templates/frontend/angular/tsconfig.spec.json +14 -0
- package/templates/frontend/nextjs/.eslintrc.json +3 -0
- package/templates/frontend/nextjs/__tests__/page.test.tsx +39 -0
- package/templates/frontend/nextjs/app/layout.tsx +18 -0
- package/templates/frontend/nextjs/app/page.tsx +69 -0
- package/templates/frontend/nextjs/jest.config.js +16 -0
- package/templates/frontend/nextjs/jest.setup.js +1 -0
- package/templates/frontend/nextjs/lint.sh +3 -0
- package/templates/frontend/nextjs/next.config.js +4 -0
- package/templates/frontend/nextjs/package-lock.json +9631 -0
- package/templates/frontend/nextjs/package.json +31 -0
- package/templates/frontend/nextjs/start.sh +2 -0
- package/templates/frontend/nextjs/test.sh +2 -0
- package/templates/frontend/nextjs/tsconfig.json +27 -0
- package/templates/frontend/svelte/.eslintrc.cjs +27 -0
- package/templates/frontend/svelte/index.html +12 -0
- package/templates/frontend/svelte/lint.sh +3 -0
- package/templates/frontend/svelte/package-lock.json +6129 -0
- package/templates/frontend/svelte/package.json +30 -0
- package/templates/frontend/svelte/src/App.spec.ts +36 -0
- package/templates/frontend/svelte/src/App.svelte +61 -0
- package/templates/frontend/svelte/src/main.ts +8 -0
- package/templates/frontend/svelte/src/setupTests.ts +1 -0
- package/templates/frontend/svelte/src/svelte-env.d.ts +2 -0
- package/templates/frontend/svelte/start.sh +2 -0
- package/templates/frontend/svelte/svelte.config.js +5 -0
- package/templates/frontend/svelte/test.sh +2 -0
- package/templates/frontend/svelte/tsconfig.json +9 -0
- package/templates/frontend/svelte/vite.config.ts +15 -0
- package/templates/frontend/vue/.eslintrc.cjs +18 -0
- package/templates/frontend/vue/index.html +12 -0
- package/templates/frontend/vue/lint.sh +3 -0
- package/templates/frontend/vue/package-lock.json +5110 -0
- package/templates/frontend/vue/package.json +30 -0
- package/templates/frontend/vue/src/App.vue +61 -0
- package/templates/frontend/vue/src/__tests__/App.spec.ts +37 -0
- package/templates/frontend/vue/src/main.ts +4 -0
- package/templates/frontend/vue/src/vite-env.d.ts +7 -0
- package/templates/frontend/vue/start.sh +2 -0
- package/templates/frontend/vue/test.sh +2 -0
- package/templates/frontend/vue/tsconfig.json +12 -0
- 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,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
|
+
})
|