Skip to content

Commit 662b5a5

Browse files
authored
Merge pull request #17 from geeklearningio/release/0.5.0
Merge release/0.5.0 to master
2 parents be5d204 + f4503b4 commit 662b5a5

25 files changed

+477
-385
lines changed

GitVersion.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
branches:
2-
dev(elop)?(ment)?$:
3-
tag: alpha
4-
features?[/-]:
2+
feature:
3+
regex: features?[/-]
54
tag: alpha.{BranchName}
6-
releases?[/-]:
7-
mode: ContinuousDeployment
8-
hotfix(es)?[/-]:
9-
mode: ContinuousDeployment
5+
develop:
6+
regex: dev(elop)?(ment)?$
7+
tag: alpha

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
# gl-vsts-tasks-build
22

3-
This package provides npm utility commands to ease **VSTS Build And Release Tasks** extensions developement.
4-
This currently powers the development process behind [Geek Learning's VSTS extensions](https://marketplace.visualstudio.com/search?term=publisher%3A%22Geek%20Learning%22&target=VSTS&sortBy=Relevance).
3+
[![Build status](https://geeklearning.visualstudio.com/gl-github/_apis/build/status/gl-vsts-tasks-build-scripts)](https://geeklearning.visualstudio.com/gl-github/_build/latest?definitionId=97)
4+
[![NPM@dev](https://img.shields.io/npm/v/gl-vsts-tasks-build-scripts/dev.svg)](https://www.npmjs.com/package/gl-vsts-tasks-build-scripts/v/dev)
5+
[![NPM@latest](https://img.shields.io/npm/v/gl-vsts-tasks-build-scripts/latest.svg?color=green)](https://www.npmjs.com/package/gl-vsts-tasks-build-scripts/v/latest)
6+
7+
This package provides NPM utility commands to ease **Azure Pipelines Tasks** extensions developement.
8+
This currently powers the development process behind [Geek Learning's extensions](https://marketplace.visualstudio.com/publishers/geeklearningio).
59

610
## Features
711

812
* **Multiple packages generation** : This allows you to generate testing versions of the extension using unique ids, so you can easily
913
test your extension and setup staged deployment to the store. At Geek Learning our CI builds 3 versions of the extension
10-
(Dev, Preview, Production) and stores them as build artifacts. We then use Release Management to publish them to the marketplace.
14+
(Dev, Preview, Production) and stores them as build artifacts. We then use Release Pipelines to publish them to the marketplace.
1115
Dev package is always published automatically upon successfull build. Preview and Production are manually pushed if it passes our
1216
final review. Ids and packages settings, are defined in the `Configuration.json` file
1317
* **Manifest automation** : We automatically populate the contributions in the vss-extension in order to reduced manual maintainance
1418
of this file.
1519
* **Common shared code** : We provide an easy way to share powershell or node scripts accros your tasks without the need to make a
1620
package of them. Place them in the right subfolder of `Common` and they will be automatically copied where appropriate on build.
17-
* **Node : Automic dependency installation** : Vsts Agent node execution engine requires npm dependencies to be bundled with your task
21+
* **Node : Automic dependency installation** : Azure Pipelines Agent node execution engine requires npm dependencies to be bundled with your task
1822
We automatically install two dependencies as a postbuild step after a successfull `npm install` at root.
1923
* **Automatic versionning** : Visual Studio Marketplace does not support semver, but we always rely on it when it comes to versionnning.
20-
As a result we needed a way to encode our semver to a Major.Minor.Patch format. This feature can be switched of if you rely on another
21-
source of versionning.
24+
As a result we needed a way to encode our semver to a Major.Minor.Patch format. This feature can be switched of if you rely on another source of versionning.
2225

2326
## Project structure
2427

2528
At the moment, if you wish to use this tooling, your project will need to comply with the architecture we designed.
26-
27-
Directory Structure
2829
```
2930
Root
3031
|-- package.json
@@ -80,10 +81,14 @@ Then to get the best of this tooling we recommand that you tweak your `package.j
8081
```
8182

8283
You can now restore or update dependencies and task bundled dependencies by running a single `npm install` at the root.
84+
8385
You can clean common files using `npm run clean`
86+
8487
You can build node tasks using `npm run build`
88+
8589
You can package your extension by running `npm run package`. Output will be placed in the `.BuildOutput` subdirectory at root.
8690

87-
### Versioning
91+
## Versioning
8892
You can set version by packaging with `npm run package -- --version <version>`.
93+
8994
You can disable the default behavior which would encode the semver metadata into the patch component with the additional flag `--noversiontransform`.

dist/clean.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
33
var fs = require("fs-extra");
4-
var path = require("path");
5-
var tasks = require("./tasks");
64
var lodash_1 = require("lodash");
75
var minimist = require("minimist");
6+
var path = require("path");
7+
var tasks = require("./tasks");
88
var options = minimist(process.argv.slice(2), {});
9-
fs.emptyDirSync('.BuildOutput');
9+
fs.emptyDirSync(".BuildOutput");
1010
lodash_1.forEach(tasks.getTasks(options.taskroot), function (task) {
1111
var targetNodeCommonDir = path.join(task.directory, "common");
1212
var taskNodeModules = path.join(task.directory, "node_modules");
1313
var targetPowershellCommonDir = path.join(task.directory, "ps_modules");
1414
fs.removeSync(targetNodeCommonDir);
1515
fs.removeSync(targetPowershellCommonDir);
16-
if (options.modules == "true") {
16+
if (options.modules === "true") {
1717
fs.removeSync(taskNodeModules);
1818
}
19-
;
2019
});

dist/configuration.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
33
var path = require("path");
4-
;
54
function getConfiguration() {
65
var currentDirectory = process.cwd();
7-
return require(path.join(currentDirectory, 'configuration.json'));
6+
return require(path.join(currentDirectory, "configuration.json"));
87
}
98
exports.getConfiguration = getConfiguration;

dist/endpoints.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
var path = require("path");
43
var fs = require("fs-extra");
4+
var path = require("path");
55
function getEndpoints(endpointsRoot) {
66
if (!endpointsRoot) {
77
var currentDirectory = process.cwd();
8-
endpointsRoot = path.join(currentDirectory, 'Endpoints');
8+
endpointsRoot = path.join(currentDirectory, "Endpoints");
99
}
1010
if (!fs.existsSync(endpointsRoot)) {
1111
return [];
1212
}
1313
return fs.readdirSync(endpointsRoot).map(function (file) {
1414
var endpointPath = path.join(endpointsRoot, file);
15-
var manifest = JSON.parse(fs.readFileSync(endpointPath, { encoding: 'utf8' }));
15+
var manifest = JSON.parse(fs.readFileSync(endpointPath, { encoding: "utf8" }));
1616
return {
17-
path: endpointPath,
18-
name: manifest.properties.name,
1917
manifest: manifest,
18+
name: manifest.properties.name,
19+
path: endpointPath,
2020
};
2121
});
2222
}

dist/extension-version.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ function getSemanticVersion() {
77
var version = options.version;
88
if (!version) {
99
version = "0.0.0";
10-
console.log('No version argument provided, fallback to default version: ' + version);
10+
console.log("No version argument provided, fallback to default version: " + version);
1111
}
1212
else {
13-
console.log('Found version: ' + version);
13+
console.log("Found version: " + version);
1414
}
1515
if (!semver.valid(version)) {
16-
throw new Error('Package: invalid semver version: ' + version);
16+
throw new Error("Package: invalid semver version: " + version);
1717
}
1818
var patch = semver.patch(version);
1919
if (!options.noversiontransform) {
2020
patch *= 1000;
2121
var prerelease = semver.prerelease(version);
2222
if (prerelease) {
23-
;
24-
patch += parseInt(prerelease[1]);
23+
patch += parseInt(prerelease[1], 10);
2524
}
2625
else {
2726
patch += 999;
@@ -32,11 +31,10 @@ function getSemanticVersion() {
3231
minor: semver.minor(version),
3332
patch: patch,
3433
getVersionString: function () {
35-
return this.major.toString() + '.' + this.minor.toString() + '.' + this.patch.toString();
36-
}
34+
return this.major.toString() + "." + this.minor.toString() + "." + this.patch.toString();
35+
},
3736
};
38-
console.log('Extension Version: ' + result.getVersionString());
37+
console.log("Extension Version: " + result.getVersionString());
3938
return result;
4039
}
4140
exports.getSemanticVersion = getSemanticVersion;
42-
;

dist/install.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
33
var async_1 = require("async");
4-
var path = require("path");
54
var child_process_1 = require("child_process");
5+
var path = require("path");
66
var tasks_1 = require("./tasks");
77
var npmInstall = function (project) {
88
return function (done) {
99
var isYarn = path.basename(process.env.npm_execpath || "npm").startsWith("yarn");
10-
var installer = isYarn ? 'yarn' : 'npm';
11-
var child = child_process_1.exec(isYarn ? 'yarn' : 'npm install', {
12-
cwd: project.directory
10+
var installer = isYarn ? "yarn" : "npm";
11+
child_process_1.exec(isYarn ? "yarn" : "npm install", {
12+
cwd: project.directory,
1313
}, function (error, stdout, stderr) {
1414
if (error) {
15-
console.error('execution error:', error);
15+
console.error("execution error:", error);
1616
done(error);
1717
return;
1818
}
@@ -23,18 +23,18 @@ var npmInstall = function (project) {
2323
if (stderr) {
2424
console.error(stderr);
2525
}
26-
var nodeModulesPath = path.join(project.directory, 'node_modules');
27-
var powerShellModules = require("glob").sync(path.join(project.directory, "node_modules", "**", "*.psm1"));
26+
var powerShellModules = require("glob")
27+
.sync(path.join(project.directory, "node_modules", "**", "*.psm1"));
2828
if (powerShellModules.length > 0) {
2929
var fs = require("fs-extra");
30-
var taskFilePath = path.join(project.directory, 'task.json');
30+
var taskFilePath = path.join(project.directory, "task.json");
3131
var task = fs.existsSync(taskFilePath) ? fs.readJsonSync(taskFilePath) : {};
3232
if (task.execution.PowerShell3) {
33-
var psModulesPath = path.join(project.directory, 'ps_modules');
33+
var psModulesPath = path.join(project.directory, "ps_modules");
3434
fs.ensureDirSync(psModulesPath);
35-
for (var i = 0; i < powerShellModules.length; i++) {
36-
var powerShellModulePath = powerShellModules[i];
37-
var powerShellModuleDirName = path.dirname(powerShellModulePath);
35+
for (var _i = 0, powerShellModules_1 = powerShellModules; _i < powerShellModules_1.length; _i++) {
36+
var modulePath = powerShellModules_1[_i];
37+
var powerShellModuleDirName = path.dirname(modulePath);
3838
var powerShellModuleFolderName = path.basename(powerShellModuleDirName);
3939
fs.copySync(powerShellModuleDirName, path.join(psModulesPath, powerShellModuleFolderName), { clobber: true, dereference: true });
4040
console.log(powerShellModuleFolderName + " copied in ps_modules for " + project.name);

dist/node-modclean.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
var minimist = require("minimist");
4-
var tasks = require("./tasks");
53
var async_1 = require("async");
6-
var path = require("path");
74
var fs = require("fs");
8-
var modclean = require('modclean');
5+
var minimist = require("minimist");
6+
var path = require("path");
7+
var tasks = require("./tasks");
8+
// tslint:disable-next-line: no-var-requires
9+
var modclean = require("modclean");
910
var runModclean = function (project) {
1011
return function (done) {
1112
if (fs.existsSync(path.join(project.directory, "node_modules"))) {
1213
var modcleanOptions = {
13-
cwd: project.directory
14+
cwd: project.directory,
1415
};
1516
var options = minimist(process.argv.slice(2), {});
1617
if (options.patterns) {
17-
modcleanOptions.patterns = options.patterns.split(',');
18+
modcleanOptions.patterns = options.patterns.split(",");
1819
}
1920
if (options.additionalpatterns) {
20-
modcleanOptions.additionalPatterns = options.additionalpatterns.split(',');
21+
modcleanOptions.additionalPatterns = options.additionalpatterns.split(",");
2122
}
2223
if (options.ignorepatterns) {
23-
modcleanOptions.ignorePatterns = options.ignorepatterns.split(',');
24+
modcleanOptions.ignorePatterns = options.ignorepatterns.split(",");
2425
}
2526
modclean(modcleanOptions, function (err, results) {
2627
// called once cleaning is complete.

0 commit comments

Comments
 (0)