Merge branch 'master' into upstream_master

This commit is contained in:
Amin Yahyaabadi 2021-08-15 23:54:20 -05:00
commit 9fc4c38317
43 changed files with 540 additions and 200 deletions

7
.github/pull.yml vendored Normal file
View File

@ -0,0 +1,7 @@
version: "1"
rules: # Array of rules
- base: upstream_master # Required. Target branch
upstream: atom:master # Required. Must be in the same fork network.
mergeMethod: hardreset # Optional, one of [none, merge, squash, rebase, hardreset], Default: none.
mergeUnstable: true # Optional, merge pull request even when the mergeable_state is not clean. Default: false
label: ":arrow_heading_down: pull upstream" # Optional

20
.github/renovate.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
"schedule": ["every weekend"],
"labels": ["dependencies"],
"separateMajorMinor": "false",
"packageRules": [
{
"matchDepTypes": ["devDependencies"],
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest", "lockFileMaintenance", "rollback", "bump"],
"groupName": "devDependencies",
"semanticCommitType": "chore",
"automerge": true
},
{
"matchDepTypes": ["dependencies"],
"matchUpdateTypes": ["major", "minor", "patch", "pin", "digest", "lockFileMaintenance", "rollback", "bump"],
"groupName": "dependencies",
"semanticCommitType": "fix"
}
]
}

18
.github/workflows/rebase.yml vendored Normal file
View File

@ -0,0 +1,18 @@
on:
issue_comment:
types: [created]
name: Automatic Rebase
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && github.event.comment.author_association == 'MEMBER' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.3.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "2.6.2"
"atom-package-manager": "npm:@atom-ide-community/atom-package-manager@2.5.2-atomic.3.1"
}
}

12
package-lock.json generated
View File

@ -5368,13 +5368,13 @@
"integrity": "sha512-tiRxakgbNPBr301ihe/785NntvYyhxlqcL3YaC8CaxJQh7kiaEtrN9B/eK2I2943Yjkh5gw25chYFDQhOMCwMA=="
},
"md5": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz",
"integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=",
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
"integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
"requires": {
"charenc": "~0.0.1",
"crypt": "~0.0.1",
"is-buffer": "~1.1.1"
"charenc": "0.0.2",
"crypt": "0.0.2",
"is-buffer": "~1.1.6"
}
},
"metrics": {

View File

@ -134,7 +134,7 @@ let UpdateManager = class UpdateManager {
const releaseRepo =
appVersion.indexOf('nightly') > -1 ? 'atom-nightly-releases' : 'atom';
return `https://github.com/atom/${releaseRepo}/releases/tag/${appVersion}`;
return `https://github.com/atom-ide-community/${releaseRepo}/releases/tag/${appVersion}`;
}
};

View File

@ -16,17 +16,19 @@ describe('UpdateManager', () => {
it('returns the page for the release when not a dev version', () => {
expect(updateManager.getReleaseNotesURLForVersion('1.7.0')).toContain(
'atom/atom/releases/tag/v1.7.0'
'atom-ide-community/atom/releases/tag/v1.7.0'
);
expect(updateManager.getReleaseNotesURLForVersion('v1.7.0')).toContain(
'atom/atom/releases/tag/v1.7.0'
'atom-ide-community/atom/releases/tag/v1.7.0'
);
expect(
updateManager.getReleaseNotesURLForVersion('1.7.0-beta10')
).toContain('atom/atom/releases/tag/v1.7.0-beta10');
).toContain('atom-ide-community/atom/releases/tag/v1.7.0-beta10');
expect(
updateManager.getReleaseNotesURLForVersion('1.7.0-nightly10')
).toContain('atom/atom-nightly-releases/releases/tag/v1.7.0-nightly10');
).toContain(
'atom-ide-community/atom-nightly-releases/releases/tag/v1.7.0-nightly10'
);
});
});
});

2
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,2 @@
packages:
- "."

View File

@ -8,9 +8,7 @@ const childProcess = require('child_process')
const cleanDependencies = require('./lib/clean-dependencies')
const deleteMsbuildFromPath = require('./lib/delete-msbuild-from-path')
const dependenciesFingerprint = require('./lib/dependencies-fingerprint')
const installApm = require('./lib/install-apm')
const runApmInstall = require('./lib/run-apm-install')
const installScriptDependencies = require('./lib/install-script-dependencies')
const installScriptRunnerDependencies = require('./lib/install-script-runner-dependencies')
const verifyMachineRequirements = require('./lib/verify-machine-requirements')
process.on('unhandledRejection', function (e) {
@ -28,22 +26,31 @@ if (!ci && process.env.CI === 'true' && process.argv.indexOf('--no-ci') === -1)
verifyMachineRequirements(ci)
if (dependenciesFingerprint.isOutdated()) {
cleanDependencies()
async function bootstrap() {
if (dependenciesFingerprint.isOutdated()) {
await cleanDependencies()
}
if (process.platform === 'win32') deleteMsbuildFromPath()
installScriptRunnerDependencies()
const { spawn, Thread, Worker } = require(`${CONFIG.scriptRunnerModulesPath}/threads`)
const installScriptDependencies = await spawn(new Worker('./lib/install-script-dependencies'))
const installScriptDependenciesPromise = installScriptDependencies(ci)
const installApm = await spawn(new Worker('./lib/install-apm'))
await installApm(ci);
await Thread.terminate(installApm)
const runApmInstall = require('./lib/run-apm-install')
runApmInstall(CONFIG.repositoryRootPath, ci)
await installScriptDependenciesPromise;
await Thread.terminate(installScriptDependencies)
dependenciesFingerprint.write()
}
if (process.platform === 'win32') deleteMsbuildFromPath()
installScriptDependencies(ci)
installApm(ci)
const apmVersionEnv = Object.assign({}, process.env);
// Set resource path so that apm can load Atom's version.
apmVersionEnv.ATOM_RESOURCE_PATH = CONFIG.repositoryRootPath;
childProcess.execFileSync(
CONFIG.getApmBinPath(),
['--version'],
{stdio: 'inherit', env: apmVersionEnv}
)
runApmInstall(CONFIG.repositoryRootPath, ci)
dependenciesFingerprint.write()
bootstrap().then(() => {process.exit(0)}).catch((e) => {throw e;})

View File

@ -2,12 +2,16 @@
'use strict'
const CONFIG = require('./config')
if (process.argv.includes('--no-bootstrap')) {
console.log('Skipping bootstrap')
} else {
// Bootstrap first to ensure all the dependencies used later in this script
// are installed.
require('./bootstrap')
const path = require('path')
const childProcess = require('child_process')
childProcess.execFileSync(process.execPath, [path.join(CONFIG.scriptRootPath, 'bootstrap')], { env: process.env, cwd: CONFIG.repositoryRootPath, stdio: 'inherit' });
}
// Required to load CS files in this build script, such as those in `donna`
@ -52,47 +56,49 @@ const notarizeOnMac = require('./lib/notarize-on-mac')
const packageApplication = require('./lib/package-application')
const prebuildLessCache = require('./lib/prebuild-less-cache')
const testSignOnMac = require('./lib/test-sign-on-mac')
const transpileBabelPaths = require('./lib/transpile-babel-paths')
const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths')
const transpileCsonPaths = require('./lib/transpile-cson-paths')
const transpilePegJsPaths = require('./lib/transpile-peg-js-paths')
const transpilePackagesWithCustomTranspilerPaths = require('./lib/transpile-packages-with-custom-transpiler-paths.js')
process.on('unhandledRejection', function (e) {
console.error(e.stack || e)
process.exit(1)
})
const CONFIG = require('./config')
// Used by the 'github' package for Babel configuration
process.env.ELECTRON_VERSION = CONFIG.appMetadata.electronVersion
let binariesPromise = Promise.resolve()
async function transpile() {
const { spawn, Thread, Worker } = require(`${CONFIG.scriptRunnerModulesPath}/threads`)
if (!argv.existingBinaries) {
checkChromedriverVersion()
cleanOutputDirectory()
copyAssets()
transpilePackagesWithCustomTranspilerPaths()
transpileBabelPaths()
transpileCoffeeScriptPaths()
transpileCsonPaths()
transpilePegJsPaths()
generateModuleCache()
prebuildLessCache()
generateMetadata()
generateAPIDocs()
if (!argv.generateApiDocs) {
binariesPromise = dumpSymbols()
}
const transpilePackagesWithCustomTranspilerPaths = await spawn(new Worker('./lib/transpile-packages-with-custom-transpiler-paths'))
const transpilePackagesWithCustomTranspilerPathsPromise = transpilePackagesWithCustomTranspilerPaths()
const transpileBabelPaths = await spawn(new Worker('./lib/transpile-babel-paths'))
const transpileBabelPathsPromise = transpileBabelPaths()
const transpileCoffeeScriptPaths = await spawn(new Worker('./lib/transpile-coffee-script-paths'))
const transpileCoffeeScriptPathsPromise = transpileCoffeeScriptPaths()
const transpileCsonPaths = await spawn(new Worker('./lib/transpile-cson-paths'))
const transpileCsonPathsPromise = transpileCsonPaths()
const transpilePegJsPaths = await spawn(new Worker('./lib/transpile-peg-js-paths'))
const transpilePegJsPathsPromise = transpilePegJsPaths()
await transpilePackagesWithCustomTranspilerPathsPromise;
await Thread.terminate(transpilePackagesWithCustomTranspilerPaths)
await transpileBabelPathsPromise;
await Thread.terminate(transpileBabelPaths)
await transpileCoffeeScriptPathsPromise;
await Thread.terminate(transpileCoffeeScriptPaths)
await transpileCsonPathsPromise;
await Thread.terminate(transpileCsonPaths)
await transpilePegJsPathsPromise;
await Thread.terminate(transpilePegJsPaths)
}
if (!argv.generateApiDocs) {
binariesPromise
.then(packageApplication)
.then(packagedAppPath => generateStartupSnapshot(packagedAppPath).then(() => packagedAppPath))
.then(async packagedAppPath => {
async function singAndCreateInstaller(packagedAppPath) {
switch (process.platform) {
case 'darwin': {
if (argv.codeSign) {
@ -147,7 +153,29 @@ if (!argv.generateApiDocs) {
}
return Promise.resolve(packagedAppPath)
}).then(packagedAppPath => {
}
async function build() {
if (!argv.existingBinaries) {
checkChromedriverVersion()
await cleanOutputDirectory()
await copyAssets()
await transpile()
generateModuleCache()
prebuildLessCache()
generateMetadata()
generateAPIDocs()
if (!argv.generateApiDocs) {
await dumpSymbols()
}
}
if (!argv.generateApiDocs) {
const packagedAppPath = await packageApplication()
await generateStartupSnapshot(packagedAppPath)
await singAndCreateInstaller(packagedAppPath)
if (argv.compressArtifacts) {
compressArtifacts(packagedAppPath)
} else {
@ -159,5 +187,9 @@ if (!argv.generateApiDocs) {
} else {
console.log('Skipping installation. Specify the --install option to install Atom'.gray)
}
})
}
}
build().then(() => {process.exit(0)}).catch((e) => {throw e;})

View File

@ -7,7 +7,13 @@ const cleanDependencies = require('./lib/clean-dependencies')
const cleanOutputDirectory = require('./lib/clean-output-directory')
const killRunningAtomInstances = require('./lib/kill-running-atom-instances')
killRunningAtomInstances()
cleanDependencies()
cleanCaches()
cleanOutputDirectory()
async function clean() {
killRunningAtomInstances()
return Promise.all([
cleanDependencies(),
cleanCaches(),
cleanOutputDirectory()
])
}
clean().then(() => {process.exit(0)}).catch((e) => {throw e;})

View File

@ -10,6 +10,8 @@ const spawnSync = require('./lib/spawn-sync');
const repositoryRootPath = path.resolve(__dirname, '..');
const apmRootPath = path.join(repositoryRootPath, 'apm');
const scriptRootPath = path.join(repositoryRootPath, 'script');
const scriptRunnerRootPath = path.join(scriptRootPath, 'script-runner');
const scriptRunnerModulesPath = path.join(scriptRunnerRootPath, 'node_modules');
const buildOutputPath = path.join(repositoryRootPath, 'out');
const docsOutputPath = path.join(repositoryRootPath, 'docs', 'output');
const intermediateAppPath = path.join(buildOutputPath, 'app');
@ -35,6 +37,11 @@ if (process.env.npm_config_jobs === undefined) {
process.env.npm_config_jobs = 'max';
}
const REPO_OWNER = process.env.REPO_OWNER || 'atom';
const MAIN_REPO = process.env.MAIN_REPO || 'atom';
const NIGHTLY_RELEASE_REPO =
process.env.NIGHTLY_RELEASE_REPO || 'atom-nightly-releases';
module.exports = {
appMetadata,
apmMetadata,
@ -46,6 +53,8 @@ module.exports = {
repositoryRootPath,
apmRootPath,
scriptRootPath,
scriptRunnerRootPath,
scriptRunnerModulesPath,
buildOutputPath,
docsOutputPath,
intermediateAppPath,
@ -55,7 +64,10 @@ module.exports = {
homeDirPath,
getApmBinPath,
getNpmBinPath,
snapshotAuxiliaryData: {}
snapshotAuxiliaryData: {},
REPO_OWNER,
MAIN_REPO,
NIGHTLY_RELEASE_REPO
};
function getChannelName(channel) {

View File

@ -20,9 +20,11 @@ module.exports = function() {
path.join(os.tmpdir(), 'atom-build'),
path.join(os.tmpdir(), 'atom-cached-atom-shells')
];
const rmPromises = [];
for (let path of cachePaths) {
console.log(`Cleaning ${path}`);
fs.removeSync(path);
rmPromises.push(fs.remove(path));
}
return Promise.all(rmPromises);
};

View File

@ -10,23 +10,25 @@ module.exports = function() {
const fs = require('fs-extra');
const glob = require('glob');
const rmPromises = [];
const apmDependenciesPath = path.join(CONFIG.apmRootPath, 'node_modules');
console.log(`Cleaning ${apmDependenciesPath}`);
fs.removeSync(apmDependenciesPath);
rmPromises.push(fs.remove(apmDependenciesPath));
const atomDependenciesPath = path.join(
CONFIG.repositoryRootPath,
'node_modules'
);
console.log(`Cleaning ${atomDependenciesPath}`);
fs.removeSync(atomDependenciesPath);
rmPromises.push(fs.remove(atomDependenciesPath));
const scriptDependenciesPath = path.join(
CONFIG.scriptRootPath,
'node_modules'
);
console.log(`Cleaning ${scriptDependenciesPath}`);
fs.removeSync(scriptDependenciesPath);
rmPromises.push(fs.remove(scriptDependenciesPath));
const bundledPackageDependenciesPaths = path.join(
CONFIG.repositoryRootPath,
@ -37,6 +39,8 @@ module.exports = function() {
for (const bundledPackageDependencyPath of glob.sync(
bundledPackageDependenciesPaths
)) {
fs.removeSync(bundledPackageDependencyPath);
rmPromises.push(fs.remove(bundledPackageDependencyPath));
}
return Promise.all(rmPromises);
};

View File

@ -4,6 +4,7 @@ const CONFIG = require('../config');
module.exports = function() {
if (fs.existsSync(CONFIG.buildOutputPath)) {
console.log(`Cleaning ${CONFIG.buildOutputPath}`);
fs.removeSync(CONFIG.buildOutputPath);
return fs.remove(CONFIG.buildOutputPath);
}
return Promise.resolve();
};

View File

@ -25,10 +25,14 @@ module.exports = function() {
ignore: path.join('**', '*-spec.*')
})
);
const copyPromises = [];
for (let srcPath of srcPaths) {
fs.copySync(srcPath, computeDestinationPath(srcPath), {
filter: includePathInPackagedApp
});
copyPromises.push(
fs.copy(srcPath, computeDestinationPath(srcPath), {
filter: includePathInPackagedApp
})
);
}
// Run a copy pass to dereference symlinked directories under node_modules.
@ -50,20 +54,26 @@ module.exports = function() {
'node_modules',
path.basename(modulePath)
);
fs.copySync(modulePath, destPath, { filter: includePathInPackagedApp });
copyPromises.push(
fs.copy(modulePath, destPath, { filter: includePathInPackagedApp })
);
});
fs.copySync(
path.join(
CONFIG.repositoryRootPath,
'resources',
'app-icons',
CONFIG.channel,
'png',
'1024.png'
),
path.join(CONFIG.intermediateAppPath, 'resources', 'atom.png')
copyPromises.push(
fs.copy(
path.join(
CONFIG.repositoryRootPath,
'resources',
'app-icons',
CONFIG.channel,
'png',
'1024.png'
),
path.join(CONFIG.intermediateAppPath, 'resources', 'atom.png')
)
);
return Promise.all(copyPromises);
};
function computeDestinationPath(srcPath) {

View File

@ -200,9 +200,32 @@ module.exports = function(packagedAppPath) {
);
console.log(`Generating .deb file from ${debianPackageDirPath}`);
spawnSync('fakeroot', ['dpkg-deb', '-b', debianPackageDirPath], {
stdio: 'inherit'
});
// don't compress by default to speed up build
let compressionLevel = 0;
let compressionType = 'none';
if (process.env.IS_RELEASE_BRANCH || process.env.IS_SIGNED_ZIP_BRANCH) {
compressionLevel = 6;
compressionType = 'xz';
}
// use sudo if available to speed up build
let sudoCommand = 'fakeroot';
if (process.env.CI || (process.getuid && process.getuid() === 0)) {
sudoCommand = 'sudo';
}
spawnSync(
sudoCommand,
[
'dpkg-deb',
`-Z${compressionType}`,
`-z${compressionLevel}`,
'-b',
debianPackageDirPath
],
{
stdio: 'inherit'
}
);
console.log(
`Copying generated package into "${outputDebianPackageFilePath}"`

View File

@ -6,6 +6,7 @@ const glob = require('glob');
const path = require('path');
const CONFIG = require('../config');
const { REPO_OWNER, MAIN_REPO } = CONFIG;
module.exports = packagedAppPath => {
const archSuffix = process.arch === 'ia32' ? '' : '-' + process.arch;
@ -17,7 +18,7 @@ module.exports = packagedAppPath => {
exe: CONFIG.executableName,
appDirectory: packagedAppPath,
authors: 'GitHub Inc.',
iconUrl: `https://raw.githubusercontent.com/atom/atom/master/resources/app-icons/${
iconUrl: `https://raw.githubusercontent.com/${REPO_OWNER}/${MAIN_REPO}/master/resources/app-icons/${
CONFIG.channel
}/atom.ico`,
loadingGif: path.join(

View File

@ -4,7 +4,7 @@ const childProcess = require('child_process');
const CONFIG = require('../config');
module.exports = function(ci) {
function installApm(ci = false, showVersion = true) {
if (ci) {
// Tell apm not to dedupe its own dependencies during its
// postinstall script. (Deduping during `npm ci` runs is broken.)
@ -16,4 +16,13 @@ module.exports = function(ci) {
['--global-style', '--loglevel=error', ci ? 'ci' : 'install'],
{ env: process.env, cwd: CONFIG.apmRootPath }
);
};
if (showVersion) {
childProcess.execFileSync(CONFIG.getApmBinPath(), ['--version'], {
stdio: 'inherit'
});
}
}
const { expose } = require(`${CONFIG.scriptRunnerModulesPath}/threads/worker`);
expose(installApm);
module.exports = installApm;

View File

@ -7,11 +7,15 @@ const CONFIG = require('../config');
// Recognised by '@electron/get', used by the 'electron-mksnapshot' and 'electron-chromedriver' dependencies
process.env.ELECTRON_CUSTOM_VERSION = CONFIG.appMetadata.electronVersion;
module.exports = function(ci) {
function installScriptDependencies(ci) {
console.log('Installing script dependencies');
childProcess.execFileSync(
CONFIG.getNpmBinPath(ci),
['--loglevel=error', ci ? 'ci' : 'install'],
{ env: process.env, cwd: CONFIG.scriptRootPath }
);
};
}
const { expose } = require(`${CONFIG.scriptRunnerModulesPath}/threads/worker`);
expose(installScriptDependencies);
module.exports = installScriptDependencies;

View File

@ -0,0 +1,16 @@
'use strict';
const childProcess = require('child_process');
const CONFIG = require('../config');
function installScriptRunnerDependencies(ci) {
console.log('Installing script runner dependencies');
childProcess.execFileSync(
CONFIG.getNpmBinPath(ci),
['--loglevel=error', ci ? 'ci' : 'install'],
{ env: process.env, cwd: CONFIG.scriptRunnerRootPath }
);
}
module.exports = installScriptRunnerDependencies;

View File

@ -7,12 +7,12 @@ const path = require('path');
const CONFIG = require('../config');
module.exports = function() {
function transpileBabelPaths() {
console.log(`Transpiling Babel paths in ${CONFIG.intermediateAppPath}`);
for (let path of getPathsToTranspile()) {
transpileBabelPath(path);
}
};
}
function getPathsToTranspile() {
let paths = [];
@ -49,3 +49,7 @@ function transpileBabelPath(path) {
CompileCache.addPathToCache(path, CONFIG.atomHomeDirPath)
);
}
const { expose } = require(`${CONFIG.scriptRunnerModulesPath}/threads/worker`);
expose(transpileBabelPaths);
module.exports = transpileBabelPaths;

View File

@ -7,14 +7,14 @@ const path = require('path');
const CONFIG = require('../config');
module.exports = function() {
function transpileCoffeeScriptPaths() {
console.log(
`Transpiling CoffeeScript paths in ${CONFIG.intermediateAppPath}`
);
for (let path of getPathsToTranspile()) {
transpileCoffeeScriptPath(path);
}
};
}
function getPathsToTranspile() {
let paths = [];
@ -63,3 +63,7 @@ function transpileCoffeeScriptPath(coffeePath) {
);
fs.unlinkSync(coffeePath);
}
const { expose } = require(`${CONFIG.scriptRunnerModulesPath}/threads/worker`);
expose(transpileCoffeeScriptPaths);
module.exports = transpileCoffeeScriptPaths;

View File

@ -7,12 +7,12 @@ const path = require('path');
const CONFIG = require('../config');
module.exports = function() {
function transpileCsonPaths() {
console.log(`Transpiling CSON paths in ${CONFIG.intermediateAppPath}`);
for (let path of getPathsToTranspile()) {
transpileCsonPath(path);
}
};
}
function getPathsToTranspile() {
let paths = [];
@ -53,3 +53,7 @@ function transpileCsonPath(csonPath) {
);
fs.unlinkSync(csonPath);
}
const { expose } = require(`${CONFIG.scriptRunnerModulesPath}/threads/worker`);
expose(transpileCsonPaths);
module.exports = transpileCsonPaths;

View File

@ -11,7 +11,7 @@ const runApmInstall = require('./run-apm-install');
require('colors');
module.exports = function() {
function transpilePackagesWithCustomTranspilerPaths() {
console.log(
`Transpiling packages with custom transpiler configurations in ${
CONFIG.intermediateAppPath
@ -78,7 +78,7 @@ module.exports = function() {
intermediatePackageBackup.restore();
}
}
};
}
function transpilePath(path) {
fs.writeFileSync(
@ -86,3 +86,7 @@ function transpilePath(path) {
CompileCache.addPathToCache(path, CONFIG.atomHomeDirPath)
);
}
const { expose } = require(`${CONFIG.scriptRunnerModulesPath}/threads/worker`);
expose(transpilePackagesWithCustomTranspilerPaths);
module.exports = transpilePackagesWithCustomTranspilerPaths;

View File

@ -7,12 +7,12 @@ const path = require('path');
const CONFIG = require('../config');
module.exports = function() {
function transpilePegJsPaths() {
console.log(`Transpiling PEG.js paths in ${CONFIG.intermediateAppPath}`);
for (let path of getPathsToTranspile()) {
transpilePegJsPath(path);
}
};
}
function getPathsToTranspile() {
let paths = [];
@ -41,3 +41,7 @@ function transpilePegJsPath(pegJsPath) {
fs.writeFileSync(jsPath, outputCode);
fs.unlinkSync(pegJsPath);
}
const { expose } = require(`${CONFIG.scriptRunnerModulesPath}/threads/worker`);
expose(transpilePegJsPaths);
module.exports = transpilePegJsPaths;

View File

@ -1,3 +1,5 @@
const { REPO_OWNER, MAIN_REPO } = require('../../config');
const git = (git, repositoryRootPath) => {
const path = require('path');
const packageJsonFilePath = path.join(repositoryRootPath, 'package.json');
@ -10,7 +12,9 @@ const git = (git, repositoryRootPath) => {
if (!err && !remotes.map(({ name }) => name).includes('ATOM')) {
git.addRemote(
'ATOM',
`https://atom:${process.env.AUTH_TOKEN}@github.com/atom/atom.git/`
`https://atom:${
process.env.AUTH_TOKEN
}@github.com/${REPO_OWNER}/${MAIN_REPO}.git/`
);
}
});

View File

@ -1,4 +1,5 @@
const { request } = require('@octokit/request');
const { REPO_OWNER, MAIN_REPO } = require('../../config');
const requestWithAuth = request.defaults({
baseUrl: 'https://api.github.com',
@ -6,8 +7,8 @@ const requestWithAuth = request.defaults({
'user-agent': 'atom',
authorization: `token ${process.env.AUTH_TOKEN}`
},
owner: 'atom',
repo: 'atom'
owner: REPO_OWNER,
repo: MAIN_REPO
});
module.exports = {
@ -28,7 +29,7 @@ module.exports = {
},
findPR: async ({ moduleName, latest }, branch) => {
return requestWithAuth('GET /search/issues', {
q: `${moduleName} type:pr ${moduleName}@${latest} in:title repo:atom/atom head:${branch}`
q: `${moduleName} type:pr ${moduleName}@${latest} in:title repo:${REPO_OWNER}/${MAIN_REPO} head:${branch}`
});
},
findOpenPRs: async () => {

View File

@ -575,9 +575,9 @@
}
},
"acorn": {
"version": "5.7.4",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz",
"integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg=="
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz",
"integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ=="
},
"acorn-jsx": {
"version": "5.0.1",
@ -879,9 +879,9 @@
}
},
"tslib": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz",
"integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w=="
}
}
},
@ -2689,9 +2689,9 @@
},
"dependencies": {
"acorn": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.0.4.tgz",
"integrity": "sha512-XNP0PqF1XD19ZlLKvB7cMmnZswW4C/03pRHgirB30uSJTaS3A3V1/P4sS3HPvFmjoriPCJQs+JDSbm4bL1TxGQ=="
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.1.0.tgz",
"integrity": "sha512-LWCF/Wn0nfHOmJ9rzQApGnxnvgfROzGilS8936rqN/lfcYkY9MYZzdMqN+2NJ4SlTc+m5HiSa+kNfDtI64dwUA=="
},
"ast-types": {
"version": "0.14.2",
@ -2725,11 +2725,11 @@
}
},
"resolve": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz",
"integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==",
"version": "1.20.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
"integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
"requires": {
"is-core-module": "^2.1.0",
"is-core-module": "^2.2.0",
"path-parse": "^1.0.6"
}
},
@ -2739,9 +2739,9 @@
"integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ=="
},
"tslib": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz",
"integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w=="
}
}
},
@ -3022,9 +3022,9 @@
"integrity": "sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA=="
},
"errno": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
"integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz",
"integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==",
"requires": {
"prr": "~1.0.1"
}
@ -3545,9 +3545,9 @@
},
"dependencies": {
"acorn": {
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA=="
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz",
"integrity": "sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA=="
}
}
},

70
script/script-runner/package-lock.json generated Normal file
View File

@ -0,0 +1,70 @@
{
"name": "atom-build-scripts-runner",
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
},
"esm": {
"version": "3.2.25",
"resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz",
"integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==",
"optional": true
},
"is-observable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-observable/-/is-observable-1.1.0.tgz",
"integrity": "sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA==",
"requires": {
"symbol-observable": "^1.1.0"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"observable-fns": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/observable-fns/-/observable-fns-0.5.1.tgz",
"integrity": "sha512-wf7g4Jpo1Wt2KIqZKLGeiuLOEMqpaOZ5gJn7DmSdqXgTdxRwSdBhWegQQpPteQ2gZvzCKqNNpwb853wcpA0j7A=="
},
"symbol-observable": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
"integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ=="
},
"threads": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/threads/-/threads-1.6.3.tgz",
"integrity": "sha512-tKwFIWRgfAT85KGkrpDt2jWPO8IVH0sLNfB/pXad/VW9eUIY2Zlz+QyeizypXhPHv9IHfqRzvk2t3mPw+imhWw==",
"requires": {
"callsites": "^3.1.0",
"debug": "^4.1.1",
"is-observable": "^1.1.0",
"observable-fns": "^0.5.1",
"tiny-worker": ">= 2"
}
},
"tiny-worker": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tiny-worker/-/tiny-worker-2.3.0.tgz",
"integrity": "sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g==",
"optional": true,
"requires": {
"esm": "^3.2.25"
}
}
}
}

View File

@ -0,0 +1,7 @@
{
"name": "atom-build-scripts-runner",
"description": "Atom build scripts runner",
"dependencies": {
"threads": "^1.6.3"
}
}

View File

@ -3,6 +3,7 @@ const request = require('request-promise-native');
const repositoryRootPath = path.resolve(__dirname, '..', '..');
const appMetadata = require(path.join(repositoryRootPath, 'package.json'));
const { REPO_OWNER, NIGHTLY_RELEASE_REPO } = require('../config');
const yargs = require('yargs');
const argv = yargs
@ -26,7 +27,7 @@ async function getReleaseVersion() {
let releaseVersion = process.env.ATOM_RELEASE_VERSION || appMetadata.version;
if (argv.nightly) {
const releases = await request({
url: 'https://api.github.com/repos/atom/atom-nightly-releases/releases',
url: `https://api.github.com/repos/${REPO_OWNER}/${NIGHTLY_RELEASE_REPO}/releases`,
headers: {
Accept: 'application/vnd.github.v3+json',
'User-Agent': 'Atom Release Build'

View File

@ -3,6 +3,8 @@ const octokit = require('@octokit/rest')();
const changelog = require('pr-changelog');
const childProcess = require('child_process');
const { REPO_OWNER, MAIN_REPO, NIGHTLY_RELEASE_REPO } = require('../../config');
module.exports.getRelease = async function(releaseVersion, githubToken) {
if (githubToken) {
octokit.authenticate({
@ -12,8 +14,8 @@ module.exports.getRelease = async function(releaseVersion, githubToken) {
}
const releases = await octokit.repos.getReleases({
owner: 'atom',
repo: 'atom'
owner: REPO_OWNER,
repo: MAIN_REPO
});
const release = releases.data.find(r => semver.eq(r.name, releaseVersion));
@ -49,16 +51,16 @@ module.exports.generateForVersion = async function(
oldVersionName = `v${parsedVersion.major}.${parsedVersion.minor - 1}.0`;
} else {
let releases = await octokit.repos.getReleases({
owner: 'atom',
repo: 'atom'
owner: REPO_OWNER,
repo: MAIN_REPO
});
oldVersion = 'v' + getPreviousRelease(releaseVersion, releases.data).name;
oldVersionName = oldVersion;
}
const allChangesText = await changelog.getChangelog({
owner: 'atom',
repo: 'atom',
owner: REPO_OWNER,
repo: MAIN_REPO,
fromTag: oldVersion,
toTag: newVersionBranch,
dependencyKey: 'packageDependencies',
@ -71,7 +73,7 @@ module.exports.generateForVersion = async function(
}) {
let prString = changelog.pullRequestsToString(pullRequests);
let title = repo;
if (repo === 'atom') {
if (repo === MAIN_REPO) {
title = 'Atom Core';
fromTag = oldVersionName;
toTag = releaseVersion;
@ -110,13 +112,13 @@ module.exports.generateForNightly = async function(
const latestCommit = latestCommitResult.stdout.toString().trim();
const output = [
`### This nightly release is based on https://github.com/atom/atom/commit/${latestCommit} :atom: :night_with_stars:`
`### This nightly release is based on https://github.com/${REPO_OWNER}/${MAIN_REPO}/commit/${latestCommit} :atom: :night_with_stars:`
];
try {
const releases = await octokit.repos.getReleases({
owner: 'atom',
repo: 'atom-nightly-releases'
owner: REPO_OWNER,
repo: NIGHTLY_RELEASE_REPO
});
const previousRelease = getPreviousRelease(releaseVersion, releases.data);
@ -139,7 +141,7 @@ module.exports.generateForNightly = async function(
output.push('No changes have been included in this release');
} else {
output.push(
`Click [here](https://github.com/atom/atom/compare/${previousCommit}...${latestCommit}) to see the changes included with this release!`
`Click [here](https://github.com/${REPO_OWNER}/${MAIN_REPO}/compare/${previousCommit}...${latestCommit}) to see the changes included with this release!`
);
}
}

View File

@ -1,5 +1,12 @@
# workaround for https://bit.ly/2CK8itc
variables:
_ATOM_RELEASES_S3_KEY: $[ variables.ATOM_RELEASES_S3_KEY ]
_ATOM_RELEASES_S3_SECRET: $[ variables.ATOM_RELEASES_S3_SECRET ]
_ATOM_RELEASES_S3_BUCKET: $[ variables.ATOM_RELEASES_S3_BUCKET ]
_PACKAGE_CLOUD_API_KEY: $[ variables.PACKAGE_CLOUD_API_KEY ]
jobs:
# Import "GetReleaseVersion" job definition, with the "NightlyFlag" parameter set
# GetReleaseVersion for nightly release
- template: platforms/templates/get-release-version.yml
parameters:
NightlyFlag: --nightly
@ -26,15 +33,11 @@ jobs:
variables:
ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ]
IsNightlyBranch: true
steps:
- template: platforms/templates/preparation.yml
- script: |
cd script/vsts
npm install
displayName: npm install
- task: DownloadBuildArtifacts@0
inputs:
itemPattern: '**'

View File

@ -23,4 +23,4 @@ steps:
GITHUB_TOKEN: $(GITHUB_TOKEN)
CI: true
CI_PROVIDER: VSTS
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'), ne(variables['LocalPackagesRestored'], 'true'))
condition: or(ne(variables['MainNodeModulesRestored'], 'true'), ne(variables['ScriptRunnerNodeModulesRestored'], true), ne(variables['ScriptNodeModulesRestored'], 'true'), ne(variables['ApmNodeModulesRestored'], 'true'), ne(variables['LocalPackagesRestored'], 'true'))

View File

@ -11,21 +11,28 @@ steps:
- task: Cache@2
displayName: Cache node_modules
inputs:
key: 'npm_main | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
key: 'npm_main | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/script-runner/package.json, script/script-runner/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
path: 'node_modules'
cacheHitVar: MainNodeModulesRestored
- task: Cache@2
displayName: Cache script/script-runner/node_modules
inputs:
key: 'npm_script_runner | "$(Agent.OS)" | "$(BUILD_ARCH)" | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/script-runner/package.json, script/script-runner/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
path: 'script/script-runner/node_modules'
cacheHitVar: ScriptRunnerNodeModulesRestored
- task: Cache@2
displayName: Cache script/node_modules
inputs:
key: 'npm_script | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
key: 'npm_script | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/script-runner/package.json, script/script-runner/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
path: 'script/node_modules'
cacheHitVar: ScriptNodeModulesRestored
- task: Cache@2
displayName: Cache apm/node_modules
inputs:
key: 'npm_apm | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
key: 'npm_apm | "$(Agent.OS)" | "$(BUILD_ARCH)" | packages/**, !packages/**/node_modules/** | package.json, package-lock.json, apm/package.json, script/package.json, script/package-lock.json, script/script-runner/package.json, script/script-runner/package-lock.json, script/vsts/platforms/${{ parameters.OS }}.yml, script/vsts/platforms/templates/preparation.yml'
path: 'apm/node_modules'
cacheHitVar: ApmNodeModulesRestored

View File

@ -3,7 +3,7 @@ steps:
# Linux Specific
- script: |
sudo apt-get update
sudo apt-get install -y build-essential ca-certificates xvfb fakeroot git rpm libsecret-1-dev libx11-dev libxkbfile-dev xz-utils xorriso zsync libxss1 libgtk-3-0 libasound2 libicu-dev software-properties-common wget
sudo apt-get install -y build-essential ca-certificates xvfb fakeroot git rpm libsecret-1-dev libx11-dev libxkbfile-dev xz-utils xorriso zsync libxss1 libgtk-3-0 libasound2 libicu-dev software-properties-common wget dpkg
# clang 9 is included in the image
clang -v
displayName: Install apt dependencies
@ -33,14 +33,16 @@ steps:
- script: npm install --global npm@6.14.8
displayName: Update npm
- pwsh: |
cd script/vsts
npm install
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
displayName: Install script/vsts dependencies
condition: or(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['IsReleaseBranch'], 'true'), eq(variables['IsSignedZipBranch'], true), eq(variables['IsNightlyBranch'], 'true'))
# Windows Specific
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
condition: eq(variables['Agent.OS'], 'Windows_NT')
- pwsh: |
cd script/vsts
npm install
displayName: Install script/vsts dependencies on Windows
condition: eq(variables['Agent.OS'], 'Windows_NT')

View File

@ -35,7 +35,6 @@ jobs:
- template: templates/test.yml
- pwsh: |
if ($env:BUILD_ARCH -eq "x64") {
$env:FileID="-x64"
@ -116,5 +115,5 @@ jobs:
artifacts:
- atom$(FileID)-windows.zip
# Core renderer tests
# tests
- template: templates/test.yml

View File

@ -1,7 +1,7 @@
trigger: none # No CI builds, only PR builds
jobs:
# Import "GetReleaseVersion" job definition
# GetReleaseVersion
- template: platforms/templates/get-release-version.yml
# Import lint definition

View File

@ -4,8 +4,15 @@ trigger:
- electron-*
pr: none # no PR triggers
# workaround for https://bit.ly/2CK8itc
variables:
_ATOM_RELEASES_S3_KEY: $[ variables.ATOM_RELEASES_S3_KEY ]
_ATOM_RELEASES_S3_SECRET: $[ variables.ATOM_RELEASES_S3_SECRET ]
_ATOM_RELEASES_S3_BUCKET: $[ variables.ATOM_RELEASES_S3_BUCKET ]
_PACKAGE_CLOUD_API_KEY: $[ variables.PACKAGE_CLOUD_API_KEY ]
jobs:
# Import "GetReleaseVersion" job definition
# GetReleaseVersion
- template: platforms/templates/get-release-version.yml
# Import lint definition
@ -35,13 +42,6 @@ jobs:
steps:
- template: platforms/templates/preparation.yml
- script: |
cd script/vsts
npm install
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
displayName: npm install
- task: DownloadBuildArtifacts@0
inputs:
itemPattern: '**'

View File

@ -11,6 +11,7 @@ const uploadToAzure = require('./lib/upload-to-azure-blob');
const uploadLinuxPackages = require('./lib/upload-linux-packages');
const CONFIG = require('../config');
const { REPO_OWNER, MAIN_REPO, NIGHTLY_RELEASE_REPO } = CONFIG;
const yargs = require('yargs');
const argv = yargs
@ -60,25 +61,41 @@ async function uploadArtifacts() {
return;
}
console.log(
`Uploading ${
assets.length
} release assets for ${releaseVersion} to Azure Blob Storage under '${azureBlobPath}'`
);
if (
process.env.ATOM_RELEASES_S3_KEY &&
process.env.ATOM_RELEASES_S3_SECRET &&
process.env.ATOM_RELEASES_S3_BUCKET
) {
console.log(
`Uploading ${
assets.length
} release assets for ${releaseVersion} to Azure Blob Storage under '${azureBlobPath}'`
);
await uploadToAzure(
process.env.ATOM_RELEASES_AZURE_CONN_STRING,
azureBlobPath,
assets
);
if (argv.linuxRepoName) {
await uploadLinuxPackages(
argv.linuxRepoName,
process.env.PACKAGE_CLOUD_API_KEY,
releaseVersion,
await uploadToAzure(
process.env.ATOM_RELEASES_AZURE_CONN_STRING,
azureBlobPath,
assets
);
} else {
console.log(
'\nEnvironment variables "ATOM_RELEASES_S3_BUCKET", "ATOM_RELEASES_S3_KEY" and/or "ATOM_RELEASES_S3_SECRET" are not set, skipping S3 upload.'
);
}
if (argv.linuxRepoName) {
if (process.env.PACKAGE_CLOUD_API_KEY) {
await uploadLinuxPackages(
argv.linuxRepoName,
process.env.PACKAGE_CLOUD_API_KEY,
releaseVersion,
assets
);
} else {
console.log(
'\nEnvironment variable "PACKAGE_CLOUD_API_KEY" is not set, skipping PackageCloud upload.'
);
}
} else {
console.log(
'\nNo Linux package repo name specified, skipping Linux package upload.'
@ -125,13 +142,13 @@ async function uploadArtifacts() {
? spawnSync('git', ['rev-parse', 'HEAD'])
.stdout.toString()
.trimEnd()
: 'master'; // Nightly tags are created in atom/atom-nightly-releases so the SHA is irrelevant
: 'master'; // Nightly tags are created in REPO_OWNER/NIGHTLY_RELEASE_REPO so the SHA is irrelevant
console.log(`Creating GitHub release v${releaseVersion}`);
const release = await publishReleaseAsync({
token: process.env.GITHUB_TOKEN,
owner: 'atom',
repo: !isNightlyRelease ? 'atom' : 'atom-nightly-releases',
owner: REPO_OWNER,
repo: !isNightlyRelease ? MAIN_REPO : NIGHTLY_RELEASE_REPO,
name: CONFIG.computedAppVersion,
notes: newReleaseNotes,
target_commitish: releaseSha,

View File

@ -38,9 +38,19 @@ async function uploadCrashReports() {
}
}
// Wrap the call the async function and catch errors from its promise because
// Node.js doesn't yet allow use of await at the script scope
uploadCrashReports().catch(err => {
console.error('An error occurred while uploading crash reports:\n\n', err);
process.exit(1);
});
if (
process.env.ATOM_RELEASES_S3_KEY &&
process.env.ATOM_RELEASES_S3_SECRET &&
process.env.ATOM_RELEASES_S3_BUCKET
) {
// Wrap the call the async function and catch errors from its promise because
// Node.js doesn't yet allow use of await at the script scope
uploadCrashReports().catch(err => {
console.error('An error occurred while uploading crash reports:\n\n', err);
process.exit(1);
});
} else {
console.log(
'\n\nEnvironment variables "ATOM_RELEASES_S3_BUCKET", "ATOM_RELEASES_S3_KEY" and/or "ATOM_RELEASES_S3_SECRET" are not set, skipping S3 upload.'
);
}

View File

@ -923,6 +923,27 @@ module.exports = class Package {
}
}
// a require function with both ES5 and ES6 default export support
_require(path) {
const modul = require(path);
if (modul === null || modul === undefined) {
// if null do not bother
return modul;
} else {
if (
modul.__esModule === true &&
typeof modul.default === 'object' &&
typeof modul.default.activate === 'function'
) {
// __esModule flag is true and the activate function exists inside it, which means
// an object containing the main functions (e.g. activate, etc) is default exported
return modul.default;
} else {
return modul;
}
}
}
getMainModulePath() {
if (this.resolvedMainModulePath) return this.mainModulePath;
this.resolvedMainModulePath = true;