Skip to content

Commit

Permalink
Bug/brackets replacement (#58)
Browse files Browse the repository at this point in the history
* brackets replaced in task name to parenthesis instead of filename

* version is updated to 3.2.1, documentation updates

* package-lock.json files updates
  • Loading branch information
jkanczler authored Sep 22, 2017
1 parent b6e55db commit 6f2f557
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 17 deletions.
2 changes: 2 additions & 0 deletions DETAILS.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ ts-node options location | false | | Location of the ts-node options. If you lea

## <a id="release-notes"></a>Release Notes

* 3.2.1 (22(09/2017)
* Replacing `[]` brackets to `()` parenthesis in the title of the result summary section.
* 3.2.0 (22/09/2017)
* Support `[]` brackets in the display name of the task.
* 3.1.0 (21/09/2017)
Expand Down
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
next-version: 3.2.0
next-version: 3.2.1
assembly-informational-format: '{SemVer}'
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ ts-node options location | false | | Location of the ts-node options. If you lea

## <a id="release-notes"></a>Release Notes

* 3.2.1 (22(09/2017)
* Replacing `[]` brackets to `()` parenthesis in the title of the result summary section.
* 3.2.0 (22/09/2017)
* Support `[]` brackets in the display name of the task.
* 3.1.0 (21/09/2017)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wepback-vsts-extension",
"version": "3.2.0",
"version": "3.2.1",
"description": "webpack Visual Studio Team System (VSTS) Extension",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion tasks/webpack-build-task/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tasks/webpack-build-task/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webpack-build-task",
"version": "3.2.0",
"version": "3.2.1",
"description": "Webpack build task for Visual Studio Team System (VSTS)",
"main": "index.js",
"scripts": {},
Expand Down
9 changes: 5 additions & 4 deletions tasks/webpack-build-task/summarySectionBuilder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { IWebpackCompilationResult } from "../webpackCompiler";
const generateWebpackResultFilename = (workingFolder: string, taskDisplayName: string) => {
const webpackResultFilenamePostfix = ".webpack.result.md";

const filename = filenamify(taskDisplayName).replace(/\[/g, "(").replace(/\]/g, ")").trim();
return path.join(workingFolder, `${filename}${webpackResultFilenamePostfix}`);
return path.join(workingFolder, `${filenamify(taskDisplayName).trim()}${webpackResultFilenamePostfix}`);
};

const createWebpackResultMarkdownFile = (
Expand All @@ -18,13 +17,15 @@ const createWebpackResultMarkdownFile = (

console.log("webpack summary section markdown file creation is started");

const webpackResultFilename = generateWebpackResultFilename(workingFolder, taskDisplayName);
const fixedTaskDisplayName = taskDisplayName.replace(/\[/g, "(").replace(/\]/g, ")").trim();

const webpackResultFilename = generateWebpackResultFilename(workingFolder, fixedTaskDisplayName);
const resultFileContent = `<pre>${result.toString(webpackConfiguration)}</pre>`;

tl.writeFile(webpackResultFilename, resultFileContent);

console.log(`webpack sumamry section markdown file is created with the name '${webpackResultFilename}'`);
console.log(`##vso[task.addattachment type=Distributedtask.Core.Summary;name=${taskDisplayName} result;]${webpackResultFilename}`);
console.log(`##vso[task.addattachment type=Distributedtask.Core.Summary;name=${fixedTaskDisplayName} result;]${webpackResultFilename}`);
};

export {
Expand Down
2 changes: 1 addition & 1 deletion tasks/webpack-build-task/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 3,
"Minor": 2,
"Patch": 0
"Patch": 1
},
"minimumAgentVersion": "1.95.0",
"groups": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ runTestTask({
};
},
toString: (config: any) => {
return "shouldReplaceBracketsToParenthesisInFilename";
return "shouldReplaceBracketsToParenthesisInTaskName";
}
},
taskDisplayName: "webpack [something in brackets]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { assert } from "chai";
const mockRunnerDefinitions = "mockRunnerDefinitions";

export const executeTest = (done: MochaDone) => {
const testPath = path.join(__dirname, mockRunnerDefinitions, "shouldReplaceBracketsToParenthesisInFilename.js");
const testPath = path.join(__dirname, mockRunnerDefinitions, "shouldReplaceBracketsToParenthesisInTaskName.js");
const testRunner = new MockTestRunner(testPath);
testRunner.run();

assert.isTrue(testRunner.succeeded, "task should be succeeded");
assert.isFalse(testRunner.failed, "task should be not failed");

const resultFileIsAttached = testRunner.stdOutContained("##vso[task.addattachment type=Distributedtask.Core.Summary;name=webpack [something in brackets] result;]");
const resultFileIsAttached = testRunner.stdOutContained("##vso[task.addattachment type=Distributedtask.Core.Summary;name=webpack (something in brackets) result;]");
assert.isTrue(resultFileIsAttached, "result file should be attached");

const resultFilenameConverted = testRunner.stdOutContained("webpack (something in brackets).webpack.result.md");
Expand Down
6 changes: 3 additions & 3 deletions tasks/webpack-build-task/tests/suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as shouldGenerateMarkdownFileInCaseOfASuccessfulRun from "./shouldGener
import * as shouldLogInformationAboutTheProcess from "./shouldLogInformationAboutTheProcess";
import * as shouldPartiallySucceedIfNoErrorsButAtLeastOneWarning from "./shouldPartiallySucceedIfNoErrorsButAtLeastOneWarning";
import * as shouldPartiallySucceedIfThereAreErrorsButTreatedAsWarning from "./shouldPartiallySucceedIfThereAreErrorsButTreatedAsWarning";
import * as shouldReplaceBracketsToParenthesisInFilename from "./shouldReplaceBracketsToParenthesisInFilename";
import * as shouldReplaceBracketsToParenthesisInTaskName from "./shouldReplaceBracketsToParenthesisInTaskName";
import * as shouldReportErrorDetailInCaseOfWebpackBuildFailure from "./shouldReportErrorDetailInCaseOfWebpackBuildFailure";
import * as shouldSucceedIfNoDisplayNameDefined from "./shouldSucceedIfNoDisplayNameDefined";
import * as shouldSucceedIfNoErrorsAndWarnings from "./shouldSucceedIfNoErrorsAndWarnings";
Expand Down Expand Up @@ -95,8 +95,8 @@ describe("webpack build task", () => {
shouldPartiallySucceedIfThereAreErrorsButTreatedAsWarning.executeTest);

it(
"should replace brackets to parenthesis in filename",
shouldReplaceBracketsToParenthesisInFilename.executeTest
"should replace brackets to parenthesis in task name",
shouldReplaceBracketsToParenthesisInTaskName.executeTest
);

it(
Expand Down
2 changes: 1 addition & 1 deletion vss-extension.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifestVersion": 1,
"id": "webpack-vsts-extension",
"version": "3.2.0",
"version": "3.2.1",
"name": "webpack",
"description": "bundle your assets, scripts, images, styles",
"publisher": "Dealogic",
Expand Down

0 comments on commit 6f2f557

Please sign in to comment.