create-hedhop 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 +52 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
- package/templates/default/_gitignore +3 -0
- package/templates/default/hedhop.config.ts +11 -0
- package/templates/default/package.json +23 -0
- package/templates/default/src/app.tsx +26 -0
- package/templates/default/src/index.css +6 -0
- package/templates/default/src/pages/home.tsx +17 -0
- package/templates/default/tsconfig.json +34 -0
- package/templates/default/vite.config.ts +12 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 qgave
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# create-hedhop
|
|
2
|
+
|
|
3
|
+
A modern CLI tool for scaffolding [Hedhop](https://www.npmjs.com/package/hedhop) projects quickly.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
The fastest way to start is by running:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm create hedhop@latest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Follow the interactive prompts to configure your new project.
|
|
14
|
+
|
|
15
|
+
### Arguments
|
|
16
|
+
|
|
17
|
+
You can pass the project name directly:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm create hedhop@latest my-project
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Available options:
|
|
24
|
+
- `--no-install`: Skip automatic dependency installation.
|
|
25
|
+
|
|
26
|
+
## Local Development
|
|
27
|
+
|
|
28
|
+
If you want to contribute or test changes locally on the CLI:
|
|
29
|
+
|
|
30
|
+
1. Clone the repository.
|
|
31
|
+
2. Install dependencies:
|
|
32
|
+
```bash
|
|
33
|
+
npm install
|
|
34
|
+
```
|
|
35
|
+
3. Build the project in watch mode:
|
|
36
|
+
```bash
|
|
37
|
+
npm run dev
|
|
38
|
+
```
|
|
39
|
+
4. Test the CLI in another directory pointing to the built binary:
|
|
40
|
+
```bash
|
|
41
|
+
node path/to/create-hedhop/dist/index.js test-project-name
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Project Structure
|
|
45
|
+
|
|
46
|
+
- `src/`: CLI source code.
|
|
47
|
+
- `templates/`: Templates that will be copied when generating a new project.
|
|
48
|
+
- `default/`: Default template with basic Vite and React configuration.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT © [qgave]
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import o from"fs-extra";import t from"path";import{spawn as j}from"child_process";import w from"prompts";import{fileURLToPath as S}from"url";import{red as r,green as s,bold as v}from"kolorist";async function N(){let l="hedhop-project",c=process.argv.slice(2).find(f=>!f.startsWith("-")),a=process.argv.includes("--no-install"),p=await w([{type:c?null:"text",name:"projectName",message:"Project name:",initial:l},{type:a?null:"toggle",name:"install",message:"Install dependencies?",initial:!0,active:"yes",inactive:"no"}],{onCancel:()=>{throw new Error(r("\u2716")+" Operation cancelled")}}),n=c||p.projectName,u=a?!1:p.install,e=t.join(process.cwd(),n);o.existsSync(e)&&(console.error(r(`
|
|
3
|
+
Error: Target directory "${n}" already exists.`)),process.exit(1)),console.log(`
|
|
4
|
+
Scaffolding project in ${v(e)}...`);let y=t.dirname(S(import.meta.url)),i=t.resolve(y,"../templates/default");o.existsSync(i)||(console.error(r(`
|
|
5
|
+
Error: Template directory not found at ${i}`)),process.exit(1)),o.copySync(i,e);let d=t.join(e,"package.json"),m=JSON.parse(o.readFileSync(d,"utf-8"));m.name=n,o.writeFileSync(d,JSON.stringify(m,null,2));let g=t.join(e,"_gitignore");o.existsSync(g)&&o.moveSync(g,t.join(e,".gitignore")),console.log(s(`
|
|
6
|
+
Done. Now run:
|
|
7
|
+
`)),console.log(` cd ${n}`),u?(console.log(s(`
|
|
8
|
+
Installing dependencies...`)),j("npm",["install"],{cwd:e,stdio:"inherit",shell:!0}).on("close",h=>{if(h!==0){console.error(r(`
|
|
9
|
+
Failed to install dependencies.`));return}console.log(s(`
|
|
10
|
+
Done. Now run:
|
|
11
|
+
`)),console.log(` cd ${n}`),console.log(" npm run dev")})):(console.log(s(`
|
|
12
|
+
Done. Now run:
|
|
13
|
+
`)),console.log(` cd ${n}`),console.log(" npm install"),console.log(" npm run dev"))}N().catch(l=>{console.error(l)});
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\r\n\r\nimport fs from 'fs-extra';\r\nimport path from 'path';\r\nimport { spawn } from 'child_process';\r\nimport prompts from 'prompts';\r\nimport { fileURLToPath } from 'url';\r\nimport { red, green, bold } from 'kolorist';\r\n\r\nasync function init() {\r\n const defaultTargetDir = 'hedhop-project';\r\n const targetDir = process.argv.slice(2).find(arg => !arg.startsWith('-'));\r\n const skipInstall = process.argv.includes('--no-install');\r\n\r\n const result = await prompts([\r\n {\r\n type: targetDir ? null : 'text',\r\n name: 'projectName',\r\n message: 'Project name:',\r\n initial: defaultTargetDir,\r\n },\r\n {\r\n type: skipInstall ? null : 'toggle',\r\n name: 'install',\r\n message: 'Install dependencies?',\r\n initial: true,\r\n active: 'yes',\r\n inactive: 'no',\r\n },\r\n ], {\r\n onCancel: () => {\r\n throw new Error(red('✖') + ' Operation cancelled');\r\n },\r\n });\r\n\r\n const projectName = targetDir || result.projectName;\r\n\r\n const install = skipInstall ? false : result.install;\r\n const root = path.join(process.cwd(), projectName);\r\n\r\n if (fs.existsSync(root)) {\r\n console.error(red(`\\nError: Target directory \"${projectName}\" already exists.`));\r\n process.exit(1);\r\n }\r\n\r\n console.log(`\\nScaffolding project in ${bold(root)}...`);\r\n\r\n\r\n const __dirname = path.dirname(fileURLToPath(import.meta.url));\r\n // templates are copied to dist/templates during build or we assume structure relative to this file\r\n // In dev/src structure it's ../templates\r\n // In dist it's ../templates\r\n const templateDir = path.resolve(__dirname, '../templates/default');\r\n\r\n if (!fs.existsSync(templateDir)) {\r\n console.error(red(`\\nError: Template directory not found at ${templateDir}`));\r\n process.exit(1);\r\n }\r\n\r\n\r\n fs.copySync(templateDir, root);\r\n\r\n\r\n const pkgPath = path.join(root, 'package.json');\r\n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));\r\n pkg.name = projectName;\r\n fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));\r\n\r\n // Rename _gitignore to .gitignore (npm publish renames .gitignore to .npmignore otherwise)\r\n const gitignorePath = path.join(root, '_gitignore');\r\n if (fs.existsSync(gitignorePath)) {\r\n fs.moveSync(gitignorePath, path.join(root, '.gitignore'));\r\n }\r\n\r\n console.log(green(`\\nDone. Now run:\\n`));\r\n console.log(` cd ${projectName}`);\r\n if (install) {\r\n console.log(green(`\\nInstalling dependencies...`));\r\n const child = spawn('npm', ['install'], {\r\n cwd: root,\r\n stdio: 'inherit',\r\n shell: true\r\n });\r\n\r\n child.on('close', (code) => {\r\n if (code !== 0) {\r\n console.error(red(`\\nFailed to install dependencies.`));\r\n return;\r\n }\r\n console.log(green(`\\nDone. Now run:\\n`));\r\n console.log(` cd ${projectName}`);\r\n console.log(` npm run dev`);\r\n });\r\n } else {\r\n console.log(green(`\\nDone. Now run:\\n`));\r\n console.log(` cd ${projectName}`);\r\n console.log(` npm install`);\r\n console.log(` npm run dev`);\r\n }\r\n}\r\n\r\ninit().catch((e) => {\r\n console.error(e);\r\n});\r\n"],"mappings":";AAEA,OAAOA,MAAQ,WACf,OAAOC,MAAU,OACjB,OAAS,SAAAC,MAAa,gBACtB,OAAOC,MAAa,UACpB,OAAS,iBAAAC,MAAqB,MAC9B,OAAS,OAAAC,EAAK,SAAAC,EAAO,QAAAC,MAAY,WAEjC,eAAeC,GAAO,CAClB,IAAMC,EAAmB,iBACnBC,EAAY,QAAQ,KAAK,MAAM,CAAC,EAAE,KAAKC,GAAO,CAACA,EAAI,WAAW,GAAG,CAAC,EAClEC,EAAc,QAAQ,KAAK,SAAS,cAAc,EAElDC,EAAS,MAAMV,EAAQ,CACzB,CACI,KAAMO,EAAY,KAAO,OACzB,KAAM,cACN,QAAS,gBACT,QAASD,CACb,EACA,CACI,KAAMG,EAAc,KAAO,SAC3B,KAAM,UACN,QAAS,wBACT,QAAS,GACT,OAAQ,MACR,SAAU,IACd,CACJ,EAAG,CACC,SAAU,IAAM,CACZ,MAAM,IAAI,MAAMP,EAAI,QAAG,EAAI,sBAAsB,CACrD,CACJ,CAAC,EAEKS,EAAcJ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IC,EAAM;AAAA;AAAA,CAAoB,CAAC,EACvC,QAAQ,IAAI,QAAQQ,CAAW,EAAE,EACjC,QAAQ,IAAI,eAAe,CAC/B,CAAC,IAED,QAAQ,IAAIR,EAAM;AAAA;AAAA,CAAoB,CAAC,EACvC,QAAQ,IAAI,QAAQQ,CAAW,EAAE,EACjC,QAAQ,IAAI,eAAe,EAC3B,QAAQ,IAAI,eAAe,EAEnC,CAEAN,EAAK,EAAE,MAAOe,GAAM,CAChB,QAAQ,MAAMA,CAAC,CACnB,CAAC","names":["fs","path","spawn","prompts","fileURLToPath","red","green","bold","init","defaultTargetDir","targetDir","arg","skipInstall","result","projectName","install","root","__dirname","templateDir","pkgPath","pkg","gitignorePath","code","e"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-hedhop",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Scaffolding tool for Hedhop projects",
|
|
5
|
+
"author": "qgave",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"hedhop",
|
|
9
|
+
"cli",
|
|
10
|
+
"scaffold",
|
|
11
|
+
"create",
|
|
12
|
+
"vite",
|
|
13
|
+
"react"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/qgave/create-hedhop"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"bin": {
|
|
21
|
+
"create-hedhop": "dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"templates"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup",
|
|
29
|
+
"dev": "tsup --watch",
|
|
30
|
+
"start": "node dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"prompts": "^2.4.2",
|
|
34
|
+
"kolorist": "^1.8.0",
|
|
35
|
+
"fs-extra": "^11.2.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"tsup": "^8.0.0",
|
|
39
|
+
"typescript": "^5.0.0",
|
|
40
|
+
"@types/node": "^20.0.0",
|
|
41
|
+
"@types/prompts": "^2.4.0",
|
|
42
|
+
"@types/fs-extra": "^11.0.0"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hedhop-app",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "hedhop build",
|
|
9
|
+
"start": "hedhop start"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"react": "^19.0.0",
|
|
13
|
+
"react-dom": "^19.0.0",
|
|
14
|
+
"hedhop": "^1.0.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"vite": "^6.0.0",
|
|
18
|
+
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
19
|
+
"@types/react": "^19.0.0",
|
|
20
|
+
"@types/react-dom": "^19.0.0",
|
|
21
|
+
"typescript": "^5.0.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Head, type RouterConfig } from 'hedhop';
|
|
3
|
+
import './index.css';
|
|
4
|
+
|
|
5
|
+
const routes = [
|
|
6
|
+
{ path: '/', page: '@/pages/home' }
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
export const router: RouterConfig = {
|
|
10
|
+
routes,
|
|
11
|
+
debug: true,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const RootLayout = ({ children }: { children: ReactNode }) => {
|
|
15
|
+
return (
|
|
16
|
+
<html lang="en">
|
|
17
|
+
<head>
|
|
18
|
+
<Head />
|
|
19
|
+
<title>Hedhop App</title>
|
|
20
|
+
</head>
|
|
21
|
+
<body>
|
|
22
|
+
<div id="app-root">{children}</div>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PageConfig } from 'hedhop';
|
|
2
|
+
|
|
3
|
+
export default function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<div style={{ padding: '2rem', maxWidth: '800px', margin: '0 auto' }}>
|
|
6
|
+
<h1>Welcome to Hedhop</h1>
|
|
7
|
+
<p>This is a starter template with React Server Components.</p>
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const config: PageConfig = {
|
|
13
|
+
meta: {
|
|
14
|
+
title: 'Home - Hedhop App',
|
|
15
|
+
description: 'Generated by create-hedhop'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2020",
|
|
7
|
+
"DOM",
|
|
8
|
+
"DOM.Iterable"
|
|
9
|
+
],
|
|
10
|
+
"module": "ESNext",
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"baseUrl": ".",
|
|
23
|
+
"paths": {
|
|
24
|
+
"@/*": [
|
|
25
|
+
"./src/*"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"include": [
|
|
30
|
+
"src",
|
|
31
|
+
"vite.config.ts",
|
|
32
|
+
"hedhop.config.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|