Merge branch 'master' into tt-18-aug-bump-welcome

This commit is contained in:
Tilde Ann Thurium
2018-08-21 11:15:05 -07:00
committed by GitHub
11 changed files with 85 additions and 24 deletions

15
package-lock.json generated
View File

@@ -24,6 +24,15 @@
"source-map": "0.1.32"
}
},
"@atom/temp": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/@atom/temp/-/temp-0.8.4.tgz",
"integrity": "sha1-RVFIywz2ygNI5xpc+ZiGq8rERek=",
"requires": {
"os-tmpdir": "^1.0.0",
"rimraf": "~2.6.2"
}
},
"@atom/watcher": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@atom/watcher/-/watcher-1.0.8.tgz",
@@ -6025,13 +6034,13 @@
}
},
"tree-view": {
"version": "https://www.atom.io/api/packages/tree-view/versions/0.222.0/tarball",
"integrity": "sha512-H3l7Q6+mUMKdUUxmxDl+23hGC77R6dbJG93jy8cNPMfMvHqdKgtW5THVYSPpsqABvN0HrrufR0dWBS9kUWYZMw==",
"version": "https://www.atom.io/api/packages/tree-view/versions/0.224.2/tarball",
"integrity": "sha512-zQgrwWo2aBInkSCsldNP9sZJA4OnzznQgKJzQNhClMZJMWEr1Pl1tWnq3x67ie6dINkJ/JWqzbjxz2v2T5U2ig==",
"requires": {
"@atom/temp": "~0.8.4",
"fs-plus": "3.0.2",
"minimatch": "0.3.0",
"pathwatcher": "8.0.1",
"temp": "0.8.3",
"underscore-plus": "1.6.8"
},
"dependencies": {

View File

@@ -160,7 +160,7 @@
"text-buffer": "13.14.6",
"timecop": "https://www.atom.io/api/packages/timecop/versions/0.36.2/tarball",
"tree-sitter": "0.13.6",
"tree-view": "https://www.atom.io/api/packages/tree-view/versions/0.222.0/tarball",
"tree-view": "https://www.atom.io/api/packages/tree-view/versions/0.224.2/tarball",
"typescript-simple": "1.0.0",
"underscore-plus": "^1.6.8",
"update-package-dependencies": "https://www.atom.io/api/packages/update-package-dependencies/versions/0.13.1/tarball",
@@ -225,7 +225,7 @@
"symbols-view": "0.118.2",
"tabs": "0.109.2",
"timecop": "0.36.2",
"tree-view": "0.222.0",
"tree-view": "0.224.2",
"update-package-dependencies": "0.13.1",
"welcome": "0.36.7",
"whitespace": "0.37.6",

View File

@@ -2,8 +2,9 @@
'use strict'
const childProcess = require('child_process')
const path = require('path')
const CONFIG = require('./config')
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')
@@ -42,4 +43,28 @@ childProcess.execFileSync(
)
runApmInstall(CONFIG.repositoryRootPath, ci)
if (!process.env.CI) {
require('colors')
const glob = require('glob')
const {spawn} = require('child_process')
// Install the local core packages in-place so they can be used in dev mode
const files = glob.sync(path.join(CONFIG.repositoryRootPath, 'packages/*/package.json'))
if (files.length > 0) {
console.log('Installing core packages for use in dev mode...')
files.forEach(file => {
const packageDir = path.dirname(file)
process.stdout.write(`Installing packages/${path.basename(packageDir)} `)
runApmInstall(path.dirname(file), false, ['inherit', 'pipe', 'inherit'])
if (process.platform === 'win32') {
return process.stdout.write('done\n'.green)
} else {
return process.stdout.write('\u2713\n'.green)
}
})
}
}
dependenciesFingerprint.write()

View File

@@ -4,7 +4,7 @@ const childProcess = require('child_process')
const CONFIG = require('../config')
module.exports = function (packagePath, ci) {
module.exports = function (packagePath, ci, stdioOptions) {
const installEnv = Object.assign({}, process.env)
// Set resource path so that apm can load metadata related to Atom.
installEnv.ATOM_RESOURCE_PATH = CONFIG.repositoryRootPath
@@ -14,6 +14,6 @@ module.exports = function (packagePath, ci) {
childProcess.execFileSync(
CONFIG.getApmBinPath(),
['--loglevel=error', ci ? 'ci' : 'install'],
{env: installEnv, cwd: packagePath, stdio: 'inherit'}
{env: installEnv, cwd: packagePath, stdio: stdioOptions || 'inherit'}
)
}

View File

@@ -30,13 +30,15 @@ describe('PackageManager', () => {
expect(packageManger.packageDirPaths[0]).toBe(path.join(configDirPath, 'packages'))
})
it('adds regular package path and dev package path in dev mode', () => {
it('adds regular package path, dev package path, and Atom repo package path in dev mode and dev resource path is set', () => {
const packageManger = new PackageManager({})
const configDirPath = path.join('~', 'someConfig')
packageManger.initialize({configDirPath, devMode: true})
expect(packageManger.packageDirPaths.length).toBe(2)
const resourcePath = path.join('~', '/atom')
packageManger.initialize({configDirPath, resourcePath, devMode: true})
expect(packageManger.packageDirPaths.length).toBe(3)
expect(packageManger.packageDirPaths).toContain(path.join(configDirPath, 'packages'))
expect(packageManger.packageDirPaths).toContain(path.join(configDirPath, 'dev', 'packages'))
expect(packageManger.packageDirPaths).toContain(path.join(resourcePath, 'packages'))
})
})

View File

@@ -20,6 +20,7 @@ class AtomProtocolHandler {
if (!safeMode) {
this.loadPaths.push(path.join(process.env.ATOM_HOME, 'dev', 'packages'))
this.loadPaths.push(path.join(resourcePath, 'packages'))
}
this.loadPaths.push(path.join(process.env.ATOM_HOME, 'packages'))

View File

@@ -94,7 +94,7 @@ class AutoUpdateManager
scheduleUpdateCheck: ->
# Only schedule update check periodically if running in release version and
# and there is no existing scheduled update check.
unless /\w{7}/.test(@version) or @checkForUpdatesIntervalID
unless /-dev/.test(@version) or @checkForUpdatesIntervalID
checkForUpdates = => @check(hidePopups: true)
fourHours = 1000 * 60 * 60 * 4
@checkForUpdatesIntervalID = setInterval(checkForUpdates, fourHours)

View File

@@ -0,0 +1,31 @@
'use strict'
const path = require('path')
const fs = require('fs-plus')
const CSON = require('season')
const electron = require('electron')
module.exports = function () {
const appResourcePath = path.dirname(path.dirname(__dirname))
const defaultRepositoryPath = path.join(electron.app.getPath('home'), 'github', 'atom')
if (process.env.ATOM_DEV_RESOURCE_PATH) {
return process.env.ATOM_DEV_RESOURCE_PATH
} else if (isAtomRepoPath(process.cwd())) {
return process.cwd()
} else if (fs.statSyncNoException(defaultRepositoryPath)) {
return defaultRepositoryPath
}
return appResourcePath
}
function isAtomRepoPath (repoPath) {
let packageJsonPath = path.join(repoPath, 'package.json')
if (fs.statSyncNoException(packageJsonPath)) {
let packageJson = CSON.readFileSync(packageJsonPath)
return packageJson.name === 'atom'
}
return false
}

View File

@@ -4,10 +4,9 @@ if (typeof snapshotResult !== 'undefined') {
const startTime = Date.now()
const electron = require('electron')
const fs = require('fs')
const path = require('path')
const yargs = require('yargs')
const getDevResourcePath = require('./get-dev-resource-path')
const args =
yargs(process.argv)
@@ -21,16 +20,8 @@ if (args.resourcePath) {
resourcePath = args.resourcePath
} else {
const stableResourcePath = path.dirname(path.dirname(__dirname))
const defaultRepositoryPath = path.join(electron.app.getPath('home'), 'github', 'atom')
if (args.dev || args.test || args.benchmark || args.benchmarkTest) {
if (process.env.ATOM_DEV_RESOURCE_PATH) {
resourcePath = process.env.ATOM_DEV_RESOURCE_PATH
} else if (fs.statSyncNoException(defaultRepositoryPath)) {
resourcePath = defaultRepositoryPath
} else {
resourcePath = stableResourcePath
}
resourcePath = getDevResourcePath() || stableResourcePath
} else {
resourcePath = stableResourcePath
}

View File

@@ -5,6 +5,7 @@ const yargs = require('yargs')
const {app} = require('electron')
const path = require('path')
const fs = require('fs-plus')
const getDevResourcePath = require('./get-dev-resource-path')
module.exports = function parseCommandLine (processArgs) {
const options = yargs(processArgs).wrap(yargs.terminalWidth())
@@ -119,7 +120,7 @@ module.exports = function parseCommandLine (processArgs) {
let pathsToOpen = []
let urlsToOpen = []
let devMode = args['dev']
let devResourcePath = process.env.ATOM_DEV_RESOURCE_PATH || path.join(app.getPath('home'), 'github', 'atom')
let devResourcePath = getDevResourcePath()
let resourcePath = null
for (const path of args._) {

View File

@@ -61,6 +61,7 @@ module.exports = class PackageManager {
if (params.configDirPath != null && !params.safeMode) {
if (this.devMode) {
this.packageDirPaths.push(path.join(params.configDirPath, 'dev', 'packages'))
this.packageDirPaths.push(path.join(this.resourcePath, 'packages'))
}
this.packageDirPaths.push(path.join(params.configDirPath, 'packages'))
}