Skip to content

Commit 433bf7c

Browse files
committed
Update build scripts to target es2020
1 parent 1d77856 commit 433bf7c

17 files changed

Lines changed: 44 additions & 35 deletions

build/azure-pipelines/common/createBuild.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async function main() {
4242
const aadCredentials = new identity_1.ClientSecretCredential(process.env['AZURE_TENANT_ID'], process.env['AZURE_CLIENT_ID'], process.env['AZURE_CLIENT_SECRET']);
4343
const client = new cosmos_1.CosmosClient({ endpoint: process.env['AZURE_DOCUMENTDB_ENDPOINT'], aadCredentials });
4444
const scripts = client.database('builds').container(quality).scripts;
45-
await (0, retry_1.retry)(() => scripts.storedProcedure('createBuild').execute('', [Object.assign(Object.assign({}, build), { _partitionKey: '' })]));
45+
await (0, retry_1.retry)(() => scripts.storedProcedure('createBuild').execute('', [{ ...build, _partitionKey: '' }]));
4646
}
4747
main().then(() => {
4848
console.log('Build successfully created');

build/azure-pipelines/mixin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function mixinClient(quality) {
4343
else {
4444
fancyLog(ansiColors.blue('[mixin]'), 'Inheriting OSS built-in extensions', builtInExtensions.map(e => e.name));
4545
}
46-
return Object.assign(Object.assign({ webBuiltInExtensions: originalProduct.webBuiltInExtensions }, o), { builtInExtensions });
46+
return { webBuiltInExtensions: originalProduct.webBuiltInExtensions, ...o, builtInExtensions };
4747
}))
4848
.pipe(productJsonFilter.restore)
4949
.pipe(es.mapSync((f) => {
@@ -64,7 +64,7 @@ function mixinServer(quality) {
6464
fancyLog(ansiColors.blue('[mixin]'), `Mixing in server:`);
6565
const originalProduct = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'product.json'), 'utf8'));
6666
const serverProductJson = JSON.parse(fs.readFileSync(serverProductJsonPath, 'utf8'));
67-
fs.writeFileSync('product.json', JSON.stringify(Object.assign(Object.assign({}, originalProduct), serverProductJson), undefined, '\t'));
67+
fs.writeFileSync('product.json', JSON.stringify({ ...originalProduct, ...serverProductJson }, undefined, '\t'));
6868
fancyLog(ansiColors.blue('[mixin]'), 'product.json', ansiColors.green('✔︎'));
6969
}
7070
function main() {

build/darwin/sign.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,26 @@ async function main() {
4141
identity: '99FM488X57',
4242
'gatekeeper-assess': false
4343
};
44-
const appOpts = Object.assign(Object.assign({}, defaultOpts), {
44+
const appOpts = {
45+
...defaultOpts,
4546
// TODO(deepak1556): Incorrectly declared type in electron-osx-sign
4647
ignore: (filePath) => {
4748
return filePath.includes(gpuHelperAppName) ||
4849
filePath.includes(rendererHelperAppName);
49-
} });
50-
const gpuHelperOpts = Object.assign(Object.assign({}, defaultOpts), { app: path.join(appFrameworkPath, gpuHelperAppName), entitlements: path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-gpu-entitlements.plist'), 'entitlements-inherit': path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-gpu-entitlements.plist') });
51-
const rendererHelperOpts = Object.assign(Object.assign({}, defaultOpts), { app: path.join(appFrameworkPath, rendererHelperAppName), entitlements: path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-renderer-entitlements.plist'), 'entitlements-inherit': path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-renderer-entitlements.plist') });
50+
}
51+
};
52+
const gpuHelperOpts = {
53+
...defaultOpts,
54+
app: path.join(appFrameworkPath, gpuHelperAppName),
55+
entitlements: path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-gpu-entitlements.plist'),
56+
'entitlements-inherit': path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-gpu-entitlements.plist'),
57+
};
58+
const rendererHelperOpts = {
59+
...defaultOpts,
60+
app: path.join(appFrameworkPath, rendererHelperAppName),
61+
entitlements: path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-renderer-entitlements.plist'),
62+
'entitlements-inherit': path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-renderer-entitlements.plist'),
63+
};
5264
let infoPlistString = await fs.readFile(infoPlistPath, 'utf8');
5365
let infoPlistJson = plist.parse(infoPlistString);
5466
Object.assign(infoPlistJson, {

build/lib/builtInExtensionsCG.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const token = process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'
1818
const contentBasePath = 'raw.githubusercontent.com';
1919
const contentFileNames = ['package.json', 'package-lock.json', 'yarn.lock'];
2020
async function downloadExtensionDetails(extension) {
21-
var _a, _b, _c;
2221
const extensionLabel = `${extension.name}@${extension.version}`;
2322
const repository = url.parse(extension.repo).path.substr(1);
2423
const repositoryContentBaseUrl = `https://${token ? `${token}@` : ''}${contentBasePath}/${repository}/v${extension.version}`;
@@ -56,11 +55,11 @@ async function downloadExtensionDetails(extension) {
5655
}
5756
}
5857
// Validation
59-
if (!((_a = results.find(r => r.fileName === 'package.json')) === null || _a === void 0 ? void 0 : _a.body)) {
58+
if (!results.find(r => r.fileName === 'package.json')?.body) {
6059
// throw new Error(`The "package.json" file could not be found for the built-in extension - ${extensionLabel}`);
6160
}
62-
if (!((_b = results.find(r => r.fileName === 'package-lock.json')) === null || _b === void 0 ? void 0 : _b.body) &&
63-
!((_c = results.find(r => r.fileName === 'yarn.lock')) === null || _c === void 0 ? void 0 : _c.body)) {
61+
if (!results.find(r => r.fileName === 'package-lock.json')?.body &&
62+
!results.find(r => r.fileName === 'yarn.lock')?.body) {
6463
// throw new Error(`The "package-lock.json"/"yarn.lock" could not be found for the built-in extension - ${extensionLabel}`);
6564
}
6665
}

build/lib/bundle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ function bundle(entryPoints, config, callback) {
2222
const allMentionedModulesMap = {};
2323
entryPoints.forEach((module) => {
2424
allMentionedModulesMap[module.name] = true;
25-
(module.include || []).forEach(function (includedModule) {
25+
module.include?.forEach(function (includedModule) {
2626
allMentionedModulesMap[includedModule] = true;
2727
});
28-
(module.exclude || []).forEach(function (excludedModule) {
28+
module.exclude?.forEach(function (excludedModule) {
2929
allMentionedModulesMap[excludedModule] = true;
3030
});
3131
});

build/lib/compilation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function createCompile(src, build, emitError) {
3838
const tsb = require('gulp-tsb');
3939
const sourcemaps = require('gulp-sourcemaps');
4040
const projectPath = path.join(__dirname, '../../', src, 'tsconfig.json');
41-
const overrideOptions = Object.assign(Object.assign({}, getTypeScriptCompilerOptions(src)), { inlineSources: Boolean(build) });
41+
const overrideOptions = { ...getTypeScriptCompilerOptions(src), inlineSources: Boolean(build) };
4242
if (!build) {
4343
overrideOptions.inlineSourceMap = true;
4444
}

build/lib/dependencies.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function asYarnDependency(prefix, tree) {
3636
return { name, version, path: dependencyPath, children };
3737
}
3838
function getYarnProductionDependencies(cwd) {
39-
const raw = cp.execSync('yarn list --json', { cwd, encoding: 'utf8', env: Object.assign(Object.assign({}, process.env), { NODE_ENV: 'production' }), stdio: [null, null, 'inherit'] });
39+
const raw = cp.execSync('yarn list --json', { cwd, encoding: 'utf8', env: { ...process.env, NODE_ENV: 'production' }, stdio: [null, null, 'inherit'] });
4040
const match = /^{"type":"tree".*$/m.exec(raw);
4141
if (!match || match.length !== 1) {
4242
throw new Error('Could not parse result of `yarn list --json`');

build/lib/electron.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSyn
4040
function darwinBundleDocumentType(extensions, icon, nameOrSuffix) {
4141
// If given a suffix, generate a name from it. If not given anything, default to 'document'
4242
if (isDocumentSuffix(nameOrSuffix) || !nameOrSuffix) {
43-
nameOrSuffix = icon.charAt(0).toUpperCase() + icon.slice(1) + ' ' + (nameOrSuffix !== null && nameOrSuffix !== void 0 ? nameOrSuffix : 'document');
43+
nameOrSuffix = icon.charAt(0).toUpperCase() + icon.slice(1) + ' ' + (nameOrSuffix ?? 'document');
4444
}
4545
return {
4646
name: nameOrSuffix,

build/lib/eslint/vscode-dts-create-func.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ module.exports = new class ApiLiteralOrTypes {
1414
create(context) {
1515
return {
1616
['TSDeclareFunction Identifier[name=/create.*/]']: (node) => {
17-
var _a;
1817
const decl = node.parent;
19-
if (((_a = decl.returnType) === null || _a === void 0 ? void 0 : _a.typeAnnotation.type) !== experimental_utils_1.AST_NODE_TYPES.TSTypeReference) {
18+
if (decl.returnType?.typeAnnotation.type !== experimental_utils_1.AST_NODE_TYPES.TSTypeReference) {
2019
return;
2120
}
2221
if (decl.returnType.typeAnnotation.typeName.type !== experimental_utils_1.AST_NODE_TYPES.Identifier) {

build/lib/eslint/vscode-dts-event-naming.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ module.exports = new (_a = class ApiEventNaming {
2525
const verbs = new Set(config.verbs);
2626
return {
2727
['TSTypeAnnotation TSTypeReference Identifier[name="Event"]']: (node) => {
28-
var _a, _b;
29-
const def = (_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent;
28+
const def = node.parent?.parent?.parent;
3029
const ident = this.getIdent(def);
3130
if (!ident) {
3231
// event on unknown structure...

0 commit comments

Comments
 (0)