helfy-create 0.0.5 → 0.1.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.
Files changed (44) hide show
  1. package/README.md +49 -38
  2. package/bin/create-helfy.js +8 -0
  3. package/package.json +31 -31
  4. package/template/declaration.d.ts +10 -8
  5. package/template/package-lock.json +6981 -7000
  6. package/template/package.json +29 -30
  7. package/template/rspack.config.js +76 -0
  8. package/template/src/App.hf +20 -0
  9. package/template/src/App.ts +5 -0
  10. package/template/src/context/ThemeContext.ts +18 -0
  11. package/template/src/pages/AboutPage.hf +12 -0
  12. package/template/src/pages/AboutPage.ts +5 -0
  13. package/template/src/pages/CounterPage.hf +13 -0
  14. package/template/src/pages/CounterPage.ts +15 -0
  15. package/template/src/pages/HomePage.hf +17 -0
  16. package/template/src/pages/HomePage.ts +5 -0
  17. package/template/src/pages/_router.hf +21 -0
  18. package/template/src/pages/_router.ts +5 -0
  19. package/template/src/pages/{_routes.tsx → _routes.ts} +10 -10
  20. package/template/src/pages/layouts/MainLayout.hf +24 -0
  21. package/template/src/pages/layouts/MainLayout.ts +5 -0
  22. package/template/src/widgets/Footer/Footer.hf +5 -0
  23. package/template/src/widgets/Footer/Footer.ts +5 -0
  24. package/template/src/widgets/Header/Header.hf +15 -0
  25. package/template/src/widgets/Header/Header.ts +11 -0
  26. package/template/src/widgets/Navbar/Navbar.hf +14 -0
  27. package/template/src/widgets/Navbar/Navbar.ts +11 -0
  28. package/template/src/widgets/NotFound/NotFound.hf +14 -0
  29. package/template/src/widgets/NotFound/NotFound.ts +12 -0
  30. package/template/src/widgets/ThemeToggle/ThemeToggle.hf +16 -0
  31. package/template/src/widgets/ThemeToggle/ThemeToggle.ts +12 -0
  32. package/template/src/widgets/navLinks.ts +5 -0
  33. package/template/tsconfig.json +0 -2
  34. package/template/src/App.tsx +0 -26
  35. package/template/src/context/ThemeContext.tsx +0 -60
  36. package/template/src/pages/AboutPage.tsx +0 -18
  37. package/template/src/pages/CounterPage.tsx +0 -17
  38. package/template/src/pages/HomePage.tsx +0 -22
  39. package/template/src/pages/_router.tsx +0 -15
  40. package/template/src/pages/layouts/MainLayout.tsx +0 -29
  41. package/template/src/widgets/Footer/Footer.tsx +0 -8
  42. package/template/src/widgets/Header/Header.tsx +0 -34
  43. package/template/src/widgets/Navbar/Navbar.tsx +0 -29
  44. package/template/src/widgets/NotFound/NotFound.tsx +0 -31
package/README.md CHANGED
@@ -1,38 +1,49 @@
1
- # create-helfy
2
-
3
- Create a new Helfy project with one command.
4
-
5
- ## Usage
6
-
7
- ```bash
8
- npx helfy-create my-app
9
- cd my-app
10
- npm run dev
11
- ```
12
-
13
- Or without a project name (creates `helfy-app`):
14
-
15
- ```bash
16
- npx helfy-create
17
- ```
18
-
19
- **Options:**
20
- - `--skip-install` — create project without running `npm install` (e.g. for custom registry or offline)
21
-
22
- ## Editor setup (VS Code)
23
-
24
- **Syntax highlighting.** The helfy-syntax extension is not in the Marketplace. Install manually from [GitHub](https://github.com/ikrymsaev/helfy-syntax/tree/main/dist):
25
-
26
- - Download the **archive** and extract to the extensions folder, or
27
- - Download the **.vsix** file and install: `Extensions` → `...` → `Install from VSIX...`
28
-
29
- **TypeScript.** Use **workspace TypeScript**: `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (Mac) → `TypeScript: Select TypeScript Version` → `Use Workspace Version`. Required because the project includes `@helfy/helfy-ts-plugin`.
30
-
31
- ## What you get
32
-
33
- - Helfy + TypeScript + Webpack setup
34
- - Babel preset with helfy compiler
35
- - Router with example pages (Home, Counter, About)
36
- - Basic styling
37
- - `npm run dev` — development server (port 3000)
38
- - `npm run build` — production build
1
+ # helfy-create
2
+
3
+ Create a new [Helfy](https://github.com/ikrymsaev/helfy/tree/main/packages/helfy) project with one command.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npx helfy-create my-app
9
+ cd my-app
10
+ npm run dev
11
+ ```
12
+
13
+ Or without a project name (creates `helfy-app`):
14
+
15
+ ```bash
16
+ npx helfy-create
17
+ ```
18
+
19
+ **Options:**
20
+ - `--skip-install` — create the project without running `npm install` (e.g. for a custom registry or offline)
21
+
22
+ ## Editor setup (VS Code / Cursor)
23
+
24
+ The Helfy extension adds `.hf` template support: highlighting, type checking of template expressions, hover,
25
+ go-to-definition, completion, diagnostics and formatting. It is not in the Marketplace — install the `.vsix` from
26
+ [GitHub](https://github.com/ikrymsaev/helfy/tree/main/packages/vscode-extension):
27
+
28
+ ```bash
29
+ code --install-extension helfy-vscode-0.1.1.vsix
30
+ ```
31
+
32
+ or `Extensions` → `...` → `Install from VSIX...`.
33
+
34
+ ## What you get
35
+
36
+ - Helfy + TypeScript + Rspack
37
+ - Components as `.ts` classes with `.hf` templates next to them
38
+ - Router with example pages (Home, Counter, lazily loaded About) and a custom 404 page
39
+ - Layout with slots, a theme context, `@safe / @wait / @fail` around the router
40
+ - `npm run dev` — development server (port 3000)
41
+ - `npm run build` — production build
42
+
43
+ ```
44
+ src/
45
+ App.ts / App.hf root component
46
+ context/ThemeContext.ts light / dark theme
47
+ pages/ pages, routes, layout
48
+ widgets/ header, sidebar, footer, 404, theme toggle
49
+ ```
@@ -18,14 +18,22 @@ if (fs.existsSync(root)) {
18
18
 
19
19
  console.log(`Creating Helfy project in ${projectName}...\n`);
20
20
 
21
+ // Present only when the template is installed locally (they are not in the published package).
22
+ const SKIP = new Set(["node_modules", "dist", ".helfy"]);
23
+ // Copied byte for byte; the rest is text with {{PROJECT_NAME}} placeholders.
24
+ const BINARY = /\.(ico|png|jpe?g|gif|webp|woff2?)$/i;
25
+
21
26
  function copyDir(src, dest) {
22
27
  fs.mkdirSync(dest, { recursive: true });
23
28
  for (const name of fs.readdirSync(src)) {
29
+ if (SKIP.has(name)) continue;
24
30
  const srcPath = path.join(src, name);
25
31
  const destName = name === "gitignore" ? ".gitignore" : name;
26
32
  const destPath = path.join(dest, destName);
27
33
  if (fs.statSync(srcPath).isDirectory()) {
28
34
  copyDir(srcPath, destPath);
35
+ } else if (BINARY.test(name)) {
36
+ fs.copyFileSync(srcPath, destPath);
29
37
  } else {
30
38
  let content = fs.readFileSync(srcPath, "utf-8");
31
39
  content = content.replace(/\{\{PROJECT_NAME\}\}/g, projectName);
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
- {
2
- "name": "helfy-create",
3
- "version": "0.0.5",
4
- "description": "Create a new Helfy project",
5
- "bin": {
6
- "helfy-create": "./bin/create-helfy.js"
7
- },
8
- "files": [
9
- "bin",
10
- "template/.babelrc",
11
- "template/gitignore",
12
- "template/package.json",
13
- "template/package-lock.json",
14
- "template/tsconfig.json",
15
- "template/webpack.config.js",
16
- "template/declaration.d.ts",
17
- "template/src"
18
- ],
19
- "keywords": [
20
- "helfy",
21
- "scaffold",
22
- "create",
23
- "starter"
24
- ],
25
- "author": "ikrymsaev",
26
- "license": "MIT",
27
- "repository": {
28
- "type": "git",
29
- "url": "https://github.com/ikrymsaev/helfy-create"
30
- }
31
- }
1
+ {
2
+ "name": "helfy-create",
3
+ "version": "0.1.0",
4
+ "description": "Create a new Helfy project",
5
+ "bin": {
6
+ "helfy-create": "./bin/create-helfy.js"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "template/.babelrc",
11
+ "template/gitignore",
12
+ "template/package.json",
13
+ "template/package-lock.json",
14
+ "template/tsconfig.json",
15
+ "template/rspack.config.js",
16
+ "template/declaration.d.ts",
17
+ "template/src"
18
+ ],
19
+ "keywords": [
20
+ "helfy",
21
+ "scaffold",
22
+ "create",
23
+ "starter"
24
+ ],
25
+ "author": "ikrymsaev",
26
+ "license": "MIT",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/ikrymsaev/helfy-create"
30
+ }
31
+ }
@@ -1,8 +1,10 @@
1
- declare module '*.scss' {
2
- const content: Record<string, string>;
3
- export default content;
4
- }
5
- declare module '*.css' {
6
- const content: Record<string, string>;
7
- export default content;
8
- }
1
+ /// <reference types="@helfy/helfy/helfy-hf" />
2
+
3
+ declare module '*.scss' {
4
+ const content: Record<string, string>;
5
+ export default content;
6
+ }
7
+ declare module '*.css' {
8
+ const content: Record<string, string>;
9
+ export default content;
10
+ }