@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-svelte",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"preview": "vite preview",
|
|
9
|
+
"test": "vitest run",
|
|
10
|
+
"lint": "eslint . --ext .svelte,.js,.ts,.cjs,.mjs --fix --ignore-path ../.gitignore"
|
|
11
|
+
},
|
|
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",
|
|
16
|
+
"@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",
|
|
22
|
+
"prettier": "^3.2.5",
|
|
23
|
+
"svelte": "^5.55.5",
|
|
24
|
+
"svelte-check": "^3.6.7",
|
|
25
|
+
"tslib": "^2.6.2",
|
|
26
|
+
"typescript": "^5.4.2",
|
|
27
|
+
"vite": "^5.1.6",
|
|
28
|
+
"vitest": "^1.4.0"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
2
|
+
import { render, fireEvent, waitFor } from '@testing-library/svelte/svelte5'
|
|
3
|
+
import App from './App.svelte'
|
|
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 { getByText } = render(App)
|
|
19
|
+
expect(getByText('Multiplier App (Svelte)')).toBeInTheDocument()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('submits a number and displays the result', async () => {
|
|
23
|
+
const { getByLabelText, getByText, getByRole } = render(App)
|
|
24
|
+
|
|
25
|
+
const input = getByLabelText(/Enter a number/i)
|
|
26
|
+
const button = getByRole('button', { name: /Multiply by 2/i })
|
|
27
|
+
|
|
28
|
+
await fireEvent.input(input, { target: { value: '5' } })
|
|
29
|
+
await fireEvent.click(button)
|
|
30
|
+
|
|
31
|
+
expect(fetch).toHaveBeenCalledTimes(1)
|
|
32
|
+
|
|
33
|
+
await waitFor(() => expect(getByText(/Result:/i)).toBeInTheDocument())
|
|
34
|
+
expect(getByText('10')).toBeInTheDocument()
|
|
35
|
+
})
|
|
36
|
+
})
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let number: string = '';
|
|
3
|
+
let result: number | null = null;
|
|
4
|
+
let error: string | null = null;
|
|
5
|
+
|
|
6
|
+
async function handleSubmit() {
|
|
7
|
+
error = null;
|
|
8
|
+
result = null;
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
const response = await fetch('http://localhost:8000/api/multiply', {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
headers: {
|
|
14
|
+
'Content-Type': 'application/json',
|
|
15
|
+
},
|
|
16
|
+
body: JSON.stringify({ number: parseFloat(number) }),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
throw new Error('Network response was not ok');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const data = await response.json();
|
|
24
|
+
result = data.result;
|
|
25
|
+
} catch (err: unknown) {
|
|
26
|
+
error = (err as Error).message;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<main style="padding: 2rem; font-family: sans-serif;">
|
|
32
|
+
<h1>Multiplier App (Svelte)</h1>
|
|
33
|
+
<form on:submit|preventDefault={handleSubmit} style="margin-bottom: 1rem;">
|
|
34
|
+
<label for="numberInput" style="display: block; margin-bottom: 0.5rem;">
|
|
35
|
+
Enter a number:
|
|
36
|
+
</label>
|
|
37
|
+
<input
|
|
38
|
+
id="numberInput"
|
|
39
|
+
type="number"
|
|
40
|
+
step="any"
|
|
41
|
+
bind:value={number}
|
|
42
|
+
required
|
|
43
|
+
style="padding: 0.5rem; margin-right: 0.5rem;"
|
|
44
|
+
/>
|
|
45
|
+
<button type="submit" style="padding: 0.5rem 1rem;">
|
|
46
|
+
Multiply by 2
|
|
47
|
+
</button>
|
|
48
|
+
</form>
|
|
49
|
+
|
|
50
|
+
{#if result !== null}
|
|
51
|
+
<div style="margin-top: 1rem; padding: 1rem; background-color: #e0ffe0; border: 1px solid #00cc00;">
|
|
52
|
+
<strong>Result:</strong> {result}
|
|
53
|
+
</div>
|
|
54
|
+
{/if}
|
|
55
|
+
|
|
56
|
+
{#if error}
|
|
57
|
+
<div style="margin-top: 1rem; padding: 1rem; background-color: #ffe0e0; border: 1px solid #cc0000;">
|
|
58
|
+
<strong>Error:</strong> {error}
|
|
59
|
+
</div>
|
|
60
|
+
{/if}
|
|
61
|
+
</main>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="vitest" />
|
|
2
|
+
import { defineConfig } from 'vitest/config'
|
|
3
|
+
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [svelte()],
|
|
7
|
+
test: {
|
|
8
|
+
environment: 'jsdom',
|
|
9
|
+
globals: true,
|
|
10
|
+
setupFiles: ['./src/setupTests.ts']
|
|
11
|
+
},
|
|
12
|
+
server: {
|
|
13
|
+
host: '127.0.0.1'
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-env node */
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
root: true,
|
|
5
|
+
env: {
|
|
6
|
+
browser: true,
|
|
7
|
+
es2021: true,
|
|
8
|
+
node: true
|
|
9
|
+
},
|
|
10
|
+
extends: [
|
|
11
|
+
'plugin:vue/vue3-essential',
|
|
12
|
+
'eslint:recommended',
|
|
13
|
+
'@vue/eslint-config-typescript/recommended'
|
|
14
|
+
],
|
|
15
|
+
parserOptions: {
|
|
16
|
+
ecmaVersion: 'latest'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Vue App</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
<script type="module" src="/src/main.ts"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|