Skip to content

Commit 4863ab0

Browse files
fix: formatting YAML properties and exporting a cjs build (#12)
--------- Co-authored-by: Farnabaz <[email protected]>
1 parent 6d36df2 commit 4863ab0

File tree

48 files changed

+1349
-530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1349
-530
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '22'
20+
- run: npm i -g --force corepack && corepack enable
21+
- run: pnpm install
22+
- run: pnpm lint
23+
- run: pnpm build
24+
- run: pnpm test

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ const editor = monaco.editor.create(el, {
158158
})
159159
```
160160

161+
## VS Code Extension
162+
163+
The exported `formatter` and `getDocumentFoldingRanges` functions are also utilized in [@nuxtlabs/vscode-mdc](https://github.com/nuxtlabs/vscode-mdc) to provide the functionality to the [MDC VS Code extension](https://marketplace.visualstudio.com/items?itemName=Nuxt.mdc).
164+
161165
## 💻 Development
162166

163167
- Clone repository

build.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineBuildConfig } from 'unbuild'
2+
3+
// https://github.com/unjs/unbuild?tab=readme-ov-file#configuration
4+
export default defineBuildConfig({
5+
name: '@nuxtlabs/monarch-mdc',
6+
// Each separate plugin's entry file should be listed here
7+
entries: [
8+
'./src/index',
9+
],
10+
externals: [
11+
'monaco-editor-core',
12+
],
13+
// Generates .d.ts declaration file(s)
14+
declaration: true,
15+
// Clean the output directory before building
16+
clean: true,
17+
rollup: {
18+
// Export as CommonJS module, primarily for accessing the formatter in @nuxtlabs/vscode-mdc
19+
emitCJS: true,
20+
},
21+
})

package.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.4.0",
44
"license": "MIT",
55
"description": "Integrate MDC syntax with Monaco Editor",
6-
"main": "./dist/index.mjs",
6+
"main": "./dist/index.cjs",
77
"module": "./dist/index.mjs",
88
"types": "./dist/index.d.ts",
99
"files": [
@@ -21,6 +21,8 @@
2121
"@nuxt/eslint-config": "^0.7.5",
2222
"@vitest/ui": "^2.1.8",
2323
"eslint": "^9.17.0",
24+
"execa": "^9.5.2",
25+
"mdclint": "^0.0.2",
2426
"monaco-editor-core": "^0.52.2",
2527
"release-it": "^18.1.1",
2628
"unbuild": "^3.2.0",
@@ -41,14 +43,5 @@
4143
"npm": {
4244
"publish": false
4345
}
44-
},
45-
"build": {
46-
"entries": [
47-
"./src/index"
48-
],
49-
"externals": [
50-
"monaco-editor-core"
51-
],
52-
"declaration": true
5346
}
5447
}

0 commit comments

Comments
 (0)