-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from HiDeoo/hd-init-extension
Setup basic extension
- Loading branch information
Showing
20 changed files
with
2,151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: integration | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint_and_test: | ||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
# Run on external PRs, but not on internal PRs as they'll be run by the push event to the branch. | ||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
- name: Test | ||
uses: GabrielBB/xvfb-action@v1.0 | ||
with: | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
dist | ||
.vscode-test | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"printWidth": 120, | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions | ||
{ | ||
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// https://code.visualstudio.com/docs/editor/debugging#_launch-configurations | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Run Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"args": ["--extensionDevelopmentPath=${workspaceFolder}"], | ||
"outFiles": ["${workspaceFolder}/dist/**/*.js"], | ||
"preLaunchTask": "${defaultBuildTask}" | ||
}, | ||
{ | ||
"name": "Test Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"args": [ | ||
"--extensionDevelopmentPath=${workspaceFolder}", | ||
"--extensionTestsPath=${workspaceFolder}/dist/tests/run", | ||
"--disable-extensions" | ||
], | ||
"outFiles": ["${workspaceFolder}/dist/tests/**/*.js"], | ||
"preLaunchTask": "${defaultBuildTask}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// https://code.visualstudio.com/docs/getstarted/settings | ||
{ | ||
"typescript.tsc.autoDetect": "off" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// https://code.visualstudio.com/docs/editor/tasks#_custom-tasks | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "watch", | ||
"problemMatcher": "$tsc-watch", | ||
"isBackground": true, | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"presentation": { | ||
"reveal": "never" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--ignore-engines true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Typedown | ||
# Typedown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"name": "typedown", | ||
"version": "0.0.1", | ||
"author": "HiDeoo", | ||
"license": "MIT", | ||
"engines": { | ||
"vscode": "^1.60.0" | ||
}, | ||
"activationEvents": [ | ||
"onCommand:typedown.tsToMd" | ||
], | ||
"contributes": { | ||
"commands": [ | ||
{ | ||
"command": "typedown.tsToMd", | ||
"title": "TypeScript to Markdown" | ||
} | ||
] | ||
}, | ||
"main": "dist", | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "tsc -p .", | ||
"watch": "tsc -w -p .", | ||
"lint": "yarn lint:prettier && yarn lint:eslint", | ||
"lint:prettier": "prettier --check .", | ||
"lint:eslint": "eslint --max-warnings=0 --ext ts src", | ||
"pretest": "yarn build", | ||
"test": "node dist/tests", | ||
"prepare": "husky install" | ||
}, | ||
"devDependencies": { | ||
"@types/glob": "7.1.4", | ||
"@types/mocha": "9.0.0", | ||
"@types/node": "14.17.4", | ||
"@types/vscode": "1.60.0", | ||
"@typescript-eslint/eslint-plugin": "4.30.0", | ||
"@typescript-eslint/parser": "4.30.0", | ||
"eslint": "7.32.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"glob": "7.1.7", | ||
"husky": "7.0.2", | ||
"lint-staged": "11.1.2", | ||
"mocha": "9.1.1", | ||
"prettier": "2.3.2", | ||
"rimraf": "3.0.2", | ||
"typescript": "4.4.2", | ||
"vscode-test": "1.6.1" | ||
}, | ||
"lint-staged": { | ||
"*.ts": "yarn lint:eslint", | ||
"**/*": "prettier --write --ignore-unknown" | ||
}, | ||
"resolutions": { | ||
"@types/node": "14.17.4" | ||
}, | ||
"repository": "https://github.com/HiDeoo/Typedown", | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { commands, ExtensionContext, window } from 'vscode' | ||
|
||
export function activate(context: ExtensionContext): void { | ||
context.subscriptions.push(commands.registerCommand('typedown.tsToMd', tsToMd)) | ||
} | ||
|
||
function tsToMd() { | ||
window.showInformationMessage('Hello World from Typedown!') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import assert from 'assert' | ||
|
||
describe('extension', () => { | ||
it('test', () => { | ||
assert.strictEqual(1, 1) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import path from 'path' | ||
import { runTests } from 'vscode-test' | ||
|
||
async function main() { | ||
try { | ||
const extensionDevelopmentPath = path.resolve(__dirname, '../..') | ||
const extensionTestsPath = path.resolve(__dirname, 'run') | ||
|
||
await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: ['--disable-extensions'] }) | ||
} catch (err) { | ||
console.error('Failed to run tests.') | ||
process.exit(1) | ||
} | ||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import glob from 'glob' | ||
import Mocha from 'mocha' | ||
import path from 'path' | ||
|
||
export function run(): Promise<void> { | ||
return new Promise((resolve, reject) => { | ||
const mocha = new Mocha({ | ||
ui: 'bdd', | ||
color: true, | ||
}) | ||
|
||
const testsRoot = path.resolve(__dirname, '..') | ||
|
||
glob('**/**.test.js', { cwd: testsRoot }, (globError, files) => { | ||
if (globError) { | ||
return reject(globError) | ||
} | ||
|
||
files.forEach((file) => mocha.addFile(path.resolve(testsRoot, file))) | ||
|
||
try { | ||
mocha.run((failures) => { | ||
if (failures > 0) { | ||
reject(new Error(`${failures} tests failed.`)) | ||
} else { | ||
resolve() | ||
} | ||
}) | ||
} catch (error) { | ||
console.error(error) | ||
reject(error) | ||
} | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "dist", | ||
"target": "es6", | ||
"module": "commonjs", | ||
"lib": ["es6"], | ||
"sourceMap": true, | ||
"esModuleInterop": true, | ||
"strict": true, | ||
"exactOptionalPropertyTypes": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitOverride": true, | ||
"noImplicitReturns": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noUncheckedIndexedAccess": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true | ||
} | ||
} |
Oops, something went wrong.