Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/tsconfig/bases into hnordt-…
Browse files Browse the repository at this point in the history
…main
  • Loading branch information
orta committed Oct 24, 2021
2 parents 7a6d61f + 9565344 commit 8bf18e3
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ Add to your `tsconfig.json`:
"extends": "@tsconfig/svelte/tsconfig.json"
```

> **NOTE**: After `@tsconfig/[email protected]`, you should add `/// <reference types="svelte" />` to a `d.ts` or a `index.ts`(entry) file to prevent typescript error.
<!-- /AUTO -->

### Contributing
Expand Down
1 change: 1 addition & 0 deletions bases/react-native.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"isolatedModules": true,
"strict": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": false
Expand Down
1 change: 1 addition & 0 deletions readme-extras/svelte.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> **NOTE**: After `@tsconfig/[email protected]`, you should add `/// <reference types="svelte" />` to a `d.ts` or a `index.ts`(entry) file to prevent typescript error.
14 changes: 14 additions & 0 deletions scripts/create-npm-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};
Expand Down
7 changes: 7 additions & 0 deletions scripts/update-markdown-readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ="<!-- AUTO -->"
Expand Down
4 changes: 2 additions & 2 deletions template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Add to your `tsconfig.json`:
```json
"extends": "@tsconfig/[filename]/tsconfig.json"
```

[readme-extra]
---

The `tsconfig.json`:
Expand All @@ -21,4 +21,4 @@ The `tsconfig.json`:
[tsconfig]
```

You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/[filename].json).
You can find the [code here](https://github.com/tsconfig/bases/blob/master/bases/[filename].json).

0 comments on commit 8bf18e3

Please sign in to comment.