create-nara 1.0.2 → 1.0.4
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/dist/template.js +18 -17
- package/package.json +1 -1
- package/templates/svelte/resources/js/components/Header.svelte +2 -2
- package/templates/svelte/resources/js/pages/dashboard.svelte +1 -1
- package/templates/svelte/resources/js/pages/landing.svelte +1 -1
- package/templates/svelte/resources/js/pages/profile.svelte +2 -2
- package/templates/svelte/resources/js/pages/users.svelte +4 -4
package/dist/template.js
CHANGED
|
@@ -11,13 +11,27 @@ export async function setupProject(options) {
|
|
|
11
11
|
}
|
|
12
12
|
// 1. Copy base template (shared files like .gitignore, tsconfig, etc)
|
|
13
13
|
copyDir(path.join(templatesDir, 'base'), targetDir);
|
|
14
|
-
//
|
|
14
|
+
// 2. Copy mode-specific template
|
|
15
|
+
const modeTemplateDir = path.join(templatesDir, mode);
|
|
16
|
+
if (fs.existsSync(modeTemplateDir)) {
|
|
17
|
+
copyDir(modeTemplateDir, targetDir);
|
|
18
|
+
}
|
|
19
|
+
// 3. Copy feature-specific templates
|
|
20
|
+
const featuresDir = path.join(templatesDir, 'features');
|
|
21
|
+
for (const feature of features) {
|
|
22
|
+
const featureDir = path.join(featuresDir, feature);
|
|
23
|
+
if (fs.existsSync(featureDir)) {
|
|
24
|
+
copyDir(featureDir, targetDir);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// 4. Rename dotfiles (npm doesn't include them by default)
|
|
28
|
+
// Must happen AFTER all templates are copied
|
|
15
29
|
const gitignoreTemplate = path.join(targetDir, 'gitignore.template');
|
|
16
30
|
const gitignoreDest = path.join(targetDir, '.gitignore');
|
|
17
31
|
if (fs.existsSync(gitignoreTemplate)) {
|
|
18
32
|
fs.renameSync(gitignoreTemplate, gitignoreDest);
|
|
19
33
|
}
|
|
20
|
-
// Rename env files
|
|
34
|
+
// Rename env files
|
|
21
35
|
const envFiles = [
|
|
22
36
|
{ src: 'env.example', dest: '.env.example' },
|
|
23
37
|
{ src: 'env.production.example', dest: '.env.production.example' }
|
|
@@ -35,20 +49,7 @@ export async function setupProject(options) {
|
|
|
35
49
|
if (fs.existsSync(envExample)) {
|
|
36
50
|
fs.copyFileSync(envExample, envFile);
|
|
37
51
|
}
|
|
38
|
-
//
|
|
39
|
-
const modeTemplateDir = path.join(templatesDir, mode);
|
|
40
|
-
if (fs.existsSync(modeTemplateDir)) {
|
|
41
|
-
copyDir(modeTemplateDir, targetDir);
|
|
42
|
-
}
|
|
43
|
-
// 3. Copy feature-specific templates
|
|
44
|
-
const featuresDir = path.join(templatesDir, 'features');
|
|
45
|
-
for (const feature of features) {
|
|
46
|
-
const featureDir = path.join(featuresDir, feature);
|
|
47
|
-
if (fs.existsSync(featureDir)) {
|
|
48
|
-
copyDir(featureDir, targetDir);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// 4. Ensure required directories exist
|
|
52
|
+
// 5. Ensure required directories exist
|
|
52
53
|
fs.mkdirSync(path.join(targetDir, 'app/controllers'), { recursive: true });
|
|
53
54
|
fs.mkdirSync(path.join(targetDir, 'app/models'), { recursive: true });
|
|
54
55
|
// Create database directory if db feature is selected
|
|
@@ -59,7 +60,7 @@ export async function setupProject(options) {
|
|
|
59
60
|
if (features.includes('uploads')) {
|
|
60
61
|
fs.mkdirSync(path.join(targetDir, 'uploads'), { recursive: true });
|
|
61
62
|
}
|
|
62
|
-
//
|
|
63
|
+
// 6. Generate package.json (dynamic content)
|
|
63
64
|
const pkg = createPackageJson(projectName, mode, features);
|
|
64
65
|
fs.writeFileSync(path.join(targetDir, 'package.json'), JSON.stringify(pkg, null, 2));
|
|
65
66
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { fly, fade } from 'svelte/transition';
|
|
3
3
|
import { page, router, inertia } from '@inertiajs/svelte';
|
|
4
|
-
import { clickOutside } from '../
|
|
5
|
-
import DarkModeToggle from '../
|
|
4
|
+
import { clickOutside } from '../components/helper';
|
|
5
|
+
import DarkModeToggle from '../components/DarkModeToggle.svelte';
|
|
6
6
|
|
|
7
7
|
interface User {
|
|
8
8
|
id: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { fly } from 'svelte/transition';
|
|
3
3
|
import { page as inertiaPage, inertia } from '@inertiajs/svelte';
|
|
4
|
-
import Header from '../
|
|
4
|
+
import Header from '../components/Header.svelte';
|
|
5
5
|
import type { User } from '../types';
|
|
6
6
|
|
|
7
7
|
export let users: User[] = [];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { inertia, page } from '@inertiajs/svelte'
|
|
3
3
|
import { fade, fly } from 'svelte/transition'
|
|
4
4
|
import { onMount } from 'svelte'
|
|
5
|
-
import DarkModeToggle from '../
|
|
5
|
+
import DarkModeToggle from '../components/DarkModeToggle.svelte'
|
|
6
6
|
|
|
7
7
|
interface User {
|
|
8
8
|
id: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { fly } from 'svelte/transition';
|
|
3
3
|
import axios from "axios";
|
|
4
|
-
import Header from "../
|
|
5
|
-
import { api, Toast } from "../
|
|
4
|
+
import Header from "../components/Header.svelte";
|
|
5
|
+
import { api, Toast } from "../components/helper";
|
|
6
6
|
|
|
7
7
|
interface User {
|
|
8
8
|
id: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { fly } from 'svelte/transition';
|
|
3
3
|
import { page as inertiaPage, router } from '@inertiajs/svelte';
|
|
4
|
-
import Header from '../
|
|
5
|
-
import UserModal from '../
|
|
6
|
-
import Pagination from '../
|
|
4
|
+
import Header from '../components/Header.svelte';
|
|
5
|
+
import UserModal from '../components/UserModal.svelte';
|
|
6
|
+
import Pagination from '../components/Pagination.svelte';
|
|
7
7
|
import axios from 'axios';
|
|
8
|
-
import { api, Toast } from '../
|
|
8
|
+
import { api, Toast } from '../components/helper';
|
|
9
9
|
import type { User, UserForm, PaginationMeta } from '../types';
|
|
10
10
|
import { createEmptyUserForm, userToForm } from '../types';
|
|
11
11
|
|