File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ pnpm objectdocs init
9191This will:
9292- Copy the site engine to ` content/.objectdocs `
9393- Install necessary dependencies
94+ - Automatically add ` content/.objectdocs ` to ` .gitignore `
9495- Prepare your project for development
9596
9697### 4. Add content
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ pnpm objectdocs init
3535This command:
3636- Copies the ` @objectdocs/site ` package to ` content/.objectdocs `
3737- Installs necessary dependencies
38+ - Automatically adds ` content/.objectdocs ` to ` .gitignore `
3839- Prepares your project for local development
3940
4041### Site Management
Original file line number Diff line number Diff line change @@ -65,6 +65,28 @@ export function registerInitCommand(cli) {
6565
6666 console . log ( '✅ ObjectDocs site copied successfully!\n' ) ;
6767
68+ // Add to .gitignore
69+ const gitignorePath = path . resolve ( process . cwd ( ) , '.gitignore' ) ;
70+ const gitignoreEntry = 'content/.objectdocs' ;
71+
72+ try {
73+ let gitignoreContent = '' ;
74+ if ( fs . existsSync ( gitignorePath ) ) {
75+ gitignoreContent = fs . readFileSync ( gitignorePath , 'utf-8' ) ;
76+ }
77+
78+ // Check if the entry already exists
79+ if ( ! gitignoreContent . includes ( gitignoreEntry ) ) {
80+ // Add the entry with a comment
81+ const separator = gitignoreContent . trim ( ) ? '\n\n' : '' ;
82+ const newContent = gitignoreContent . trim ( ) + separator + '# ObjectDocs\n' + gitignoreEntry + '\n' ;
83+ fs . writeFileSync ( gitignorePath , newContent ) ;
84+ console . log ( '📝 Added content/.objectdocs to .gitignore\n' ) ;
85+ }
86+ } catch ( e ) {
87+ console . warn ( '⚠️ Could not update .gitignore:' , e . message ) ;
88+ }
89+
6890 // Install dependencies in the target directory
6991 console . log ( '📦 Installing dependencies...\n' ) ;
7092
You can’t perform that action at this time.
0 commit comments