diff --git a/README.md b/README.md index 191f838..1b38596 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,8 @@ Add to your `tsconfig.json`: "extends": "@tsconfig/svelte/tsconfig.json" ``` +> **NOTE**: After `@tsconfig/svelte@2.0.0`, you should add `/// ` to a `d.ts` or a `index.ts`(entry) file to prevent typescript error. + ### Contributing diff --git a/bases/react-native.json b/bases/react-native.json index d9e8a10..511b74f 100644 --- a/bases/react-native.json +++ b/bases/react-native.json @@ -13,6 +13,7 @@ "isolatedModules": true, "strict": true, "moduleResolution": "node", + "resolveJsonModule": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "skipLibCheck": false diff --git a/readme-extras/svelte.md b/readme-extras/svelte.md new file mode 100644 index 0000000..6d54bf7 --- /dev/null +++ b/readme-extras/svelte.md @@ -0,0 +1 @@ +> **NOTE**: After `@tsconfig/svelte@2.0.0`, you should add `/// ` to a `d.ts` or a `index.ts`(entry) file to prevent typescript error. diff --git a/scripts/create-npm-packages.ts b/scripts/create-npm-packages.ts index a2604b8..726580a 100644 --- a/scripts/create-npm-packages.ts +++ b/scripts/create-npm-packages.ts @@ -44,6 +44,20 @@ for await (const tsconfigEntry of Deno.readDir("bases")) { packageText = packageText.replace(/\[filename\]/g, name) .replace(/\[display_title\]/g, title) .replace(/\[tsconfig\]/g, Deno.readTextFileSync(tsconfigFilePath)) + + // Inject readme-extra if any + try { + const readmeExtra = (await Deno.readTextFile(path.join(packagePath, "readme-extras", `${name}.md`))).trim() + + if (readmeExtra) + packageText = packageText.replace(/\[readme-extra\]/g, `\n${readmeExtra}\n`) + } catch (error) { + // NOOP, there is no extra readme + // console.log(error) + } + + // Remove readme-extra placeholders if any + packageText = packageText.replace(/\[readme-extra\]/g, '') await Deno.writeTextFile(fileToEdit, packageText) }; diff --git a/scripts/update-markdown-readme.ts b/scripts/update-markdown-readme.ts index f89d6da..cee02b8 100644 --- a/scripts/update-markdown-readme.ts +++ b/scripts/update-markdown-readme.ts @@ -37,6 +37,13 @@ Add to your \`tsconfig.json\`: "extends": "@tsconfig/${name}/tsconfig.json" \`\`\` ` + + try { + const readmeExtra = (await Deno.readTextFile(`./readme-extras/${name}.md`)).trim() + + if (readmeExtra) + center += `\n${readmeExtra}\n` + } catch (error) {} }; const startMarker ="" diff --git a/template/README.md b/template/README.md index 51a0b8b..ea42fae 100644 --- a/template/README.md +++ b/template/README.md @@ -12,7 +12,7 @@ Add to your `tsconfig.json`: ```json "extends": "@tsconfig/[filename]/tsconfig.json" ``` - +[readme-extra] --- The `tsconfig.json`: @@ -21,4 +21,4 @@ The `tsconfig.json`: [tsconfig] ``` -You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/[filename].json). \ No newline at end of file +You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/[filename].json).