create-vault-cms 1.0.0

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/LICENSE +21 -0
  2. package/README.md +72 -0
  3. package/package.json +33 -0
  4. package/src/cli.js +81 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 David V. Kimball
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,72 @@
1
+ # Vault CMS
2
+
3
+ Use [Obsidian](https://obsidian.md) as a content management system for your [Astro](https://astro.build) website.
4
+
5
+ ![Vault CMS cover with Obsidian and Astro logos at the bottom.](https://github.com/user-attachments/assets/fb5d8368-71dd-4bf8-8851-36ada6d4f530)
6
+
7
+
8
+ ## Video Guide
9
+
10
+ šŸ“ŗ [Video Guide](https://youtu.be/dSm8aLPdVz0)
11
+
12
+ ## Features
13
+
14
+ - Easy integration into Astro website projects
15
+ - **Auto-detection** of your Astro theme and content structure
16
+ - Preconfigured plugins, hotkeys and settings optimized for Astro workflows
17
+ - CMS-like homepage using Obsidian Bases
18
+ - Works with any Astro theme by automatically detecting content types and frontmatter properties
19
+ - Optional instant-publish option via the Git plugin
20
+
21
+ ![Vault CMS Showcase.](https://github.com/user-attachments/assets/0d1ea89e-9d6b-40b1-944d-cfe6143e222e)
22
+
23
+ > [!NOTE]
24
+ > Preconfigured vaults for [Slate](https://github.com/SlateDesign/slate-blog), [Chiri](https://github.com/the3ash/astro-chiri), and [Starlight](https://github.com/withastro/starlight) have moved to the [Presets](https://github.com/davidvkimball/vault-cms-presets) repo. 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).
25
+
26
+ ## Installation Guide
27
+
28
+ 1. Clone or install your Astro theme of choice.
29
+ 2. Clone or download a zip of this repo.
30
+ 3. Copy the contents of the `Starter Vault` folder into your Astro project. **Recommended location:** `src/content` folder, but it can be placed at the level of `src/content` or higher (like the project root).
31
+ 4. Open Obsidian and select the "Open folder as vault" option, and select the folder containing the `.obsidian` directory.
32
+ 5. The Vault CMS plugin will automatically detect your Astro project structure and guide you through setup via a wizard.
33
+
34
+ ### Starter Vault vs Theme Examples
35
+
36
+ - **`Starter Vault`**: This is the adaptive vault that works with any Astro theme. It automatically detects your theme's structure and configures itself accordingly. This is what you should copy into your project.
37
+
38
+ - **`Theme Examples`**: This folder contains preconfigured vault examples for specific Astro themes (Slate, Chiri, Starlight). These serve as reference examples showing how Vault CMS can be configured for particular themes. You don't need to use these unless you want to see theme-specific configurations.
39
+
40
+ ### Using Theme Examples
41
+
42
+ If you're using one of the supported themes (Slate, Chiri, or Starlight) and want to use a preconfigured vault example instead of the adaptive Starter Vault:
43
+
44
+ 1. Navigate to the `Theme Examples` folder and find your theme's folder (e.g., `Slate`, `Chiri`, or `Starlight`).
45
+ 2. **Copy the CONTENTS** of that theme folder (not the folder itself) into your Astro project's `src/content` folder.
46
+ - āš ļø **Important**: Copy the files and folders inside the theme folder, not the theme folder itself. For example, if using Slate, copy the contents of `Theme Examples/Slate/` (like `_bases/`, `post/`, etc.) into `src/content/`, not the `Slate` folder. (Note: `_bases` is the new standard, but `bases` is still supported for backwards compatibility).
47
+ 3. Open Obsidian and select "Open folder as vault", then select your `src/content` folder (or the folder containing the `.obsidian` directory).
48
+ 4. The vault should already be preconfigured for your theme.
49
+
50
+ > [!TIP]
51
+ > If you're unsure which to use, start with the **Starter Vault** - it will automatically adapt to your theme. Use the Theme Examples only if you want to see a preconfigured setup for a specific theme.
52
+
53
+ ## How Auto-Detection Works
54
+
55
+ Vault CMS automatically detects and configures itself based on your Astro project:
56
+
57
+ - **Project Detection**: Automatically finds your Astro project by locating `astro.config.mjs`, `astro.config.ts`, or other Astro config files
58
+ - **Content Type Detection**: Scans your content folders (like `posts`, `pages`, `docs`, etc.) and automatically identifies them as content types
59
+ - **Frontmatter Analysis**: Analyzes existing content files to detect frontmatter properties (title, date, description, etc.) and configures the plugin accordingly
60
+ - **Theme Adaptation**: Adapts to your Astro theme's specific quirks and requirements automatically
61
+
62
+ When you first open the vault, a setup wizard will guide you through the configuration process. The wizard uses the auto-detected information to pre-populate settings, making setup quick and easy. You can always run the wizard again later by using the "Open Setup Wizard" command.
63
+
64
+ ### Recommended .gitignore
65
+
66
+ Add the following to your Astro project's `.gitignore` file:
67
+ ```
68
+ # Obsidian workspace files
69
+ **/.obsidian/workspace.json
70
+ **/.obsidian/workspace-mobile.json
71
+ ```
72
+ This prevents conflicts between multiple devices.
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "create-vault-cms",
3
+ "version": "1.0.0",
4
+ "description": "Installer for Vault CMS",
5
+ "main": "src/cli.js",
6
+ "bin": {
7
+ "create-vault-cms": "src/cli.js"
8
+ },
9
+ "files": [
10
+ "src",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "scripts": {
15
+ "test": "echo \"Error: no test specified\" && exit 1"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/davidvkimball/vault-cms.git"
20
+ },
21
+ "keywords": [],
22
+ "author": "",
23
+ "license": "ISC",
24
+ "type": "commonjs",
25
+ "bugs": {
26
+ "url": "https://github.com/davidvkimball/vault-cms/issues"
27
+ },
28
+ "homepage": "https://github.com/davidvkimball/vault-cms#readme",
29
+ "dependencies": {
30
+ "commander": "^14.0.2",
31
+ "fs-extra": "^11.3.3"
32
+ }
33
+ }
package/src/cli.js ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { Command } = require('commander');
4
+ const fs = require('fs-extra');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const program = new Command();
9
+
10
+ program
11
+ .name('create-vault-cms')
12
+ .description('Official installer for Vault CMS')
13
+ .version('1.0.0');
14
+
15
+ program
16
+ .argument('[target]', 'target directory', '.')
17
+ .option('-t, --template <name>', 'template to use (from vault-cms-presets)')
18
+ .action(async (target, options) => {
19
+ const targetDir = path.resolve(target);
20
+ const tempDir = path.join(targetDir, '.vault-cms-temp');
21
+
22
+ const repoUrl = options.template
23
+ ? 'https://github.com/davidvkimball/vault-cms-presets.git'
24
+ : 'https://github.com/davidvkimball/vault-cms.git';
25
+
26
+ console.log(`šŸš€ Installing Vault CMS${options.template ? ` (template: ${options.template})` : ''}...`);
27
+
28
+ try {
29
+ // 1. Download
30
+ console.log(' šŸ“¦ Downloading files...');
31
+ execSync(`git clone --depth 1 ${repoUrl} "${tempDir}"`, { stdio: 'ignore' });
32
+
33
+ // 2. Determine source path
34
+ const sourcePath = options.template ? path.join(tempDir, options.template) : tempDir;
35
+
36
+ if (!(await fs.pathExists(sourcePath))) {
37
+ throw new Error(`Template "${options.template}" not found in presets repository.`);
38
+ }
39
+
40
+ // 3. Define what to keep
41
+ const toKeep = ['_bases', '.obsidian', 'README.md'];
42
+
43
+ // 4. Move selected files
44
+ await fs.ensureDir(targetDir);
45
+ for (const item of toKeep) {
46
+ const src = path.join(sourcePath, item);
47
+ const dest = path.join(targetDir, item);
48
+
49
+ if (await fs.pathExists(src)) {
50
+ await fs.copy(src, dest);
51
+ console.log(` āœ“ Added ${item}`);
52
+ }
53
+ }
54
+
55
+ // 5. Update .gitignore
56
+ const gitignorePath = path.join(targetDir, '.gitignore');
57
+ const ignores = '\n# Vault CMS / Obsidian\n.obsidian/workspace.json\n.obsidian/workspace-mobile.json\n.ref/\n';
58
+
59
+ if (await fs.pathExists(gitignorePath)) {
60
+ const content = await fs.readFile(gitignorePath, 'utf8');
61
+ if (!content.includes('.obsidian/workspace.json')) {
62
+ await fs.appendFile(gitignorePath, ignores);
63
+ console.log(' āœ“ Updated .gitignore');
64
+ }
65
+ } else {
66
+ await fs.writeFile(gitignorePath, ignores.trim() + '\n');
67
+ console.log(' āœ“ Created .gitignore');
68
+ }
69
+
70
+ // 6. Cleanup
71
+ await fs.remove(tempDir);
72
+
73
+ console.log('\n✨ Vault CMS is ready!');
74
+ } catch (err) {
75
+ console.error('\nāŒ Installation failed:', err.message);
76
+ if (await fs.pathExists(tempDir)) await fs.remove(tempDir);
77
+ process.exit(1);
78
+ }
79
+ });
80
+
81
+ program.parse();