This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement hardcoded angular style commit conventions
- Loading branch information
1 parent
7d45724
commit fc81416
Showing
4 changed files
with
101 additions
and
87 deletions.
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 |
---|---|---|
@@ -1,65 +1,7 @@ | ||
# vscode-commitizen README | ||
|
||
This is the README for your extension "vscode-commitizen". After writing up a brief description, we recommend including the following sections. | ||
[![Travis](https://img.shields.io/travis/KnisterPeter/vscode-commitizen.svg)](https://github.com/KnisterPeter/vscode-commitizen) | ||
[![Marketplace Version](http://vsmarketplacebadge.apphb.com/version/knisterpeter.vscode-commitizen.svg)](https://marketplace.visualstudio.com/items?itemName=KnisterPeter.vscode-commitizen) | ||
[![Installs](http://vsmarketplacebadge.apphb.com/installs/knisterpeter.vscode-commitizen.svg)](https://marketplace.visualstudio.com/items?itemName=KnisterPeter.vscode-commitizen) | ||
|
||
## Features | ||
|
||
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. | ||
|
||
For example if there is an image subfolder under your extension project workspace: | ||
|
||
\!\[feature X\]\(images/feature-x.png\) | ||
|
||
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. | ||
## Requirements | ||
|
||
If you have any requirements or dependencies, add a section describing those and how to install and configure them. | ||
|
||
## Extension Settings | ||
|
||
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. | ||
|
||
For example: | ||
|
||
This extension contributes the following settings: | ||
|
||
* `myExtension.enable`: enable/disable this extension | ||
* `myExtension.thing`: set to `blah` to do something | ||
|
||
## Known Issues | ||
|
||
Calling out known issues can help limit users opening duplicate issues against your extension. | ||
|
||
## Release Notes | ||
|
||
Users appreciate release notes as you update your extension. | ||
|
||
### 1.0.0 | ||
|
||
Initial release of ... | ||
|
||
### 1.0.1 | ||
|
||
Fixed issue #. | ||
|
||
### 1.1.0 | ||
|
||
Added features X, Y, and Z. | ||
|
||
----------------------------------------------------------------------------------------------------------- | ||
|
||
## Working with Markdown | ||
|
||
**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: | ||
|
||
* Split the editor (`Cmd+\` on OSX or `Ctrl+\` on Windows and Linux) | ||
* Toggle preview (`Shift+CMD+V` on OSX or `Shift+Ctrl+V` on Windows and Linux) | ||
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (OSX) to see a list of Markdown snippets | ||
|
||
### For more information | ||
|
||
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) | ||
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) | ||
|
||
**Enjoy!** | ||
This vscode extension add commitizen support. |
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
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,29 +1,89 @@ | ||
'use strict'; | ||
// The module 'vscode' contains the VS Code extensibility API | ||
// Import the module and reference it with the alias vscode in your code below | ||
import * as vscode from 'vscode'; | ||
import * as execa from 'execa'; | ||
|
||
// this method is called when your extension is activated | ||
// your extension is activated the very first time the command is executed | ||
export function activate(context: vscode.ExtensionContext) { | ||
|
||
// Use the console to output diagnostic information (console.log) and errors (console.error) | ||
// This line of code will only be executed once when your extension is activated | ||
console.log('Congratulations, your extension "vscode-commitizen" is now active!'); | ||
const types = { | ||
'feat': 'A new feature', | ||
'fix': 'A bug fix', | ||
'docs': 'Documentation only changes', | ||
'style': 'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)', | ||
'refactor': 'A code change that neither fixes a bug nor adds a feature', | ||
'perf': 'A code change that improves performance', | ||
'test': 'Adding missing tests or correcting existing tests', | ||
'build': 'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)', | ||
'ci': 'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)', | ||
'chore': 'Other changes that don\'t modify src or test files' | ||
}; | ||
|
||
// The command has been defined in the package.json file | ||
// Now provide the implementation of the command with registerCommand | ||
// The commandId parameter must match the command field in package.json | ||
let disposable = vscode.commands.registerCommand('extension.sayHello', () => { | ||
// The code you place here will be executed every time your command is executed | ||
export function activate(context: vscode.ExtensionContext) { | ||
context.subscriptions.push(vscode.commands.registerCommand('extension.commit', () => { | ||
const typePicks = Object.keys(types).map(feature => ({ | ||
label: feature, | ||
description: types[feature] | ||
})) | ||
|
||
// Display a message box to the user | ||
vscode.window.showInformationMessage('Hello World!'); | ||
}); | ||
const required = (input: string) => { | ||
if (input.length > 0) { | ||
return ''; | ||
} | ||
return 'Value is required'; | ||
}; | ||
|
||
context.subscriptions.push(disposable); | ||
let type; | ||
let scope; | ||
let subject; | ||
let body; | ||
let breaking; | ||
let closes; | ||
vscode.window.showQuickPick(typePicks, {placeHolder: 'Select the type of change that you\'re committing'}) | ||
.then(pick => { | ||
if (pick) { | ||
type = pick.label; | ||
} | ||
}) | ||
.then(() => vscode.window.showInputBox({placeHolder: 'Denote the SCOPE of this change (optional)'})) | ||
.then(input => { | ||
if (input) { | ||
scope = input; | ||
} | ||
}) | ||
.then(() => vscode.window.showInputBox({placeHolder: 'Write a SHORT, IMPERATIVE tense description of the change', validateInput: required})) | ||
.then(input => { | ||
if (input) { | ||
subject = input; | ||
} | ||
}) | ||
.then(() => vscode.window.showInputBox({placeHolder: 'Provide a LONGER description of the change (optional). Use "|" to break new line'})) | ||
.then(input => { | ||
if (input) { | ||
body = input.replace('|', '\n'); | ||
} | ||
}) | ||
.then(() => vscode.window.showInputBox({placeHolder: 'List any BREAKING CHANGES (optional)'})) | ||
.then(input => { | ||
if (input) { | ||
breaking = input; | ||
} | ||
}) | ||
.then(() => vscode.window.showInputBox({placeHolder: 'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34'})) | ||
.then(input => { | ||
if (input) { | ||
closes = input; | ||
} | ||
}) | ||
.then(() => { | ||
if (type && subject) { | ||
const messsage = type + | ||
(scope ? `(${scope})` : '') + | ||
`: ${subject}\n\n${body}\n\n` + | ||
(breaking ? `BREAKING CHANGE: ${breaking}` : '') + | ||
(closes ? `Closes ${closes}` : ''); | ||
commit(vscode.workspace.rootPath, messsage); | ||
} | ||
}); | ||
})); | ||
} | ||
|
||
// this method is called when your extension is deactivated | ||
export function deactivate() { | ||
} | ||
export async function commit(cwd: string, message: string): Promise<void> { | ||
return execa('git', ['commit', '-m', message], {cwd}) | ||
.then(() => {}); | ||
} |
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,8 @@ | ||
declare module 'execa' { | ||
import {ExecFileOptions} from 'child_process'; | ||
|
||
function execa(command: string, args?: string[], options?: ExecFileOptions): Promise<{stdout: string, stderr: string}>; | ||
namespace execa { | ||
} | ||
export = execa; | ||
} |