@pro-laico/create-atomic-payload 0.1.4 → 0.1.6

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/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # create-atomic-payload
2
+
3
+ Scaffold a new [Atomic Payload](https://atomicpayload.com) project — the Payload CMS starter where all you need to know is Tailwind.
4
+
5
+ > Atomic Payload creates a hard separation between front-end development and the backend. Build your website directly in Payload CMS's dashboard, without ever having to touch real code.
6
+
7
+ ## Prerequisites
8
+
9
+ - **Node.js** 18 or later
10
+ - **pnpm** (recommended) — install with `npm install -g pnpm`
11
+
12
+ ## Quick Start
13
+
14
+ ```bash
15
+ npx @pro-laico/create-atomic-payload my-project
16
+ cd my-project
17
+ cp .env.example .env
18
+ # Edit .env with your MongoDB URI, Payload secret, etc.
19
+ pnpm dev
20
+ ```
21
+
22
+ To create in the current directory instead of a subfolder:
23
+
24
+ ```bash
25
+ npx @pro-laico/create-atomic-payload .
26
+ cp .env.example .env
27
+ pnpm dev
28
+ ```
29
+
30
+ ## What It Does
31
+
32
+ The CLI will:
33
+
34
+ 1. Copy the Atomic Payload template to your project folder
35
+ 2. Install dependencies with pnpm
36
+ 3. Build sharp (image processing)
37
+ 4. Download fonts
38
+
39
+ Then you configure `.env` and run `pnpm dev`.
40
+
41
+ ## Options
42
+
43
+ | Option | Description |
44
+ |-------|-------------|
45
+ | `--help`, `-h` | Show help message |
46
+
47
+ ## Next Steps
48
+
49
+ After creating your project, see the project's `README.md` for:
50
+
51
+ - MongoDB setup
52
+ - Vercel Blob (file storage)
53
+ - Deployment
54
+ - Optional integrations (Mux, Resend)
55
+
56
+ ## Troubleshooting
57
+
58
+ **Sharp / image errors on Windows?**
59
+ Run `pnpm rebuild sharp` in your project directory.
60
+
61
+ **Fonts not loading?**
62
+ Run `pnpm download:fonts` in your project directory.
63
+
64
+ ## Links
65
+
66
+ - [Atomic Payload Documentation](https://atomicpayload.com)
67
+ - [Discord](https://discord.gg/EPHgjrQBxY)
68
+ - [Payload CMS](https://payloadcms.com)
69
+
70
+ ---
71
+
72
+ > While this project utilizes Payload CMS, Atomic Payload is not affiliated with Payload CMS.
package/bin/cli.js CHANGED
@@ -32,6 +32,10 @@ function getProjectName() {
32
32
  return 'my-atomic-payload'
33
33
  }
34
34
 
35
+ function isCurrentDir(projectName) {
36
+ return projectName === '.'
37
+ }
38
+
35
39
  function printBanner() {
36
40
  const title = chalk.cyan.bold(' Atomic Payload')
37
41
  const tagline = chalk.gray(' The Payload CMS starter where all you need to know is Tailwind')
@@ -56,21 +60,19 @@ function printHelp() {
56
60
  ${chalk.gray('Examples:')}
57
61
  npx @pro-laico/create-atomic-payload
58
62
  npx @pro-laico/create-atomic-payload my-website
63
+ npx @pro-laico/create-atomic-payload . ${chalk.dim('# create in current directory')}
59
64
  `)
60
65
  }
61
66
 
62
67
  function printNextSteps(projectName) {
63
- const steps = [
64
- `cd ${projectName}`,
65
- 'cp .env.example .env',
66
- '# Edit .env with your MongoDB URI, Payload secret, etc.',
67
- 'pnpm dev',
68
- ]
68
+ const steps = isCurrentDir(projectName)
69
+ ? ['cp .env.example .env', '# Edit .env with your MongoDB URI, Payload secret, etc.', 'pnpm dev']
70
+ : [`cd ${projectName}`, 'cp .env.example .env', '# Edit .env with your MongoDB URI, Payload secret, etc.', 'pnpm dev']
69
71
  const maxLen = Math.max(...steps.map((s) => s.length), 40)
70
72
  const line = '─'.repeat(maxLen + 2)
71
73
 
72
74
  console.log()
73
- console.log(chalk.green.bold(' ✓ Created ') + chalk.green(projectName))
75
+ console.log(chalk.green.bold(' ✓ Created ') + chalk.green(isCurrentDir(projectName) ? 'in current directory' : projectName))
74
76
  console.log()
75
77
  console.log(chalk.gray(' Next steps:'))
76
78
  console.log(chalk.cyan(' ╭' + line + '╮'))
@@ -93,26 +95,35 @@ async function main() {
93
95
 
94
96
  const projectName = getProjectName()
95
97
 
96
- if (!/^[a-z0-9-]+$/.test(projectName)) {
97
- console.error(chalk.red(' ✗ Project name must use only lowercase letters, numbers, and hyphens'))
98
+ if (!isCurrentDir(projectName) && !/^[a-z0-9-]+$/.test(projectName)) {
99
+ console.error(chalk.red(' ✗ Project name must use only lowercase letters, numbers, and hyphens, or "." for current directory'))
98
100
  process.exit(1)
99
101
  }
100
102
 
101
103
  printBanner()
102
104
 
103
105
  const targetDir = path.resolve(process.cwd(), projectName)
104
- const targetExists = fs.existsSync(targetDir)
105
106
 
106
- if (targetExists) {
107
- console.error(chalk.red(` ✗ Directory "${projectName}" already exists. Remove it or choose a different name.`))
108
- process.exit(1)
107
+ if (isCurrentDir(projectName)) {
108
+ if (fs.existsSync(path.join(targetDir, 'package.json'))) {
109
+ console.error(chalk.red(' ✗ Current directory already has a package.json. Use a different directory or remove it first.'))
110
+ process.exit(1)
111
+ }
112
+ } else {
113
+ const targetExists = fs.existsSync(targetDir)
114
+ if (targetExists) {
115
+ console.error(chalk.red(` ✗ Directory "${projectName}" already exists. Remove it or choose a different name.`))
116
+ process.exit(1)
117
+ }
109
118
  }
110
119
 
111
120
  const templatePath = await getTemplatePath()
112
121
  const copySpinner = ora({ text: 'Copying template...', color: 'cyan' }).start()
113
122
  const startCopy = Date.now()
114
123
 
115
- await fsp.mkdir(path.dirname(targetDir), { recursive: true })
124
+ if (!isCurrentDir(projectName)) {
125
+ await fsp.mkdir(path.dirname(targetDir), { recursive: true })
126
+ }
116
127
  await fsp.cp(templatePath, targetDir, {
117
128
  recursive: true,
118
129
  filter: (src) => {
@@ -121,6 +132,12 @@ async function main() {
121
132
  },
122
133
  })
123
134
 
135
+ // Rename gitignore.template → .gitignore (npm renames .gitignore to .npmignore during pack/extract)
136
+ const gitignoreTemplate = path.join(targetDir, 'gitignore.template')
137
+ if (fs.existsSync(gitignoreTemplate)) {
138
+ await fsp.rename(gitignoreTemplate, path.join(targetDir, '.gitignore'))
139
+ }
140
+
124
141
  copySpinner.succeed(`Template copied in ${((Date.now() - startCopy) / 1000).toFixed(1)}s`)
125
142
 
126
143
  const installSpinner = ora({ text: 'Installing dependencies with pnpm...', color: 'cyan' }).start()
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.1.4",
6
+ "version": "0.1.6",
7
7
  "description": "Scaffold a new Atomic Payload project - the Payload CMS starter where all you need to know is Tailwind.",
8
8
  "license": "MIT",
9
9
  "type": "module",
@@ -0,0 +1,17 @@
1
+ node_modules
2
+ .next
3
+ .vercel
4
+ .DS_Store
5
+
6
+ # TypeScript
7
+ tsconfig.tsbuildinfo
8
+
9
+ public/robots.txt
10
+ public/sitemap*.xml
11
+
12
+ .env
13
+ .env*.local
14
+
15
+ # Ignore all automatically generated font files
16
+ /src/app/definition.ts
17
+ /public/fonts
Binary file
@@ -0,0 +1,10 @@
1
+ // DO NOT EDIT MANUALLY. THIS FILE IS AUTOMATICALLY GENERATED.
2
+
3
+ import localFont from 'next/font/local'
4
+
5
+ const fontSerif = localFont({ src: '../../public/fonts/serif.woff2', variable: '--font-setSerif' })
6
+ const fontMono = localFont({ src: '../../public/fonts/mono.woff2', variable: '--font-setMono' })
7
+ const fontDisplay = localFont({ src: '../../public/fonts/display.woff2', variable: '--font-setDisplay' })
8
+
9
+ const fonts = { fontSerif, fontMono, fontDisplay }
10
+ export default fonts