easy-starter 1.2.0 → 1.2.1
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/package.json
CHANGED
package/template/.cursorrules
CHANGED
|
@@ -90,3 +90,19 @@ export type Database = {
|
|
|
90
90
|
// CORRECT (custom ID):
|
|
91
91
|
await update("item", "explicit-custom-id", { name: "Custom ID Item", value: 99 });
|
|
92
92
|
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 4. Styling & Image Manipulation Guidelines
|
|
97
|
+
|
|
98
|
+
### CSS / SCSS Implementation
|
|
99
|
+
* **Centralized & Generic**: Implement as many styles as possible in `src/styles.scss` using generic, reusable selectors.
|
|
100
|
+
* **Minimize Inline Styles**: Avoid inline styles (e.g., `style={{ ... }}`) in React components. Keep style declarations in the central SCSS file to maintain design consistency and code quality.
|
|
101
|
+
|
|
102
|
+
### Image Asset Handling
|
|
103
|
+
* **STRONG PREFERENCE**: It is highly preferred to insert images as `background-image` declarations inside `src/styles.scss` rather than using `<img>` tags in React components wherever possible.
|
|
104
|
+
* **CRITICAL FOR SCSS**: When referencing images inside `src/styles.scss` (e.g., as background-image), always append the `?as=webp` query parameter to convert them to modern WebP format during build, unless the source file is already an `.svg`. Do specify width or height query parameters.
|
|
105
|
+
* **CORRECT**: `background-image: url("./images/icon.png?as=webp&height=128");`
|
|
106
|
+
* **CRITICAL FOR CODE (React / HTML / JavaScript)**: If you must reference an image path directly within the code (e.g., in `<img src="..." />` or JS variables), you **MUST** only refer to images located inside the `public` directory (and nowhere else).
|
|
107
|
+
* **CORRECT**: `<img src="/logo.png" />` (when referencing `/public/logo.png`)
|
|
108
|
+
* **INCORRECT**: `<img src="../src/images/logo.png" />` or importing images directly into React files.
|
|
@@ -26,4 +26,7 @@ jobs:
|
|
|
26
26
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
27
27
|
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
|
|
28
28
|
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
|
|
29
|
+
SSH_PATH: ${{ secrets.SSH_PATH }}
|
|
30
|
+
PM2_APP_NAME: ${{ secrets.PM2_APP_NAME }}
|
|
31
|
+
SERVER_URL: ${{ secrets.SERVER_URL }}
|
|
29
32
|
run: npm run deploy
|
package/template/env
CHANGED
|
@@ -2,9 +2,11 @@ NODE_ENV=development # development/production
|
|
|
2
2
|
SERVER_PORT=1111
|
|
3
3
|
ADMIN_PASSWORD=admin
|
|
4
4
|
|
|
5
|
+
SERVER_URL=https://your-production-url.com/
|
|
6
|
+
|
|
5
7
|
# deploy
|
|
6
8
|
SSH_HOST=[IP_ADDRESS]
|
|
7
9
|
SSH_USERNAME=root
|
|
8
10
|
SSH_PASSWORD=[PASSWORD]
|
|
9
|
-
|
|
11
|
+
SSH_PATH=/root/easy-starter-app
|
|
10
12
|
PM2_APP_NAME=easy-starter-app
|
|
@@ -11,7 +11,7 @@ const password = process.env.SSH_PASSWORD;
|
|
|
11
11
|
// Configuration for your target server
|
|
12
12
|
const server = process.env.SERVER_URL;
|
|
13
13
|
const pm2AppName = process.env.PM2_APP_NAME;
|
|
14
|
-
const sshPath =
|
|
14
|
+
const sshPath = process.env.SSH_PATH; // Path on the remote VPS
|
|
15
15
|
|
|
16
16
|
const path = resolve(process.cwd()); // Local project path
|
|
17
17
|
const ignoreFiles = [
|
|
@@ -26,10 +26,11 @@ const ignoreFiles = [
|
|
|
26
26
|
".DS_Store",
|
|
27
27
|
];
|
|
28
28
|
|
|
29
|
-
// Ensure credentials are provided
|
|
29
|
+
// Ensure credentials and paths are provided
|
|
30
30
|
if (host === undefined) throw new Error("SSH_HOST environment variable is not defined.");
|
|
31
31
|
if (username === undefined) throw new Error("SSH_USERNAME environment variable is not defined.");
|
|
32
32
|
if (password === undefined) throw new Error("SSH_PASSWORD environment variable is not defined.");
|
|
33
|
+
if (sshPath === undefined) throw new Error("SSH_PATH environment variable is not defined.");
|
|
33
34
|
|
|
34
35
|
deploy();
|
|
35
36
|
|
|
@@ -4,19 +4,10 @@ import { readFile } from "fs/promises";
|
|
|
4
4
|
import cors from "cors";
|
|
5
5
|
import express from "express";
|
|
6
6
|
|
|
7
|
-
// easy-db-node provides a simple local database storing data in JSON files.
|
|
8
|
-
// It's ideal for small to medium projects where setting up a full SQL/NoSQL DB is overkill.
|
|
9
7
|
import easyDBNode from "easy-db-node";
|
|
10
|
-
|
|
11
|
-
// ssr-hook allows for simple Server-Side Rendering of React components,
|
|
12
|
-
// ensuring SEO friendliness and faster initial page loads.
|
|
13
8
|
import { renderToHTML } from "ssr-hook/server";
|
|
14
|
-
|
|
15
|
-
// typed-client-server-api establishes a type-safe RPC-like API between your React frontend
|
|
16
|
-
// and this Express backend, preventing mismatch errors and providing autocomplete.
|
|
17
9
|
import { setAPIBackend } from "typed-client-server-api";
|
|
18
10
|
|
|
19
|
-
// easy-analytics handles privacy-friendly local analytics collection.
|
|
20
11
|
import { postEasyAnalytics, getEasyAnalytics } from "easy-analytics/server";
|
|
21
12
|
|
|
22
13
|
import App from "../src/App";
|
|
@@ -29,7 +20,7 @@ const LOCALHOST = `http://localhost:${PORT}`;
|
|
|
29
20
|
// The ORIGIN is used for SEO and by ssr-hook to know where the requests are coming from.
|
|
30
21
|
const ORIGIN = process.env.NODE_ENV === "development"
|
|
31
22
|
? LOCALHOST
|
|
32
|
-
:
|
|
23
|
+
: process.env.SERVER_URL;
|
|
33
24
|
|
|
34
25
|
const INDEX_HTML_PATH = resolve(__dirname, "..", "dist", "index.html");
|
|
35
26
|
|