commit
4a92cc3879
1708 changed files with 126187 additions and 18066 deletions
@ -1,14 +0,0 @@ |
|||||||
export function ReadonlyEditor(props: any) { |
|
||||||
return ( |
|
||||||
<div className="fixed bottom-0 left-0 right-0 top-0 z-[9999] border bg-white p-5 text-black"> |
|
||||||
<h2 className="mb-2 text-xl font-semibold">Private Component</h2> |
|
||||||
<p className="mb-4"> |
|
||||||
Renderer is a private component. If you are a collaborator and have |
|
||||||
access to it. Run the following command: |
|
||||||
</p> |
|
||||||
<code className="mt-5 rounded-md bg-gray-800 p-2 text-white"> |
|
||||||
npm run generate-renderer |
|
||||||
</code> |
|
||||||
</div> |
|
||||||
); |
|
||||||
} |
|
@ -1,14 +0,0 @@ |
|||||||
export function Renderer(props: any) { |
|
||||||
return ( |
|
||||||
<div className="fixed bottom-0 left-0 right-0 top-0 z-[9999] border bg-white p-5 text-black"> |
|
||||||
<h2 className="mb-2 text-xl font-semibold">Private Component</h2> |
|
||||||
<p className="mb-4"> |
|
||||||
Renderer is a private component. If you are a collaborator and have |
|
||||||
access to it. Run the following command: |
|
||||||
</p> |
|
||||||
<code className="mt-5 rounded-md bg-gray-800 p-2 text-white"> |
|
||||||
npm run generate-renderer |
|
||||||
</code> |
|
||||||
</div> |
|
||||||
); |
|
||||||
} |
|
@ -1,5 +0,0 @@ |
|||||||
export function renderFlowJSON(data: any, options?: any) { |
|
||||||
console.warn("renderFlowJSON is not implemented"); |
|
||||||
console.warn("run the following command to generate the renderer:"); |
|
||||||
console.warn("> npm run generate-renderer"); |
|
||||||
} |
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,2 @@ |
|||||||
|
packages: |
||||||
|
- packages/* |
@ -1,14 +0,0 @@ |
|||||||
export function Renderer(props: any) { |
|
||||||
return ( |
|
||||||
<div className="fixed bottom-0 left-0 right-0 top-0 z-[9999] border bg-white p-5 text-black"> |
|
||||||
<h2 className="mb-2 text-xl font-semibold">Private Component</h2> |
|
||||||
<p className="mb-4"> |
|
||||||
Renderer is a private component. If you are a collaborator and have |
|
||||||
access to it. Run the following command: |
|
||||||
</p> |
|
||||||
<code className="mt-5 rounded-md bg-gray-800 p-2 text-white"> |
|
||||||
npm run generate-renderer |
|
||||||
</code> |
|
||||||
</div> |
|
||||||
); |
|
||||||
} |
|
@ -1,5 +0,0 @@ |
|||||||
export function renderFlowJSON(data: any, options?: any) { |
|
||||||
console.warn("renderFlowJSON is not implemented"); |
|
||||||
console.warn("run the following command to generate the renderer:"); |
|
||||||
console.warn("> npm run generate-renderer"); |
|
||||||
} |
|
@ -0,0 +1,76 @@ |
|||||||
|
import fs from 'node:fs/promises'; |
||||||
|
import path from 'node:path'; |
||||||
|
import { fileURLToPath } from 'node:url'; |
||||||
|
import type { Node } from '@roadmapsh/editor'; |
||||||
|
import matter from 'gray-matter'; |
||||||
|
import type { RoadmapFrontmatter } from '../src/lib/roadmap'; |
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url); |
||||||
|
const __dirname = path.dirname(__filename); |
||||||
|
|
||||||
|
// Directory containing the roadmaps
|
||||||
|
const ROADMAP_CONTENT_DIR = path.join(__dirname, '../src/data/roadmaps'); |
||||||
|
const allRoadmaps = await fs.readdir(ROADMAP_CONTENT_DIR); |
||||||
|
|
||||||
|
const editorRoadmapIds = new Set<string>(); |
||||||
|
for (const roadmapId of allRoadmaps) { |
||||||
|
const roadmapFrontmatterDir = path.join( |
||||||
|
ROADMAP_CONTENT_DIR, |
||||||
|
roadmapId, |
||||||
|
`${roadmapId}.md`, |
||||||
|
); |
||||||
|
const roadmapFrontmatterRaw = await fs.readFile( |
||||||
|
roadmapFrontmatterDir, |
||||||
|
'utf-8', |
||||||
|
); |
||||||
|
const { data } = matter(roadmapFrontmatterRaw); |
||||||
|
|
||||||
|
const roadmapFrontmatter = data as RoadmapFrontmatter; |
||||||
|
if (roadmapFrontmatter.renderer === 'editor') { |
||||||
|
editorRoadmapIds.add(roadmapId); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
for (const roadmapId of editorRoadmapIds) { |
||||||
|
const roadmapJSONDir = path.join( |
||||||
|
ROADMAP_CONTENT_DIR, |
||||||
|
roadmapId, |
||||||
|
`${roadmapId}.json`, |
||||||
|
); |
||||||
|
|
||||||
|
const roadmapJSONRaw = await fs.readFile(roadmapJSONDir, 'utf-8'); |
||||||
|
const roadmapJSON = JSON.parse(roadmapJSONRaw); |
||||||
|
|
||||||
|
const roadmapNodes = roadmapJSON.nodes as Node[]; |
||||||
|
const updatedNodes = roadmapNodes.map((node) => { |
||||||
|
const width = +(node?.width || node?.style?.width || 0); |
||||||
|
const height = +(node?.height || node?.style?.height || 0); |
||||||
|
|
||||||
|
const ADDITIONAL_WIDTH = 1; |
||||||
|
// adding one `1px` in width to avoid the node to be cut in half
|
||||||
|
// this is a quick fix to avoid the issue
|
||||||
|
if (node?.style?.width) { |
||||||
|
node.style.width = width + ADDITIONAL_WIDTH; |
||||||
|
} |
||||||
|
|
||||||
|
if (node?.width) { |
||||||
|
node.width = width + ADDITIONAL_WIDTH; |
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
...node, |
||||||
|
measured: { |
||||||
|
width: width + ADDITIONAL_WIDTH, |
||||||
|
height, |
||||||
|
}, |
||||||
|
}; |
||||||
|
}); |
||||||
|
|
||||||
|
const updatedRoadmapJSON = { |
||||||
|
...roadmapJSON, |
||||||
|
nodes: updatedNodes, |
||||||
|
}; |
||||||
|
|
||||||
|
const updatedRoadmapJSONString = JSON.stringify(updatedRoadmapJSON, null, 2); |
||||||
|
await fs.writeFile(roadmapJSONDir, updatedRoadmapJSONString, 'utf-8'); |
||||||
|
} |
@ -0,0 +1,58 @@ |
|||||||
|
import fs from 'fs'; |
||||||
|
import path from 'path'; |
||||||
|
|
||||||
|
const roadmapDirs = fs.readdirSync( |
||||||
|
path.join(__dirname, '..', 'src', 'data', 'roadmaps'), |
||||||
|
); |
||||||
|
|
||||||
|
roadmapDirs.forEach((roadmapDir) => { |
||||||
|
const roadmapDirPath = path.join( |
||||||
|
__dirname, |
||||||
|
'..', |
||||||
|
'src', |
||||||
|
'data', |
||||||
|
'roadmaps', |
||||||
|
roadmapDir, |
||||||
|
'content', |
||||||
|
); |
||||||
|
|
||||||
|
const roadmapDirContent = fs.readdirSync(roadmapDirPath); |
||||||
|
|
||||||
|
roadmapDirContent.forEach((content) => { |
||||||
|
const contentPath = path.join(roadmapDirPath, content); |
||||||
|
const contentStats = fs.statSync(contentPath); |
||||||
|
|
||||||
|
const oldName = path.basename(contentPath); |
||||||
|
const newName = oldName.replace(/^(\d+)-/, ''); |
||||||
|
|
||||||
|
fs.renameSync(contentPath, path.join(roadmapDirPath, newName)); |
||||||
|
|
||||||
|
if (contentStats.isDirectory()) { |
||||||
|
const contentDirContent = fs.readdirSync(contentPath); |
||||||
|
|
||||||
|
contentDirContent.forEach((contentDir) => { |
||||||
|
const contentDirPath = path.join(contentPath, contentDir); |
||||||
|
const contentDirStats = fs.statSync(contentDirPath); |
||||||
|
|
||||||
|
const oldName = path.basename(contentDirPath); |
||||||
|
const newName = oldName.replace(/^(\d+)-/, ''); |
||||||
|
|
||||||
|
fs.renameSync(contentDirPath, path.join(contentPath, newName)); |
||||||
|
|
||||||
|
if (contentDirStats.isDirectory()) { |
||||||
|
const contentDirContent = fs.readdirSync(contentDirPath); |
||||||
|
|
||||||
|
contentDirContent.forEach((contentDir) => { |
||||||
|
const contentDirPath2 = path.join(contentDirPath, contentDir); |
||||||
|
const contentDirStats2 = fs.statSync(contentDirPath2); |
||||||
|
|
||||||
|
const oldName2 = path.basename(contentDirPath2); |
||||||
|
const newName2 = oldName2.replace(/^(\d+)-/, ''); |
||||||
|
|
||||||
|
fs.renameSync(contentDirPath2, path.join(contentDirPath, newName2)); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,6 @@ |
|||||||
|
<script |
||||||
|
type='text/javascript' |
||||||
|
id='hs-script-loader' |
||||||
|
async |
||||||
|
defer |
||||||
|
src='//js.hs-scripts.com/46095657.js?businessUnitId=2306992'></script> |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue