From 726ce55eec84b95981b7da1740f6c3ce2bd13a18 Mon Sep 17 00:00:00 2001 From: Jason Rudolph Date: Fri, 28 Sep 2018 10:30:42 -0400 Subject: [PATCH 1/4] Set probot/no-response days-until-close to 28 days --- .github/no-response.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/no-response.yml b/.github/no-response.yml index 3c6b33d42..1c8799d13 100644 --- a/.github/no-response.yml +++ b/.github/no-response.yml @@ -1,7 +1,7 @@ # Configuration for probot-no-response - https://github.com/probot/no-response # Number of days of inactivity before an issue is closed for lack of response -daysUntilClose: 180 +daysUntilClose: 28 # Label requiring a response responseRequiredLabel: more-information-needed From 4a6c5e2c52b90f2ce2d3928faf1744473f0963de Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 1 Oct 2018 15:33:42 -0700 Subject: [PATCH 2/4] :arrow_right: Migrate core package 'dalek' into ./packages --- package-lock.json | 6 +-- package.json | 4 +- packages/README.md | 3 +- packages/dalek/.gitignore | 3 ++ packages/dalek/LICENSE.md | 20 ++++++++++ packages/dalek/README.md | 19 +++++++++ packages/dalek/lib/dalek.js | 54 +++++++++++++++++++++++++ packages/dalek/lib/main.js | 19 +++++++++ packages/dalek/package.json | 29 ++++++++++++++ packages/dalek/test/dalek.test.js | 66 +++++++++++++++++++++++++++++++ packages/dalek/test/runner.js | 2 + 11 files changed, 217 insertions(+), 8 deletions(-) create mode 100644 packages/dalek/.gitignore create mode 100644 packages/dalek/LICENSE.md create mode 100644 packages/dalek/README.md create mode 100644 packages/dalek/lib/dalek.js create mode 100644 packages/dalek/lib/main.js create mode 100644 packages/dalek/package.json create mode 100644 packages/dalek/test/dalek.test.js create mode 100644 packages/dalek/test/runner.js diff --git a/package-lock.json b/package-lock.json index f739b8635..d569cab74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1561,16 +1561,14 @@ } }, "dalek": { - "version": "https://www.atom.io/api/packages/dalek/versions/0.2.2/tarball", - "integrity": "sha512-7p7KFZFakk54JTKiP/gsXaEMAcsO30Y5dT3lrHZG3jeAMg201YSq5ayAd735i79S/RbpH32X5DaE6XC3Qf9BSw==", + "version": "file:packages/dalek", "requires": { "grim": "^2.0.1" }, "dependencies": { "grim": { "version": "2.0.2", - "resolved": "https://registry.npmjs.org/grim/-/grim-2.0.2.tgz", - "integrity": "sha1-52CinKe4NDsMH/r2ziDyGkbuiu0=", + "bundled": true, "requires": { "event-kit": "^2.0.0" } diff --git a/package.json b/package.json index c8fcf427a..89ff45181 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "coffee-script": "1.12.7", "color": "^0.7.3", "command-palette": "https://www.atom.io/api/packages/command-palette/versions/0.43.5/tarball", - "dalek": "https://www.atom.io/api/packages/dalek/versions/0.2.2/tarball", + "dalek": "file:packages/dalek", "dedent": "^0.7.0", "deprecation-cop": "https://www.atom.io/api/packages/deprecation-cop/versions/0.56.9/tarball", "dev-live-reload": "file:packages/dev-live-reload", @@ -195,7 +195,7 @@ "bookmarks": "0.45.1", "bracket-matcher": "0.89.3", "command-palette": "0.43.5", - "dalek": "0.2.2", + "dalek": "file:./packages/dalek", "deprecation-cop": "0.56.9", "dev-live-reload": "file:./packages/dev-live-reload", "encoding-selector": "0.23.9", diff --git a/packages/README.md b/packages/README.md index ccf1081d6..737549047 100644 --- a/packages/README.md +++ b/packages/README.md @@ -26,7 +26,7 @@ See [RFC 003](https://github.com/atom/atom/blob/master/docs/rfcs/003-consolidate | **bookmarks** | [`atom/bookmarks`][bookmarks] | | | **bracket-matcher** | [`atom/bracket-matcher`][bracket-matcher] | | | **command-palette** | [`atom/command-palette`][command-palette] | | -| **dalek** | [`atom/dalek`][dalek] | [#17838](https://github.com/atom/atom/issues/17838) | +| **dalek** | [`./dalek`](./dalek) | [#17838](https://github.com/atom/atom/issues/17838) | | **deprecation-cop** | [`atom/deprecation-cop`][deprecation-cop] | [#17839](https://github.com/atom/atom/issues/17839) | | **dev-live-reload** | [`./dev-live-reload`](dev-live-reload) | [#17840](https://github.com/atom/atom/issues/17840) | | **encoding-selector** | [`atom/encoding-selector`][encoding-selector] | [#17841](https://github.com/atom/atom/issues/17841) | @@ -113,7 +113,6 @@ See [RFC 003](https://github.com/atom/atom/blob/master/docs/rfcs/003-consolidate [bookmarks]: https://github.com/atom/bookmarks [bracket-matcher]: https://github.com/atom/bracket-matcher [command-palette]: https://github.com/atom/command-palette -[dalek]: https://github.com/atom/dalek [deprecation-cop]: https://github.com/atom/deprecation-cop [encoding-selector]: https://github.com/atom/encoding-selector [find-and-replace]: https://github.com/atom/find-and-replace diff --git a/packages/dalek/.gitignore b/packages/dalek/.gitignore new file mode 100644 index 000000000..ade14b919 --- /dev/null +++ b/packages/dalek/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +npm-debug.log +node_modules diff --git a/packages/dalek/LICENSE.md b/packages/dalek/LICENSE.md new file mode 100644 index 000000000..60afff4ac --- /dev/null +++ b/packages/dalek/LICENSE.md @@ -0,0 +1,20 @@ +Copyright (c) 2016 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/dalek/README.md b/packages/dalek/README.md new file mode 100644 index 000000000..393f40f41 --- /dev/null +++ b/packages/dalek/README.md @@ -0,0 +1,19 @@ +# dalek + +**EXTERMINATEs** core packages installed in `~/.atom/packages`. + +## Why worry? + +When people install core Atom packages as if they are community packages, it can cause many problems that are very hard to diagnose. This package is intended to notify people when they are in this precarious position so they can take corrective action. + +## I got a warning, what do I do? + +1. Note down the packages named in the notification +1. Exit Atom +1. Open a command prompt +1. For each package named in the notification, execute `apm uninstall [package-name]` +1. Start Atom again normally to verify that the warning notification no longer appears + +## I have more questions. Where can I ask them? + +Please feel free to ask on [the official Atom message board](https://discuss.atom.io/c/support). diff --git a/packages/dalek/lib/dalek.js b/packages/dalek/lib/dalek.js new file mode 100644 index 000000000..8d322cc03 --- /dev/null +++ b/packages/dalek/lib/dalek.js @@ -0,0 +1,54 @@ +/** @babel */ + +const fs = require('fs') +const path = require('path') + +module.exports = { + async enumerate () { + if (atom.inDevMode()) { + return [] + } + + const duplicatePackages = [] + const names = atom.packages.getAvailablePackageNames() + for (let name of names) { + if (atom.packages.isBundledPackage(name)) { + const isDuplicatedPackage = await this.isInstalledAsCommunityPackage(name) + if (isDuplicatedPackage) { + duplicatePackages.push(name) + } + } + } + + return duplicatePackages + }, + + async isInstalledAsCommunityPackage (name) { + const availablePackagePaths = atom.packages.getPackageDirPaths() + + for (let packagePath of availablePackagePaths) { + const candidate = path.join(packagePath, name) + + if (fs.existsSync(candidate)) { + const realPath = await this.realpath(candidate) + if (realPath === candidate) { + return true + } + } + } + + return false + }, + + realpath (path) { + return new Promise((resolve, reject) => { + fs.realpath(path, function (error, realpath) { + if (error) { + reject(error) + } else { + resolve(realpath) + } + }) + }) + } +} diff --git a/packages/dalek/lib/main.js b/packages/dalek/lib/main.js new file mode 100644 index 000000000..2a9a196fa --- /dev/null +++ b/packages/dalek/lib/main.js @@ -0,0 +1,19 @@ +/** @babel */ + +const dalek = require('./dalek') +const Grim = require('grim') + +module.exports = { + activate () { + atom.packages.onDidActivateInitialPackages(async () => { + const duplicates = await dalek.enumerate() + for (let i = 0; i < duplicates.length; i++) { + const duplicate = duplicates[i] + Grim.deprecate( + `You have the core package "${duplicate}" installed as a community package. See https://github.com/atom/dalek for how this causes problems and instructions on how to correct the situation.`, + { packageName: duplicate } + ) + } + }) + } +} diff --git a/packages/dalek/package.json b/packages/dalek/package.json new file mode 100644 index 000000000..06894bbfa --- /dev/null +++ b/packages/dalek/package.json @@ -0,0 +1,29 @@ +{ + "name": "dalek", + "main": "./lib/main", + "version": "0.2.2", + "description": "EXTERMINATEs built-in packages installed in ~/.atom/packages", + "keywords": [], + "repository": "https://github.com/atom/atom", + "license": "MIT", + "atomTestRunner": "./test/runner", + "engines": { + "atom": ">=1.12.7 <2.0.0" + }, + "dependencies": { + "grim": "^2.0.1" + }, + "devDependencies": { + "atom-mocha-test-runner": "^1.0.0", + "sinon": "^2.0.0", + "standard": "^8.6.0" + }, + "standard": { + "env": { + "jasmine": true + }, + "globals": [ + "atom" + ] + } +} diff --git a/packages/dalek/test/dalek.test.js b/packages/dalek/test/dalek.test.js new file mode 100644 index 000000000..8b84dd29d --- /dev/null +++ b/packages/dalek/test/dalek.test.js @@ -0,0 +1,66 @@ +/** @babel */ + +const assert = require('assert') +const fs = require('fs') +const sinon = require('sinon') +const path = require('path') + +const dalek = require('../lib/dalek') + +describe('dalek', function () { + describe('enumerate', function () { + let availablePackages = {} + let realPaths = {} + let bundledPackages = [] + let packageDirPaths = [] + let sandbox = null + + beforeEach(function () { + availablePackages = { + 'an-unduplicated-installed-package': path.join('Users', 'username', '.atom', 'packages', 'an-unduplicated-installed-package'), + 'duplicated-package': path.join('Users', 'username', '.atom', 'packages', 'duplicated-package'), + 'unduplicated-package': path.join(`${atom.getLoadSettings().resourcePath}`, 'node_modules', 'unduplicated-package') + } + + atom.devMode = false + bundledPackages = ['duplicated-package', 'unduplicated-package'] + packageDirPaths = [path.join('Users', 'username', '.atom', 'packages')] + sandbox = sinon.sandbox.create() + sandbox.stub(dalek, 'realpath').callsFake((filePath) => Promise.resolve(realPaths[filePath] || filePath)) + sandbox.stub(atom.packages, 'isBundledPackage').callsFake((packageName) => { return bundledPackages.includes(packageName) }) + sandbox.stub(atom.packages, 'getAvailablePackageNames').callsFake(() => Object.keys(availablePackages)) + sandbox.stub(atom.packages, 'getPackageDirPaths').callsFake(() => { return packageDirPaths }) + sandbox.stub(fs, 'existsSync').callsFake((candidate) => { return Object.values(availablePackages).includes(candidate) && !candidate.includes(atom.getLoadSettings().resourcePath) }) + }) + + afterEach(function () { + sandbox.restore() + }) + + it('returns a list of duplicate names', async function () { + assert.deepEqual(await dalek.enumerate(), ['duplicated-package']) + }) + + describe('when in dev mode', function () { + beforeEach(function () { + atom.devMode = true + }) + + it('always returns an empty list', async function () { + assert.deepEqual(await dalek.enumerate(), []) + }) + }) + + describe('when a package is symlinked into the package directory', async function () { + beforeEach(function () { + const realPath = path.join('Users', 'username', 'duplicated-package') + const packagePath = path.join('Users', 'username', '.atom', 'packages', 'duplicated-package') + realPaths[packagePath] = realPath + }) + + it('is not included in the list of duplicate names', async function () { + assert.deepEqual(await dalek.enumerate(), []) + }) + }) + }) +}) diff --git a/packages/dalek/test/runner.js b/packages/dalek/test/runner.js new file mode 100644 index 000000000..5688fc9c0 --- /dev/null +++ b/packages/dalek/test/runner.js @@ -0,0 +1,2 @@ +const createRunner = require('atom-mocha-test-runner').createRunner +module.exports = createRunner({testSuffixes: ['test.js']}) From 00354922e7e9b98ea377b13600d0b909e7ce7401 Mon Sep 17 00:00:00 2001 From: mfonville Date: Tue, 2 Oct 2018 10:21:49 +0200 Subject: [PATCH 3/4] Update Electron to 2.0.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c8fcf427a..c90b679d7 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/atom/atom/issues" }, "license": "MIT", - "electronVersion": "2.0.10", + "electronVersion": "2.0.11", "dependencies": { "@atom/nsfw": "1.0.18", "@atom/source-map-support": "^0.3.4", From c66ed0fa13b414773f066e81d1130e8e42edaca5 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 2 Oct 2018 07:57:28 -0700 Subject: [PATCH 4/4] Update dalek's README link in package notifications --- packages/dalek/lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dalek/lib/main.js b/packages/dalek/lib/main.js index 2a9a196fa..8ec35d9ca 100644 --- a/packages/dalek/lib/main.js +++ b/packages/dalek/lib/main.js @@ -10,7 +10,7 @@ module.exports = { for (let i = 0; i < duplicates.length; i++) { const duplicate = duplicates[i] Grim.deprecate( - `You have the core package "${duplicate}" installed as a community package. See https://github.com/atom/dalek for how this causes problems and instructions on how to correct the situation.`, + `You have the core package "${duplicate}" installed as a community package. See https://github.com/atom/atom/blob/master/packages/dalek/README.md for how this causes problems and instructions on how to correct the situation.`, { packageName: duplicate } ) }