Skip to content

Commit cc5dd0c

Browse files
committed
refactor build
1 parent f4eab75 commit cc5dd0c

5 files changed

Lines changed: 62 additions & 62 deletions

File tree

build/azure-pipelines/product-compile.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ steps:
7777
yarn postinstall
7878
displayName: Run postinstall scripts
7979
condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'), eq(variables['CacheRestored'], 'true'))
80+
env:
81+
OSS_GITHUB_ID: "a5d3c261b032765a78de"
82+
OSS_GITHUB_SECRET: $(oss-github-client-secret)
83+
INSIDERS_GITHUB_ID: "31f02627809389d9f111"
84+
INSIDERS_GITHUB_SECRET: $(insiders-github-client-secret)
8085

8186
# Mixin must run before optimize, because the CSS loader will
8287
# inline small SVGs
@@ -116,11 +121,6 @@ steps:
116121
yarn gulp minify-vscode-reh-web
117122
displayName: Compile
118123
condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'))
119-
env:
120-
OSS_GITHUB_ID: "a5d3c261b032765a78de"
121-
OSS_GITHUB_SECRET: $(oss-github-client-secret)
122-
INSIDERS_GITHUB_ID: "31f02627809389d9f111"
123-
INSIDERS_GITHUB_SECRET: $(insiders-github-client-secret)
124124

125125
- script: |
126126
set -e

build/lib/compilation.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ function compileTask(src, out, build) {
7474
if (src === 'src') {
7575
generator.execute();
7676
}
77-
generateGitHubAuthConfig();
7877
return srcPipe
7978
.pipe(generator.stream)
8079
.pipe(compile())
@@ -97,17 +96,6 @@ function watchTask(out, build) {
9796
}
9897
exports.watchTask = watchTask;
9998
const REPO_SRC_FOLDER = path.join(__dirname, '../../src');
100-
function generateGitHubAuthConfig() {
101-
const schemes = ['OSS', 'INSIDERS'];
102-
let content = {};
103-
schemes.forEach(scheme => {
104-
content[scheme] = {
105-
id: process.env[`${scheme}_GITHUB_ID`],
106-
secret: process.env[`${scheme}_GITHUB_SECRET`]
107-
};
108-
});
109-
fs.writeFileSync(path.join(__dirname, '../../extensions/github-authentication/src/common/config.json'), JSON.stringify(content));
110-
}
11199
class MonacoGenerator {
112100
constructor(isWatch) {
113101
this._executeSoonTimer = null;

build/lib/compilation.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ export function compileTask(src: string, out: string, build: boolean): () => Nod
8888
generator.execute();
8989
}
9090

91-
generateGitHubAuthConfig();
92-
9391
return srcPipe
9492
.pipe(generator.stream)
9593
.pipe(compile())
@@ -117,19 +115,6 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt
117115

118116
const REPO_SRC_FOLDER = path.join(__dirname, '../../src');
119117

120-
function generateGitHubAuthConfig() {
121-
const schemes = ['OSS', 'INSIDERS'];
122-
let content: { [key: string]: { id?: string, secret?: string }} = {};
123-
schemes.forEach(scheme => {
124-
content[scheme] = {
125-
id: process.env[`${scheme}_GITHUB_ID`],
126-
secret: process.env[`${scheme}_GITHUB_SECRET`]
127-
};
128-
});
129-
130-
fs.writeFileSync(path.join(__dirname, '../../extensions/github-authentication/src/common/config.json'), JSON.stringify(content));
131-
}
132-
133118
class MonacoGenerator {
134119
private readonly _isWatch: boolean;
135120
public readonly stream: NodeJS.ReadWriteStream;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
const fs = require('fs');
7+
const path = require('path');
8+
9+
const schemes = ['OSS', 'INSIDERS'];
10+
11+
function main() {
12+
let content = {};
13+
14+
for (const scheme of schemes) {
15+
const id = process.env[`${scheme}_GITHUB_ID`];
16+
const secret = process.env[`${scheme}_GITHUB_SECRET`];
17+
18+
if (id && secret) {
19+
content[scheme] = { id, secret };
20+
}
21+
}
22+
23+
fs.writeFileSync(path.join(__dirname, '../src/common/config.json'), JSON.stringify(content));
24+
}
25+
26+
main();
Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
{
2-
"name": "github-authentication",
3-
"displayName": "%displayName%",
4-
"description": "%description%",
5-
"publisher": "vscode",
6-
"version": "0.0.1",
7-
"engines": {
8-
"vscode": "^1.41.0"
9-
},
10-
"enableProposedApi": true,
11-
"categories": [
12-
"Other"
13-
],
14-
"activationEvents": [
15-
"*"
16-
],
17-
"main": "./out/extension.js",
18-
"scripts": {
19-
"vscode:prepublish": "npm run compile",
20-
"compile": "gulp compile-extension:github-authentication",
21-
"watch": "gulp watch-extension:github-authentication"
22-
},
23-
"dependencies": {
24-
"uuid": "^3.3.3"
25-
},
26-
"devDependencies": {
27-
"@types/keytar": "^4.4.2",
28-
"@types/node": "^10.12.21",
29-
"@types/uuid": "^3.4.6",
30-
"typescript": "^3.7.5"
31-
}
2+
"name": "github-authentication",
3+
"displayName": "%displayName%",
4+
"description": "%description%",
5+
"publisher": "vscode",
6+
"version": "0.0.1",
7+
"engines": {
8+
"vscode": "^1.41.0"
9+
},
10+
"enableProposedApi": true,
11+
"categories": [
12+
"Other"
13+
],
14+
"activationEvents": [
15+
"*"
16+
],
17+
"main": "./out/extension.js",
18+
"scripts": {
19+
"vscode:prepublish": "npm run compile",
20+
"compile": "gulp compile-extension:github-authentication",
21+
"watch": "gulp watch-extension:github-authentication",
22+
"postinstall": "node build/postinstall.js"
23+
},
24+
"dependencies": {
25+
"uuid": "^3.3.3"
26+
},
27+
"devDependencies": {
28+
"@types/keytar": "^4.4.2",
29+
"@types/node": "^10.12.21",
30+
"@types/uuid": "^3.4.6",
31+
"typescript": "^3.7.5"
32+
}
3233
}

0 commit comments

Comments
 (0)