Skip to content

Commit

Permalink
Merge pull request #14 from jacksteamdev/feat--example-website-for-te…
Browse files Browse the repository at this point in the history
…sting

feat: add test website for scraping
  • Loading branch information
jacksteamdev authored Jan 16, 2025
2 parents 57a1e6a + 9f2c914 commit de93593
Show file tree
Hide file tree
Showing 19 changed files with 359 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/test-site/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
node_modules

# Output
.output
.vercel
.netlify
.wrangler
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions packages/test-site/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
4 changes: 4 additions & 0 deletions packages/test-site/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock
15 changes: 15 additions & 0 deletions packages/test-site/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
38 changes: 38 additions & 0 deletions packages/test-site/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# sv

Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npx sv create

# create a new project in my-app
npx sv create my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
34 changes: 34 additions & 0 deletions packages/test-site/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import prettier from 'eslint-config-prettier';
import js from '@eslint/js';
import { includeIgnoreFile } from '@eslint/compat';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import { fileURLToPath } from 'node:url';
import ts from 'typescript-eslint';
const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));

export default ts.config(
includeIgnoreFile(gitignorePath),
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.svelte'],

languageOptions: {
parserOptions: {
parser: ts.parser
}
}
}
);
36 changes: 36 additions & 0 deletions packages/test-site/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "test-server",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"format": "prettier --write .",
"lint": "prettier --check . && eslint ."
},
"devDependencies": {
"@eslint/compat": "^1.2.3",
"@eslint/js": "^9.17.0",
"@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"autoprefixer": "^10.4.20",
"eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.6",
"prettier-plugin-tailwindcss": "^0.6.5",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"tailwindcss": "^3.4.9",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0",
"vite": "^5.4.11"
}
}
6 changes: 6 additions & 0 deletions packages/test-site/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
};
3 changes: 3 additions & 0 deletions packages/test-site/src/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
13 changes: 13 additions & 0 deletions packages/test-site/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
12 changes: 12 additions & 0 deletions packages/test-site/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
1 change: 1 addition & 0 deletions packages/test-site/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.
6 changes: 6 additions & 0 deletions packages/test-site/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script lang="ts">
import '../app.css';
let { children } = $props();
</script>

{@render children()}
113 changes: 113 additions & 0 deletions packages/test-site/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<svelte:head>
<title>Understanding Express Routes: A Complete Guide</title>
<meta name="description" content="Learn how to master Express.js routing with practical examples and best practices for building scalable Node.js applications." />
<meta property="og:title" content="Understanding Express Routes: A Complete Guide" />
<meta property="og:description" content="Learn how to master Express.js routing with practical examples and best practices for building scalable Node.js applications." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://yoursite.com/blog/express-routes-guide" />
<meta property="og:image" content="https://yoursite.com/images/express-routes-banner.jpg" />
<meta name="author" content="Jane Doe" />
<link rel="canonical" href="https://yoursite.com/blog/express-routes-guide" />
</svelte:head>

<article class="blog-post">
<header>
<h1>Understanding Express Routes: A Complete Guide</h1>
<div class="metadata">
<address class="author">
By <a rel="author" href="/authors/jane-doe">Jane Doe</a>
</address>
<time datetime="2023-12-14">December 14, 2023</time>
</div>
</header>

<section class="content">
<h2>Introduction</h2>
<p>Express.js has become the de facto standard for building web applications with Node.js. At its core, routing is one of the most fundamental concepts you need to master.</p>

<h2>Basic Route Structure</h2>
<p>Express routes follow a simple pattern that combines HTTP methods with URL paths:</p>

<pre><code>{`
app.get('/users', (req, res) => {
res.send('Get all users');
});
`}</code></pre>

<h2>Route Parameters</h2>
<p>Dynamic routes can be created using parameters:</p>

<pre><code>{`
app.get('/users/:id', (req, res) => {
const userId = req.params.id;
res.send(\`Get user \${userId}\`);
});
`}</code></pre>

<h2>Middleware Integration</h2>
<p>Routes can include middleware functions for additional processing:</p>

<pre><code>{`
const authMiddleware = (req, res, next) => {
// Authentication logic
next();
};
app.get('/protected', authMiddleware, (req, res) => {
res.send('Protected route');
});
`}</code></pre>
</section>

<footer>
<div class="tags">
<span class="tag">Express.js</span>
<span class="tag">Node.js</span>
<span class="tag">Web Development</span>
</div>

<div class="share">
<h3>Share this article</h3>
<nav class="social-links">
<a href="#twitter">Twitter</a>
<a href="#linkedin">LinkedIn</a>
<a href="#facebook">Facebook</a>
</nav>
</div>
</footer>
</article>

<style>
.blog-post {
max-width: 800px;
margin: 0 auto;
padding: 2rem;
}
.metadata {
color: #666;
margin: 1rem 0;
}
.content {
line-height: 1.6;
}
.tags {
margin: 2rem 0;
}
.tag {
background: #eee;
padding: 0.25rem 0.5rem;
border-radius: 4px;
margin-right: 0.5rem;
}
pre {
background: #f4f4f4;
padding: 1rem;
border-radius: 4px;
overflow-x: auto;
}
</style>
Binary file added packages/test-site/static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions packages/test-site/svelte.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://svelte.dev/docs/kit/integrations
// for more information about preprocessors
preprocess: vitePreprocess(),

kit: {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter()
}
};

export default config;
11 changes: 11 additions & 0 deletions packages/test-site/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Config } from 'tailwindcss';

export default {
content: ['./src/**/*.{html,js,svelte,ts}'],

theme: {
extend: {}
},

plugins: []
} satisfies Config;
19 changes: 19 additions & 0 deletions packages/test-site/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
6 changes: 6 additions & 0 deletions packages/test-site/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [sveltekit()]
});

0 comments on commit de93593

Please sign in to comment.