Skip to content

Commit

Permalink
chore: migrate to monorepo (#759)
Browse files Browse the repository at this point in the history
WIP. Still there are a lot of todos.
-> I will continue work on next weekend. (18th, 19th May)

---------

Co-authored-by: yosuke ota <otameshiyo23@gmail.com>
  • Loading branch information
baseballyama and ota-meshi committed Jun 8, 2024
1 parent 7e4e258 commit 74e0f0b
Show file tree
Hide file tree
Showing 1,887 changed files with 463 additions and 607 deletions.
1 change: 0 additions & 1 deletion .browserslistrc

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/GHPages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ jobs:
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
- name: Install And Build
run: |+
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
74 changes: 54 additions & 20 deletions .github/workflows/NodeCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [main]

env:
project_root_path: ./packages/eslint-plugin-svelte

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -15,12 +18,20 @@ jobs:
- uses: actions/setup-node@v4
- name: Install Packages
run: pnpm install
- name: Lint
run: |+
- name: Lint eslint-plugin-svelte
run: |
pnpm run build
pnpm run lint
working-directory: ${{ env.project_root_path }}
- name: Lint docs-svelte-kit
run: |
pnpm run build
pnpm run lint
working-directory: ./docs-svelte-kit
- name: Type Coverage
run: pnpm run typecov
working-directory: ${{ env.project_root_path }}

build:
runs-on: ubuntu-latest
steps:
Expand All @@ -30,9 +41,11 @@ jobs:
- name: Install Packages
run: pnpm install
- name: Build
run: |+
run: |
pnpm run update
pnpm run build
working-directory: ${{ env.project_root_path }}

test:
name: 'Test for ESLint ${{ matrix.eslint }} on Node.js: ${{ matrix.node }} OS: ${{matrix.os}}'
runs-on: ${{ matrix.os }}
Expand All @@ -49,15 +62,23 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install ESLint ${{ matrix.eslint }}
run: |+
pnpm install -D eslint@${{ matrix.eslint }}
rm -rf node_modules
if: matrix.eslint != 9
- name: Install Packages
run: pnpm install
- name: Build eslint-plugin-svelte
run: pnpm build
working-directory: ${{ env.project_root_path }}
# Hack: Install `eslint-plugin-svelte` is necessary for `packages/eslint-plugin-svelte/tests/src/configs` tests.
- name: Install eslint-plugin-svelte
run: pnpm install -D eslint-plugin-svelte
working-directory: ${{ env.project_root_path }}
- name: Install ESLint ${{ matrix.eslint }}
if: matrix.eslint != 9
run: pnpm install -D -w eslint@${{ matrix.eslint }}

- name: Test
run: pnpm run test
run: pnpm test
working-directory: ${{ env.project_root_path }}

test-for-svelte-v4:
name: 'Test for Svelte v4 on Node.js: ${{ matrix.node }} OS: ${{matrix.os}}'
runs-on: ${{ matrix.os }}
Expand All @@ -83,17 +104,20 @@ jobs:
with:
node-version: ${{ matrix.node }}
- name: Install svelte@4
run: |+
run: |
pnpm install -D svelte@4
rm -rf node_modules
working-directory: ${{ env.project_root_path }}
- name: Install ESLint ${{ matrix.eslint }}
run: |+
pnpm install -D eslint@${{ matrix.eslint }}
run: |
pnpm install -D -w eslint@${{ matrix.eslint }}
rm -rf node_modules
- name: Install Packages
run: pnpm install
- name: Test
run: pnpm run test
working-directory: ${{ env.project_root_path }}

test-for-svelte-v3:
name: Test for Svelte v3
runs-on: ${{ matrix.os }}
Expand All @@ -109,18 +133,25 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Remove @sveltejs/kit # Remove @sveltejs/kit because postinstall fails on old node.
run: |+
pnpm rm @sveltejs/kit
rm -rf node_modules
- name: Install svelte@3
run: |+
pnpm install -D svelte@3 @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5 eslint@8
# Remove @sveltejs/kit because postinstall fails on old node.
run: |
cd docs-svelte-kit
pnpm rm @sveltejs/kit
cd ..
pnpm install -D -w @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5 eslint@8
cd packages/eslint-plugin-svelte
pnpm install -D svelte@3
cd ../..
rm -rf packages/eslint-plugin-svelte/node_modules
rm -rf docs-svelte-kit/node_modules
rm -rf node_modules
- name: Install Packages
run: pnpm install
- name: Test
run: pnpm run test
working-directory: ${{ env.project_root_path }}

test-for-typescript-eslint-v5:
name: Test for typescript-eslint v5
runs-on: ${{ matrix.os }}
Expand All @@ -137,13 +168,15 @@ jobs:
with:
node-version: ${{ matrix.node }}
- name: Install typescript-eslint v5
run: |+
pnpm install -D @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5
run: |
pnpm install -D -w @typescript-eslint/parser@5 @typescript-eslint/eslint-plugin@5
rm -rf node_modules
- name: Install Packages
run: pnpm install
- name: Test
run: pnpm run test
working-directory: ${{ env.project_root_path }}

update-resources:
runs-on: ubuntu-latest
steps:
Expand All @@ -156,6 +189,7 @@ jobs:
run: pnpm install
- name: Update resources
run: pnpm run update
working-directory: ${{ env.project_root_path }}
- name: Check changes
run: |
git add --all && \
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/format.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ dist

## repo
/pnpm-lock.yaml
/lib
/.svelte-kit
/.type-coverage
/build
packages/eslint-plugin-svelte/lib
packages/eslint-plugin-svelte/.type-coverage

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
22 changes: 0 additions & 22 deletions .stylelintignore

This file was deleted.

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
59 changes: 59 additions & 0 deletions docs-svelte-kit/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import * as myPlugin from '@ota-meshi/eslint-plugin';
import globals from 'globals';

/**
* @type {import('eslint').Linter.FlatConfig[]}
*/
const config = [
{
ignores: [
'node_modules/',
'.svelte-kit/',
'build/',
'shim/eslint.mjs',
'shim/assert.mjs',
'src/routes/*.md',
'src/routes/**/*.md',
'src/app.html'
]
},
...myPlugin.config({
eslintPlugin: true,
ts: true,
json: true,
packageJson: true,
yaml: true,
md: true,
prettier: true,
svelte: { withTs: false }
}),
{
languageOptions: {
sourceType: 'module',
globals: {
...globals.browser,
require: 'readonly'
}
}
},
{
rules: {
'jsdoc/require-jsdoc': 'off',
'@typescript-eslint/no-shadow': 'off',
'no-shadow': 'off',
'@typescript-eslint/naming-convention': 'off',
'new-cap': 'off',
complexity: 'off',
'n/no-missing-import': 'off',
'n/file-extension-in-import': 'off',
'n/no-extraneous-import': 'off'
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: { project: null }
}
}
];
export default config;
63 changes: 63 additions & 0 deletions docs-svelte-kit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "docs",
"private": true,
"type": "module",
"scripts": {
"lint": "eslint --cache .",
"lint-fix": "eslint --cache . --fix",
"build": "cd ../packages/eslint-plugin-svelte && pnpm build && cd ../../docs-svelte-kit && pnpm run svelte-kit build",
"preview": "pnpm run svelte-kit preview",
"dev": "pnpm run svelte-kit dev",
"svelte-kit": "vite"
},
"devDependencies": {
"@babel/core": "^7.24.5",
"@babel/types": "^7.24.5",
"@fontsource/fira-mono": "^5.0.13",
"@ota-meshi/eslint-plugin": "^0.17.1",
"@sindresorhus/slugify": "^2.2.1",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.9",
"@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-scope": "^3.7.7",
"@types/eslint-visitor-keys": "^3.3.0",
"@types/less": "^3.0.6",
"@types/markdown-it": "^14.1.1",
"@types/markdown-it-container": "^2.0.10",
"@types/markdown-it-emoji": "^3.0.1",
"@types/node": "^20.12.12",
"@types/prismjs": "^1.26.4",
"@types/stylus": "^0.48.42",
"@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.3",
"escape-html": "^1.0.3",
"eslint-plugin-svelte": "workspace:^",
"eslint-scope": "^8.0.1",
"eslint-visitor-keys": "^4.0.0",
"espree": "^10.0.1",
"globals": "^15.2.0",
"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",
"prism-svelte": "^0.5.0",
"prismjs": "^1.29.0",
"sass": "^1.77.2",
"source-map-js": "^1.2.0",
"stylus": "^0.63.0",
"svelte": "^5.0.0-next.112",
"svelte-adapter-ghpages": "0.2.2",
"util": "^0.12.5",
"vite": "^5.2.11",
"vite-plugin-eslint4b": "^0.4.2",
"vite-plugin-svelte-md": "^0.1.7"
}
}
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 };
Loading

0 comments on commit 74e0f0b

Please sign in to comment.