Skip to content

Commit

Permalink
0.7.0 (#1732)
Browse files Browse the repository at this point in the history
* feat: Started testing the mume 0.7.8

* feat: Switched to esbuild to bundle the package.

* feat: Supported MathJax V3

* ci: Added github workflow to test packaging

* feat: Added editor-light/dark and system-light/dark class to preview

* ci: Updated yarn.lock

* ci: Fixed the CI build

* ci: Fixed the CI build

* ci: Fixed the CI build

* ci: Fixed the CI build
  • Loading branch information
shd101wyy authored Sep 1, 2023
1 parent 6a1483e commit d6769fa
Show file tree
Hide file tree
Showing 23 changed files with 4,588 additions and 2,269 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ out


## special cases
mume
29 changes: 12 additions & 17 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
{
"env": {
"browser": false,
"commonjs": true,
"es6": true,
"node": true
},
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn"
}
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": ["**/*.d.ts"]
}
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Test"
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: "Test"
runs-on: ubuntu-latest
steps:
- name: 'Check out code'
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Install nodejs 18'
uses: actions/setup-node@v2
with:
node-version: '18'
- name: 'Build and test'
run: |
corepack enable
yarn global add @vscode/vsce
yarn install
yarn run check:all
yarn run build
# yarn test
vsce package
ls -lah *.vsix
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
node_modules
out
.direnv
mume
crossnote
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ out


## special cases
mume
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2
}
7 changes: 5 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint"]
}
"recommendations": [
"dbaeumer.vscode-eslint",
"connor4312.esbuild-problem-matchers"
]
}
37 changes: 20 additions & 17 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
// Check https://github.com/microsoft/vscode-test-adapter-converter for reference
{
"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",
"group": "build",
"problemMatcher": "$esbuild-watch",
"isBackground": true,
"label": "npm: watch",
},
{
"type": "npm",
"script": "build",
"group": "build",
"problemMatcher": "$esbuild",
"label": "npm: build",
}
]
}
10 changes: 9 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ tsconfig.json
vsc-extension-quickstart.md
styles/src/**
.envrc
.direnv/**
.direnv/**
flake.lock
flake.nix
shell.nix
node_modules
.eslintignore
.prettierignore
build.js
prettier.config.js
47 changes: 47 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const { context, build } = require('esbuild');

/**
* @type {import('esbuild').BuildOptions}
*/
const sharedConfig = {
entryPoints: ['./src/extension.ts'],
bundle: true,
minify: true,
};

/**
* @type {import('esbuild').BuildOptions}
*/
const cjsConfig = {
...sharedConfig,
platform: 'node', // For CJS
outfile: './out/native/extension.js',
target: 'node16',
format: 'cjs',
external: ['vscode'],
};

async function main() {
try {
// Watch mode
if (process.argv.includes('--watch')) {
// CommonJS
const cjsContext = await context({
...cjsConfig,
sourcemap: true,
minify: false,
// bundle: false,
// external: undefined,
});
await cjsContext.watch();
} else {
// Build mode
// CommonJS
await build(cjsConfig);
}
} catch (error) {
console.error(error);
}
}

main();
39 changes: 39 additions & 0 deletions copy-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copy files from
* - ./node_modules/@shd101wyy/mume/out/dependencies/. to ./mume/dependencies/
* - ./node_modules/@shd101wyy/mume/out/styles/. to ./mume/styles/
* - ./node_modules/@shd101wyy/mume/out/webview/. to ./mume/webview/
*/
const fs = require('fs');

const copyData = [
{
source: './node_modules/@shd101wyy/mume/out/dependencies/',
target: './mume/dependencies/',
},
{
source: './node_modules/@shd101wyy/mume/out/styles/',
target: './mume/styles/',
},
{
source: './node_modules/@shd101wyy/mume/out/webview/',
target: './mume/webview/',
},
];

// Delete ./mume directory
if (fs.existsSync('./mume')) {
fs.rmdirSync('./mume', { recursive: true });
}

// Make source directories
copyData.forEach(data => {
fs.mkdirSync(data.target, { recursive: true });
});

// Copy directories
copyData.forEach(data => {
fs.cpSync(data.source, data.target, { recursive: true });
});

console.log('Copy files done.');
66 changes: 38 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,20 @@
"gabyx"
],
"publisher": "shd101wyy",
"main": "./out/src/extension",
"main": "./out/native/extension.js",
"scripts": {
"check": "npm run check:eslint && npm run check:prettier && npm run check:tsc && npm run check:tslint",
"build": "yarn copy:files && rm -rf ./out && node build.js",
"check:all": "yarn check:eslint && yarn check:prettier && yarn check:tsc",
"check:eslint": "eslint \"**/*\"",
"check:prettier": "prettier --check \"**/*.*\"",
"check:tsc": "tsc --project . --noEmit",
"check:tslint": "tslint --project .",
"compile": "tsc -p ./",
"fix": "npm run fix:eslint && npm run fix:tslint && npm run fix:prettier",
"copy:files": "node copy-files.js",
"fix:all": "yarn fix:eslint && yarn fix:eslint && yarn fix:prettier",
"fix:eslint": "eslint --fix \"**/*\"",
"fix:prettier": "prettier --write \"**/*.*\"",
"fix:tslint": "tslint --project .",
"test": "npm run compile && node ./node_modules/vscode/bin/test",
"vscode:prepublish": "npm run compile",
"watch": "tsc -watch -p ./"
"test": "yarn build && node ./node_modules/vscode/bin/test",
"vscode:prepublish": "yarn build",
"watch": "yarn copy:files && rm -rf ./out && node build.js --watch"
},
"contributes": {
"commands": [
Expand Down Expand Up @@ -231,6 +230,11 @@
"https://latex.codecogs.com/png.latex"
]
},
"markdown-preview-enhanced.mathjaxV3ScriptSrc": {
"description": "MathJax v3 script source. Leave it empty to use the default CDN.",
"default": "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js",
"type": "string"
},
"markdown-preview-enhanced.enableWikiLinkSyntax": {
"description": "Enable Wiki Link syntax support. More information can be found at https://help.github.com/articles/adding-links-to-wikis/",
"default": true,
Expand Down Expand Up @@ -494,11 +498,6 @@
"default": 0,
"type": "number"
},
"markdown-preview-enhanced.usePuppeteerCore": {
"description": "If set to true, then locally installed puppeteer-core will be required. Otherwise, the puppeteer globally installed by `npm install -g puppeteer` will be required.",
"default": true,
"type": "boolean"
},
"markdown-preview-enhanced.puppeteerArgs": {
"description": "Args passed to puppeteer.launch({args: $puppeteerArgs})",
"default": [],
Expand All @@ -518,6 +517,16 @@
"markdownDescription": "jsDelivr CDN host. Example values: `cdn.jsdelivr.net`, `fastly.jsdelivr.net`, `gcore.jsdelivr.net`, `testingcf.jsdelivr.net`",
"default": "cdn.jsdelivr.net",
"type": "string"
},
"markdown-preview-enhanced.plantumlJarPath": {
"description": "Absolute path to the plantuml.jar file (`java` is required in system path).",
"default": "",
"type": "string"
},
"markdown-preview-enhanced.krokiServer": {
"description": "The URL of the Kroki server to use. ",
"default": "https://kroki.io",
"type": "string"
}
}
},
Expand Down Expand Up @@ -568,8 +577,7 @@
}
},
"activationEvents": [
"onLanguage:markdown",
"onCommand:markdown-preview-enhanced.openPreviewToTheSide"
"onLanguage:markdown"
],
"husky": {
"hooks": {
Expand All @@ -579,31 +587,33 @@
"lint-staged": {
"**/*.*": [
"eslint",
"prettier --write",
"git add"
"prettier --write"
]
},
"dependencies": {
"@shd101wyy/mume": "0.7.7",
"@shd101wyy/mume": "0.7.8",
"@types/vfile": "^3.0.2"
},
"devDependencies": {
"@types/cheerio": "^0.22.18",
"@types/jquery": "^3.3.9",
"@types/cheerio": "0.22.11",
"@types/mocha": "^5.2.5",
"@types/node": "^11.11.0",
"@types/vscode": "1.70.0",
"eslint": "^5.15.1",
"@types/node": "16",
"@types/vscode": "1.80.0",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"esbuild": "^0.19.2",
"eslint": "^8.48.0",
"husky": "^3.0.9",
"lint-staged": "^9.4.2",
"mocha": "^6.1.4",
"prettier": "^1.18.2",
"prettier-plugin-packagejson": "^2.0.1",
"tslint": "^5.13.1",
"tslint-config-prettier": "^1.18.0",
"typescript": "4.9.4"
"ts-loader": "^9.4.4",
"typescript": "^5.2.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
},
"engines": {
"vscode": "^1.70.0"
"vscode": "^1.80.0"
}
}
8 changes: 4 additions & 4 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
arrowParens: "always",
endOfLine: "lf",
quoteProps: "consistent",
trailingComma: "all",
arrowParens: 'always',
endOfLine: 'lf',
quoteProps: 'consistent',
trailingComma: 'all',
};
Loading

0 comments on commit d6769fa

Please sign in to comment.