Skip to content

Commit

Permalink
chore: migrate site (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
baseballyama committed May 19, 2024
1 parent ed2597b commit 879149a
Show file tree
Hide file tree
Showing 17 changed files with 190 additions and 35 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/GHPages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ jobs:
run: |
pnpm install
pnpm run update
pnpm run build
pnpm build
export NODE_OPTIONS="--max-old-space-size=8192"
pnpm run docs:build
cd docs-svelte-kit
pnpm build
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./build/eslint-plugin-svelte
path: ./docs-svelte-kit/build/eslint-plugin-svelte
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
5 changes: 2 additions & 3 deletions .github/workflows/NodeCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name:
Install svelte@3
# Remove @sveltejs/kit because postinstall fails on old node.
- name: Install svelte@3
# Remove @sveltejs/kit because postinstall fails on old node.
run: |
cd docs-svelte-kit
pnpm rm @sveltejs/kit
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ dist
packages/eslint-plugin-svelte/lib
packages/eslint-plugin-svelte/.type-coverage

/.svelte-kit
/build
docs-svelte-kit/.svelte-kit
docs-svelte-kit/build
/svelte.config-dist.js
/docs-svelte-kit/shim/eslint.mjs
/docs-svelte-kit/shim/assert.mjs
Expand Down
10 changes: 10 additions & 0 deletions docs-svelte-kit/.env-cmdrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'use strict';

module.exports = {
sveltekit: {
NODE_OPTIONS: `--import ./svelte-kit-import.mjs ${
// eslint-disable-next-line no-process-env -- ignore
process.env.NODE_OPTIONS || ''
}`
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';

const dirname = path.dirname(fileURLToPath(import.meta.url));

build(path.join(dirname, '../../node_modules/assert'), path.join(dirname, '../shim/assert.mjs'));
build(path.join(dirname, '../node_modules/assert'), path.join(dirname, '../shim/assert.mjs'));

/** build */
function build(input: string, out: string, injects: string[] = []) {
Expand Down
116 changes: 116 additions & 0 deletions docs-svelte-kit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"name": "docs",
"private": true,
"scripts": {
"build": "pnpm run svelte-kit build",
"preview": "pnpm run svelte-kit preview",
"dev": "pnpm run svelte-kit dev",
"svelte-kit": "env-cmd -e sveltekit node node_modules/vite/bin/vite.js"
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@jridgewell/sourcemap-codec": "^1.4.15",
"debug": "^4.3.4",
"eslint-compat-utils": "^0.5.0",
"esutils": "^2.0.3",
"known-css-properties": "^0.31.0",
"postcss": "^8.4.38",
"postcss-load-config": "^3.1.4",
"postcss-safe-parser": "^6.0.0",
"postcss-selector-parser": "^6.0.16",
"semver": "^7.6.0",
"svelte-eslint-parser": ">=0.36.0 <1.0.0"
},
"devDependencies": {
"@1stg/stylelint-config": "^6.0.0",
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.24.1",
"@babel/plugin-proposal-function-bind": "^7.24.1",
"@babel/types": "^7.24.0",
"@eslint-community/eslint-plugin-eslint-comments": "4.3.0",
"@fontsource/fira-mono": "^5.0.12",
"@ota-meshi/eslint-plugin": "^0.17.1",
"@sindresorhus/slugify": "^2.2.1",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.6",
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"@types/babel__core": "^7.20.5",
"@types/cross-spawn": "^6.0.6",
"@types/escape-html": "^1.0.4",
"@types/eslint": "^8.56.10",
"@types/eslint-scope": "^3.7.7",
"@types/eslint-utils": "^3.0.5",
"@types/eslint-visitor-keys": "^3.3.0",
"@types/esutils": "^2.0.2",
"@types/json-schema": "^7.0.15",
"@types/less": "^3.0.6",
"@types/markdown-it": "^14.0.1",
"@types/markdown-it-container": "^2.0.10",
"@types/markdown-it-emoji": "^3.0.0",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.7",
"@types/postcss-safe-parser": "^5.0.4",
"@types/prismjs": "^1.26.3",
"@types/semver": "^7.5.8",
"@types/stylus": "^0.48.42",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"@typescript/vfs": "^1.5.0",
"acorn": "^8.11.3",
"assert": "^2.1.0",
"cross-spawn": "^7.0.3",
"env-cmd": "^10.1.0",
"esbuild": "^0.21.0",
"esbuild-register": "^3.5.0",
"escape-html": "^1.0.3",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-formatter-friendly": "^7.0.0",
"eslint-plugin-eslint-plugin": "^6.0.0",
"eslint-plugin-jsdoc": "^48.2.3",
"eslint-plugin-json-schema-validator": "^5.1.0",
"eslint-plugin-jsonc": "^2.15.1",
"eslint-plugin-markdown": "^5.0.0",
"eslint-plugin-mdx": "^3.1.5",
"eslint-plugin-n": "^17.2.1",
"eslint-plugin-node-dependencies": "^0.12.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-regexp": "^2.5.0",
"eslint-plugin-svelte": "workspace:^",
"eslint-plugin-yml": "^1.14.0",
"eslint-scope": "^8.0.1",
"eslint-typegen": "^0.2.3",
"eslint-visitor-keys": "^4.0.0",
"espree": "^10.0.1",
"estree-walker": "^3.0.3",
"globals": "^15.0.0",
"less": "^4.2.0",
"locate-character": "^3.0.0",
"magic-string": "^0.30.10",
"markdown-it-anchor": "^8.6.7",
"markdown-it-container": "^4.0.0",
"markdown-it-emoji": "^3.0.0",
"pako": "^2.1.0",
"postcss-nested": "^6.0.1",
"prettier": "^3.2.5",
"prettier-plugin-pkg": "^0.18.1",
"prettier-plugin-svelte": "^3.2.3",
"prism-svelte": "^0.5.0",
"prismjs": "^1.29.0",
"rimraf": "^5.0.5",
"sass": "^1.75.0",
"source-map-js": "^1.2.0",
"stylelint": "~16.5.0",
"stylelint-config-standard": "^36.0.0",
"stylus": "^0.63.0",
"svelte": "^5.0.0-next.112",
"svelte-adapter-ghpages": "0.2.2",
"tslib": "^2.6.2",
"typescript-eslint": "^7.7.0",
"util": "^0.12.5",
"vite": "^5.2.9",
"vite-plugin-eslint4b": "^0.4.0",
"vite-plugin-svelte-md": "^0.1.7",
"yaml": "^2.4.1"
}
}
4 changes: 2 additions & 2 deletions docs-svelte-kit/shim/source-map-js.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SourceMapGenerator } from '../../node_modules/source-map-js/lib/source-map-generator.js';
import { SourceMapConsumer } from '../../node_modules/source-map-js/lib/source-map-consumer.js';
import { SourceMapGenerator } from '../node_modules/source-map-js/lib/source-map-generator.js';
import { SourceMapConsumer } from '../node_modules/source-map-js/lib/source-map-consumer.js';
export { SourceMapGenerator, SourceMapConsumer };
export default { SourceMapGenerator, SourceMapConsumer };
2 changes: 1 addition & 1 deletion docs-svelte-kit/src/lib/components/ESLintCodeBlock.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import ESLintEditor from '../eslint/ESLintEditor.svelte';
import { preprocess, postprocess, createLinterConfig } from '../eslint/scripts/linter.js';
import { loadTsParser } from '../eslint/scripts/ts-parser.js';
import { loadModulesForBrowser } from '../../../../src/utils/load-module';
import { loadModulesForBrowser } from '../../../../packages/eslint-plugin-svelte/src/utils/load-module.ts';
import { Linter } from 'eslint';
import globals from 'globals';
Expand Down
2 changes: 1 addition & 1 deletion docs-svelte-kit/src/lib/components/ESLintPlayground.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
createLinterConfig
} from '../eslint/scripts/linter.js';
import { loadTsParser } from '../eslint/scripts/ts-parser.js';
import { loadModulesForBrowser } from '../../../../src/utils/load-module';
import { loadModulesForBrowser } from '../../../../packages/eslint-plugin-svelte/src/utils/load-module.ts';
import { Linter } from 'eslint';
import globals from 'globals';
let tsParser = null;
Expand Down
7 changes: 5 additions & 2 deletions docs-svelte-kit/src/lib/eslint/scripts/linter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { rules as pluginRules } from '../../../../../src/utils/rules.ts';
import { rules as pluginRules } from '../../../../../packages/eslint-plugin-svelte/src/utils/rules.ts';
import { builtinRules } from 'eslint/use-at-your-own-risk';
import * as svelteEslintParser from 'svelte-eslint-parser';

export { preprocess, postprocess } from '../../../../../src/processor/index.ts';
export {
preprocess,
postprocess
} from '../../../../../packages/eslint-plugin-svelte/src/processor/index.ts';

export const categories = [
{
Expand Down
2 changes: 1 addition & 1 deletion docs-svelte-kit/src/lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { rules } from '../../../src/utils/rules.ts';
import { rules } from '../../../packages/eslint-plugin-svelte/src/utils/rules.ts';
import { readable, writable } from 'svelte/store';
import { page } from '$app/stores';
import { base as baseUrl } from '$app/paths';
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions svelte.config.mjs → docs-svelte-kit/svelte.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ const config = {
assets: outDir
}),
files: {
routes: path.join(dirname, './docs-svelte-kit/src/routes'),
appTemplate: path.join(dirname, './docs-svelte-kit/src/app.html'),
routes: path.join(dirname, './src/routes'),
appTemplate: path.join(dirname, './src/app.html'),
hooks: {
server: path.join(dirname, './docs-svelte-kit/src/hooks/server'),
client: path.join(dirname, './docs-svelte-kit/src/hooks/client')
server: path.join(dirname, './src/hooks/server'),
client: path.join(dirname, './src/hooks/client')
},
lib: path.join(dirname, './docs-svelte-kit/src/lib'),
assets: path.join(dirname, './docs-svelte-kit/statics')
lib: path.join(dirname, './src/lib'),
assets: path.join(dirname, './statics')
}
}
};
Expand Down
25 changes: 25 additions & 0 deletions docs-svelte-kit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"target": "es2020",
"module": "NodeNext",
"moduleResolution": "Node16",
"lib": ["es2020", "dom"],
"allowJs": true,
"checkJs": true,
"declaration": true,
"strict": true,
"noImplicitAny": true,

"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"esModuleInterop": true,
"outDir": "lib",
"skipLibCheck": true,
"resolveJsonModule": true
},
"include": ["vite.config.ts", "**/*.mts", "**/*.ts"]
}
26 changes: 13 additions & 13 deletions vite.config.mts → docs-svelte-kit/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import path from 'path';
// @ts-expect-error -- Missing types
import svelteMd from 'vite-plugin-svelte-md';
import eslint4b, { requireESLintUseAtYourOwnRisk4b } from 'vite-plugin-eslint4b';
import svelteMdOption from './docs-svelte-kit/tools/vite-plugin-svelte-md-option.mjs';
import svelteMdOption from './tools/vite-plugin-svelte-md-option.mjs';

import './docs-svelte-kit/build-system/build.mts';
import generateRoutes from './docs-svelte-kit/tools/generate-routes.mjs';
import './build-system/build.ts';
import generateRoutes from './tools/generate-routes.mjs';
import type { UserConfig } from 'vite';
import { fileURLToPath } from 'url';

Expand All @@ -20,7 +20,7 @@ const config: UserConfig = {
svelteMd(
svelteMdOption({
baseUrl: '/eslint-plugin-svelte',
root: path.join(dirname, './docs')
root: path.join(dirname, '../docs')
})
),
sveltekit(),
Expand All @@ -32,15 +32,15 @@ const config: UserConfig = {
},
resolve: {
alias: {
assert: path.join(dirname, './docs-svelte-kit/shim/assert.mjs'),
'postcss-load-config': path.join(dirname, './docs-svelte-kit/shim/postcss-load-config.mjs'),
'source-map-js': path.join(dirname, './docs-svelte-kit/shim/source-map-js.mjs'),
module: path.join(dirname, './docs-svelte-kit/shim/module.mjs'),
url: path.join(dirname, './docs-svelte-kit/shim/url.mjs'),
os: path.join(dirname, './docs-svelte-kit/shim/os.mjs'),
fs: path.join(dirname, './docs-svelte-kit/shim/fs.mjs'),
globby: path.join(dirname, './docs-svelte-kit/shim/globby.mjs'),
picocolors: path.join(dirname, './docs-svelte-kit/shim/picocolors.mjs'),
assert: path.join(dirname, './shim/assert.mjs'),
'postcss-load-config': path.join(dirname, './shim/postcss-load-config.mjs'),
'source-map-js': path.join(dirname, './shim/source-map-js.mjs'),
module: path.join(dirname, './shim/module.mjs'),
url: path.join(dirname, './shim/url.mjs'),
os: path.join(dirname, './shim/os.mjs'),
fs: path.join(dirname, './shim/fs.mjs'),
globby: path.join(dirname, './shim/globby.mjs'),
picocolors: path.join(dirname, './shim/picocolors.mjs'),
tslib: path.join(dirname, './node_modules/tslib/tslib.es6.js'),

// Alias to CJS
Expand Down
1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
packages:
- 'packages/*'
- 'docs-svelte-kit'

0 comments on commit 879149a

Please sign in to comment.