next-skill 1.0.0 → 1.0.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/README.md +20 -0
- package/index.js +24 -7
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# `next-skill`
|
|
2
|
+
|
|
3
|
+
A command-line tool to bootstrap a new Next.js project with best practices and a predefined project structure. It sets up a new application and includes a `.claude/SKILLS.md` file to guide AI-assisted development.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
To create a new Next.js project, run the following command in your terminal:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx next-skill
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The script will prompt you to enter a name for your project folder. If you press enter without a name, it will install the new Next.js application in the current directory.
|
|
14
|
+
|
|
15
|
+
### What it does
|
|
16
|
+
|
|
17
|
+
1. **Creates a new Next.js application**: It runs `create-next-app` to scaffold a new project.
|
|
18
|
+
2. **Adds AI Development Standards**: It creates a `.claude/SKILLS.md` file in your project. This file contains a set of development standards and best practices optimized for working with AI assistants like Claude.
|
|
19
|
+
3. **Sets up Project Structure**: It creates common folders like `components`, `lib`, and `utils` to organize your code. It correctly handles both standard and `src` directory layouts.
|
|
20
|
+
4. **Environment Files**: It creates `.env` and `.env.local` files for managing your environment variables.
|
package/index.js
CHANGED
|
@@ -109,22 +109,39 @@ async function main() {
|
|
|
109
109
|
function createProjectFolders(targetDir) {
|
|
110
110
|
const projectPath = path.join(process.cwd(), targetDir);
|
|
111
111
|
const appDir = path.join(projectPath, 'app');
|
|
112
|
-
const
|
|
112
|
+
const srcDir = path.join(projectPath, 'src');
|
|
113
|
+
const srcAppDir = path.join(srcDir, 'app');
|
|
114
|
+
const pagesDir = path.join(projectPath, 'pages'); // Still useful to differentiate App vs Pages router
|
|
115
|
+
|
|
116
|
+
let isAppRouter = false;
|
|
117
|
+
let basePath = projectPath; // Default to root
|
|
118
|
+
|
|
119
|
+
// Check for App Router in src directory first
|
|
120
|
+
if (fs.existsSync(srcAppDir) && !fs.existsSync(pagesDir)) {
|
|
121
|
+
isAppRouter = true;
|
|
122
|
+
basePath = srcDir; // If src/app exists, new folders go inside src
|
|
123
|
+
console.log('App Router with src directory setup detected.');
|
|
124
|
+
}
|
|
125
|
+
// Then check for App Router in root directory
|
|
126
|
+
else if (fs.existsSync(appDir) && !fs.existsSync(pagesDir)) {
|
|
127
|
+
isAppRouter = true;
|
|
128
|
+
basePath = projectPath; // If app exists at root, new folders go at root
|
|
129
|
+
console.log('App Router setup detected.');
|
|
130
|
+
}
|
|
113
131
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
console.log('App Router setup detected. Creating additional folders...');
|
|
132
|
+
if (isAppRouter) {
|
|
133
|
+
console.log('Creating additional folders...');
|
|
117
134
|
const foldersToCreate = ['components', 'lib', 'utils'];
|
|
118
135
|
foldersToCreate.forEach(folder => {
|
|
119
|
-
const folderPath = path.join(
|
|
136
|
+
const folderPath = path.join(basePath, folder);
|
|
120
137
|
if (!fs.existsSync(folderPath)) {
|
|
121
138
|
fs.mkdirSync(folderPath, { recursive: true });
|
|
122
|
-
console.log(`Created folder: ${
|
|
139
|
+
console.log(`Created folder: ${path.relative(projectPath, folderPath)}`);
|
|
123
140
|
}
|
|
124
141
|
});
|
|
125
142
|
}
|
|
126
143
|
|
|
127
|
-
// Create .env and .env.local files
|
|
144
|
+
// Create .env and .env.local files at the project root
|
|
128
145
|
const envFiles = ['.env', '.env.local'];
|
|
129
146
|
envFiles.forEach(file => {
|
|
130
147
|
const filePath = path.join(projectPath, file);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-skill",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Create a Next.js app with .claude/SKILLS.md",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Create a Next.js app with .claude/SKILLS.md and folders for components, libs, and utils along with env files.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"next-skill": "./index.js"
|