diff --git a/apps/svelte.dev/package.json b/apps/svelte.dev/package.json index 50825b195d..8a581ce22c 100644 --- a/apps/svelte.dev/package.json +++ b/apps/svelte.dev/package.json @@ -80,7 +80,6 @@ "prettier-plugin-svelte": "^3.2.4", "satori": "^0.10.13", "satori-html": "^0.3.2", - "shelljs": "^0.8.5", "shiki": "^1.6.4", "shiki-twoslash": "^3.1.2", "svelte": "5.0.0-next.243", diff --git a/apps/svelte.dev/scripts/update.js b/apps/svelte.dev/scripts/update.js index 724c0d1be8..a9b100dcee 100644 --- a/apps/svelte.dev/scripts/update.js +++ b/apps/svelte.dev/scripts/update.js @@ -1,9 +1,12 @@ -import sh from 'shelljs'; +import { fork } from 'node:child_process'; +import { fileURLToPath } from 'url'; -sh.env['FORCE_UPDATE'] = process.argv.includes('--force=true'); +const dir = fileURLToPath(new URL('.', import.meta.url)); -Promise.all([ - sh.exec('node ./scripts/get_contributors.js'), - sh.exec('node ./scripts/get_donors.js'), - sh.exec('node ./scripts/update_template.js') -]); +const env = { + FORCE_UPDATE: process.argv.includes('--force=true') || '' +}; + +fork(`${dir}/get_contributors.js`, { env }); +fork(`${dir}/get_donors.js`, { env }); +fork(`${dir}/update_template.js`); diff --git a/apps/svelte.dev/scripts/update_template.js b/apps/svelte.dev/scripts/update_template.js index 2d371e1f65..4e454c1c6b 100644 --- a/apps/svelte.dev/scripts/update_template.js +++ b/apps/svelte.dev/scripts/update_template.js @@ -1,43 +1,42 @@ // @ts-check -import { lstat, readFile, stat, writeFile } from 'node:fs/promises'; -import path, { dirname } from 'node:path'; +import fs from 'node:fs'; import { fileURLToPath } from 'node:url'; -import sh from 'shelljs'; +import { execSync } from 'node:child_process'; +import glob from 'tiny-glob/sync.js'; const force = process.env.FORCE_UPDATE === 'true'; -const __dirname = dirname(fileURLToPath(import.meta.url)); -sh.cd(path.join(__dirname, '..')); +const dir = fileURLToPath(new URL('./svelte-app', import.meta.url)); const outputFile = 'static/svelte-app.json'; try { - if (!force && (await stat(outputFile))) { + if (!force && fs.existsSync(outputFile)) { console.info(`[update/template] ${outputFile} exists. Skipping`); process.exit(0); } } catch { // fetch svelte app - sh.rm('-rf', 'scripts/svelte-app'); - sh.exec('npx degit sveltejs/template scripts/svelte-app'); + fs.rmdirSync(dir); + execSync(`npx degit sveltejs/template ${dir}`); // remove src (will be recreated client-side) and node_modules - sh.rm('-rf', 'scripts/svelte-app/src'); - sh.rm('-rf', 'scripts/svelte-app/node_modules'); + fs.rmdirSync(`${dir}/src`); + fs.rmdirSync(`${dir}/node_modules`); // build svelte-app.json - const appPath = 'scripts/svelte-app'; + const appPath = dir; const files = []; - for (const path of sh.find(appPath)) { + for (const path of glob(`${dir}/**`)) { // Skip directories - if (!(await lstat(path)).isFile()) continue; + if (!fs.lstatSync(path).isFile()) continue; - const bytes = await readFile(path); + const bytes = fs.readFileSync(path); const string = bytes.toString(); const data = bytes.compare(Buffer.from(string)) === 0 ? string : [...bytes]; files.push({ path: path.slice(appPath.length + 1), data }); } - writeFile(outputFile, JSON.stringify(files)); + fs.writeFileSync(outputFile, JSON.stringify(files)); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 56095ffcd4..84ad6982b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -198,9 +198,6 @@ importers: satori-html: specifier: ^0.3.2 version: 0.3.2 - shelljs: - specifier: ^0.8.5 - version: 0.8.5 shiki: specifier: ^1.6.4 version: 1.6.4 @@ -1878,9 +1875,6 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] - function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - gauge@3.0.2: resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} engines: {node: '>=10'} @@ -1925,10 +1919,6 @@ packages: has-unicode@2.0.1: resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} - hasown@2.0.2: - resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} - engines: {node: '>= 0.4'} - hex-rgb@4.3.0: resolution: {integrity: sha512-Ox1pJVrDCyGHMG9CFg1tmrRUMRPRsAWYc/PinY0XzJU4K7y7vjNoLKIQ7BR5UJMCxNN8EM1MNDmHWA/B3aZUuw==} engines: {node: '>=6'} @@ -1976,10 +1966,6 @@ packages: resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==} engines: {node: '>=12'} - interpret@1.4.0: - resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} - engines: {node: '>= 0.10'} - is-arrayish@0.3.2: resolution: {integrity: sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==} @@ -1987,9 +1973,6 @@ packages: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} - is-core-module@2.13.1: - resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} - is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -2338,9 +2321,6 @@ packages: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} - path-parse@1.0.7: - resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} @@ -2443,10 +2423,6 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} - rechoir@0.6.2: - resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==} - engines: {node: '>= 0.10'} - regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} @@ -2461,10 +2437,6 @@ packages: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} engines: {node: '>=10'} - resolve@1.22.8: - resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} - hasBin: true - reusify@1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} @@ -2537,11 +2509,6 @@ packages: resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==} engines: {node: '>=0.10.0'} - shelljs@0.8.5: - resolution: {integrity: sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==} - engines: {node: '>=4'} - hasBin: true - shiki-twoslash@3.1.2: resolution: {integrity: sha512-JBcRIIizi+exIA/OUhYkV6jtyeZco0ykCkIRd5sgwIt1Pm4pz+maoaRZpm6SkhPwvif4fCA7xOtJOykhpIV64Q==} peerDependencies: @@ -2614,10 +2581,6 @@ packages: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} - supports-preserve-symlinks-flag@1.0.0: - resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} - engines: {node: '>= 0.4'} - svelte-check@4.0.1: resolution: {integrity: sha512-AuWnCZdREoOzMhoptHPUUPYUxLNdXSkoZnPnlv19SZJJimRzLmjjZLKsOiRB4AnhgX+56/WSEdvkWXI/q2BSsA==} engines: {node: '>= 18.0.0'} @@ -4572,8 +4535,6 @@ snapshots: fsevents@2.3.3: optional: true - function-bind@1.1.2: {} - gauge@3.0.2: dependencies: aproba: 2.0.0 @@ -4635,10 +4596,6 @@ snapshots: has-unicode@2.0.1: {} - hasown@2.0.2: - dependencies: - function-bind: 1.1.2 - hex-rgb@4.3.0: {} https-proxy-agent@5.0.1: @@ -4679,18 +4636,12 @@ snapshots: internmap@2.0.3: {} - interpret@1.4.0: {} - is-arrayish@0.3.2: {} is-binary-path@2.1.0: dependencies: binary-extensions: 2.3.0 - is-core-module@2.13.1: - dependencies: - hasown: 2.0.2 - is-extglob@2.1.1: {} is-fullwidth-code-point@3.0.0: {} @@ -4998,8 +4949,6 @@ snapshots: path-is-absolute@1.0.1: {} - path-parse@1.0.7: {} - path-type@4.0.0: {} peek-readable@4.1.0: {} @@ -5085,10 +5034,6 @@ snapshots: dependencies: picomatch: 2.3.1 - rechoir@0.6.2: - dependencies: - resolve: 1.22.8 - regenerator-runtime@0.14.1: {} resolve-from@5.0.0: {} @@ -5097,12 +5042,6 @@ snapshots: resolve.exports@2.0.2: {} - resolve@1.22.8: - dependencies: - is-core-module: 2.13.1 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - reusify@1.0.4: {} rimraf@2.7.1: @@ -5213,12 +5152,6 @@ snapshots: shebang-regex@1.0.0: {} - shelljs@0.8.5: - dependencies: - glob: 7.2.3 - interpret: 1.4.0 - rechoir: 0.6.2 - shiki-twoslash@3.1.2(typescript@5.5.4): dependencies: '@typescript/twoslash': 3.1.0 @@ -5302,8 +5235,6 @@ snapshots: dependencies: has-flag: 3.0.0 - supports-preserve-symlinks-flag@1.0.0: {} - svelte-check@4.0.1(svelte@5.0.0-next.243)(typescript@5.5.4): dependencies: '@jridgewell/trace-mapping': 0.3.25