feat: integrate astro

feat/preact-migrate
Arik Chakma 2 years ago
parent d081ecf5b3
commit e6054e247c
  1. 101
      astro.config.mjs
  2. 82
      package.json
  3. 107
      pnpm-lock.yaml
  4. 8
      tsconfig.json

@ -5,56 +5,57 @@ import compress from 'astro-compress';
import { defineConfig } from 'astro/config'; import { defineConfig } from 'astro/config';
import rehypeExternalLinks from 'rehype-external-links'; import rehypeExternalLinks from 'rehype-external-links';
import { serializeSitemap, shouldIndexPage } from './sitemap.mjs'; import { serializeSitemap, shouldIndexPage } from './sitemap.mjs';
import preact from '@astrojs/preact';
// https://astro.build/config
export default defineConfig({ export default defineConfig({
site: 'https://roadmap.sh/', site: 'https://roadmap.sh/',
markdown: { markdown: {
shikiConfig: { shikiConfig: {
theme: 'dracula', theme: 'dracula',
}, },
rehypePlugins: [ rehypePlugins: [
[ [
rehypeExternalLinks, rehypeExternalLinks,
{ {
target: '_blank', target: '_blank',
rel: function (element) { rel: function (element) {
const href = element.properties.href; const href = element.properties.href;
const whiteListedStarts = [ const whiteListedStarts = [
'/', '/',
'#', '#',
'mailto:', 'mailto:',
'https://github.com/kamranahmedse', 'https://github.com/kamranahmedse',
'https://thenewstack.io', 'https://thenewstack.io',
'https://cs.fyi', 'https://cs.fyi',
'https://roadmap.sh' 'https://roadmap.sh',
]; ];
if (whiteListedStarts.some((start) => href.startsWith(start))) {
if (whiteListedStarts.some((start) => href.startsWith(start))) { return [];
return []; }
} return 'noopener noreferrer nofollow';
},
return 'noopener noreferrer nofollow'; },
}, ],
}, ],
], },
], build: {
}, format: 'file',
build: { },
format: 'file', integrations: [
}, tailwind({
integrations: [ config: {
tailwind({ applyBaseStyles: false,
config: { },
applyBaseStyles: false, }),
}, sitemap({
}), filter: shouldIndexPage,
sitemap({ serialize: serializeSitemap,
filter: shouldIndexPage, }),
serialize: serializeSitemap, compress({
}), css: false,
compress({ js: false,
css: false, }),
js: false, preact(),
}), ],
],
}); });

@ -1,43 +1,45 @@
{ {
"name": "roadmap.sh", "name": "roadmap.sh",
"type": "module", "type": "module",
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "astro dev", "dev": "astro dev",
"start": "astro dev", "start": "astro dev",
"build": "astro build", "build": "astro build",
"preview": "astro preview", "preview": "astro preview",
"astro": "astro", "astro": "astro",
"deploy": "NODE_DEBUG=gh-pages gh-pages -d dist -t", "deploy": "NODE_DEBUG=gh-pages gh-pages -d dist -t",
"compress:jsons": "node bin/compress-jsons.cjs", "compress:jsons": "node bin/compress-jsons.cjs",
"upgrade": "ncu -u", "upgrade": "ncu -u",
"roadmap-links": "node bin/roadmap-links.cjs", "roadmap-links": "node bin/roadmap-links.cjs",
"roadmap-dirs": "node bin/roadmap-dirs.cjs", "roadmap-dirs": "node bin/roadmap-dirs.cjs",
"roadmap-content": "node bin/roadmap-content.cjs", "roadmap-content": "node bin/roadmap-content.cjs",
"best-practice-dirs": "node bin/best-practice-dirs.cjs", "best-practice-dirs": "node bin/best-practice-dirs.cjs",
"test:e2e": "playwright test" "test:e2e": "playwright test"
}, },
"dependencies": { "dependencies": {
"@astrojs/sitemap": "^1.2.1", "@astrojs/preact": "^2.1.0",
"@astrojs/tailwind": "^3.1.1", "@astrojs/sitemap": "^1.2.1",
"astro": "^2.1.7", "@astrojs/tailwind": "^3.1.1",
"astro-compress": "^1.1.35", "astro": "^2.1.7",
"node-html-parser": "^6.1.5", "astro-compress": "^1.1.35",
"npm-check-updates": "^16.8.0", "node-html-parser": "^6.1.5",
"rehype-external-links": "^2.0.1", "npm-check-updates": "^16.8.0",
"roadmap-renderer": "^1.0.4", "preact": "^10.6.5",
"tailwindcss": "^3.2.7" "rehype-external-links": "^2.0.1",
}, "roadmap-renderer": "^1.0.4",
"devDependencies": { "tailwindcss": "^3.2.7"
"@playwright/test": "^1.32.1", },
"@tailwindcss/typography": "^0.5.9", "devDependencies": {
"gh-pages": "^5.0.0", "@playwright/test": "^1.32.1",
"js-yaml": "^4.1.0", "@tailwindcss/typography": "^0.5.9",
"markdown-it": "^13.0.1", "gh-pages": "^5.0.0",
"openai": "^3.2.1", "js-yaml": "^4.1.0",
"prettier": "^2.8.7", "markdown-it": "^13.0.1",
"prettier-plugin-astro": "^0.8.0", "openai": "^3.2.1",
"prettier": "^2.8.7",
"prettier-plugin-astro": "^0.8.0",
"prettier-plugin-tailwindcss": "^0.2.6" "prettier-plugin-tailwindcss": "^0.2.6"
} }
} }

@ -1,6 +1,7 @@
lockfileVersion: 5.4 lockfileVersion: 5.4
specifiers: specifiers:
'@astrojs/preact': ^2.1.0
'@astrojs/sitemap': ^1.2.1 '@astrojs/sitemap': ^1.2.1
'@astrojs/tailwind': ^3.1.1 '@astrojs/tailwind': ^3.1.1
'@playwright/test': ^1.32.1 '@playwright/test': ^1.32.1
@ -13,6 +14,7 @@ specifiers:
node-html-parser: ^6.1.5 node-html-parser: ^6.1.5
npm-check-updates: ^16.8.0 npm-check-updates: ^16.8.0
openai: ^3.2.1 openai: ^3.2.1
preact: ^10.6.5
prettier: ^2.8.7 prettier: ^2.8.7
prettier-plugin-astro: ^0.8.0 prettier-plugin-astro: ^0.8.0
prettier-plugin-tailwindcss: ^0.2.6 prettier-plugin-tailwindcss: ^0.2.6
@ -21,12 +23,14 @@ specifiers:
tailwindcss: ^3.2.7 tailwindcss: ^3.2.7
dependencies: dependencies:
'@astrojs/preact': 2.1.0_preact@10.13.2
'@astrojs/sitemap': 1.2.1 '@astrojs/sitemap': 1.2.1
'@astrojs/tailwind': 3.1.1_xwlinsvcxfu6nyuevlo4g7jv7y '@astrojs/tailwind': 3.1.1_xwlinsvcxfu6nyuevlo4g7jv7y
astro: 2.1.7 astro: 2.1.7
astro-compress: 1.1.35 astro-compress: 1.1.35
node-html-parser: 6.1.5 node-html-parser: 6.1.5
npm-check-updates: 16.8.0 npm-check-updates: 16.8.0
preact: 10.13.2
rehype-external-links: 2.0.1 rehype-external-links: 2.0.1
roadmap-renderer: 1.0.4 roadmap-renderer: 1.0.4
tailwindcss: 3.2.7_postcss@8.4.21 tailwindcss: 3.2.7_postcss@8.4.21
@ -105,6 +109,22 @@ packages:
- supports-color - supports-color
dev: false dev: false
/@astrojs/preact/2.1.0_preact@10.13.2:
resolution: {integrity: sha512-1AnXpnjC24/mWJyq+EN5DoWp+w9Hg/y3dwFX3728rlBhyuY573jx+4+VHuG/g0A1alzJuIAhSPtqCP0YQktUnw==}
engines: {node: '>=16.12.0'}
peerDependencies:
preact: ^10.6.5
dependencies:
'@babel/core': 7.20.7
'@babel/plugin-transform-react-jsx': 7.20.7_@babel+core@7.20.7
'@preact/signals': 1.1.3_preact@10.13.2
babel-plugin-module-resolver: 5.0.0
preact: 10.13.2
preact-render-to-string: 5.2.6_preact@10.13.2
transitivePeerDependencies:
- supports-color
dev: false
/@astrojs/prism/2.1.0: /@astrojs/prism/2.1.0:
resolution: {integrity: sha512-+II6nfIFGZ7iH0FunhRGcj/J1mCxjcHl85cZRuFePKLoIhFHJT3nC3myQnUw386hUaIn2W20McxxtAVf4leeRQ==} resolution: {integrity: sha512-+II6nfIFGZ7iH0FunhRGcj/J1mCxjcHl85cZRuFePKLoIhFHJT3nC3myQnUw386hUaIn2W20McxxtAVf4leeRQ==}
engines: {node: '>=16.12.0'} engines: {node: '>=16.12.0'}
@ -792,6 +812,19 @@ packages:
config-chain: 1.1.13 config-chain: 1.1.13
dev: false dev: false
/@preact/signals-core/1.2.3:
resolution: {integrity: sha512-Kui4p7PMcEQevBgsTO0JBo3gyQ88Q3qzEvsVCuSp11t0JcN4DmGCTJcGRVSCq7Bn7lGxJBO+57jNSzDoDJ+QmA==}
dev: false
/@preact/signals/1.1.3_preact@10.13.2:
resolution: {integrity: sha512-N09DuAVvc90bBZVRwD+aFhtGyHAmJLhS3IFoawO/bYJRcil4k83nBOchpCEoS0s5+BXBpahgp0Mjf+IOqP57Og==}
peerDependencies:
preact: 10.x
dependencies:
'@preact/signals-core': 1.2.3
preact: 10.13.2
dev: false
/@proload/core/0.3.3: /@proload/core/0.3.3:
resolution: {integrity: sha512-7dAFWsIK84C90AMl24+N/ProHKm4iw0akcnoKjRvbfHifJZBLhaDsDus1QJmhG12lXj4e/uB/8mB/0aduCW+NQ==} resolution: {integrity: sha512-7dAFWsIK84C90AMl24+N/ProHKm4iw0akcnoKjRvbfHifJZBLhaDsDus1QJmhG12lXj4e/uB/8mB/0aduCW+NQ==}
dependencies: dependencies:
@ -1217,6 +1250,17 @@ packages:
- debug - debug
dev: true dev: true
/babel-plugin-module-resolver/5.0.0:
resolution: {integrity: sha512-g0u+/ChLSJ5+PzYwLwP8Rp8Rcfowz58TJNCe+L/ui4rpzE/mg//JVX0EWBUYoxaextqnwuGHzfGp2hh0PPV25Q==}
engines: {node: '>= 16'}
dependencies:
find-babel-config: 2.0.0
glob: 8.0.3
pkg-up: 3.1.0
reselect: 4.1.7
resolve: 1.22.1
dev: false
/bail/2.0.2: /bail/2.0.2:
resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==} resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
dev: false dev: false
@ -2072,6 +2116,14 @@ packages:
dependencies: dependencies:
to-regex-range: 5.0.1 to-regex-range: 5.0.1
/find-babel-config/2.0.0:
resolution: {integrity: sha512-dOKT7jvF3hGzlW60Gc3ONox/0rRZ/tz7WCil0bqA1In/3I8f1BctpXahRnEKDySZqci7u+dqq93sZST9fOJpFw==}
engines: {node: '>=16.0.0'}
dependencies:
json5: 2.2.2
path-exists: 4.0.0
dev: false
/find-cache-dir/3.3.2: /find-cache-dir/3.3.2:
resolution: {integrity: sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==} resolution: {integrity: sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -2081,6 +2133,13 @@ packages:
pkg-dir: 4.2.0 pkg-dir: 4.2.0
dev: true dev: true
/find-up/3.0.0:
resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==}
engines: {node: '>=6'}
dependencies:
locate-path: 3.0.0
dev: false
/find-up/4.1.0: /find-up/4.1.0:
resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -2885,6 +2944,14 @@ packages:
strip-bom: 3.0.0 strip-bom: 3.0.0
dev: false dev: false
/locate-path/3.0.0:
resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==}
engines: {node: '>=6'}
dependencies:
p-locate: 3.0.0
path-exists: 3.0.0
dev: false
/locate-path/5.0.0: /locate-path/5.0.0:
resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -3905,6 +3972,13 @@ packages:
yocto-queue: 0.1.0 yocto-queue: 0.1.0
dev: false dev: false
/p-locate/3.0.0:
resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==}
engines: {node: '>=6'}
dependencies:
p-limit: 2.3.0
dev: false
/p-locate/4.1.0: /p-locate/4.1.0:
resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -3999,6 +4073,11 @@ packages:
tslib: 2.4.1 tslib: 2.4.1
dev: false dev: false
/path-exists/3.0.0:
resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==}
engines: {node: '>=4'}
dev: false
/path-exists/4.0.0: /path-exists/4.0.0:
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
engines: {node: '>=8'} engines: {node: '>=8'}
@ -4070,6 +4149,13 @@ packages:
dependencies: dependencies:
find-up: 4.1.0 find-up: 4.1.0
/pkg-up/3.1.0:
resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==}
engines: {node: '>=8'}
dependencies:
find-up: 3.0.0
dev: false
/playwright-core/1.32.1: /playwright-core/1.32.1:
resolution: {integrity: sha512-KZYUQC10mXD2Am1rGlidaalNGYk3LU1vZqqNk0gT4XPty1jOqgup8KDP8l2CUlqoNKhXM5IfGjWgW37xvGllBA==} resolution: {integrity: sha512-KZYUQC10mXD2Am1rGlidaalNGYk3LU1vZqqNk0gT4XPty1jOqgup8KDP8l2CUlqoNKhXM5IfGjWgW37xvGllBA==}
engines: {node: '>=14'} engines: {node: '>=14'}
@ -4164,6 +4250,19 @@ packages:
picocolors: 1.0.0 picocolors: 1.0.0
source-map-js: 1.0.2 source-map-js: 1.0.2
/preact-render-to-string/5.2.6_preact@10.13.2:
resolution: {integrity: sha512-JyhErpYOvBV1hEPwIxc/fHWXPfnEGdRKxc8gFdAZ7XV4tlzyzG847XAyEZqoDnynP88akM4eaHcSOzNcLWFguw==}
peerDependencies:
preact: '>=10'
dependencies:
preact: 10.13.2
pretty-format: 3.8.0
dev: false
/preact/10.13.2:
resolution: {integrity: sha512-q44QFLhOhty2Bd0Y46fnYW0gD/cbVM9dUVtNTDKPcdXSMA7jfY+Jpd6rk3GB0lcQss0z5s/6CmVP0Z/hV+g6pw==}
dev: false
/prebuild-install/7.1.1: /prebuild-install/7.1.1:
resolution: {integrity: sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==} resolution: {integrity: sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==}
engines: {node: '>=10'} engines: {node: '>=10'}
@ -4274,6 +4373,10 @@ packages:
engines: {node: '>=10.13.0'} engines: {node: '>=10.13.0'}
hasBin: true hasBin: true
/pretty-format/3.8.0:
resolution: {integrity: sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==}
dev: false
/prismjs/1.29.0: /prismjs/1.29.0:
resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==} resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -4523,6 +4626,10 @@ packages:
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
dev: false dev: false
/reselect/4.1.7:
resolution: {integrity: sha512-Zu1xbUt3/OPwsXL46hvOOoQrap2azE7ZQbokq61BQfiXvhewsKDwhMeZjTX9sX0nvw1t/U5Audyn1I9P/m9z0A==}
dev: false
/resolve-alpn/1.2.1: /resolve-alpn/1.2.1:
resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==} resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==}
dev: false dev: false

@ -1,3 +1,7 @@
{ {
"extends": "astro/tsconfigs/strict" "extends": "astro/tsconfigs/strict",
} "compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
}
}

Loading…
Cancel
Save