Skip to content

Commit

Permalink
upgrade to TypeScript 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Feb 9, 2022
1 parent afe59eb commit e82a456
Show file tree
Hide file tree
Showing 5 changed files with 787 additions and 893 deletions.
6 changes: 6 additions & 0 deletions .changeset/seven-ads-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'default-template': patch
'@sveltejs/kit': patch
---

upgrade to TypeScript 4.5
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"playwright-chromium": "^1.17.0",
"prettier": "^2.5.0",
"rollup": "^2.60.2",
"typescript": "~4.4.4"
"typescript": "^4.5.5"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/create-svelte/templates/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@sveltejs/kit": "workspace:*",
"svelte": "^3.44.0",
"svelte-preprocess": "^4.9.8",
"typescript": "^4.4.3"
"typescript": "^4.5.5"
},
"type": "module",
"dependencies": {
Expand Down
19 changes: 11 additions & 8 deletions packages/kit/src/packaging/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ export async function make_package(config, cwd = process.cwd()) {
const svelte_ext = config.extensions.find((ext) => file.endsWith(ext)); // unlike `ext`, could be e.g. `.svelte.md`

if (!config.kit.package.files(normalized)) {
const dts_file = (svelte_ext ? file : file.slice(0, -ext.length)) + '.d.ts';
const dts_path = path.join(package_dir, dts_file);
if (fs.existsSync(dts_path)) {
fs.unlinkSync(dts_path);

const dir = path.dirname(dts_path);
if (fs.readdirSync(dir).length === 0) {
fs.rmdirSync(dir);
const base = svelte_ext ? file : file.slice(0, -ext.length);
const dts_files = [base + '.d.ts', base + '.d.mts', base + '.d.cts'];
for (const dts_file of dts_files) {
const dts_path = path.join(package_dir, dts_file);
if (fs.existsSync(dts_path)) {
fs.unlinkSync(dts_path);

const dir = path.dirname(dts_path);
if (fs.readdirSync(dir).length === 0) {
fs.rmdirSync(dir);
}
}
}
continue;
Expand Down
Loading

0 comments on commit e82a456

Please sign in to comment.