Skip to content

Commit

Permalink
Merge pull request #6 from ony3000/reorganize-repository-structure
Browse files Browse the repository at this point in the history
Reorganize the repository structure into a monorepo
  • Loading branch information
ony3000 committed Oct 2, 2023
2 parents 819c2c2 + 08c9c51 commit 17b94f0
Show file tree
Hide file tree
Showing 50 changed files with 743 additions and 711 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

25 changes: 0 additions & 25 deletions .eslintrc.json

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,9 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# turbo
.turbo

# vercel
.vercel
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"importOrderSeparation": true,
"overrides": [
{
"files": ["tests/**/performance/Callout.*"],
"files": ["packages/test-suite/**/performance/Callout.*"],
"options": {
"printWidth": 80,
"singleQuote": false
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"eslint.workingDirectories": [{ "mode": "auto" }]
}
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

1 change: 1 addition & 0 deletions LICENSE
51 changes: 0 additions & 51 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
68 changes: 15 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,26 @@
{
"name": "prettier-plugin-merge",
"version": "0.2.1",
"description": "A Prettier plugin that sequentially applies the formatting results of other Prettier plugins.",
"repository": "https://github.com/ony3000/prettier-plugin-merge",
"keywords": [
"prettier",
"plugin",
"merge"
],
"private": true,
"name": "root",
"version": "0.0.0",
"author": "Hyeonjong <nianelo4@gmail.com>",
"license": "MIT",
"type": "module",
"files": [
"dist"
],
"types": "./dist/index.d.ts",
"main": "./dist/prettier-plugin-merge.umd.cjs",
"module": "./dist/prettier-plugin-merge.js",
"exports": {
".": {
"import": "./dist/prettier-plugin-merge.js",
"require": "./dist/prettier-plugin-merge.umd.cjs"
}
},
"scripts": {
"dev": "vite build --watch --minify=false",
"build": "vite build",
"lint": "eslint src",
"test": "pnpm run build && jest --ci --passWithNoTests"
},
"dependencies": {
"diff": "5.1.0"
"clean": "pnpm -r exec rm -rf dist && pnpm -r exec rm -rf node_modules",
"dev": "turbo run dev --no-daemon --filter bundle-entry",
"build": "turbo run build --no-daemon --filter bundle-entry",
"lint": "turbo run lint --no-daemon",
"test": "turbo run test --no-daemon --filter test-suite",
"merge-deps": "merge-packages packages/bundle-entry packages/eslint-config-custom packages/test-suite packages/tsconfig packages/v2-plugin",
"prepare-release": "pnpm -r exec rm -rf dist && turbo run prepare-release --no-daemon --filter prettier-plugin-merge"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "4.1.1",
"@types/diff": "5.0.3",
"@types/jest": "29.5.2",
"@types/node": "20.2.5",
"@typescript-eslint/eslint-plugin": "5.54.0",
"@typescript-eslint/parser": "5.54.0",
"eslint": "8.35.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-config-prettier": "8.6.0",
"eslint-import-resolver-node": "0.3.7",
"eslint-import-resolver-typescript": "3.5.3",
"eslint-plugin-import": "2.27.5",
"jest": "29.5.0",
"ppm-012": "npm:prettier-plugin-merge@0.1.2",
"ppm-020": "npm:prettier-plugin-merge@0.2.0",
"merge-packages": "0.1.6",
"prettier": "~2.8.4",
"prettier-plugin-brace-style": "0.2.1",
"prettier-plugin-classnames": "0.1.1",
"prettier-plugin-tailwindcss": "0.3.0",
"ts-jest": "29.1.0",
"typescript": "4.9.5",
"vite": "4.3.9",
"vite-plugin-dts": "3.0.0-beta.2"
"tsconfig": "workspace:*",
"turbo": "1.10.14",
"typescript": "4.9.5"
},
"peerDependencies": {
"prettier": "~2.8.4"
}
"packageManager": "pnpm@7.33.0"
}
3 changes: 3 additions & 0 deletions packages/bundle-entry/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['custom/base'],
};
11 changes: 11 additions & 0 deletions packages/bundle-entry/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// eslint-disable-next-line import/no-import-module-exports
import prettier from 'prettier';

if (prettier.version.startsWith('2.')) {
// eslint-disable-next-line global-require
module.exports = require('v2-plugin');
} else {
// TODO: implement v3 plugin
// eslint-disable-next-line global-require
module.exports = require('v2-plugin');
}
26 changes: 26 additions & 0 deletions packages/bundle-entry/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"private": true,
"name": "bundle-entry",
"version": "0.0.0",
"author": "Hyeonjong <nianelo4@gmail.com>",
"license": "MIT",
"main": "dist/index.js",
"scripts": {
"dev": "esbuild index.ts standalone.ts --bundle --outdir=dist --platform=node \"--external:prettier\" --watch=forever",
"build": "esbuild index.ts standalone.ts --bundle --outdir=dist --platform=node \"--external:prettier\" --minify",
"lint": "eslint .",
"prepare-release": "esbuild index.ts --bundle --outdir=dist --platform=node \"--external:prettier\" --minify"
},
"dependencies": {
"prettier": "2.8.4",
"v2-plugin": "workspace:*"
},
"devDependencies": {
"@types/node": "20.2.5",
"esbuild": "0.17.19",
"eslint": "8.35.0",
"eslint-config-custom": "workspace:*",
"tsconfig": "workspace:*",
"typescript": "4.9.5"
}
}
3 changes: 3 additions & 0 deletions packages/bundle-entry/standalone.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import v2Plugin from 'v2-plugin';

export { v2Plugin };
4 changes: 4 additions & 0 deletions packages/bundle-entry/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "tsconfig/base.json",
"include": ["."]
}
30 changes: 30 additions & 0 deletions packages/eslint-config-custom/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { resolve } = require('node:path');

const project = resolve(process.cwd(), 'tsconfig.json');

module.exports = {
extends: ['airbnb-base', 'airbnb-typescript/base', 'prettier'],
parserOptions: {
project,
},
plugins: ['import'],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.mts', '.cts', '.d.ts'],
},
'import/resolver': {
node: {
extensions: ['.js', '.ts'],
},
typescript: {
alwaysTryTypes: true,
},
},
},
ignorePatterns: ['**/*.*js', '**/*.jsx', '**/*.d.ts'],
rules: {
'@typescript-eslint/no-loop-func': 0,
'import/prefer-default-export': 0,
'no-restricted-syntax': 0,
},
};
19 changes: 19 additions & 0 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"private": true,
"name": "eslint-config-custom",
"version": "0.0.0",
"author": "Hyeonjong <nianelo4@gmail.com>",
"license": "MIT",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "5.54.0",
"@typescript-eslint/parser": "5.54.0",
"eslint": "8.35.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-config-prettier": "8.6.0",
"eslint-import-resolver-node": "0.3.7",
"eslint-import-resolver-typescript": "3.5.3",
"eslint-plugin-import": "2.27.5",
"typescript": "4.9.5"
}
}
21 changes: 21 additions & 0 deletions packages/prettier-plugin-merge/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Hyeonjong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
51 changes: 51 additions & 0 deletions packages/prettier-plugin-merge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# prettier-plugin-merge

A Prettier plugin that sequentially applies the formatting results of other Prettier plugins.

**Note**: Prettier v3 is not yet supported.

![The process of applying formats sequentially.](./.github/banner.png)

## Installation

```sh
npm install --save-dev prettier@~2.8 prettier-plugin-merge
```

```sh
yarn add --dev prettier@~2.8 prettier-plugin-merge
```

```sh
pnpm add --save-dev prettier@~2.8 prettier-plugin-merge
```

## Configuration

**Note**: This plugin MUST come last. Other plugins usually have no order constraints.

JSON:

```json
{
"plugins": [
"other-prettier-plugin-1",
"other-prettier-plugin-2",
"other-prettier-plugin-3",
"prettier-plugin-merge"
]
}
```

JS:

```javascript
module.exports = {
plugins: [
require('other-prettier-plugin-1'),
require('other-prettier-plugin-2'),
require('other-prettier-plugin-3'),
require('prettier-plugin-merge'),
],
};
```
Loading

0 comments on commit 17b94f0

Please sign in to comment.