diff --git a/apps/svelte.dev/.gitignore b/apps/svelte.dev/.gitignore index d5d05236ed..321615eddf 100644 --- a/apps/svelte.dev/.gitignore +++ b/apps/svelte.dev/.gitignore @@ -6,7 +6,6 @@ /src/routes/_home/Supporters/contributors.js /src/routes/_home/Supporters/donors.jpg /src/routes/_home/Supporters/donors.js -/static/svelte-app.json # git-repositories of synced docs go here /repos/ diff --git a/apps/svelte.dev/package.json b/apps/svelte.dev/package.json index f1afbe76d0..3c5b747365 100644 --- a/apps/svelte.dev/package.json +++ b/apps/svelte.dev/package.json @@ -50,7 +50,6 @@ "cookie": "^0.7.0", "d3-geo": "^3.1.0", "d3-geo-projection": "^4.0.0", - "do-not-zip": "^1.0.0", "flexsearch": "^0.7.43", "flru": "^1.0.2", "port-authority": "^2.0.1", diff --git a/apps/svelte.dev/scripts/svelte-app/.gitignore b/apps/svelte.dev/scripts/svelte-app/.gitignore deleted file mode 100644 index da93220bc3..0000000000 --- a/apps/svelte.dev/scripts/svelte-app/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/node_modules/ -/public/build/ - -.DS_Store diff --git a/apps/svelte.dev/scripts/svelte-app/README.md b/apps/svelte.dev/scripts/svelte-app/README.md deleted file mode 100644 index a79c334034..0000000000 --- a/apps/svelte.dev/scripts/svelte-app/README.md +++ /dev/null @@ -1,105 +0,0 @@ -# This repo is no longer maintained. Consider using `npm init vite` and selecting the `svelte` option or — if you want a full-fledged app framework — use [SvelteKit](https://kit.svelte.dev), the official application framework for Svelte. - ---- - -# svelte app - -This is a project template for [Svelte](https://svelte.dev) apps. It lives at https://github.com/sveltejs/template. - -To create a new project based on this template using [degit](https://github.com/Rich-Harris/degit): - -```bash -npx degit sveltejs/template svelte-app -cd svelte-app -``` - -_Note that you will need to have [Node.js](https://nodejs.org) installed._ - -## Get started - -Install the dependencies... - -```bash -cd svelte-app -npm install -``` - -...then start [Rollup](https://rollupjs.org): - -```bash -npm run dev -``` - -Navigate to [localhost:8080](http://localhost:8080). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes. - -By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the `sirv` commands in package.json to include the option `--host 0.0.0.0`. - -If you're using [Visual Studio Code](https://code.visualstudio.com/) we recommend installing the official extension [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense. - -## Building and running in production mode - -To create an optimised version of the app: - -```bash -npm run build -``` - -You can run the newly built app with `npm run start`. This uses [sirv](https://github.com/lukeed/sirv), which is included in your package.json's `dependencies` so that the app will work when you deploy to platforms like [Heroku](https://heroku.com). - -## Single-page app mode - -By default, sirv will only respond to requests that match files in `public`. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere. - -If you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for _any_ path. You can make it so by editing the `"start"` command in package.json: - -```js -"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 -``` - -If you want to use `baseUrl` or `path` aliases within your `tsconfig`, you need to set up `@rollup/plugin-alias` to tell Rollup to resolve the aliases. For more info, see [this StackOverflow question](https://stackoverflow.com/questions/63427935/setup-tsconfig-path-in-svelte). - -## Deploying to the web - -### With [Vercel](https://vercel.com) - -Install `vercel` if you haven't already: - -```bash -npm install -g vercel -``` - -Then, from within your project folder: - -```bash -cd public -vercel deploy --name my-project -``` - -### With [surge](https://surge.sh/) - -Install `surge` if you haven't already: - -```bash -npm install -g surge -``` - -Then, from within your project folder: - -```bash -npm run build -surge public my-project.surge.sh -``` diff --git a/apps/svelte.dev/scripts/svelte-app/package.json b/apps/svelte.dev/scripts/svelte-app/package.json deleted file mode 100644 index 715aa915cf..0000000000 --- a/apps/svelte.dev/scripts/svelte-app/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "svelte-app", - "version": "1.0.0", - "private": true, - "type": "module", - "scripts": { - "build": "rollup -c", - "dev": "rollup -c -w", - "start": "sirv public --no-clear" - }, - "devDependencies": { - "@rollup/plugin-commonjs": "^24.0.0", - "@rollup/plugin-node-resolve": "^15.0.0", - "@rollup/plugin-terser": "^0.4.0", - "rollup": "^3.15.0", - "rollup-plugin-css-only": "^4.3.0", - "rollup-plugin-livereload": "^2.0.0", - "rollup-plugin-svelte": "^7.1.2", - "svelte": "^3.55.0" - }, - "dependencies": { - "sirv-cli": "^2.0.0" - } -} diff --git a/apps/svelte.dev/scripts/svelte-app/public/favicon.png b/apps/svelte.dev/scripts/svelte-app/public/favicon.png deleted file mode 100644 index 7e6f5eb5a2..0000000000 Binary files a/apps/svelte.dev/scripts/svelte-app/public/favicon.png and /dev/null differ diff --git a/apps/svelte.dev/scripts/svelte-app/public/global.css b/apps/svelte.dev/scripts/svelte-app/public/global.css deleted file mode 100644 index c29160fa70..0000000000 --- a/apps/svelte.dev/scripts/svelte-app/public/global.css +++ /dev/null @@ -1,68 +0,0 @@ -html, -body { - position: relative; - width: 100%; - height: 100%; -} - -body { - color: #333; - margin: 0; - padding: 8px; - box-sizing: border-box; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, - 'Helvetica Neue', sans-serif; -} - -a { - color: rgb(0, 100, 200); - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -a:visited { - color: rgb(0, 80, 160); -} - -label { - display: block; -} - -input, -button, -select, -textarea { - font-family: inherit; - font-size: inherit; - -webkit-padding: 0.4em 0; - padding: 0.4em; - margin: 0 0 0.5em 0; - box-sizing: border-box; - border: 1px solid #ccc; - border-radius: 2px; -} - -input:disabled { - color: #ccc; -} - -button { - color: #333; - background-color: #f4f4f4; - outline: none; -} - -button:disabled { - color: #999; -} - -button:not(:disabled):active { - background-color: #ddd; -} - -button:focus { - border-color: #666; -} diff --git a/apps/svelte.dev/scripts/svelte-app/public/index.html b/apps/svelte.dev/scripts/svelte-app/public/index.html deleted file mode 100644 index df75bae420..0000000000 --- a/apps/svelte.dev/scripts/svelte-app/public/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - Svelte app - - - - - - - - - - diff --git a/apps/svelte.dev/scripts/svelte-app/rollup.config.js b/apps/svelte.dev/scripts/svelte-app/rollup.config.js deleted file mode 100644 index d1d73065cd..0000000000 --- a/apps/svelte.dev/scripts/svelte-app/rollup.config.js +++ /dev/null @@ -1,78 +0,0 @@ -import { spawn } from 'child_process'; -import svelte from 'rollup-plugin-svelte'; -import commonjs from '@rollup/plugin-commonjs'; -import terser from '@rollup/plugin-terser'; -import resolve from '@rollup/plugin-node-resolve'; -import livereload from 'rollup-plugin-livereload'; -import css from 'rollup-plugin-css-only'; - -const production = !process.env.ROLLUP_WATCH; - -function serve() { - let server; - - function toExit() { - if (server) server.kill(0); - } - - return { - writeBundle() { - if (server) return; - server = spawn('npm', ['run', 'start', '--', '--dev'], { - stdio: ['ignore', 'inherit', 'inherit'], - shell: true - }); - - process.on('SIGTERM', toExit); - process.on('exit', toExit); - } - }; -} - -export default { - input: 'src/main.js', - output: { - sourcemap: true, - format: 'iife', - name: 'app', - file: 'public/build/bundle.js' - }, - plugins: [ - svelte({ - compilerOptions: { - // enable run-time checks when not in production - dev: !production - } - }), - // we'll extract any component CSS out into - // a separate file - better for performance - css({ output: 'bundle.css' }), - - // If you have external dependencies installed from - // npm, you'll most likely need these plugins. In - // some cases you'll need additional configuration - - // consult the documentation for details: - // https://github.com/rollup/plugins/tree/master/packages/commonjs - resolve({ - browser: true, - dedupe: ['svelte'], - exportConditions: ['svelte'] - }), - commonjs(), - - // In dev mode, call `npm run start` once - // the bundle has been generated - !production && serve(), - - // Watch the `public` directory and refresh the - // browser on changes when not in production - !production && livereload('public'), - - // If we're building for production (npm run build - // instead of npm run dev), minify - production && terser() - ], - watch: { - clearScreen: false - } -}; diff --git a/apps/svelte.dev/scripts/svelte-app/scripts/setupTypeScript.js b/apps/svelte.dev/scripts/svelte-app/scripts/setupTypeScript.js deleted file mode 100644 index 736315a97b..0000000000 --- a/apps/svelte.dev/scripts/svelte-app/scripts/setupTypeScript.js +++ /dev/null @@ -1,139 +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 -*/ - -import fs from 'fs'; -import path from 'path'; -import { argv } from 'process'; -import url from 'url'; - -const __filename = url.fileURLToPath(import.meta.url); -const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); -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': '^3.0.0', - 'svelte-preprocess': '^5.0.0', - '@rollup/plugin-typescript': '^11.0.0', - typescript: '^4.9.0', - '@tsconfig/svelte': '^3.0.0' -}); - -// Add script for checking -packageJSON.scripts = Object.assign(packageJSON.scripts, { - check: '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('\n\n\n\n\n\n"},{"path":"README.md","data":"# This repo is no longer maintained. Consider using `npm init vite` and selecting the `svelte` option or — if you want a full-fledged app framework — use [SvelteKit](https://kit.svelte.dev), the official application framework for Svelte.\n\n---\n\n# svelte app\n\nThis is a project template for [Svelte](https://svelte.dev) apps. It lives at https://github.com/sveltejs/template.\n\nTo create a new project based on this template using [degit](https://github.com/Rich-Harris/degit):\n\n```bash\nnpx degit sveltejs/template svelte-app\ncd svelte-app\n```\n\n*Note that you will need to have [Node.js](https://nodejs.org) installed.*\n\n\n## Get started\n\nInstall the dependencies...\n\n```bash\ncd svelte-app\nnpm install\n```\n\n...then start [Rollup](https://rollupjs.org):\n\n```bash\nnpm run dev\n```\n\nNavigate to [localhost:8080](http://localhost:8080). You should see your app running. Edit a component file in `src`, save it, and reload the page to see your changes.\n\nBy default, the server will only respond to requests from localhost. To allow connections from other computers, edit the `sirv` commands in package.json to include the option `--host 0.0.0.0`.\n\nIf you're using [Visual Studio Code](https://code.visualstudio.com/) we recommend installing the official extension [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). If you are using other editors you may need to install a plugin in order to get syntax highlighting and intellisense.\n\n## Building and running in production mode\n\nTo create an optimised version of the app:\n\n```bash\nnpm run build\n```\n\nYou can run the newly built app with `npm run start`. This uses [sirv](https://github.com/lukeed/sirv), which is included in your package.json's `dependencies` so that the app will work when you deploy to platforms like [Heroku](https://heroku.com).\n\n\n## Single-page app mode\n\nBy default, sirv will only respond to requests that match files in `public`. This is to maximise compatibility with static fileservers, allowing you to deploy your app anywhere.\n\nIf you're building a single-page app (SPA) with multiple routes, sirv needs to be able to respond to requests for *any* path. You can make it so by editing the `\"start\"` command in package.json:\n\n```js\n\"start\": \"sirv public --single\"\n```\n\n## Using TypeScript\n\nThis template comes with a script to set up a TypeScript development environment, you can run it immediately after cloning the template with:\n\n```bash\nnode scripts/setupTypeScript.js\n```\n\nOr remove the script via:\n\n```bash\nrm scripts/setupTypeScript.js\n```\n\nIf you want to use `baseUrl` or `path` aliases within your `tsconfig`, you need to set up `@rollup/plugin-alias` to tell Rollup to resolve the aliases. For more info, see [this StackOverflow question](https://stackoverflow.com/questions/63427935/setup-tsconfig-path-in-svelte).\n\n## Deploying to the web\n\n### With [Vercel](https://vercel.com)\n\nInstall `vercel` if you haven't already:\n\n```bash\nnpm install -g vercel\n```\n\nThen, from within your project folder:\n\n```bash\ncd public\nvercel deploy --name my-project\n```\n\n### With [surge](https://surge.sh/)\n\nInstall `surge` if you haven't already:\n\n```bash\nnpm install -g surge\n```\n\nThen, from within your project folder:\n\n```bash\nnpm run build\nsurge public my-project.surge.sh\n```\n"},{"path":"rollup.config.js","data":"import { spawn } from 'child_process';\nimport svelte from 'rollup-plugin-svelte';\nimport commonjs from '@rollup/plugin-commonjs';\nimport terser from '@rollup/plugin-terser';\nimport resolve from '@rollup/plugin-node-resolve';\nimport livereload from 'rollup-plugin-livereload';\nimport css from 'rollup-plugin-css-only';\n\nconst production = !process.env.ROLLUP_WATCH;\n\nfunction serve() {\n\tlet server;\n\n\tfunction toExit() {\n\t\tif (server) server.kill(0);\n\t}\n\n\treturn {\n\t\twriteBundle() {\n\t\t\tif (server) return;\n\t\t\tserver = spawn('npm', ['run', 'start', '--', '--dev'], {\n\t\t\t\tstdio: ['ignore', 'inherit', 'inherit'],\n\t\t\t\tshell: true\n\t\t\t});\n\n\t\t\tprocess.on('SIGTERM', toExit);\n\t\t\tprocess.on('exit', toExit);\n\t\t}\n\t};\n}\n\nexport default {\n\tinput: 'src/main.js',\n\toutput: {\n\t\tsourcemap: true,\n\t\tformat: 'iife',\n\t\tname: 'app',\n\t\tfile: 'public/build/bundle.js'\n\t},\n\tplugins: [\n\t\tsvelte({\n\t\t\tcompilerOptions: {\n\t\t\t\t// enable run-time checks when not in production\n\t\t\t\tdev: !production\n\t\t\t}\n\t\t}),\n\t\t// we'll extract any component CSS out into\n\t\t// a separate file - better for performance\n\t\tcss({ output: 'bundle.css' }),\n\n\t\t// If you have external dependencies installed from\n\t\t// npm, you'll most likely need these plugins. In\n\t\t// some cases you'll need additional configuration -\n\t\t// consult the documentation for details:\n\t\t// https://github.com/rollup/plugins/tree/master/packages/commonjs\n\t\tresolve({\n\t\t\tbrowser: true,\n\t\t\tdedupe: ['svelte'],\n\t\t\texportConditions: ['svelte']\n\t\t}),\n\t\tcommonjs(),\n\n\t\t// In dev mode, call `npm run start` once\n\t\t// the bundle has been generated\n\t\t!production && serve(),\n\n\t\t// Watch the `public` directory and refresh the\n\t\t// browser on changes when not in production\n\t\t!production && livereload('public'),\n\n\t\t// If we're building for production (npm run build\n\t\t// instead of npm run dev), minify\n\t\tproduction && terser()\n\t],\n\twatch: {\n\t\tclearScreen: false\n\t}\n};\n"},{"path":"scripts/setupTypeScript.js","data":"// @ts-check\n\n/** This script modifies the project to support TS code in .svelte files like:\n\n \n \n As well as validating the code for CI.\n */\n\n/** To work on this script:\n rm -rf test-template template && git clone sveltejs/template test-template && node scripts/setupTypeScript.js test-template\n*/\n\nimport fs from \"fs\"\nimport path from \"path\"\nimport { argv } from \"process\"\nimport url from 'url';\n\nconst __filename = url.fileURLToPath(import.meta.url);\nconst __dirname = url.fileURLToPath(new URL('.', import.meta.url));\nconst projectRoot = argv[2] || path.join(__dirname, \"..\")\n\n// Add deps to pkg.json\nconst packageJSON = JSON.parse(fs.readFileSync(path.join(projectRoot, \"package.json\"), \"utf8\"))\npackageJSON.devDependencies = Object.assign(packageJSON.devDependencies, {\n \"svelte-check\": \"^3.0.0\",\n \"svelte-preprocess\": \"^5.0.0\",\n \"@rollup/plugin-typescript\": \"^11.0.0\",\n \"typescript\": \"^4.9.0\",\n \"tslib\": \"^2.5.0\",\n \"@tsconfig/svelte\": \"^3.0.0\"\n})\n\n// Add script for checking\npackageJSON.scripts = Object.assign(packageJSON.scripts, {\n \"check\": \"svelte-check\"\n})\n\n// Write the package JSON\nfs.writeFileSync(path.join(projectRoot, \"package.json\"), JSON.stringify(packageJSON, null, \" \"))\n\n// mv src/main.js to main.ts - note, we need to edit rollup.config.js for this too\nconst beforeMainJSPath = path.join(projectRoot, \"src\", \"main.js\")\nconst afterMainTSPath = path.join(projectRoot, \"src\", \"main.ts\")\nfs.renameSync(beforeMainJSPath, afterMainTSPath)\n\n// Switch the app.svelte file to use TS\nconst appSveltePath = path.join(projectRoot, \"src\", \"App.svelte\")\nlet appFile = fs.readFileSync(appSveltePath, \"utf8\")\nappFile = appFile.replace(\"