From 82ac4f135893d1a7c4aa3bc2ba81b23d349106dc Mon Sep 17 00:00:00 2001 From: Tim Kipp Date: Sun, 6 Sep 2020 16:10:49 -0700 Subject: [PATCH] chore: removed Svelte TypeScript support for now --- cmd/templates/svelte/frontend/README.md | 14 -- .../frontend/scripts/setupTypeScript.js | 125 ------------------ 2 files changed, 139 deletions(-) delete mode 100644 cmd/templates/svelte/frontend/scripts/setupTypeScript.js diff --git a/cmd/templates/svelte/frontend/README.md b/cmd/templates/svelte/frontend/README.md index 54bca49c..360f2715 100644 --- a/cmd/templates/svelte/frontend/README.md +++ b/cmd/templates/svelte/frontend/README.md @@ -57,20 +57,6 @@ If you're building a single-page app (SPA) with multiple routes, sirv needs to b "start": "sirv public --single" ``` -## Using TypeScript - -This template comes with a script to set up a TypeScript development environment, you can run it immediately after cloning the template with: - -```bash -node scripts/setupTypeScript.js -``` - -Or remove the script via: - -```bash -rm scripts/setupTypeScript.js -``` - ## Deploying to the web ### With [Vercel](https://vercel.com) diff --git a/cmd/templates/svelte/frontend/scripts/setupTypeScript.js b/cmd/templates/svelte/frontend/scripts/setupTypeScript.js deleted file mode 100644 index 3855f538..00000000 --- a/cmd/templates/svelte/frontend/scripts/setupTypeScript.js +++ /dev/null @@ -1,125 +0,0 @@ -// @ts-check - -/** This script modifies the project to support TS code in .svelte files like: - - - - As well as validating the code for CI. - */ - -/** To work on this script: - rm -rf test-template template && git clone sveltejs/template test-template && node scripts/setupTypeScript.js test-template -*/ - -const fs = require("fs") -const path = require("path") -const { argv } = require("process") - -const projectRoot = argv[2] || path.join(__dirname, "..") - -// Add deps to pkg.json -const packageJSON = JSON.parse(fs.readFileSync(path.join(projectRoot, "package.json"), "utf8")) -packageJSON.devDependencies = Object.assign(packageJSON.devDependencies, { - "svelte-check": "^1.0.0", - "svelte-preprocess": "^4.0.0", - "@rollup/plugin-typescript": "^4.0.0", - "typescript": "^3.9.3", - "tslib": "^2.0.0", - "@tsconfig/svelte": "^1.0.0" -}) - -// Add script for checking -packageJSON.scripts = Object.assign(packageJSON.scripts, { - "validate": "svelte-check" -}) - -// Write the package JSON -fs.writeFileSync(path.join(projectRoot, "package.json"), JSON.stringify(packageJSON, null, " ")) - -// mv src/main.js to main.ts - note, we need to edit rollup.config.js for this too -const beforeMainJSPath = path.join(projectRoot, "src", "main.js") -const afterMainTSPath = path.join(projectRoot, "src", "main.ts") -fs.renameSync(beforeMainJSPath, afterMainTSPath) - -// Switch the app.svelte file to use TS -const appSveltePath = path.join(projectRoot, "src", "App.svelte") -let appFile = fs.readFileSync(appSveltePath, "utf8") -appFile = appFile.replace("