Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from Milkdown:main #32

Merged
merged 7 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ runs:
run: pnpm install
shell: bash

- uses: nrwl/nx-set-shas@v4

- name: Build packages
run: pnpm build
shell: bash
74 changes: 58 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,87 @@ on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CI: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
build-and-test:
install-deps:
runs-on: ubuntu-latest
steps:
- name: checkout code repository
- name: Checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: nrwl/nx-set-shas@v4
- uses: ./.github/actions/setup

lint:
runs-on: ubuntu-latest
needs: install-deps
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: install dependencies
run: pnpm install
- name: Run lint
run: pnpm test:lint --format github

- name: run unit tests
unit:
runs-on: ubuntu-latest
needs: install-deps
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ./.github/actions/setup

- name: Run unit tests
run: pnpm test:unit

# build all the packages to prepare for release
- name: build packs
run: pnpm build
e2e:
runs-on: ubuntu-latest
needs: install-deps
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5]
steps:
- name: Checkout code repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: run lint
run: pnpm test:lint --format github
- uses: ./.github/actions/setup

- name: install browsers
- name: Install browsers
run: pnpm --filter=@milkdown/e2e test:install

- name: run playwright
run: pnpm test:e2e
- name: Run playwright
run: pnpm test:e2e -- --forbid-only --shard=${{ matrix.shard }}/${{ strategy.job-total }}

- name: upload test results
- name: Upload test results
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-results-main
name: test-results-e2e-${{ matrix.shard }}
path: e2e/playwright-report/
retention-days: 7

summary:
if: ${{ always() }}
needs: [lint, unit, e2e]
runs-on: ubuntu-latest
steps:
- name: On error
if: ${{ needs.e2e.result != 'success' || needs.unit.result != 'success' || needs.lint.result != 'success' }}
run: exit 1
4 changes: 4 additions & 0 deletions .github/workflows/fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
permissions:
contents: read

env:
CI: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
fix:
runs-on: ubuntu-latest
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:

concurrency: ${{ github.workflow }}-${{ github.ref }}

env:
CI: true
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
prepare:
runs-on: ubuntu-latest
Expand All @@ -20,8 +24,8 @@ jobs:
uses: changesets/action@v1
with:
version: pnpm ci:version
commit: "chore: version packages"
title: "chore: version packages"
commit: 'chore: version packages'
title: 'chore: version packages'
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -35,9 +39,6 @@ jobs:

- uses: ./.github/actions/setup

- name: build packs
run: pnpm build

- name: Publish to NPM
run: pnpm ci:publish
env:
Expand All @@ -52,8 +53,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
commit: main
tag: "${{ env.MILKDOWN_RELEASE_TAG }}"
body: "Please refer to [CHANGELOG.md](https://github.com/milkdown/milkdown/blob/${{ env.MILKDOWN_RELEASE_TAG }}/packages/kit/CHANGELOG.md) for details."
tag: '${{ env.MILKDOWN_RELEASE_TAG }}'
body: 'Please refer to [CHANGELOG.md](https://github.com/milkdown/milkdown/blob/${{ env.MILKDOWN_RELEASE_TAG }}/packages/kit/CHANGELOG.md) for details.'
token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true

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

pnpm exec commitlint --edit $1
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@nx/workspace": "20.2.2",
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.0.0",
"@swc-node/register": "^1.10.9",
"@swc/core": "^1.7.5",
Expand All @@ -56,7 +56,6 @@
"autoprefixer": "^10.2.5",
"concurrently": "^9.0.0",
"cross-env": "^7.0.3",
"cypress": "^13.13.0",
"esbuild": "^0.24.0",
"git-cz": "^4.7.6",
"husky": "^9.0.10",
Expand Down
8 changes: 8 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @milkdown/components

## 7.5.9

### Patch Changes

- a3dde0c: Enable image proxy.
- Updated dependencies [a3dde0c]
- @milkdown/[email protected]

## 7.5.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/components",
"type": "module",
"version": "7.5.8",
"version": "7.5.9",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/table-block/view/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
EditorView,
NodeView,
NodeViewConstructor,
ViewMutationRecord,
} from '@milkdown/prose/view'
import type { Ctx } from '@milkdown/ctx'
import { NodeSelection } from '@milkdown/prose/state'
Expand Down Expand Up @@ -106,7 +107,7 @@ export class TableNodeView implements NodeView {
return false
}

ignoreMutation(mutation: MutationRecord) {
ignoreMutation(mutation: ViewMutationRecord) {
if (!this.dom || !this.contentDOM) return true

if ((mutation.type as unknown) === 'selection') return false
Expand Down
8 changes: 8 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @milkdown/core

## 7.5.9

### Patch Changes

- a3dde0c: Enable image proxy.
- Updated dependencies [a3dde0c]
- @milkdown/[email protected]

## 7.5.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/core",
"type": "module",
"version": "7.5.8",
"version": "7.5.9",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions packages/crepe/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @milkdown/crepe

## 7.5.9

### Patch Changes

- a3dde0c: Enable image proxy.
- Updated dependencies [a3dde0c]
- @milkdown/[email protected]

## 7.5.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/crepe/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/crepe",
"type": "module",
"version": "7.5.8",
"version": "7.5.9",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/crepe/src/feature/block-edit/handle/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { Icon } from '../../shared'
export interface BlockHandleProps {
show: boolean
onAdd: () => void
addIcon: Icon
handleIcon: Icon
addIcon?: Icon
handleIcon?: Icon
}

const blockHandleComponent: Component<BlockHandleProps> = ({
Expand Down
3 changes: 3 additions & 0 deletions packages/crepe/src/feature/image-block/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { captionIcon, confirmIcon, imageIcon } from '../../icons'

interface ImageBlockConfig {
onUpload: (file: File) => Promise<string>
proxyDomURL: (url: string) => Promise<string> | string

inlineImageIcon: Icon
inlineConfirmButton: Icon
Expand Down Expand Up @@ -42,6 +43,7 @@ export const defineFeature: DefineFeature<ImageBlockFeatureConfig> = (
uploadPlaceholderText:
config?.inlineUploadPlaceholderText ?? 'or paste link',
onUpload: config?.inlineOnUpload ?? config?.onUpload ?? value.onUpload,
proxyDomURL: config?.proxyDomURL,
}))
ctx.update(imageBlockConfig.key, (value) => ({
uploadButton: config?.blockUploadButton ?? (() => 'Upload file'),
Expand All @@ -53,6 +55,7 @@ export const defineFeature: DefineFeature<ImageBlockFeatureConfig> = (
uploadPlaceholderText:
config?.blockUploadPlaceholderText ?? 'or paste link',
onUpload: config?.blockOnUpload ?? config?.onUpload ?? value.onUpload,
proxyDomURL: config?.proxyDomURL,
}))
})
.use(imageBlockComponent)
Expand Down
8 changes: 8 additions & 0 deletions packages/ctx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @milkdown/ctx

## 7.5.9

### Patch Changes

- a3dde0c: Enable image proxy.
- Updated dependencies [a3dde0c]
- @milkdown/[email protected]

## 7.5.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ctx/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/ctx",
"type": "module",
"version": "7.5.8",
"version": "7.5.9",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
6 changes: 6 additions & 0 deletions packages/exception/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @milkdown/exception

## 7.5.9

### Patch Changes

- a3dde0c: Enable image proxy.

## 7.5.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/exception/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/exception",
"type": "module",
"version": "7.5.8",
"version": "7.5.9",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions packages/integrations/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @milkdown/react

## 7.5.9

### Patch Changes

- a3dde0c: Enable image proxy.
- Updated dependencies [a3dde0c]
- @milkdown/[email protected]

## 7.5.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/react",
"type": "module",
"version": "7.5.8",
"version": "7.5.9",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions packages/integrations/vue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @milkdown/vue

## 7.5.9

### Patch Changes

- a3dde0c: Enable image proxy.
- Updated dependencies [a3dde0c]
- @milkdown/[email protected]

## 7.5.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/vue",
"type": "module",
"version": "7.5.8",
"version": "7.5.9",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
Loading
Loading