@clidey/dory 0.15.0 โ†’ 0.17.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.
package/bin/dory.js CHANGED
@@ -14,15 +14,21 @@ const commands = {
14
14
  build: () => {
15
15
  console.log('๐ŸŸ Dory is ready to build your docs!');
16
16
 
17
- // Clear the docs folder if it exists
18
- const docsDir = resolve(__dirname, '..', 'docs');
17
+ const currentDir = process.cwd();
18
+ const userDocsDir = resolve(currentDir, 'docs');
19
+ const hasUserDocs = existsSync(userDocsDir);
20
+
21
+ // Use different temp directory if user has their own docs folder
22
+ const tempDirName = hasUserDocs ? '.dory-build-temp' : 'docs';
23
+ const docsDir = resolve(__dirname, '..', tempDirName);
24
+
25
+ // Clear the temp build folder if it exists
19
26
  if (existsSync(docsDir)) {
20
27
  console.log('๐Ÿงน Tidying up the workspace...');
21
28
  rmSync(docsDir, { recursive: true, force: true });
22
29
  }
23
30
 
24
31
  // Check if dory.json exists in current directory
25
- const currentDir = process.cwd();
26
32
  const doryConfigPath = resolve(currentDir, 'dory.json');
27
33
 
28
34
  if (!existsSync(doryConfigPath)) {
@@ -53,8 +59,9 @@ const commands = {
53
59
  }
54
60
  };
55
61
 
56
- // Copy all files and directories except node_modules, dist, and .git
57
- const excludeDirs = ['node_modules', 'dist', '.git', 'docs', 'pnpm-lock.yaml'];
62
+ // Copy all files and directories except node_modules, dist, .git, and temp build dir
63
+ // Don't exclude 'docs' if user has their own docs folder - we need to copy it
64
+ const excludeDirs = ['node_modules', 'dist', '.git', 'pnpm-lock.yaml', tempDirName];
58
65
 
59
66
  const items = readdirSync(currentDir);
60
67
  for (const item of items) {
@@ -88,7 +95,7 @@ const commands = {
88
95
  }
89
96
  rmSync(distDir, { recursive: true, force: true });
90
97
 
91
- // Revert docs folder back to original state
98
+ // Clean up temp build folder (but preserve user's docs folder if it exists)
92
99
  console.log('๐Ÿงน Cleaning up...');
93
100
  rmSync(docsDir, { recursive: true, force: true });
94
101
  console.log('โœ… All done!');
package/k8s/Dockerfile CHANGED
@@ -7,8 +7,7 @@ RUN apk add --no-cache git
7
7
 
8
8
  COPY ./k8s/config/nginx-default.conf /app/k8s/config/nginx-default.conf
9
9
 
10
- # Install dory globally
11
- RUN npm install -g @clidey/dory@latest
10
+ RUN npm install -g @clidey/dory@0.17.0
12
11
  EXPOSE 3000
13
12
 
14
13
  CMD ["dory", "preview"]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@clidey/dory",
3
3
  "private": false,
4
- "version": "0.15.0",
4
+ "version": "0.17.0",
5
5
  "type": "module",
6
6
  "description": "A CLI tool for building and previewing documentation sites",
7
7
  "keywords": [
@@ -100,21 +100,46 @@ export function preprocessMdxTags() {
100
100
  // Otherwise, leave as-is for proper JSX parsing
101
101
  return match;
102
102
  }
103
-
103
+ // For unknown components, always treat as text (wrap in backticks)
104
104
  // If already inside backticks, do not wrap again
105
- // Find the start of the line up to the match
106
105
  const before = processed.slice(0, offset);
107
- // Count the number of backticks before this tag
108
106
  const backtickMatches = before.match(/`+/g);
109
- // If the number of backticks is odd, we're inside a backtick span
110
107
  const insideBackticks = backtickMatches ? backtickMatches.reduce((acc, s) => acc + s.length, 0) % 2 === 1 : false;
111
108
  if (insideBackticks) {
112
109
  return match;
113
110
  }
114
- // Otherwise, wrap in backticks to prevent JSX parsing
115
111
  return `\`<${tag}>\``;
116
112
  });
117
113
 
114
+ // This regex finds all <tag> and </tag> occurrences
115
+ processed = processed.replace(/<\/?([a-z][a-z0-9]*)>/gi, (match, tag, offset) => {
116
+ // If inside a code block, do not touch
117
+ if (isInsideCodeBlock(processed, offset)) {
118
+ return match;
119
+ }
120
+
121
+ // If known component, check if it has a closing tag (only for opening tags)
122
+ if (KNOWN_COMPONENTS.includes(tag)) {
123
+ // Only check for matching closing tag for opening tags
124
+ if (!match.startsWith('</')) {
125
+ if (!hasMatchingClosingTag(processed, tag, offset)) {
126
+ return `\`${match}\``;
127
+ }
128
+ }
129
+ // Otherwise, leave as-is for proper JSX parsing
130
+ return match;
131
+ }
132
+ // For unknown components, always treat as text (wrap in backticks)
133
+ // If already inside backticks, do not wrap again
134
+ const before = processed.slice(0, offset);
135
+ const backtickMatches = before.match(/`+/g);
136
+ const insideBackticks = backtickMatches ? backtickMatches.reduce((acc, s) => acc + s.length, 0) % 2 === 1 : false;
137
+ if (insideBackticks) {
138
+ return match;
139
+ }
140
+ return `\`${match}\``;
141
+ });
142
+
118
143
  return {
119
144
  code: processed,
120
145
  map: null,