Skip to content

Commit 1432456

Browse files
committed
format all
1 parent 7d5a302 commit 1432456

28 files changed

+751
-802
lines changed

.azure-pipelines/azure-pipelines.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@
1010
# vsce package
1111
# (give VSIX to someone for buddy testing)
1212
trigger:
13-
- master
13+
- master
1414

1515
# no `pr` keyword because we want all PRs to run this
1616

1717
pool:
1818
vmImage: ubuntu-16.04
1919

2020
steps:
21-
# for convenience, we tag CI-produced packages with a version number
22-
# pointing to the commit which was built. for PRs, also include the PR #.
23-
- bash: |
24-
PACKAGE_VERSION=$(node -p "require('./package.json').version")
21+
# for convenience, we tag CI-produced packages with a version number
22+
# pointing to the commit which was built. for PRs, also include the PR #.
23+
- bash: |
24+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
2525
26-
if [ -n "$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" ]; then
27-
VERSION_STRING=${PACKAGE_VERSION}-pr-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-$(git rev-parse --short HEAD)
28-
else
29-
VERSION_STRING=${PACKAGE_VERSION}-ci-$(git rev-parse --short HEAD)
30-
fi
26+
if [ -n "$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" ]; then
27+
VERSION_STRING=${PACKAGE_VERSION}-pr-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-$(git rev-parse --short HEAD)
28+
else
29+
VERSION_STRING=${PACKAGE_VERSION}-ci-$(git rev-parse --short HEAD)
30+
fi
3131
32-
npm --no-git-tag-version version $VERSION_STRING
33-
echo "##vso[build.updatebuildnumber]${VERSION_STRING}_${BUILD_BUILDID}"
34-
echo "$PACKAGE_VERSION" > version.txt
35-
displayName: Set version number of package and build
32+
npm --no-git-tag-version version $VERSION_STRING
33+
echo "##vso[build.updatebuildnumber]${VERSION_STRING}_${BUILD_BUILDID}"
34+
echo "$PACKAGE_VERSION" > version.txt
35+
displayName: Set version number of package and build
3636
37-
- template: common-steps.yml
37+
- template: common-steps.yml

.azure-pipelines/build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ jobs:
7171
- script: 'node node_modules/vscode/bin/test'
7272
displayName: 'Run tests'
7373
env:
74-
DISPLAY: :10
74+
DISPLAY: :10

.azure-pipelines/common-steps.yml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,52 @@
22
#
33
# Things which happen regardless of CI, PR, or release builds
44
steps:
5-
- script: npm install
6-
displayName: npm install
5+
- script: npm install
6+
displayName: npm install
77

8-
- script: npm run compile
9-
displayName: Build extension
8+
- script: npm run compile
9+
displayName: Build extension
1010

11-
# - script: npm run test
12-
# displayName: npm run test
11+
# - script: npm run test
12+
# displayName: npm run test
1313

14-
# Acquire the `vsce` tool and use it to package
15-
- script: |
16-
sudo npm install -g vsce
17-
vsce package
18-
displayName: Create VSIX
14+
# Acquire the `vsce` tool and use it to package
15+
- script: |
16+
sudo npm install -g vsce
17+
vsce package
18+
displayName: Create VSIX
1919
20-
- script: |
21-
npm run vscode:prepublish
22-
cat /home/vsts/.npm/_logs/*.log
23-
displayName: Echo npm error logs on failure
24-
condition: failed()
20+
- script: |
21+
npm run vscode:prepublish
22+
cat /home/vsts/.npm/_logs/*.log
23+
displayName: Echo npm error logs on failure
24+
condition: failed()
2525
26-
# For releasable builds, we'll want the branch and the changelog
27-
# Expects that a 'version.txt' has been laid down by a previous step
28-
# https://regex101.com/r/xrBmAt/1
29-
- bash: |
30-
echo $(Build.SourceBranch) | sed "s|refs/[^/]*/||" > branch.txt
31-
PACKAGE_VERSION=$(cat version.txt)
32-
VERSION_REGEX="## $(echo $PACKAGE_VERSION | sed 's/\./\\./g')"
33-
sed -n "/$VERSION_REGEX/,/## /p" CHANGELOG.md | sed '$d' > minichangelog.txt
34-
cat minichangelog.txt
35-
displayName: Get branch and mini-changelog
26+
# For releasable builds, we'll want the branch and the changelog
27+
# Expects that a 'version.txt' has been laid down by a previous step
28+
# https://regex101.com/r/xrBmAt/1
29+
- bash: |
30+
echo $(Build.SourceBranch) | sed "s|refs/[^/]*/||" > branch.txt
31+
PACKAGE_VERSION=$(cat version.txt)
32+
VERSION_REGEX="## $(echo $PACKAGE_VERSION | sed 's/\./\\./g')"
33+
sed -n "/$VERSION_REGEX/,/## /p" CHANGELOG.md | sed '$d' > minichangelog.txt
34+
cat minichangelog.txt
35+
displayName: Get branch and mini-changelog
3636
37-
# Choose files to publish
38-
- task: CopyFiles@2
39-
displayName: Stage VSIX for publishing
40-
inputs:
41-
contents: |-
42-
*.vsix
43-
version.txt
44-
branch.txt
45-
minichangelog.txt
46-
targetFolder: $(Build.ArtifactStagingDirectory)
37+
# Choose files to publish
38+
- task: CopyFiles@2
39+
displayName: Stage VSIX for publishing
40+
inputs:
41+
contents: |-
42+
*.vsix
43+
version.txt
44+
branch.txt
45+
minichangelog.txt
46+
targetFolder: $(Build.ArtifactStagingDirectory)
4747

48-
# Publish files as an artifact
49-
- task: PublishBuildArtifacts@1
50-
displayName: Publish VSIX
51-
inputs:
52-
pathToPublish: $(Build.ArtifactStagingDirectory)
53-
artifactName: vs-shell-format
48+
# Publish files as an artifact
49+
- task: PublishBuildArtifacts@1
50+
displayName: Publish VSIX
51+
inputs:
52+
pathToPublish: $(Build.ArtifactStagingDirectory)
53+
artifactName: vs-shell-format

.azure-pipelines/deploy.yml

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -10,64 +10,63 @@ pool:
1010
vmImage: ubuntu-16.04
1111

1212
steps:
13-
# release version should be correctly set in package.json
14-
- bash: |
15-
PACKAGE_VERSION=$(cat package.json | jq '.version')
16-
echo "PACKAGE_VERSION=$PACKAGE_VERSION"
17-
PUBLISHED_VERSION=$(curl 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \
18-
-H 'origin: https://marketplace.visualstudio.com' \
19-
-H 'pragma: no-cache' \
20-
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36' \
21-
-H 'content-type: application/json' \
22-
-H 'accept: application/json;api-version=5.1-preview.1;excludeUrls=true' \
23-
-H 'cache-control: no-cache' \-H 'authority: marketplace.visualstudio.com' \
24-
-H 'referer: https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format' \
25-
--data-binary '{"assetTypes":null,"filters":[{"criteria":[{"filterType":7,"value":"foxundermoon.shell-format"}],"direction":2,"pageSize":1,"pageNumber":1,"sortBy":0,"sortOrder":0,"pagingToken":null}],"flags":71}' |
26-
jq '.results[0].extensions[0].versions[0].version')
27-
echo "PUBLISHED_VERSION=$PUBLISHED_VERSION"
28-
if [ "$PACKAGE_VERSION" = "$PUBLISHED_VERSION" ]; then
29-
echo 'niddend published'
30-
exit 1
31-
else
32-
echo "need publish"
33-
exit 0
34-
fi
35-
displayName: check need publish
36-
- bash: |
37-
PACKAGE_VERSION=$(node -p "require('./package.json').version")
38-
echo "##vso[build.updatebuildnumber]${PACKAGE_VERSION}_release_${BUILD_BUILDID}"
39-
echo "$PACKAGE_VERSION" > version.txt
40-
displayName: Set version number of build
13+
# release version should be correctly set in package.json
14+
- bash: |
15+
PACKAGE_VERSION=$(cat package.json | jq '.version')
16+
echo "PACKAGE_VERSION=$PACKAGE_VERSION"
17+
PUBLISHED_VERSION=$(curl 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \
18+
-H 'origin: https://marketplace.visualstudio.com' \
19+
-H 'pragma: no-cache' \
20+
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36' \
21+
-H 'content-type: application/json' \
22+
-H 'accept: application/json;api-version=5.1-preview.1;excludeUrls=true' \
23+
-H 'cache-control: no-cache' \-H 'authority: marketplace.visualstudio.com' \
24+
-H 'referer: https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format' \
25+
--data-binary '{"assetTypes":null,"filters":[{"criteria":[{"filterType":7,"value":"foxundermoon.shell-format"}],"direction":2,"pageSize":1,"pageNumber":1,"sortBy":0,"sortOrder":0,"pagingToken":null}],"flags":71}' |
26+
jq '.results[0].extensions[0].versions[0].version')
27+
echo "PUBLISHED_VERSION=$PUBLISHED_VERSION"
28+
if [ "$PACKAGE_VERSION" = "$PUBLISHED_VERSION" ]; then
29+
echo 'niddend published'
30+
exit 1
31+
else
32+
echo "need publish"
33+
exit 0
34+
fi
35+
displayName: check need publish
36+
- bash: |
37+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
38+
echo "##vso[build.updatebuildnumber]${PACKAGE_VERSION}_release_${BUILD_BUILDID}"
39+
echo "$PACKAGE_VERSION" > version.txt
40+
displayName: Set version number of build
4141
42-
# do all the normal build stuff
43-
- template: common-steps.yml
42+
# do all the normal build stuff
43+
- template: common-steps.yml
4444

45-
# if the mini changelog is empty, complain
46-
- bash: |
47-
LINE_COUNT=$(cat minichangelog.txt | wc -l)
48-
if [ "$LINE_COUNT" -lt 3 ]; then
49-
echo Mini changelog is too short. Did you use the wrong version number in CHANGELOG.txt?
50-
exit 1
51-
fi
52-
displayName: Check for length of mini-changelog
53-
54-
# create a GitHub Release
55-
- bash: |
56-
export npm_config_cache=$(Build.SourcesDirectory)/.azure-pipelines/github-release/npm-cache
57-
npm install
58-
displayName: Prepare to create GitHub Release
59-
workingDirectory: '$(Build.SourcesDirectory)/.azure-pipelines/github-release'
60-
- bash: |
61-
SCRIPT=.azure-pipelines/github-release/github-release.js
62-
VSIX=*.vsix
63-
VERSION=$(node -p "require('./package.json').version")
64-
node $SCRIPT $VSIX $VERSION $GITHUB_TOKEN
65-
displayName: Create GitHub Release
66-
env:
67-
GITHUB_TOKEN: $(github.token)
68-
- bash: |
69-
vsce publish -p $VS_MARKETPLACE_TOKEN
70-
displayName: publish to marketing
71-
env:
72-
VS_MARKETPLACE_TOKEN: $(vs.marketplace.token)
45+
# if the mini changelog is empty, complain
46+
- bash: |
47+
LINE_COUNT=$(cat minichangelog.txt | wc -l)
48+
if [ "$LINE_COUNT" -lt 3 ]; then
49+
echo Mini changelog is too short. Did you use the wrong version number in CHANGELOG.txt?
50+
exit 1
51+
fi
52+
displayName: Check for length of mini-changelog
7353
54+
# create a GitHub Release
55+
- bash: |
56+
export npm_config_cache=$(Build.SourcesDirectory)/.azure-pipelines/github-release/npm-cache
57+
npm install
58+
displayName: Prepare to create GitHub Release
59+
workingDirectory: '$(Build.SourcesDirectory)/.azure-pipelines/github-release'
60+
- bash: |
61+
SCRIPT=.azure-pipelines/github-release/github-release.js
62+
VSIX=*.vsix
63+
VERSION=$(node -p "require('./package.json').version")
64+
node $SCRIPT $VSIX $VERSION $GITHUB_TOKEN
65+
displayName: Create GitHub Release
66+
env:
67+
GITHUB_TOKEN: $(github.token)
68+
- bash: |
69+
vsce publish -p $VS_MARKETPLACE_TOKEN
70+
displayName: publish to marketing
71+
env:
72+
VS_MARKETPLACE_TOKEN: $(vs.marketplace.token)

.azure-pipelines/github-release/github-release.js

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
const Octokit = require("@octokit/rest");
2-
const util = require("util");
3-
const exec = util.promisify(require("child_process").exec);
4-
const fs = require("fs");
1+
const Octokit = require('@octokit/rest');
2+
const util = require('util');
3+
const exec = util.promisify(require('child_process').exec);
4+
const fs = require('fs');
55

6-
const DEBUG_LOGGING =
7-
process.env.SYSTEM_DEBUG && process.env.SYSTEM_DEBUG == "true";
6+
const DEBUG_LOGGING = process.env.SYSTEM_DEBUG && process.env.SYSTEM_DEBUG == 'true';
87
let vsixName = process.argv[2] || null;
98
let version = process.argv[3] || null;
109
let token = process.argv[4] || null;
@@ -23,68 +22,68 @@ This is intended to be run by the release pipeline only.`);
2322
async function createRelease() {
2423
const octokit = new Octokit({
2524
auth: `token ${token}`,
26-
userAgent: "azure-pipelines/vscode-release-pipeline v1.0",
25+
userAgent: 'azure-pipelines/vscode-release-pipeline v1.0',
2726
request: {
2827
timeout: 0,
29-
agent: undefined
28+
agent: undefined,
3029
},
31-
baseUrl: "https://api.github.com",
30+
baseUrl: 'https://api.github.com',
3231
log: {
3332
debug: () => {},
3433
info: () => {},
3534
warn: console.warn,
36-
error: console.error
37-
}
35+
error: console.error,
36+
},
3837
});
3938

4039
let target_commitish;
4140
if (process.env.BUILD_SOURCEBRANCH) {
4241
target_commitish = process.env.BUILD_SOURCEBRANCH;
4342
} else {
44-
const { stdout: head_commit } = await exec("git rev-parse --verify HEAD");
43+
const { stdout: head_commit } = await exec('git rev-parse --verify HEAD');
4544
target_commitish = head_commit.trim();
4645
}
4746

48-
const { stdout: body } = await exec("cat minichangelog.txt");
47+
const { stdout: body } = await exec('cat minichangelog.txt');
4948

50-
console.log("Creating release...");
49+
console.log('Creating release...');
5150
let createReleaseResult;
5251
try {
5352
createReleaseResult = await octokit.repos.createRelease({
54-
owner: "foxundermoon",
55-
repo: "vs-shell-format",
53+
owner: 'foxundermoon',
54+
repo: 'vs-shell-format',
5655
tag_name: `v${version}`,
5756
target_commitish: target_commitish,
5857
name: `${version}`,
59-
body: body
58+
body: body,
6059
});
6160
} catch (e) {
6261
throw e;
6362
}
64-
console.log("Created release.");
63+
console.log('Created release.');
6564

6665
if (DEBUG_LOGGING) {
6766
console.log(createReleaseResult);
6867
}
6968

7069
const vsixSize = fs.statSync(vsixName).size;
7170

72-
console.log("Uploading VSIX...");
71+
console.log('Uploading VSIX...');
7372
let uploadResult;
7473
try {
7574
uploadResult = await octokit.repos.uploadReleaseAsset({
7675
url: createReleaseResult.data.upload_url,
7776
headers: {
78-
"content-length": vsixSize,
79-
"content-type": "application/zip"
77+
'content-length': vsixSize,
78+
'content-type': 'application/zip',
8079
},
8180
name: vsixName,
82-
file: fs.createReadStream(vsixName)
81+
file: fs.createReadStream(vsixName),
8382
});
8483
} catch (e) {
8584
throw e;
8685
}
87-
console.log("Uploaded VSIX.");
86+
console.log('Uploaded VSIX.');
8887

8988
if (DEBUG_LOGGING) {
9089
console.log(uploadResult);

0 commit comments

Comments
 (0)