@projectinvicta/nails 3.0.14 → 3.2.2

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 (85) hide show
  1. package/.github/workflows/npm-publish.yml +33 -0
  2. package/.github/workflows/release.yml +64 -0
  3. package/README.md +72 -10
  4. package/bin/lib/init.js +63 -32
  5. package/bin/test/test_init.sh +28 -20
  6. package/dist/Nails.d.ts +13 -6
  7. package/dist/Nails.js +36 -44
  8. package/dist/Nails.js.map +1 -1
  9. package/dist/Server.d.ts +31 -0
  10. package/dist/Server.js +193 -0
  11. package/dist/Server.js.map +1 -0
  12. package/dist/types.d.ts +6 -0
  13. package/lib/Nails.ts +48 -51
  14. package/lib/Server.ts +216 -0
  15. package/lib/types.ts +12 -2
  16. package/package.json +3 -2
  17. package/templates/default/bin/console.js +17 -0
  18. package/templates/default/config/db.js +1 -1
  19. package/templates/default/package-lock.json +2726 -4217
  20. package/templates/default/package.json +19 -6
  21. package/templates/default/spec/User.test.js +1 -1
  22. package/templates/default/src/app.jsx +7 -3
  23. package/templates/mcp/bin/console.js +17 -0
  24. package/templates/mcp/bin/promote.sh +20 -0
  25. package/templates/mcp/bin/rollout.sh +74 -0
  26. package/templates/mcp/bin/server.js +6 -0
  27. package/templates/mcp/bin/start.sh +16 -0
  28. package/templates/mcp/common/readme_fetcher.js +4 -0
  29. package/templates/mcp/config/db.js +11 -0
  30. package/templates/mcp/config/mimes.js +40 -0
  31. package/templates/mcp/config/routes.js +20 -0
  32. package/templates/mcp/config/service.js +45 -0
  33. package/templates/mcp/config/ssl/certificate.pem +22 -0
  34. package/templates/mcp/config/ssl/csr.csr +17 -0
  35. package/templates/mcp/config/ssl/key.pem +28 -0
  36. package/templates/mcp/config/ssl/private_key.pem +30 -0
  37. package/templates/mcp/config/ssl/public_key.pem +9 -0
  38. package/templates/mcp/package-lock.json +8032 -0
  39. package/templates/mcp/package.json +64 -0
  40. package/templates/mcp/server/controllers/home_controller.js +34 -0
  41. package/templates/mcp/server/controllers/mcp_controller.js +87 -0
  42. package/templates/mcp/server/controllers/users_controller.js +29 -0
  43. package/templates/mcp/server/models/Dog.js +8 -0
  44. package/templates/mcp/server/models/User.js +18 -0
  45. package/templates/mcp/server/views/home/index.ejs +14 -0
  46. package/templates/mcp/server/views/partials/javascripts.ejs +1 -0
  47. package/templates/mcp/server/views/partials/reactapp.ejs +1 -0
  48. package/templates/mcp/server/views/partials/styles.ejs +3 -0
  49. package/templates/mcp/spec/User.test.js +22 -0
  50. package/templates/mcp/spec/home_controller.test.js +28 -0
  51. package/templates/mcp/spec/setupTests.js +0 -0
  52. package/templates/mcp/vite.config.ts +42 -0
  53. package/templates/mobile/bin/console.js +17 -0
  54. package/templates/mobile/bin/promote.sh +20 -0
  55. package/templates/mobile/bin/rollout.sh +74 -0
  56. package/templates/mobile/bin/server.js +7 -0
  57. package/templates/mobile/bin/start.sh +16 -0
  58. package/templates/mobile/capacitor.config.ts +27 -0
  59. package/templates/mobile/common/constants.js +6 -0
  60. package/templates/mobile/common/readme_fetcher.js +4 -0
  61. package/templates/mobile/config/db.js +19 -0
  62. package/templates/mobile/config/mimes.js +59 -0
  63. package/templates/mobile/config/routes.js +38 -0
  64. package/templates/mobile/config/service.js +45 -0
  65. package/templates/mobile/config/ssl/certificate.pem +22 -0
  66. package/templates/mobile/config/ssl/csr.csr +17 -0
  67. package/templates/mobile/config/ssl/key.pem +28 -0
  68. package/templates/mobile/config/ssl/private_key.pem +30 -0
  69. package/templates/mobile/config/ssl/public_key.pem +9 -0
  70. package/templates/mobile/package.json +72 -0
  71. package/templates/mobile/src/AboutPage.jsx +9 -0
  72. package/templates/mobile/src/HomePage.jsx +9 -0
  73. package/templates/mobile/src/Layout.jsx +78 -0
  74. package/templates/mobile/src/ReadmePage.jsx +7 -0
  75. package/templates/mobile/src/app.jsx +33 -0
  76. package/templates/mobile/src/components/ReadmeLoader.jsx +13 -0
  77. package/templates/mobile/src/index.html +52 -0
  78. package/templates/mobile/src/styles/appstyles.css +3 -0
  79. package/templates/mobile/vite-mobile.config.ts +31 -0
  80. package/tests/bin/init.spec.js +70 -2
  81. package/tests/healthz.spec.js +300 -0
  82. package/tests/nails.spec.js +5 -1
  83. package/tests/services/integration/config/db.ts +1 -1
  84. package/tests/services.integration.spec.js +5 -1
  85. package/vite.config.ts +1 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Routes specifies the array of route definitions to be passed to the router
3
+ *
4
+ * Routes are checked in series, and the first matching route is applied.
5
+ * A route definition is as follows:
6
+ * ['METHOD', 'MATCHER', 'OPTIONS']
7
+ *
8
+ * METHOD => crud methods (GET, PUT, POST, DELETE)
9
+ * MATCHER => to be matched against the path. Captured elements will be passed to options. Delegates to express application routing.
10
+ * OPTIONS => an object with parametes deciding how the route will be handled in order of execution:
11
+ * path: => the path to a static file ( index.html f/e)
12
+ * controller: => controller to route the request to. TODO: May implement a resource definition for automatically routing cruds
13
+ * action: => the method to run in the controller. If not specified, the index method will be called.
14
+ * [1..n]: => each numerical definition defines a parameter in which to store the value of the captured elements in the regex.
15
+ * controller, and action are protected names and will apply the cature to controller name and method respectively.
16
+ * f/e: ['get', /\/(home)/, {0: 'controller'}] => routes to home controller
17
+ * ['get, '/\/home\/(5)/, {controller: 'home', 0: 'id'}] => routes to home controller and adds {id: 5} to the params hash.
18
+ */
19
+
20
+ export default [
21
+ // Routes the root request to index.html, as well as all other requests to static
22
+ ['get', "/", {controller: 'home'}],
23
+ // Routes all requests starting with /public as static requests to the public folder.
24
+ ['get', '/public', {public: true}],
25
+
26
+ // A test route which routes the first part of pathname to controller and the second to the action
27
+ // ['get', /^\/(\w+)\/(\w+)$/i, {0: 'controller', 1: 'action'}],
28
+
29
+ // Maps the first two parts of the path to controller and action, and the third to the id parameter
30
+ // ['get', "/:controller/:action/:id"],
31
+
32
+ // For all other GET requests, render HomeController#index
33
+ ['get', '/:catchall', {controller: 'home'}],
34
+
35
+ // Defines a WebSocket handler
36
+ // ['ws', "/:controller/:action/:id"]
37
+ ];
38
+
@@ -0,0 +1,45 @@
1
+ // Initializes application before server starts
2
+ // Each of these is REQUIRED
3
+ import routes from './routes.js';
4
+ import mimes from './mimes.js';
5
+ import db from './db.js';
6
+
7
+ import path from 'node:path';
8
+ var SERVER_ROOT = path.resolve(import.meta.dirname, '..');
9
+ var APP_ROOT = path.resolve(SERVER_ROOT, 'server');
10
+
11
+ // Only for reading the certificates for SSL
12
+ import fs from 'node:fs';
13
+ const PRIVATE_KEY_FILE = fs.readFileSync(`${import.meta.dirname}/ssl/key.pem`);
14
+ const CERTIFICATE_FILE = fs.readFileSync(`${import.meta.dirname}/ssl/certificate.pem`);
15
+
16
+ var config = {
17
+ APP_ROOT: APP_ROOT,
18
+ // root directory for delivering static assets
19
+ PUBLIC_ROOT: SERVER_ROOT + '/public',
20
+ CONTROLLERS_ROOT: APP_ROOT + '/controllers',
21
+ VIEWS_ROOT: APP_ROOT + '/views',
22
+ MODELS_ROOT: APP_ROOT + '/models',
23
+ SERVER_ROOT: SERVER_ROOT,
24
+
25
+ ENABLE_HTTP: true,
26
+ //IP: "0.0.0.0",
27
+ PORT: 3333,
28
+
29
+ // Uncomment these to use serverside react view engine.
30
+ //VIEW_ENGINE: require('express-react-views').createEngine(),
31
+ //VIEW_ENGINE_EXT: 'jsx',
32
+
33
+ // For HTTPS
34
+ ENABLE_HTTPS: true,
35
+ SSL_PORT: 3334,
36
+ PRIVATE_KEY: PRIVATE_KEY_FILE,
37
+ CERTIFICATE: CERTIFICATE_FILE,
38
+ };
39
+
40
+ export default {
41
+ config,
42
+ routes,
43
+ mimes,
44
+ db
45
+ }
@@ -0,0 +1,22 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDrzCCApegAwIBAgIUR04h3qlfhW5SYQrnm0VjDSLQrwUwDQYJKoZIhvcNAQEL
3
+ BQAwZzELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMQ4wDAYDVQQKDAVOYWlsczES
4
+ MBAGA1UEAwwJ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GZq9Hwbt0bHi1bKev/itw
20
+ RyK60j25fsVf8RDkrMFaCgP/x/6iMl26TCi3R3W4cW5NlesxWYwNcOxnUwL7OQQT
21
+ 8aY1iR/Cn/RoRiZ90D4anCOTYLPX6pTHAPsTHBuU+odAUhXBGvIhSknvCf3xhahW
22
+ hUY1yUnEYhgXbYLRCEsa7q48BoSFMibmwbt07YRJXNAGjgcc7bzCV43vc/GeUgdZ
23
+ RrS1GNuzO0+S1TfvxfMBNBpoPbkeY2yHlUr+A8j6KHQw5mr3GnoOoeQTdZYK594m
24
+ N6J/gxF1emQqJoP+i+mx7iSdf5i2DmV9ACl/tyU92PKocIcsYoIevSmhtliBnsdG
25
+ R1kPkoUWuEVZujxzlIXcj0vEtOxyKJmzlBXKKO7B8U4HociBNMM41acX9WsIYdsA
26
+ QFjZTyU2DkpOCPRcBFbgQFPwfrkC93hndiByWPCkmAjeHJ0O74fnBCUP5BhmFuuc
27
+ /L0WWAVKp8HGgFmiq+i+rznJZEEEEoZClDFNkOBp4yfGZL9yZ2Ot3IRb2HNIJaj1
28
+ 69CX7ukHVHPLgiOcRSbFyuZZyqO++kWgEQm5jKlFFqGyFNpHmkGL8CGFlq7x9sF7
29
+ ONozML/sxGNw4Ubo6TAPflvl7KOd9bcYJdpODqtJgngi
30
+ -----END ENCRYPTED PRIVATE KEY-----
@@ -0,0 +1,9 @@
1
+ ---- BEGIN SSH2 PUBLIC KEY ----
2
+ Comment: "2048-bit RSA, converted by stantonwjones@darkmatter.lan from"
3
+ AAAAB3NzaC1yc2EAAAADAQABAAABAQDPJQsK/daFi/b+7bOSEJcKdzjvNJygX3BvMQ4HY+
4
+ JJaiSDyQgtwc8K85XDH0/eWyu5a6OzbadU3SkSdYP+0+uTdxfxRUCChKoASIoAaAfwB/BW
5
+ WOIdsuGPhJjYiLnPL4SScFdjUbJXGP5JOSQ6wgsRdqsDeQezUjF0CvR1CXoJaqRQt7p5T9
6
+ TlRzzuhN5Vf6BDpXBPTcNyUGKCaUwGQn2QmpXzRXrAZNb7XpzBSXdpUWm9W7U9zCFHva7J
7
+ XCuXsC9yMy3w1mpbL+oFBx7Wvic5FqwnATXjM7xBSqcG4tYzrISyn5pj13cIzzk9aEPRI3
8
+ qhV6kiA62JofiX1RkxMP+j
9
+ ---- END SSH2 PUBLIC KEY ----
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "nails_app",
3
+ "version": "0.0.0",
4
+ "description": "A basic nails application",
5
+ "main": "server.js",
6
+ "type": "module",
7
+ "bin": "./bin/start.sh",
8
+ "scripts": {
9
+ "console": "export NAILS_RELEASE_STAGE=development TZ=America/Los_Angeles && node bin/console.js",
10
+ "console:dev": "export NAILS_RELEASE_STAGE=development TZ=America/Los_Angeles && node bin/console.js",
11
+ "console:test": "export NAILS_RELEASE_STAGE=test TZ=America/Los_Angeles && node bin/console.js",
12
+ "console:qa": "export NAILS_RELEASE_STAGE=qa TZ=America/Los_Angeles && node bin/console.js",
13
+ "console:staging": "export NAILS_RELEASE_STAGE=staging TZ=America/Los_Angeles && node bin/console.js",
14
+ "console:prod": "export NAILS_RELEASE_STAGE=production TZ=America/Los_Angeles && node bin/console.js",
15
+ "test": "vitest run",
16
+ "start": "export NAILS_RELEASE_STAGE=development TZ=America/Los_Angeles && vite build && node bin/server.js",
17
+ "start:dev": "export NAILS_RELEASE_STAGE=development TZ=America/Los_Angeles && vite build && node bin/server.js",
18
+ "start:test": "export NAILS_RELEASE_STAGE=test TZ=America/Los_Angeles && vite build && node bin/server.js",
19
+ "start:qa": "export NAILS_RELEASE_STAGE=qa TZ=America/Los_Angeles && vite build && node bin/server.js",
20
+ "start:staging": "export NAILS_RELEASE_STAGE=staging TZ=America/Los_Angeles && vite build && node bin/server.js",
21
+ "start:prod": "export NAILS_RELEASE_STAGE=production TZ=America/Los_Angeles && vite build && node bin/server.js",
22
+ "start:mobile": "vite dev --config vite-mobile.config.ts",
23
+ "build": "vite build",
24
+ "build:mobile": "vite build --config vite-mobile.config.ts",
25
+ "rollout": "NAME=$npm_package_name ./bin/rollout.sh",
26
+ "promote": "./bin/promote.sh"
27
+ },
28
+ "author": "",
29
+ "license": "BSD",
30
+ "bugs": {
31
+ "url": "https://github.com/stantonwjones/nails-boilerplate/issues"
32
+ },
33
+ "config": {
34
+ "mongodbMemoryServer": {
35
+ "version": "latest"
36
+ }
37
+ },
38
+ "imports": {
39
+ "#models/*": "./server/models/*",
40
+ "#common/*": "./common/*",
41
+ "#config/*": "./config/*"
42
+ },
43
+ "dependencies": {
44
+ "@projectinvicta/nails": "*",
45
+ "@capacitor/android": "^7.4.4",
46
+ "@capacitor/app": "7.1.0",
47
+ "@capacitor/browser": "^7.0.2",
48
+ "@capacitor/core": "7.4.4",
49
+ "@capacitor/google-maps": "^7.2.0",
50
+ "@capacitor/haptics": "7.0.2",
51
+ "@capacitor/keyboard": "7.0.2",
52
+ "@capacitor/status-bar": "7.0.2",
53
+ "@mui/icons-material": "^7.3.1",
54
+ "@mui/material": "^7.3.1",
55
+ "@vitejs/plugin-legacy": "^6.1.1",
56
+ "@vitejs/plugin-react": "^4.7.0",
57
+ "react": "^19.1.0",
58
+ "react-dom": "^19.1.0",
59
+ "react-router-dom": "^7.7.0",
60
+ "sequelize": "^6.37.7",
61
+ "vite": "^6.3.5",
62
+ "chai-http": "*"
63
+ },
64
+ "devDependencies": {
65
+ "@capacitor/cli": "7.4.4",
66
+ "@emotion/react": "^11.14.0",
67
+ "@emotion/styled": "^11.14.1",
68
+ "@mui/types": "^7.4.5",
69
+ "typescript": "^5.9.3",
70
+ "vitest": "^3.2.4"
71
+ }
72
+ }
@@ -0,0 +1,9 @@
1
+
2
+
3
+ export default function About() {
4
+ return (<p>
5
+ This framework is designed to provide a lightweight, configurable MVC backend for node developers. With minimal dependencies, Nails offers a greater syntactical familiarity than php alongside the creative freedom of bleeding edge solutions like Rails and Django.
6
+
7
+ This boilerplate offers the basic necessities to get your MVC site off the ground. The modules used in Nails Boilerplate can be easily extended to produce the custom functionality to fit your needs, and you are encouraged to do so.
8
+ </p>)
9
+ }
@@ -0,0 +1,9 @@
1
+ export default function Home() {
2
+ return (
3
+ <div>
4
+ <h2>
5
+ {window.WELCOME_MESSAGE}
6
+ </h2>
7
+ </div>
8
+ );
9
+ }
@@ -0,0 +1,78 @@
1
+ import { Link, Outlet, useNavigate } from 'react-router-dom';
2
+
3
+ import AppBar from '@mui/material/AppBar';
4
+ import Toolbar from '@mui/material/Toolbar';
5
+ import Stack from '@mui/material/Stack';
6
+ import Typography from '@mui/material/Typography';
7
+ import CssBaseline from '@mui/material/CssBaseline';
8
+ import Container from "@mui/material/Container";
9
+ import BottomNavigation from "@mui/material/BottomNavigation";
10
+ import BottomNavigationAction from "@mui/material/BottomNavigationAction";
11
+
12
+ import HomeOutlinedIcon from '@mui/icons-material/HomeOutlined';
13
+ import InfoIcon from '@mui/icons-material/Info';
14
+ import MenuBookIcon from '@mui/icons-material/MenuBook';
15
+ import IconButton from "@mui/material/IconButton";
16
+ import LogoutIcon from '@mui/icons-material/Logout';
17
+
18
+ export default function Layout() {
19
+
20
+ let navigate = useNavigate();
21
+ return (
22
+ <>
23
+ <CssBaseline />
24
+ <AppBar position="static">
25
+ <Toolbar>
26
+ <Typography variant="h5"
27
+ component="div"
28
+ sx={{
29
+ mr: 2,
30
+ display: 'flex',
31
+ fontFamily: 'monospace',
32
+ fontWeight: 700,
33
+ letterSpacing: '.1rem',
34
+ color: 'inherit',
35
+ textDecoration: 'none',
36
+ }}>
37
+ Nails App
38
+ </Typography>
39
+ <Stack spacing={2} direction="row"
40
+ sx={{
41
+ display: 'flex',
42
+ flexGrow: 1,
43
+ alignItems: "center",
44
+ justifyContent: "end",
45
+ }}>
46
+ <Typography variant="subtitle1" component="div" >
47
+ User
48
+ </Typography>
49
+ <IconButton onClick={signOut}>
50
+ <LogoutIcon />
51
+ </IconButton>
52
+ </Stack>
53
+ </Toolbar>
54
+ </AppBar>
55
+ <main>
56
+ <Container>
57
+ <Outlet />
58
+ </Container>
59
+ </main>
60
+ <footer>
61
+ <BottomNavigation
62
+ showLabels
63
+ onChange={(event, newValue) => {
64
+ navigate(`/${newValue}`);
65
+ }}
66
+ >
67
+ <BottomNavigationAction value="" label="Home" icon={<HomeOutlinedIcon />} />
68
+ <BottomNavigationAction value="readme" label="ReadMe" icon={<MenuBookIcon />} />
69
+ <BottomNavigationAction value="about" label="About Nails" icon={<InfoIcon />} />
70
+ </BottomNavigation>
71
+ </footer>
72
+ </>
73
+ );
74
+ }
75
+
76
+ function signOut() {
77
+ alert("Signing out");
78
+ }
@@ -0,0 +1,7 @@
1
+ import ReadmeLoader from "./components/ReadmeLoader";
2
+
3
+ export default function ReadmePage() {
4
+ return (
5
+ <ReadmeLoader />
6
+ )
7
+ }
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
4
+
5
+ import Layout from './Layout';
6
+ import Home from './HomePage';
7
+ import About from './AboutPage';
8
+ import Readme from './ReadmePage';
9
+
10
+ import './styles/appstyles.css';
11
+
12
+ function App() {
13
+ console.log("rendering app");
14
+ return (
15
+ <Router>
16
+ <Routes>
17
+ <Route path="/" element={<Layout />}>
18
+ <Route index element={<Home />} />
19
+ <Route path="about" element={<About />} />
20
+ <Route path="readme" element={<Readme />} />
21
+ </Route>
22
+ </Routes>
23
+ </Router>
24
+ );
25
+ }
26
+
27
+ document.addEventListener("DOMContentLoaded", function() {
28
+ console.log("The DOM is ready, but images and other resources might still be loading.");
29
+ // Perform actions that only require the DOM structure to be available
30
+ const container = document.getElementById('AppRoot');
31
+ const root = createRoot(container);
32
+ root.render(<App />);
33
+ });
@@ -0,0 +1,13 @@
1
+ import { useEffect, useState } from "react"
2
+ import { fetchReadme } from "@common/readme_fetcher";
3
+
4
+ export default function ReadmeLoader() {
5
+ const [readmeHtmlSnippet, setReadmeHtmlSnippet] = useState(null);
6
+ useEffect(() => {
7
+ fetchReadme().then(setReadmeHtmlSnippet);
8
+ }, []);
9
+ return (
10
+ <div dangerouslySetInnerHTML={{__html: readmeHtmlSnippet}}>
11
+ </div>
12
+ )
13
+ }
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>Nails App</title>
6
+
7
+ <base href="/" />
8
+
9
+ <meta name="color-scheme" content="light dark" />
10
+ <meta
11
+ name="viewport"
12
+ content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
13
+ />
14
+ <meta name="format-detection" content="telephone=no" />
15
+ <meta name="msapplication-tap-highlight" content="no" />
16
+
17
+ <!-- <link rel="manifest" href="/manifest.json" /> -->
18
+
19
+ <link rel="shortcut icon" type="image/png" href="/favicon.ico" />
20
+
21
+ <!-- add to homescreen for ios -->
22
+ <meta name="apple-mobile-web-app-capable" content="yes" />
23
+ <meta name="apple-mobile-web-app-title" content="Nails App" />
24
+ <meta name="apple-mobile-web-app-status-bar-style" content="black" />
25
+
26
+ </head>
27
+
28
+ <body>
29
+ <div id="AppRoot" ></div>
30
+ <script type="module" src="./app.jsx"></script>
31
+
32
+
33
+ <!-- BEGIN COPIED FROM PHONEGAP APP
34
+ <div class="app" id="AppContainer">
35
+ <h1>PhoneGap</h1>
36
+ <div id="deviceready" class="blink">
37
+ <p class="event listening">Connecting to Device</p>
38
+ <p class="event received">Device is Ready</p>
39
+ </div>
40
+ </div>
41
+
42
+ <script type="text/javascript" src="js/index.js"></script>
43
+ <script type="text/javascript" src="js/reactapp.js"></script>
44
+ <script type="text/javascript">
45
+ app.initialize();
46
+ </script>
47
+ -->
48
+
49
+ <!-- END COPIED FROM PHONEGAP APP -->
50
+ </body>
51
+
52
+ </html>
@@ -0,0 +1,3 @@
1
+ body {
2
+ background-color: aliceblue;
3
+ }
@@ -0,0 +1,31 @@
1
+ /// <reference types="vitest" />
2
+
3
+ import react from '@vitejs/plugin-react'
4
+ import { defineConfig } from 'vite'
5
+ import path from 'path'
6
+
7
+ // https://vitejs.dev/config/
8
+ export default defineConfig({
9
+ root: './src',
10
+ // publicDir: false,
11
+ // define: {
12
+ // 'process.env': {}
13
+ // },
14
+ plugins: [
15
+ react(),
16
+ ],
17
+ build: {
18
+ outDir: path.resolve(__dirname, './mobile-dist'),
19
+ emptyOutDir: true,
20
+ },
21
+ esbuild: {
22
+ minifyIdentifiers: false,
23
+ keepNames: true,
24
+ },
25
+ resolve: {
26
+ alias: {
27
+ '@common': path.resolve(__dirname, './common'), // Alias '@' to the 'common' directory
28
+ '@server': path.resolve(__dirname, './server'), // Alias '@' to the 'server' directory
29
+ },
30
+ },
31
+ })
@@ -1,3 +1,71 @@
1
- import { describe, it, expect, vi } from 'vitest';
1
+ import { describe, it, expect } from 'vitest';
2
+ import { execSync } from 'child_process';
3
+ import path from 'node:path';
4
+ import fs from 'node:fs';
5
+ import os from 'node:os';
2
6
 
3
- it.todo('Should test something');
7
+ describe('nails init integration tests', () => {
8
+ const templates = ['default', 'mcp', 'mobile'];
9
+ const NAILS_MODULE_DIR = process.cwd();
10
+
11
+ templates.forEach(template => {
12
+ it(`should initialize and test a new project with the ${template} template`, { timeout: 120000 }, () => {
13
+ const dateString = Date.now();
14
+ const testDir = path.join(os.tmpdir(), `test_project_${template}_${dateString}`);
15
+
16
+ // 1. Create a temporary directory
17
+ if (!fs.existsSync(testDir)) {
18
+ fs.mkdirSync(testDir, { recursive: true });
19
+ }
20
+
21
+ try {
22
+ // 2. Initialize project using the local version of init.js
23
+ console.log(`Running init for ${template}...`);
24
+ execSync(`node bin/lib/init.js ${testDir} --template ${template}`, { stdio: 'inherit' });
25
+
26
+ // 3. Verify directory and configuration files based on the template style
27
+ expect(fs.existsSync(testDir)).toBe(true);
28
+ expect(fs.existsSync(path.join(testDir, 'NAILS'))).toBe(true);
29
+ expect(fs.existsSync(path.join(testDir, 'package.json'))).toBe(true);
30
+
31
+ // Verify folder structure based on the template
32
+ if (template === 'default') {
33
+ expect(fs.existsSync(path.join(testDir, 'server'))).toBe(true);
34
+ expect(fs.existsSync(path.join(testDir, 'src'))).toBe(true);
35
+ expect(fs.existsSync(path.join(testDir, 'public'))).toBe(true);
36
+ expect(fs.existsSync(path.join(testDir, 'vite.config.ts'))).toBe(true);
37
+ expect(fs.existsSync(path.join(testDir, 'vite-mobile.config.ts'))).toBe(false);
38
+ } else if (template === 'mcp') {
39
+ expect(fs.existsSync(path.join(testDir, 'server'))).toBe(true);
40
+ expect(fs.existsSync(path.join(testDir, 'src'))).toBe(false);
41
+ expect(fs.existsSync(path.join(testDir, 'public'))).toBe(false);
42
+ expect(fs.existsSync(path.join(testDir, 'vite.config.ts'))).toBe(true);
43
+ } else if (template === 'mobile') {
44
+ expect(fs.existsSync(path.join(testDir, 'server'))).toBe(false);
45
+ expect(fs.existsSync(path.join(testDir, 'src'))).toBe(true);
46
+ expect(fs.existsSync(path.join(testDir, 'vite-mobile.config.ts'))).toBe(true);
47
+ expect(fs.existsSync(path.join(testDir, 'capacitor.config.ts'))).toBe(true);
48
+ }
49
+
50
+ // 4. Change directory to the test project
51
+ process.chdir(testDir);
52
+
53
+ // 5. Install dependencies including local nails path
54
+ console.log(`Installing dependencies for ${template}...`);
55
+ execSync(`npm install ${NAILS_MODULE_DIR} --legacy-peer-deps`, { stdio: 'inherit' });
56
+
57
+ // 6. Run tests in the new test project
58
+ console.log(`Running tests inside the ${template} project...`);
59
+ // Use --pool=forks to isolate process/module cache between test files and prevent Sequelize database errors
60
+ // Use --passWithNoTests since mobile template doesn't have any tests by default
61
+ execSync('npm test -- --pool=forks --passWithNoTests', { stdio: 'inherit' });
62
+
63
+ } finally {
64
+ // Return to original directory and clean up
65
+ process.chdir(NAILS_MODULE_DIR);
66
+ console.log(`Cleaning up test directory ${testDir}...`);
67
+ fs.rmSync(testDir, { recursive: true, force: true });
68
+ }
69
+ });
70
+ });
71
+ });