Skip to content

Commit

Permalink
refactor: support monorepo (#160)
Browse files Browse the repository at this point in the history
* refactor: support monorepo

* refactor: update lock file
  • Loading branch information
Jocs authored Apr 19, 2024
1 parent 6bf4553 commit c89e755
Show file tree
Hide file tree
Showing 603 changed files with 50,371 additions and 39,806 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

21 changes: 21 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Node Setup
description: Node.js setup for CI, including cache configuration

runs:
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install
shell: bash
37 changes: 37 additions & 0 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 🩺 CI Lint

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
eslint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: 🌡️ Run ESLint
run: pnpm lint --quiet

typecheck:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: 🧼 Type checking
run: npm run lint:types
25 changes: 25 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 🧪 CI Test

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read
pull-requests: write

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: ./.github/actions/setup-node

- name: 🩺 Run test
run: pnpm run test
32 changes: 0 additions & 32 deletions .github/workflows/node.js.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ lerna-debug.log*

node_modules
dist
lib
coverage
*.local

Expand All @@ -22,3 +23,7 @@ coverage
*.njsproj
*.sln
*.sw?

# turbo
.turbo
.vercel
6 changes: 3 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

bun run commitlint --edit $1
npx --no -- commitlint --edit ${1}
7 changes: 4 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
#!/usr/bin/env sh
# . "$(dirname -- "$0")/_/husky.sh"

bun run lint-staged
# lint all changed files
npx --no lint-staged --concurrent false
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*.ts": ["eslint --fix"],
"*.{html,css}": ["stylelint \"/**/*.css\" --fix"]
"*.{html,css}": ["stylelint \"**/*.css\" --fix"]
}
25 changes: 25 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"git": {
"commitMessage": "chore(release): release v${version}",
"tagName": "v${version}"
},
"npm": false,
"github": {
"release": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular",
"infile": "CHANGELOG.md",
"ignoreRecommendedBump": true
},

"@release-it-plugins/workspaces": {
"publish": false,
"skipChecks": true,
"workspaces": [
"packages/*"
]
}
}
}
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<p align="center"><img src="./public/logo.jpg" alt="muya" height="150"></p>


<p align="center"><img src="./docs/logo.jpg" alt="muya" height="150"></p>

**Muya** originated from [MarkText](https://github.com/marktext/marktext), which was originally used in the MarkText and provides Markdown editing support for MarkText. Today, Muya is available as a stand-alone library that provides an efficient Markdown editing experience for many web browser applications.

Expand Down Expand Up @@ -33,15 +31,15 @@ Coming soon!!!

```sh
# step1: install dependencies
bun install
pnpm install
# step2: run the development codes
bun run dev
pnpm run dev
```

## Build

```sh
bun build
pnpm build
```

## publish
Expand Down
Binary file removed bun.lockb
Binary file not shown.
File renamed without changes
72 changes: 72 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// eslint.config.mjs
import antfu from '@antfu/eslint-config';
import parser from '@typescript-eslint/parser';

function typescriptPreset() {
return {
files: ['**/*.ts', '**/*.tsx'],
rules: {
'ts/naming-convention': [
'warn',
// Interfaces' names should start with a capital 'I'.
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z0-9]',
match: true,
},
},
// Private fields of a class should start with an underscore '_'.
{
selector: ['classMethod', 'classProperty'],
modifiers: ['private'],
format: ['camelCase'],
leadingUnderscore: 'require',
},
],
},
languageOptions: {
parser,
},
};
}

export default antfu(
{
stylistic: {
indent: 4,
semi: true,
},
react: false,
yaml: {
overrides: {
'yaml/indent': ['error', 4, { indicatorValueIndent: 2 }],
},
},
markdown: false,
typescript: true,
formatters: {
css: true,
html: true,
},
},
{
files: ['**/*.ts', '**/*.tsx'],
ignores: [
'**/*.tsx',
'**/*.d.ts',
'**/vite.config.ts',
'playwright.config.ts',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/*.test.ts',
'**/*.test.tsx',
], // do not check test files
rules: {
'complexity': ['warn', { max: 20 }],
'max-lines-per-function': ['warn', 200],
},
},
typescriptPreset(),
);
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Muya vanilla ts demo project
4 changes: 2 additions & 2 deletions index.html → examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.jpg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Muya Development</title>
<title>Muya Example</title>
</head>
<body>
<div class="tools">
Expand All @@ -22,6 +22,6 @@
<div class="editor-container">
<div id="editor"></div>
</div>
<script type="module" src="/examples/main.ts"></script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading

0 comments on commit c89e755

Please sign in to comment.