create-vault-cms 1.0.7 → 1.0.9

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.
Files changed (4) hide show
  1. package/README.md +29 -23
  2. package/_GUIDE.md +26 -0
  3. package/package.json +3 -2
  4. package/src/cli.js +38 -16
package/README.md CHANGED
@@ -1,42 +1,37 @@
1
1
  # Vault CMS
2
2
 
3
- Use [Obsidian](https://obsidian.md) as a content management system for your [Astro](https://astro.build) website.
3
+ The open-source headless content management system that turns [Obsidian](https://obsidian.md) into a publishing platform for your [Astro](https://astro.build) website.
4
4
 
5
5
  ![Vault CMS cover with Obsidian and Astro logos at the bottom.](https://github.com/user-attachments/assets/fb5d8368-71dd-4bf8-8851-36ada6d4f530)
6
6
 
7
+ ## Features
8
+
9
+ - **Auto-detection and automation**: Understands your content structure and lets you focus on writing.
10
+ - **CMS-like homepage**: See your content in a visual grid and perform bulk actions.
11
+ - **Preconfigured**: Optimized settings, hotkeys, and plugins for the Astro workflow.
12
+ - **Headless and flexible**: Just Markdown files and a workspace ready to be customized by you.
13
+ - **Compatability**: Works with almost any Astro theme.
14
+
7
15
  ## Quick Start
8
16
 
9
- The fastest way to install Vault CMS into your Astro project is via the CLI:
17
+ The fastest way to install Vault CMS into your Astro project is via the CLI at your project root:
10
18
 
11
19
  ```bash
12
20
  pnpm create vault-cms
13
21
  ```
14
22
 
15
- *Follow the prompts to install into `src/content` or your desired directory.*
23
+ *Follow the prompts to install into `src/content` or your desired sub-directory.*
16
24
 
17
- ## Documentation
25
+ ### Manual Installation
18
26
 
19
- For full installation guides, plugin details, and customization options, read the [Vault CMS documentation](https://docs.vaultcms.org).
27
+ If you prefer to install manually, you can download the latest version of Vault CMS and place it directly into your Astro project.
20
28
 
21
- ## Features
29
+ 1. **Download the source**: [Clone this repository](https://github.com/davidvkimball/vault-cms) or [download the ZIP archive](https://github.com/davidvkimball/vault-cms/archive/refs/heads/master.zip).
30
+ 2. **Locate your content directory**: In most Astro projects, this is `src/content`.
31
+ 3. **Move the files**: Copy the `.obsidian` and `_bases` folders (and `_GUIDE.md`) from the Vault CMS source into your content directory.
32
+ 4. **Open in Obsidian**: Open the content directory as a new vault in Obsidian.
22
33
 
23
- - Easy integration into Astro website projects
24
- - **Auto-detection** of your Astro theme and content structure
25
- - Preconfigured plugins, hotkeys and settings optimized for Astro workflows
26
- - CMS-like homepage using Obsidian Bases
27
- - Works with any Astro theme by automatically detecting content types and frontmatter properties
28
- - Optional instant-publish option via the Git plugin
29
-
30
- ![Vault CMS Showcase.](https://github.com/user-attachments/assets/0d1ea89e-9d6b-40b1-944d-cfe6143e222e)
31
-
32
- ## Video Guide
33
-
34
- šŸ“ŗ [Video Guide](https://youtu.be/dSm8aLPdVz0)
35
-
36
- > [!NOTE]
37
- > To see Vault CMS combined with an Astro site specifically designed with it in mind, check out my theme [Astro Modular](https://github.com/davidvkimball/astro-modular).
38
-
39
- ## Presets
34
+ ### Presets
40
35
 
41
36
  If you are using a supported theme like **Starlight**, **Slate**, or **Chiri**, you can use a preconfigured preset:
42
37
 
@@ -45,3 +40,14 @@ pnpm create vault-cms -- --template starlight
45
40
  ```
46
41
 
47
42
  See all available presets at the [Presets Repo](https://github.com/davidvkimball/vault-cms-presets).
43
+
44
+ ## Deep Dive
45
+
46
+ - **Documentation**: [docs.vaultcms.org](https://docs.vaultcms.org)
47
+ - **Video Guide**: [Set Up Guide on YouTube](https://www.youtube.com/watch?v=3zeqJ5tqmaQ)
48
+ - **Community**: [Join the Discord](https://discord.gg/gyrNHAwHK8)
49
+
50
+ > [!NOTE]
51
+ > To see Vault CMS combined with an Astro site specifically designed with it in mind, check out the [Astro Modular](https://github.com/davidvkimball/astro-modular) theme.
52
+
53
+ ![Vault CMS Showcase.](https://github.com/user-attachments/assets/0d1ea89e-9d6b-40b1-944d-cfe6143e222e)
package/_GUIDE.md ADDED
@@ -0,0 +1,26 @@
1
+ # Welcome to Vault CMS
2
+
3
+ ## Run the setup wizard
4
+
5
+ If you just installed Vault CMS, the most important step is running the wizard. It will detect your Astro theme and configure your content types automatically.
6
+
7
+ > [!TIP]
8
+ > **Command**: Press `Ctrl/Cmd + P` and search for **"Vault CMS: Open Wizard"** if you closed it.
9
+
10
+ ## The CMS home base
11
+
12
+ We use a custom Obsidian bases view to give you a bird's-eye view of your content.
13
+
14
+ > [!NOTE]
15
+ > Click the **Home** icon in your tab bar or open the `_bases/Home.base` file to see your content in a grid view.
16
+
17
+ ## Key workflows
18
+
19
+ - **Writing**: hust use `Ctrl/Cmd + N` to create a new file using your default content type and start writing.
20
+ - **Publishing**: use the **Git: Push** command (or click the up arrow in the status bar) to send your changes live to your Astro site.
21
+
22
+ ### Need help?
23
+
24
+ - **Documentation**: [docs.vaultcms.org](https://docs.vaultcms.org)
25
+ - **Community**: [join the Discord](https://discord.gg/gyrNHAwHK8)
26
+ - **Video Guide**: [set up guide on YouTube](https://www.youtube.com/watch?v=3zeqJ5tqmaQ)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vault-cms",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Installer for Vault CMS",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -9,6 +9,7 @@
9
9
  "files": [
10
10
  "src",
11
11
  "README.md",
12
+ "_GUIDE.md",
12
13
  "LICENSE"
13
14
  ],
14
15
  "scripts": {
@@ -32,4 +33,4 @@
32
33
  "fs-extra": "^11.3.3",
33
34
  "inquirer": "^8.2.7"
34
35
  }
35
- }
36
+ }
package/src/cli.js CHANGED
@@ -24,7 +24,7 @@ program
24
24
  console.log('šŸš€ Initializing Vault CMS Installer...');
25
25
 
26
26
  const availableTemplates = await fetchTemplates();
27
-
27
+
28
28
  let template = options.template;
29
29
  let targetPath = target;
30
30
 
@@ -67,11 +67,12 @@ program
67
67
  const targetDir = path.resolve(targetPath);
68
68
  const tempZip = path.join(targetDir, 'vault-cms-temp.zip');
69
69
  const extractDir = path.join(targetDir, '.vault-cms-temp-extract');
70
-
70
+
71
71
  const repoName = template ? 'vault-cms-presets' : 'vault-cms';
72
72
  const zipUrl = `https://github.com/davidvkimball/${repoName}/archive/refs/heads/master.zip`;
73
73
 
74
74
  console.log(`\nšŸš€ Installing Vault CMS${template ? ` (template: ${template})` : ''}...`);
75
+ console.log(` šŸ“ Target directory: ${targetDir}`);
75
76
 
76
77
  await fs.ensureDir(targetDir);
77
78
 
@@ -82,7 +83,13 @@ program
82
83
  const zip = new AdmZip(tempZip);
83
84
  zip.extractAllTo(extractDir, true);
84
85
 
85
- const folders = await fs.readdir(extractDir);
86
+ const items = await fs.readdir(extractDir);
87
+ const folders = items.filter(item => fs.statSync(path.join(extractDir, item)).isDirectory());
88
+
89
+ if (folders.length === 0) {
90
+ throw new Error('Could not find content in the downloaded archive.');
91
+ }
92
+
86
93
  const innerFolder = path.join(extractDir, folders[0]);
87
94
  const sourcePath = template ? path.join(innerFolder, template) : innerFolder;
88
95
 
@@ -90,11 +97,11 @@ program
90
97
  throw new Error(`Template "${template}" not found in presets repository.`);
91
98
  }
92
99
 
93
- const toKeep = ['_bases', '.obsidian', 'README.md'];
100
+ const toKeep = ['_bases', '.obsidian', '_GUIDE.md'];
94
101
  for (const item of toKeep) {
95
102
  const src = path.join(sourcePath, item);
96
103
  const dest = path.join(targetDir, item);
97
-
104
+
98
105
  if (await fs.pathExists(src)) {
99
106
  await fs.copy(src, dest, { overwrite: true });
100
107
  console.log(` āœ“ Added ${item}`);
@@ -105,21 +112,30 @@ program
105
112
  const projectRoot = await findProjectRoot(targetDir);
106
113
  const gitignorePath = path.join(projectRoot, '.gitignore');
107
114
  const ignores = '\n# Vault CMS / Obsidian\n.obsidian/workspace.json\n.obsidian/workspace-mobile.json\n.ref/\n';
108
-
115
+
116
+ const isExternalRoot = projectRoot !== targetDir && !targetDir.startsWith(projectRoot);
117
+
109
118
  if (await fs.pathExists(gitignorePath)) {
110
119
  const content = await fs.readFile(gitignorePath, 'utf8');
111
120
  if (!content.includes('.obsidian/workspace.json')) {
112
121
  await fs.appendFile(gitignorePath, ignores);
113
122
  console.log(` āœ“ Updated .gitignore at ${path.relative(process.cwd(), gitignorePath)}`);
114
123
  }
115
- } else {
124
+ } else if (!isExternalRoot) {
116
125
  await fs.writeFile(gitignorePath, ignores.trim() + '\n');
117
126
  console.log(` āœ“ Created .gitignore at ${path.relative(process.cwd(), gitignorePath)}`);
127
+ } else {
128
+ console.log(` āš ļø Skipped .gitignore (could not find a safe project root)`);
118
129
  }
119
130
 
120
131
  await fs.remove(tempZip);
121
132
  await fs.remove(extractDir);
122
133
 
134
+ if (projectRoot === targetDir) {
135
+ console.log('\n āš ļø Note: No Astro project or package.json found in parent directories.');
136
+ console.log(' Installation completed, but you may need to move these files into your content folder manually.');
137
+ }
138
+
123
139
  console.log('\n✨ Vault CMS is ready!');
124
140
  process.exit(0);
125
141
  } catch (err) {
@@ -129,14 +145,20 @@ program
129
145
  });
130
146
 
131
147
  async function findProjectRoot(startDir) {
132
- let current = startDir;
133
- while (current !== path.parse(current).root) {
134
- const hasPkg = await fs.pathExists(path.join(current, 'package.json'));
135
- const hasAstro = await fs.pathExists(path.join(current, 'astro.config.mjs')) || await fs.pathExists(path.join(current, 'astro.config.ts'));
136
- if (hasPkg || hasAstro) return current;
137
- current = path.dirname(current);
138
- }
139
- return startDir; // Fallback to target dir
148
+ let current = startDir;
149
+ // Look up to 6 levels up for a project root (Astro config, package.json, or .git)
150
+ let depth = 0;
151
+ while (current !== path.parse(current).root && depth < 6) {
152
+ const hasPkg = await fs.pathExists(path.join(current, 'package.json'));
153
+ const hasAstro = await fs.pathExists(path.join(current, 'astro.config.mjs')) || await fs.pathExists(path.join(current, 'astro.config.ts'));
154
+ const hasGit = await fs.pathExists(path.join(current, '.git'));
155
+
156
+ if (hasPkg || hasAstro || hasGit) return current;
157
+
158
+ current = path.dirname(current);
159
+ depth++;
160
+ }
161
+ return startDir; // Fallback to target dir
140
162
  }
141
163
 
142
164
  function downloadFile(url, dest) {
@@ -172,7 +194,7 @@ function fetchTemplates() {
172
194
  .map(item => item.name);
173
195
  resolve(dirs);
174
196
  } catch (e) {
175
- resolve(['starlight', 'slate', 'chiri']);
197
+ resolve(['starlight', 'slate', 'chiri']);
176
198
  }
177
199
  });
178
200
  }).on('error', () => resolve(['starlight', 'slate', 'chiri']));