create-vault-cms 1.1.1 → 1.1.3
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/package.json +1 -1
- package/src/cli.js +9 -28
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -58,7 +58,7 @@ program
|
|
|
58
58
|
{
|
|
59
59
|
type: 'input',
|
|
60
60
|
name: 'path',
|
|
61
|
-
message: 'Where should we install Vault CMS?',
|
|
61
|
+
message: 'Where should we install Vault CMS? (use . for current folder)',
|
|
62
62
|
default: 'src/content',
|
|
63
63
|
}
|
|
64
64
|
]);
|
|
@@ -142,7 +142,7 @@ program
|
|
|
142
142
|
const { openObsidian } = await inquirer.prompt([{
|
|
143
143
|
type: 'confirm',
|
|
144
144
|
name: 'openObsidian',
|
|
145
|
-
message: 'Would you like to open this folder
|
|
145
|
+
message: 'Would you like to open Obsidian and add this folder as a vault?',
|
|
146
146
|
default: true
|
|
147
147
|
}]);
|
|
148
148
|
|
|
@@ -158,37 +158,18 @@ program
|
|
|
158
158
|
});
|
|
159
159
|
|
|
160
160
|
async function openInObsidian(targetPath) {
|
|
161
|
-
|
|
162
|
-
const normalizedPath = targetPath.replace(/\\/g, '/');
|
|
163
|
-
|
|
164
|
-
// Adding a trailing slash often helps Obsidian recognize it as a folder/vault
|
|
165
|
-
const folderUri = `obsidian://open?path=${encodeURIComponent(normalizedPath + '/')}`;
|
|
166
|
-
|
|
167
|
-
const anchors = [
|
|
168
|
-
path.join('_bases', 'Home.base'),
|
|
169
|
-
'_GUIDE.md'
|
|
170
|
-
];
|
|
171
|
-
|
|
172
|
-
let anchorFile = '';
|
|
173
|
-
for (const a of anchors) {
|
|
174
|
-
if (await fs.pathExists(path.join(targetPath, a))) {
|
|
175
|
-
anchorFile = a;
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const fileUri = anchorFile
|
|
181
|
-
? `obsidian://open?path=${encodeURIComponent(normalizedPath + '/' + anchorFile.replace(/\\/g, '/'))}`
|
|
182
|
-
: folderUri;
|
|
161
|
+
const obsidianUri = 'obsidian://choose-vault';
|
|
183
162
|
|
|
184
163
|
return new Promise((resolve) => {
|
|
185
164
|
const command = process.platform === 'win32'
|
|
186
|
-
? `start "" "${
|
|
165
|
+
? `start "" "${obsidianUri}"`
|
|
187
166
|
: process.platform === 'darwin'
|
|
188
|
-
? `open "${
|
|
189
|
-
: `xdg-open "${
|
|
167
|
+
? `open "${obsidianUri}"`
|
|
168
|
+
: `xdg-open "${obsidianUri}"`;
|
|
190
169
|
|
|
191
|
-
console.log(
|
|
170
|
+
console.log(`\n 📂 Opening Obsidian Vault Manager...`);
|
|
171
|
+
console.log(` 📍 Action: Click "Open folder as vault" and select:`);
|
|
172
|
+
console.log(` ${targetPath}\n`);
|
|
192
173
|
|
|
193
174
|
exec(command, (error) => {
|
|
194
175
|
if (error) {
|