Skip to content

Commit

Permalink
feat: support outputUnreleased options
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Mar 11, 2019
1 parent 6c314f9 commit bbab14f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 22 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@
"type": "string",
"default": "CHANGELOG.md",
"markdownDescription": "%ext.config.changelogFileName%"
},
"changelog.outputUnreleased": {
"type": "boolean",
"default": false,
"markdownDescription": "%ext.config.outputUnreleased%"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"ext.config.type-3": "Append changes to current changelog file",
"ext.config.release-count": "How many releases to be generated from the latest. If 0, the whole changelog will be regenerated. [Docs](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-core/README.md)",
"ext.config.changelogFileName": "Changelog filename",
"ext.config.outputUnreleased": "Output unreleased changelog",
"cmd.generate.title": "Generate changelog",
"cmd.generateFromLastVersion.title": "Generate changelog from last 1 version",
"cmd.generateFromLastTwoVersion.title": "Generate changelog from last 2 version",
Expand Down
21 changes: 11 additions & 10 deletions package.nls.zh-cn.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"ext.config.preset": "[conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) 的预设",
"ext.config.type": "以何种方式生成更新日志",
"ext.config.type-1": "在新的文档中创建更新日志",
"ext.config.type-2": "创建/覆盖 当前的更新日志文件",
"ext.config.type-3": "追加变更到当前的更新日志",
"ext.config.type": "以何种方式生成变更日志",
"ext.config.type-1": "在新的文档中创建变更日志",
"ext.config.type-2": "创建/覆盖 当前的变更日志文件",
"ext.config.type-3": "追加变更到当前的变更日志",
"ext.config.release-count": "从最新版本生成多少个版本。 如果为0,则将重新生成整个更改日志。[Docs](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-core/README.md)",
"ext.config.changelogFileName": "更新日志的文件名",
"cmd.generate.title": "生成更新日志",
"cmd.generateFromLastVersion.title": "生成前 1 个版本的更新日志",
"cmd.generateFromLastTwoVersion.title": "生成前 2 个版本的更新日志",
"cmd.generateFromLastNVersion.title": "生成前 N 个版本的更新日志",
"cmd.generateAll.title": "生成完整的更新日志"
"ext.config.changelogFileName": "变更日志的文件名",
"ext.config.outputUnreleased": "是否生成未发布的变更日志",
"cmd.generate.title": "生成变更日志",
"cmd.generateFromLastVersion.title": "生成前 1 个版本的变更日志",
"cmd.generateFromLastTwoVersion.title": "生成前 2 个版本的变更日志",
"cmd.generateFromLastNVersion.title": "生成前 N 个版本的变更日志",
"cmd.generateAll.title": "生成完整的变更日志"
}
21 changes: 11 additions & 10 deletions package.nls.zh-tw.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"ext.config.preset": "[conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) 的預設",
"ext.config.type": "以何種方式生成更新日誌",
"ext.config.type-1": "在新的文檔中創建更新日誌",
"ext.config.type-2": "創建/覆蓋 當前的更新日誌文件",
"ext.config.type-3": "追加變更到當前的更新日誌",
"ext.config.type": "以何種方式生成變更日誌",
"ext.config.type-1": "在新的文檔中創建變更日誌",
"ext.config.type-2": "創建/覆蓋 當前的變更日誌文件",
"ext.config.type-3": "追加變更到當前的變更日誌",
"ext.config.release-count": "從最新版本生成多少個版本。如果為0,則將重新生成整個更改日誌。[Docs](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-core/README.md)",
"ext.config.changelogFileName": "更新日誌的文件名",
"cmd.generate.title": "生成更新日誌",
"cmd.generateFromLastVersion.title": "生成前 1 個版本的更新日誌",
"cmd.generateFromLastTwoVersion.title": "生成前 2 個版本的更新日誌",
"cmd.generateFromLastNVersion.title": "生成前 N 個版本的更新日誌",
"cmd.generateAll.title": "生成完整的更新日誌"
"ext.config.changelogFileName": "變更日誌的文件名",
"ext.config.outputUnreleased": "是否生成未发布的变更日志",
"cmd.generate.title": "生成變更日誌",
"cmd.generateFromLastVersion.title": "生成前 1 個版本的變更日誌",
"cmd.generateFromLastTwoVersion.title": "生成前 2 個版本的變更日誌",
"cmd.generateFromLastNVersion.title": "生成前 N 個版本的變更日誌",
"cmd.generateAll.title": "生成完整的變更日誌"
}
8 changes: 6 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface IConfig {
type: string;
preset: string;
releaseCount: number;
outputUnreleased: boolean;
changelogFileName: string;
}

Expand Down Expand Up @@ -65,7 +66,8 @@ export function activate(context: VSCODE.ExtensionContext) {
isAppend ? "--append" : "",
...(isOverwriteChangelog || isAppend
? ["--outfile", config.changelogFileName]
: [])
: []),
config.outputUnreleased ? "--output-unreleased" : ""
];

const { stdout: changelog } = await execa(process.execPath, args, {
Expand Down Expand Up @@ -95,6 +97,7 @@ export function activate(context: VSCODE.ExtensionContext) {
const type = config.get<string>("type") || "";
const preset = config.get<string>("preset") || "";
const changelogFileName = config.get<string>("changelogFileName") || "";
const outputUnreleased = config.get<boolean>("outputUnreleased") || false;

if (releaseCount === null) {
releaseCount = config.get<number>("release-count") || 0;
Expand All @@ -104,7 +107,8 @@ export function activate(context: VSCODE.ExtensionContext) {
type,
preset,
releaseCount,
changelogFileName
changelogFileName,
outputUnreleased
});
}

Expand Down

0 comments on commit bbab14f

Please sign in to comment.