Skip to content

Commit c8ba6d2

Browse files
authored
Merge pull request #41 from CodinGame/fix-release
Fix release
2 parents 072a97c + fff52cd commit c8ba6d2

File tree

8 files changed

+2885
-6767
lines changed

8 files changed

+2885
-6767
lines changed
File renamed without changes.

.github/workflows/check_build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
name: Lint commits
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313
with:
1414
# we actually need "github.event.pull_request.commits + 1" commit
1515
fetch-depth: 0
16-
- uses: actions/setup-node@v3
16+
- uses: actions/setup-node@v4
1717
- run: npm ci
1818
- run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
1919
check:
@@ -22,11 +22,11 @@ jobs:
2222

2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626
with:
2727
fetch-depth: 0
2828
- name: Setup Node.js
29-
uses: actions/setup-node@v3
29+
uses: actions/setup-node@v4
3030
with:
3131
node-version: 20.10.0
3232
- name: Install dependencies

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99

1010
steps:
1111
- name: Checkout
12-
uses: actions/checkout@v3
12+
uses: actions/checkout@v4
1313
- name: Setup Node.js
14-
uses: actions/setup-node@v3
14+
uses: actions/setup-node@v4
1515
with:
1616
node-version: 20.10.0
1717
- name: Install dependencies

commitlint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module.exports = {
1+
export default {
22
extends: ['@codingame/commitlint-config-codingame']
33
};

package-lock.json

Lines changed: 2843 additions & 6729 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"name": "@codingame/monaco-editor-react",
33
"version": "0.0.0-semantic-release",
44
"description": "Monaco Editor React component",
5+
"type": "module",
6+
"release": {
7+
"extends": "@codingame/semantic-release-config-github"
8+
},
59
"scripts": {
610
"build": "npm run lint && npm run compile",
711
"compile": "tsc",
@@ -35,28 +39,28 @@
3539
],
3640
"types": "dist/index.d.ts",
3741
"dependencies": {
38-
"@codingame/monaco-editor-wrapper": "^5.1.0",
42+
"@codingame/monaco-editor-wrapper": "^5.2.0",
3943
"deep-equal": "^2.2.3",
4044
"lodash.debounce": "^4.0.8",
41-
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@^2.1.1",
45+
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@^2.1.3",
4246
"react-dom": "^18.2.0",
4347
"uuid": "^9.0.1",
44-
"vscode": "npm:@codingame/monaco-vscode-api@^2.1.1"
48+
"vscode": "npm:@codingame/monaco-vscode-api@^2.1.3"
4549
},
4650
"devDependencies": {
47-
"@codingame/commitlint-config-codingame": "^1.0.7",
51+
"@codingame/commitlint-config-codingame": "^1.0.10",
4852
"@codingame/eslint-config": "^1.1.10",
4953
"@codingame/eslint-config-react": "^1.0.2",
50-
"@codingame/semantic-release-config": "^1.3.5",
54+
"@codingame/semantic-release-config-github": "^1.0.0",
5155
"@codingame/tsconfig": "^1.1.1",
52-
"@commitlint/cli": "^18.6.0",
56+
"@commitlint/cli": "^18.6.1",
5357
"@types/deep-equal": "^1.0.4",
5458
"@types/lodash.debounce": "^4.0.9",
5559
"@types/react": "18.2.55",
5660
"@types/react-dom": "^18.2.19",
5761
"@types/vscode": "^1.86.0",
58-
"@typescript-eslint/eslint-plugin": "6.21.0",
59-
"@typescript-eslint/parser": "6.21.0",
62+
"@typescript-eslint/eslint-plugin": "7.0.1",
63+
"@typescript-eslint/parser": "7.0.1",
6064
"conventional-changelog-conventionalcommits": "^7.0.2",
6165
"eslint": "8.56.0",
6266
"eslint-config-standard": "17.1.0",
@@ -71,6 +75,9 @@
7175
"peerDependencies": {
7276
"react": ">=16.0.0"
7377
},
78+
"overrides": {
79+
"@typescript-eslint/eslint-plugin": "$@typescript-eslint/eslint-plugin"
80+
},
7481
"volta": {
7582
"node": "20.10.0",
7683
"npm": "10.4.0"

release.config.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/vscodeParts.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Fragment, ReactNode, useEffect, useRef, useState } from 'react'
22
import * as monaco from 'monaco-editor'
3-
import { renderSidebarPart, renderActivitybarPar, renderEditorPart, renderPanelPart, renderStatusBarPart, registerCustomView, ViewContainerLocation, CustomViewOption } from '@codingame/monaco-vscode-views-service-override/views'
3+
import { attachPart, Parts, onPartVisibilityChange, registerCustomView, ViewContainerLocation, CustomViewOption, isPartVisibile } from '@codingame/monaco-vscode-views-service-override/views'
44
import { createPortal } from 'react-dom'
55
import { initializePromise } from '@codingame/monaco-editor-wrapper'
66
import { DisposableStore } from 'vscode/monaco'
@@ -12,19 +12,19 @@ interface CustomView extends Omit<CustomViewOption, 'renderBody' | 'location' |
1212
})[]
1313
}
1414

15-
interface VscodePartRendererProps {
15+
export interface VscodePartRendererProps {
1616
views?: CustomView[]
1717
className?: string
1818
style?: React.CSSProperties
1919
}
2020

21-
function createPart (location: ViewContainerLocation | null, renderPart: (container: HTMLElement) => monaco.IDisposable) {
21+
function createPart (part: Parts, location: ViewContainerLocation | null) {
2222
const element = document.createElement('div')
2323
element.style.flex = '1'
2424
element.style.minWidth = '0'
2525

2626
initializePromise.then(() => {
27-
renderPart(element)
27+
attachPart(part, element)
2828
}, console.error)
2929

3030
let counter = 0
@@ -46,6 +46,15 @@ function createPart (location: ViewContainerLocation | null, renderPart: (contai
4646

4747
const [portalComponents, setPortalComponents] = useState({} as Record<string, HTMLElement>)
4848

49+
const [visible, setVisible] = useState(isPartVisibile(part))
50+
51+
useEffect(() => {
52+
const disposable = onPartVisibilityChange(part, setVisible)
53+
return () => {
54+
disposable.dispose()
55+
}
56+
}, [])
57+
4958
useEffect(() => {
5059
if (location == null) {
5160
return
@@ -126,7 +135,7 @@ function createPart (location: ViewContainerLocation | null, renderPart: (contai
126135
})}
127136
<div
128137
ref={ref} className={className} style={{
129-
display: 'flex',
138+
display: visible ? 'flex' : 'none',
130139
alignItems: 'stretch',
131140
justifyContent: 'stretch',
132141
...style
@@ -137,10 +146,11 @@ function createPart (location: ViewContainerLocation | null, renderPart: (contai
137146
}
138147
}
139148

140-
export const SidebarPart = createPart(ViewContainerLocation.Sidebar, renderSidebarPart)
141-
export const ActivitybarPart = createPart(null, renderActivitybarPar)
142-
export const EditorPart = createPart(null, renderEditorPart)
143-
export const StatusBarPart = createPart(null, renderStatusBarPart)
144-
export const PanelPart = createPart(ViewContainerLocation.Panel, renderPanelPart)
149+
export const SidebarPart = createPart(Parts.SIDEBAR_PART, ViewContainerLocation.Sidebar)
150+
export const ActivitybarPart = createPart(Parts.ACTIVITYBAR_PART, null)
151+
export const EditorPart = createPart(Parts.EDITOR_PART, null)
152+
export const StatusBarPart = createPart(Parts.STATUSBAR_PART, null)
153+
export const PanelPart = createPart(Parts.PANEL_PART, ViewContainerLocation.Panel)
154+
export const AuxiliaryPart = createPart(Parts.AUXILIARYBAR_PART, ViewContainerLocation.AuxiliaryBar)
145155

146156
export type { CustomView }

0 commit comments

Comments
 (0)