Skip to content

Commit

Permalink
feat!: project overhaul (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu authored Sep 1, 2023
1 parent 5ff7fd7 commit 6294dbc
Show file tree
Hide file tree
Showing 21 changed files with 4,890 additions and 4,986 deletions.
23 changes: 1 addition & 22 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": [
"out",
"dist",
"**/*.d.ts"
]
"extends": "@nuxtjs/typescript"
}
34 changes: 6 additions & 28 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,16 @@ on:

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [16]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Checkout
uses: actions/checkout@master
with:
persist-credentials: false
fetch-depth: 0

- name: Cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}

- name: Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn

- name: Lint
run: yarn lint
node-version: lts/*

# - name: Test
# run: yarn test
- name: pnpm setup
uses: pnpm/action-setup@v2

- name: Generate extension
run: yarn generate
Expand All @@ -48,3 +25,4 @@ jobs:
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
dependencies: false
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
52 changes: 12 additions & 40 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,18 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run VSCode Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Run Web Extension in VS Code",
"type": "pwa-extensionHost",
"debugWebWorkerHost": true,
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentKind=web"
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": ["${workspaceFolder}/dist/web/**/*.js"],
"preLaunchTask": "npm: watch-web"
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: dev"
}
]
]
}
39 changes: 19 additions & 20 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch-web",
"group": "build",
"script": "dev",
"isBackground": true,
"problemMatcher": ["$ts-webpack-watch"]
"presentation": {
"reveal": "never"
},
"problemMatcher": [
{
"base": "$ts-webpack-watch",
"background": {
"activeOnStart": true,
"beginsPattern": "Start build",
"endsPattern": "Write syntaxes/mdc.tmLanguage.json"
}
}
],
"group": "build"
}
]
]
}
2 changes: 2 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ vsc-extension-quickstart.md
**/.eslintrc.json
**/*.map
**/*.ts
example.md
scritps/**
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

68 changes: 68 additions & 0 deletions example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Hello

_Hello_ **World** from [`vscode-mdc`](https://github.com/nuxtlabs/vscode-mdc)

> This file contains the basic Markdown Components syntax
::hero
:::card
A nested card

::::card { title="Card title" .red}
A **super** nested card
::::
:::
::

::hero
Default slot text

#description
This will be rendered inside the `description` slot.
::

- [x] List A
- [ ] List B
- [ ] List B.1

![](/af-logo-animated.svg){.w-30.mt--10.mb-5}

## Hello{.text-red}

Hello World{class="text-green text-xl"}

[Link](https://nuxt.com){class="nuxt"}

![Nuxt Logo](https://nuxt.com/assets/design-kit/logo/icon-green.svg){#nuxt-logo}

`code`{style="color: red"}

_italic_{style="color: blue"}

**bold**{style="color: blue"}

```bash
npm i nuxt
```

```ts
import MarkdownIt from 'markdown-it'
import mdc from 'markdown-it-mdc'

// :warning: this line should not be transformed
const md = new MarkdownIt()
.use(mdc)
```

<Counter :count="1" />

<CustomComponent>
Nested <Counter @click="foo" />
</CustomComponent>

<style scoped>
.mdc-button {
background-color: #ff0000;
}
</style>

49 changes: 16 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "mdc",
"displayName": "MDC",
"packageManager": "pnpm@8.7.1",
"displayName": "MDC - Markdown Components",
"description": "Provides syntax highlighting and colon matching for MDC (Markdown Components) files for Nuxt Content.",
"version": "0.1.8",
"publisher": "Nuxt",
Expand All @@ -10,19 +11,14 @@
"type": "git"
},
"homepage": "https://github.com/nuxtlabs/vscode-mdc/blob/main/README.md",
"license": "SEE LICENSE IN LICENSE",
"license": "MIT",
"engines": {
"vscode": "^1.42.0"
},
"categories": [
"Programming Languages",
"Snippets"
],
"activationEvents": [
"onStartupFinished"
],
"main": "./out/extension.js",
"browser": "./dist/web/extension.js",
"contributes": {
"languages": [
{
Expand Down Expand Up @@ -55,37 +51,24 @@
]
},
"scripts": {
"vscode:prepublish": "yarn run compile && npm run package-web",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "yarn run compile && yarn run lint",
"vscode:prepublish": "npm run build",
"build": "esno scripts/build.ts",
"dev": "esno watch scripts/build.ts",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"test": "vitest",
"release": "standard-version && git push --follow-tags",
"generate": "vsce package --yarn",
"compile-web": "webpack",
"watch-web": "webpack --watch",
"package-web": "webpack --mode production --devtool hidden-source-map"
"generate": "vsce package --no-dependencies",
"publish": "vsce publish --no-dependencies"
},
"devDependencies": {
"@types/glob": "^8.0.0",
"@types/mocha": "^9.1.1",
"@types/node": "18.x",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@types/node": "^18.17.12",
"@types/vscode": "1.42.0",
"@types/webpack-env": "^1.18.0",
"@vscode/test-web": "^0.0.30",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"eslint": "^8.23.1",
"glob": "^8.0.3",
"mocha": "^10.0.0",
"process": "^0.11.10",
"@vscode/vsce": "^2.21.0",
"eslint": "^8.48.0",
"esno": "^0.17.0",
"standard-version": "^9.5.0",
"ts-loader": "^9.3.1",
"typescript": "4.8.3",
"vsce": "^2.11.0",
"vscode-test": "^1.6.1",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"typescript": "5.2.2",
"vscode-textmate": "^9.0.0"
}
}
Loading

0 comments on commit 6294dbc

Please sign in to comment.