diff --git a/package.json b/package.json index 6377d59556..9bb0b9d8ad 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "buildCommandIndex": "gulp buildCommandIndex", "buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out ../joplin-website/docs/api/references/plugin_api packages/lib/services/plugins/api/", "updateMarkdownDoc": "node ./packages/tools/updateMarkdownDoc", - "buildSettingJsonSchema": "yarn workspace joplin start -- settingschema ../../../joplin-website/docs/schema/settings.json", + "buildSettingJsonSchema": "yarn workspace joplin start settingschema ../../../joplin-website/docs/schema/settings.json", "buildTranslations": "node packages/tools/build-translation.js", "buildWebsite": "node ./packages/tools/website/build.js && yarn run buildPluginDoc && yarn run buildSettingJsonSchema", "circularDependencyCheck": "madge --warning --circular --extensions js ./", diff --git a/packages/tools/website/build.ts b/packages/tools/website/build.ts index db5ebe350a..4797676bd6 100644 --- a/packages/tools/website/build.ts +++ b/packages/tools/website/build.ts @@ -19,6 +19,7 @@ const docDir = `${dirname(dirname(dirname(dirname(__dirname))))}/joplin-website/ if (!pathExistsSync(docDir)) throw new Error(`Doc directory does not exist: ${docDir}`); const websiteAssetDir = `${rootDir}/Assets/WebsiteAssets`; +const readmeDir = `${rootDir}/readme`; const mainTemplateHtml = readFileSync(`${websiteAssetDir}/templates/main-new.mustache`, 'utf8'); const frontTemplateHtml = readFileSync(`${websiteAssetDir}/templates/front.mustache`, 'utf8'); const plansTemplateHtml = readFileSync(`${websiteAssetDir}/templates/plans.mustache`, 'utf8'); @@ -247,7 +248,7 @@ async function main() { // PLANS PAGE // ============================================================= - const planPageFaqMd = await readFile(`${rootDir}/readme/faq_joplin_cloud.md`, 'utf8'); + const planPageFaqMd = await readFile(`${readmeDir}/faq_joplin_cloud.md`, 'utf8'); const planPageFaqHtml = getMarkdownIt().render(planPageFaqMd, {}); const planPageParams: PlanPageParams = { @@ -276,17 +277,21 @@ async function main() { // Markdown files under /readme // ============================================================= - const mdFiles = glob.sync(`${rootDir}/readme/**/*.md`).map((f: string) => f.substr(rootDir.length + 1)); + const mdFiles = glob.sync(`${readmeDir}/**/*.md`).map((f: string) => f.substr(rootDir.length + 1)); const sources = []; const donateLinksMd = await getDonateLinks(); const makeTargetFilePath = (input: string): string => { - const filenameNoExt = basename(input, '.md'); - if (isNewsFile(input)) { - return `${docDir}/news/${filenameNoExt}/index.html`; // `${input.replace(/\.md/, '').replace(/readme\/news\//, 'docs/news/')}/index.html`; + const filenameNoExt = basename(input, '.md'); + return `${docDir}/news/${filenameNoExt}/index.html`; } else { - return `${docDir}/${filenameNoExt}/index.html`; + // Input is for example "readme/spec/interop_with_frontmatter.md", + // and we need to convert it to + // "docs/spec/interop_with_frontmatter/index.html" and prefix it + // with the website repo full path. + + return `${docDir}/${input.replace(/\.md/, '/index.html').replace(/readme\//, '')}`; } };