taskmonkey-cli 0.10.0 → 0.10.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/package.json +1 -1
- package/src/commands/pull.js +11 -7
package/package.json
CHANGED
package/src/commands/pull.js
CHANGED
|
@@ -36,17 +36,21 @@ export async function pull() {
|
|
|
36
36
|
written++;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// Write docs if available
|
|
39
|
+
// Write docs if available. The server returns relative paths that may
|
|
40
|
+
// contain subdirectories (e.g. cms/contao.md), so we need to mkdir -p
|
|
41
|
+
// the dirname of each full target path, not just the top-level folder.
|
|
40
42
|
if (docs?.files) {
|
|
41
43
|
for (const [name, content] of Object.entries(docs.files)) {
|
|
42
|
-
// shared/ files go to shared/,
|
|
43
|
-
const
|
|
44
|
+
// shared/ files go to shared/, everything else to docs/
|
|
45
|
+
const isShared = name.startsWith('shared/');
|
|
46
|
+
const baseDir = isShared
|
|
44
47
|
? join(config._configDir, 'shared')
|
|
45
48
|
: join(config._configDir, 'docs');
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const relName = isShared ? name.substring(7) : name;
|
|
50
|
+
const fullPath = join(baseDir, relName);
|
|
51
|
+
mkdirSync(dirname(fullPath), { recursive: true });
|
|
52
|
+
writeFileSync(fullPath, content);
|
|
53
|
+
console.log(chalk.gray(` ${isShared ? 'shared' : 'docs'}/${relName}`));
|
|
50
54
|
written++;
|
|
51
55
|
}
|
|
52
56
|
}
|