@webhouse/create-cms 0.1.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/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/index.js +95 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WebHouse
|
|
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,40 @@
|
|
|
1
|
+
# @webhouse/create-cms
|
|
2
|
+
|
|
3
|
+
Scaffold a new [@webhouse/cms](https://github.com/webhousecode/cms) project in seconds.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm create @webhouse/cms my-site
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This creates a new directory with a ready-to-run CMS project.
|
|
12
|
+
|
|
13
|
+
## What you get
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
my-site/
|
|
17
|
+
├── cms.config.ts # Collection schemas (TypeScript)
|
|
18
|
+
├── package.json # Dependencies pre-configured
|
|
19
|
+
├── .env # API keys (add your own)
|
|
20
|
+
└── content/
|
|
21
|
+
└── posts/
|
|
22
|
+
└── hello-world.json # Example post
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Next steps
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
cd my-site
|
|
29
|
+
npm install
|
|
30
|
+
npx cms dev # Start dev server
|
|
31
|
+
npx cms build # Build static site
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Documentation
|
|
35
|
+
|
|
36
|
+
See the [main repository](https://github.com/webhousecode/cms) for full documentation.
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
MIT
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
5
|
+
import { join, resolve } from "path";
|
|
6
|
+
var projectName = process.argv[2] || "my-cms-site";
|
|
7
|
+
var projectDir = resolve(process.cwd(), projectName);
|
|
8
|
+
console.log("");
|
|
9
|
+
console.log(`\x1B[36mi\x1B[0m Creating new CMS project: ${projectName}`);
|
|
10
|
+
console.log("");
|
|
11
|
+
if (existsSync(projectDir)) {
|
|
12
|
+
console.error(`\x1B[31m\u2717\x1B[0m Directory already exists: ${projectDir}`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
mkdirSync(projectDir, { recursive: true });
|
|
16
|
+
mkdirSync(join(projectDir, "content", "posts"), { recursive: true });
|
|
17
|
+
writeFileSync(join(projectDir, "cms.config.ts"), `import { defineConfig, defineCollection } from '@webhouse/cms';
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
collections: [
|
|
21
|
+
defineCollection({
|
|
22
|
+
name: 'posts',
|
|
23
|
+
label: 'Blog Posts',
|
|
24
|
+
fields: [
|
|
25
|
+
{ name: 'title', type: 'text', label: 'Title', required: true },
|
|
26
|
+
{ name: 'excerpt', type: 'textarea', label: 'Excerpt' },
|
|
27
|
+
{ name: 'content', type: 'richtext', label: 'Content' },
|
|
28
|
+
{ name: 'date', type: 'date', label: 'Publish Date' },
|
|
29
|
+
],
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
storage: {
|
|
33
|
+
adapter: 'filesystem',
|
|
34
|
+
filesystem: {
|
|
35
|
+
contentDir: 'content',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
build: {
|
|
39
|
+
outDir: 'dist',
|
|
40
|
+
},
|
|
41
|
+
api: {
|
|
42
|
+
port: 3000,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
`, "utf-8");
|
|
46
|
+
writeFileSync(join(projectDir, ".env"), `# AI provider \u2014 uncomment one:
|
|
47
|
+
# ANTHROPIC_API_KEY=sk-ant-...
|
|
48
|
+
# OPENAI_API_KEY=sk-...
|
|
49
|
+
`, "utf-8");
|
|
50
|
+
var examplePost = {
|
|
51
|
+
id: "example-post-001",
|
|
52
|
+
slug: "hello-world",
|
|
53
|
+
collection: "posts",
|
|
54
|
+
status: "published",
|
|
55
|
+
data: {
|
|
56
|
+
title: "Hello, World!",
|
|
57
|
+
excerpt: "My first post using @webhouse/cms.",
|
|
58
|
+
content: "# Hello, World!\n\nWelcome to your new CMS-powered blog.\n\n## Getting Started\n\n```bash\nnpx cms dev # Start dev server\nnpx cms build # Build static site\n```\n\nHappy writing!\n",
|
|
59
|
+
date: (/* @__PURE__ */ new Date()).toISOString()
|
|
60
|
+
},
|
|
61
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
62
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
63
|
+
};
|
|
64
|
+
writeFileSync(
|
|
65
|
+
join(projectDir, "content", "posts", "hello-world.json"),
|
|
66
|
+
JSON.stringify(examplePost, null, 2),
|
|
67
|
+
"utf-8"
|
|
68
|
+
);
|
|
69
|
+
writeFileSync(join(projectDir, "package.json"), JSON.stringify({
|
|
70
|
+
name: projectName,
|
|
71
|
+
version: "0.1.0",
|
|
72
|
+
private: true,
|
|
73
|
+
type: "module",
|
|
74
|
+
scripts: {
|
|
75
|
+
dev: "cms dev",
|
|
76
|
+
build: "cms build"
|
|
77
|
+
},
|
|
78
|
+
dependencies: {
|
|
79
|
+
"@webhouse/cms": "^0.1.1",
|
|
80
|
+
"@webhouse/cms-cli": "^0.1.1",
|
|
81
|
+
"@webhouse/cms-ai": "^0.1.1"
|
|
82
|
+
}
|
|
83
|
+
}, null, 2), "utf-8");
|
|
84
|
+
console.log(`\x1B[32m\u2713\x1B[0m Project created at ${projectDir}`);
|
|
85
|
+
console.log("");
|
|
86
|
+
console.log("Next steps:");
|
|
87
|
+
console.log(` cd ${projectName}`);
|
|
88
|
+
console.log(" npm install");
|
|
89
|
+
console.log(" npx cms dev # Start dev server + admin UI");
|
|
90
|
+
console.log(" npx cms build # Build static site");
|
|
91
|
+
console.log("");
|
|
92
|
+
console.log("AI content generation:");
|
|
93
|
+
console.log(" 1. Add your ANTHROPIC_API_KEY to .env");
|
|
94
|
+
console.log(' 2. npx cms ai generate posts "Write a blog post about..."');
|
|
95
|
+
console.log("");
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webhouse/create-cms",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Scaffold a new @webhouse/cms project",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-cms": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/webhousecode/cms.git",
|
|
18
|
+
"directory": "packages/create-cms"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/webhousecode/cms#readme",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/webhousecode/cms/issues"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"cms",
|
|
26
|
+
"create",
|
|
27
|
+
"scaffold",
|
|
28
|
+
"webhouse",
|
|
29
|
+
"ai-native"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"tsup": "^8.3.5",
|
|
42
|
+
"typescript": "^5.7.2"
|
|
43
|
+
}
|
|
44
|
+
}
|