mirror of
https://github.com/nkoehring/250kb-club.git
synced 2025-04-19 13:49:04 +02:00
updates URLs
This commit is contained in:
parent
3b5b233b06
commit
82b0af4432
7 changed files with 9 additions and 134 deletions
|
@ -5,7 +5,7 @@
|
|||
"build": "rollup -c",
|
||||
"dev": "rollup -c -w",
|
||||
"start": "sirv public",
|
||||
"upload": "scp -r public/* 250kb.club:/srv/http/250kb.club/"
|
||||
"update-pages": "node ./scripts/refresh-pages.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^14.0.0",
|
||||
|
|
|
@ -29,3 +29,6 @@ https://worldti.me
|
|||
https://sneak.berlin
|
||||
https://plumebio.com
|
||||
https://jeremysarber.com
|
||||
https://kunalmarwaha.com/
|
||||
https://weboas.is/
|
||||
https://jlelse.blog/
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -6,8 +6,8 @@
|
|||
<title>The 250kb Club</title>
|
||||
<meta name="description" content="An exclusive membership for web pages presenting themselves in no more than 250kb.">
|
||||
<link rel="icon" href="/favicon.png" type="image/x-icon">
|
||||
<link rel='stylesheet' href='/global.css?1606074523572'>
|
||||
<script defer src='/build/bundle.js?1606074523572'></script>
|
||||
<link rel='stylesheet' href='/global.css?1606085041254'>
|
||||
<script defer src='/build/bundle.js?1606085041254'></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
// @ts-check
|
||||
|
||||
/** This script modifies the project to support TS code in .svelte files like:
|
||||
|
||||
<script lang="ts">
|
||||
export let name: string;
|
||||
</script>
|
||||
|
||||
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": "^6.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("<script>", '<script lang="ts">')
|
||||
appFile = appFile.replace("export let name;", 'export let name: string;')
|
||||
fs.writeFileSync(appSveltePath, appFile)
|
||||
|
||||
// Edit rollup config
|
||||
const rollupConfigPath = path.join(projectRoot, "rollup.config.js")
|
||||
let rollupConfig = fs.readFileSync(rollupConfigPath, "utf8")
|
||||
|
||||
// Edit imports
|
||||
rollupConfig = rollupConfig.replace(`'rollup-plugin-terser';`, `'rollup-plugin-terser';
|
||||
import sveltePreprocess from 'svelte-preprocess';
|
||||
import typescript from '@rollup/plugin-typescript';`)
|
||||
|
||||
// Replace name of entry point
|
||||
rollupConfig = rollupConfig.replace(`'src/main.js'`, `'src/main.ts'`)
|
||||
|
||||
// Add preprocess to the svelte config, this is tricky because there's no easy signifier.
|
||||
// Instead we look for `css:` then the next `}` and add the preprocessor to that
|
||||
let foundCSS = false
|
||||
let match
|
||||
|
||||
// https://regex101.com/r/OtNjwo/1
|
||||
const configEditor = new RegExp(/css:.|\n*}/gmi)
|
||||
while (( match = configEditor.exec(rollupConfig)) != null) {
|
||||
if (foundCSS) {
|
||||
const endOfCSSIndex = match.index + 1
|
||||
rollupConfig = rollupConfig.slice(0, endOfCSSIndex) + ",\n preprocess: sveltePreprocess()," + rollupConfig.slice(endOfCSSIndex);
|
||||
break
|
||||
}
|
||||
if (match[0].includes("css:")) foundCSS = true
|
||||
}
|
||||
|
||||
|
||||
// Add TypeScript
|
||||
rollupConfig = rollupConfig.replace(
|
||||
'commonjs(),',
|
||||
'commonjs(),\n\t\ttypescript({\n\t\t\tsourceMap: !production,\n\t\t\tinlineSources: !production\n\t\t}),'
|
||||
);
|
||||
fs.writeFileSync(rollupConfigPath, rollupConfig)
|
||||
|
||||
// Add TSConfig
|
||||
const tsconfig = `{
|
||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
|
||||
}`
|
||||
const tsconfigPath = path.join(projectRoot, "tsconfig.json")
|
||||
fs.writeFileSync(tsconfigPath, tsconfig)
|
||||
|
||||
// Delete this script, but not during testing
|
||||
if (!argv[2]) {
|
||||
// Remove the script
|
||||
fs.unlinkSync(path.join(__filename))
|
||||
|
||||
// Check for Mac's DS_store file, and if it's the only one left remove it
|
||||
const remainingFiles = fs.readdirSync(path.join(__dirname))
|
||||
if (remainingFiles.length === 1 && remainingFiles[0] === '.DS_store') {
|
||||
fs.unlinkSync(path.join(__dirname, '.DS_store'))
|
||||
}
|
||||
|
||||
// Check if the scripts folder is empty
|
||||
if (fs.readdirSync(path.join(__dirname)).length === 0) {
|
||||
// Remove the scripts folder
|
||||
fs.rmdirSync(path.join(__dirname))
|
||||
}
|
||||
}
|
||||
|
||||
// Adds the extension recommendation
|
||||
fs.mkdirSync(path.join(projectRoot, ".vscode"))
|
||||
fs.writeFileSync(path.join(projectRoot, ".vscode", "extensions.json"), `{
|
||||
"recommendations": ["svelte.svelte-vscode"]
|
||||
}
|
||||
`)
|
||||
|
||||
console.log("Converted to TypeScript.")
|
||||
|
||||
if (fs.existsSync(path.join(projectRoot, "node_modules"))) {
|
||||
console.log("\nYou will need to re-run your dependency manager to get started.")
|
||||
}
|
|
@ -1 +1 @@
|
|||
[{"url":"https://koehr.in","contentWeight":23078,"extraWeight":66537,"stamp":1606004545427},{"url":"https://koehr.tech","contentWeight":4964,"extraWeight":20108,"stamp":1606004547391},{"url":"https://sjmulder.nl","contentWeight":2361,"extraWeight":0,"stamp":1606004663706},{"url":"http://cyberia.host","contentWeight":1191,"extraWeight":0,"stamp":1606004664417},{"url":"https://text.npr.org","contentWeight":2760,"extraWeight":0,"stamp":1606004665037},{"url":"https://playerone.kevincox.ca","contentWeight":1904,"extraWeight":42661,"stamp":1606004665881},{"url":"https://dotfilehub.com","contentWeight":961,"extraWeight":1281,"stamp":1606004667422},{"url":"https://manpages.bsd.lv","contentWeight":7045,"extraWeight":1346,"stamp":1606004669823},{"url":"https://danluu.com","contentWeight":2895,"extraWeight":0,"stamp":1606004670441},{"url":"https://gtf.io","contentWeight":2040,"extraWeight":2752,"stamp":1606004671103},{"url":"http://minid.net","contentWeight":4110,"extraWeight":0,"stamp":1606004672171},{"url":"https://250kb.club","contentWeight":1682,"extraWeight":8330,"stamp":1606070901151},{"url":"https://subreply.com","contentWeight":6713,"extraWeight":52472,"stamp":1606070902296},{"url":"https://seirdy.one","contentWeight":1554,"extraWeight":1951,"stamp":1606070903577},{"url":"https://richj.co","contentWeight":2119,"extraWeight":1840,"stamp":1606070904708},{"url":"https://mkws.sh/","contentWeight":75059,"extraWeight":7051,"stamp":1606070907275},{"url":"https://porkbrain.com","contentWeight":89742,"extraWeight":1941,"stamp":1606070908242},{"url":"https://pgjones.dev","contentWeight":15979,"extraWeight":187928,"stamp":1606070910182},{"url":"https://jaime.gomezobregon.com","contentWeight":21100,"extraWeight":71592,"stamp":1606070911329},{"url":"https://lawzava.com","contentWeight":2324,"extraWeight":2267,"stamp":1606070912369},{"url":"https://www.cleanpython.com/","contentWeight":7781,"extraWeight":126068,"stamp":1606070914335},{"url":"https://monokai.nl","contentWeight":4823,"extraWeight":85479,"stamp":1606070915137},{"url":"https://flatpackapps.com","contentWeight":41219,"extraWeight":1262,"stamp":1606070917537},{"url":"https://frontaid.io","contentWeight":59536,"extraWeight":103859,"stamp":1606070918722},{"url":"https://worldti.me","contentWeight":3099,"extraWeight":39571,"stamp":1606070920657},{"url":"https://sneak.berlin","contentWeight":187882,"extraWeight":1257173,"stamp":1606070922342},{"url":"https://plumebio.com","contentWeight":1994,"extraWeight":1598,"stamp":1606070924010},{"url":"https://jeremysarber.com","contentWeight":2522,"extraWeight":0,"stamp":1606070925135}]
|
||||
[{"url":"https://koehr.in","contentWeight":23078,"extraWeight":66537,"stamp":1606004545427},{"url":"https://koehr.tech","contentWeight":4964,"extraWeight":20108,"stamp":1606004547391},{"url":"https://sjmulder.nl","contentWeight":2361,"extraWeight":0,"stamp":1606004663706},{"url":"http://cyberia.host","contentWeight":1191,"extraWeight":0,"stamp":1606004664417},{"url":"https://text.npr.org","contentWeight":2760,"extraWeight":0,"stamp":1606004665037},{"url":"https://playerone.kevincox.ca","contentWeight":1904,"extraWeight":42661,"stamp":1606004665881},{"url":"https://dotfilehub.com","contentWeight":961,"extraWeight":1281,"stamp":1606004667422},{"url":"https://manpages.bsd.lv","contentWeight":7045,"extraWeight":1346,"stamp":1606004669823},{"url":"https://danluu.com","contentWeight":2895,"extraWeight":0,"stamp":1606004670441},{"url":"https://gtf.io","contentWeight":2040,"extraWeight":2752,"stamp":1606004671103},{"url":"http://minid.net","contentWeight":4110,"extraWeight":0,"stamp":1606004672171},{"url":"https://250kb.club","contentWeight":1682,"extraWeight":8330,"stamp":1606070901151},{"url":"https://subreply.com","contentWeight":6713,"extraWeight":52472,"stamp":1606070902296},{"url":"https://seirdy.one","contentWeight":1554,"extraWeight":1951,"stamp":1606070903577},{"url":"https://richj.co","contentWeight":2119,"extraWeight":1840,"stamp":1606070904708},{"url":"https://mkws.sh/","contentWeight":75059,"extraWeight":7051,"stamp":1606070907275},{"url":"https://porkbrain.com","contentWeight":89742,"extraWeight":1941,"stamp":1606070908242},{"url":"https://pgjones.dev","contentWeight":15979,"extraWeight":187928,"stamp":1606070910182},{"url":"https://jaime.gomezobregon.com","contentWeight":21100,"extraWeight":71592,"stamp":1606070911329},{"url":"https://lawzava.com","contentWeight":2324,"extraWeight":2267,"stamp":1606070912369},{"url":"https://www.cleanpython.com/","contentWeight":7781,"extraWeight":126068,"stamp":1606070914335},{"url":"https://monokai.nl","contentWeight":4823,"extraWeight":85479,"stamp":1606070915137},{"url":"https://flatpackapps.com","contentWeight":41219,"extraWeight":1262,"stamp":1606070917537},{"url":"https://frontaid.io","contentWeight":59536,"extraWeight":103859,"stamp":1606070918722},{"url":"https://worldti.me","contentWeight":3099,"extraWeight":39571,"stamp":1606070920657},{"url":"https://sneak.berlin","contentWeight":187882,"extraWeight":1257173,"stamp":1606070922342},{"url":"https://plumebio.com","contentWeight":1994,"extraWeight":1598,"stamp":1606070924010},{"url":"https://jeremysarber.com","contentWeight":2522,"extraWeight":0,"stamp":1606070925135},{"url":"https://kunalmarwaha.com/","contentWeight":917,"extraWeight":850,"stamp":1606084225033},{"url":"https://weboas.is/","contentWeight":20293,"extraWeight":93372,"stamp":1606084229149},{"url":"https://jlelse.blog/","contentWeight":3834,"extraWeight":1363,"stamp":1606084229673}]
|
Loading…
Add table
Reference in a new issue