Atom => Pulsar

This commit is contained in:
Maurício Szabo 2023-05-11 22:31:58 -03:00
parent a94ffa17df
commit 7234f92973
7 changed files with 50 additions and 50 deletions

View File

@ -1,4 +1,4 @@
##### Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our [official announcement](https://github.blog/2022-06-08-sunsetting-atom/)
##### Pulsar and all repositories under Pulsar will be archived on December 15, 2022. Learn more in our [official announcement](https://github.blog/2022-06-08-sunsetting-atom/)
# Notifications package
[![CI](https://github.com/atom/notifications/actions/workflows/ci.yml/badge.svg)](https://github.com/atom/notifications/actions/workflows/ci.yml)
@ -6,5 +6,5 @@
### Docs
Notifications are available for use in your Atom packages via the `atom.notifications` `NotificationManager` object. See
Notifications are available for use in your Pulsar packages via the `atom.notifications` `NotificationManager` object. See
https://atom.io/docs/api/latest/NotificationManager and https://atom.io/docs/api/latest/Notification for documentation.

View File

@ -25,7 +25,7 @@ const ignoredCommands = {
// Ten minutes in milliseconds.
const tenMinutes = 10 * 60 * 1000;
// Public: Handles logging all of the Atom commands for the automatic repro steps feature.
// Public: Handles logging all of the Pulsar commands for the automatic repro steps feature.
//
// It uses an array as a circular data structure to log only the most recent commands.
module.exports =

View File

@ -212,7 +212,7 @@ module.exports =
const promises = [];
promises.push(this.issue.findSimilarIssues());
promises.push(UserUtilities.checkAtomUpToDate());
promises.push(UserUtilities.checkPulsarUpToDate());
if (packageName != null) { promises.push(UserUtilities.checkPackageUpToDate(packageName)); }
return Promise.all(promises).then(allData => {
@ -244,7 +244,7 @@ Upgrading to the latest version may fix this issue.\
fatalNotification.innerHTML += `\
<br><br>
Locally installed core Pulsar package <code>${packageName}</code> is out of date: ${packageCheck.installedVersion} installed locally;
${packageCheck.versionShippedWithAtom} included with the version of Pulsar you're running.
${packageCheck.versionShippedWithPulsar} included with the version of Pulsar you're running.
Removing the locally installed version may fix this issue.\
`;

View File

@ -122,14 +122,14 @@ module.exports =
} else if (packageName != null) {
packageMessage = `'${packageName}' package v${packageVersion}`;
} else {
packageMessage = 'Atom Core';
packageMessage = 'Pulsar Core';
}
this.issueBody = `\
<!--
Have you read Atom's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/atom/.github/blob/master/CODE_OF_CONDUCT.md
Have you read Pulsar's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/atom/.github/blob/master/CODE_OF_CONDUCT.md
Do you want to ask a question? Are you looking for support? The Atom message board is the best place for getting support: https://discuss.atom.io
Do you want to ask a question? Are you looking for support? The Pulsar message board is the best place for getting support: https://discuss.atom.io
-->
### Prerequisites
@ -139,7 +139,7 @@ Do you want to ask a question? Are you looking for support? The Atom message boa
* Followed all applicable steps in the debugging guide: <https://flight-manual.atom.io/hacking-atom/sections/debugging/>
* Checked the FAQs on the message board for common solutions: <https://discuss.atom.io/c/faq>
* Checked that your issue isn't already filed: <https://github.com/issues?q=is%3Aissue+user%3Aatom>
* Checked that there is not already an Atom package that provides the described functionality: <https://atom.io/packages>
* Checked that there is not already an Pulsar package that provides the described functionality: <https://atom.io/packages>
### Description

View File

@ -138,7 +138,7 @@ module.exports = {
});
},
getLatestAtomData() {
getLatestPulsarData() {
const githubHeaders = new Headers({
accept: 'application/vnd.github.v3+json',
contentType: "application/json"
@ -147,10 +147,10 @@ module.exports = {
.then(function(r) { if (r.ok) { return r.json(); } else { return Promise.reject(r.statusCode); } });
},
checkAtomUpToDate() {
return this.getLatestAtomData().then(function(latestAtomData) {
checkPulsarUpToDate() {
return this.getLatestPulsarData().then(function(latestPulsarData) {
const installedVersion = __guard__(atom.getVersion(), x => x.replace(/-.*$/, ''));
const latestVersion = latestAtomData.name;
const latestVersion = latestPulsarData.name;
const upToDate = (installedVersion != null) && semver.gte(installedVersion, latestVersion);
return {upToDate, latestVersion, installedVersion};});
},
@ -160,7 +160,7 @@ module.exports = {
return (pack != null ? pack.metadata.version : undefined);
},
getPackageVersionShippedWithAtom(packageName) {
getPackageVersionShippedWithPulsar(packageName) {
return require(path.join(atom.getLoadSettings().resourcePath, 'package.json')).packageDependencies[packageName];
},
@ -179,17 +179,17 @@ module.exports = {
const installedVersion = this.getPackageVersion(packageName);
let upToDate = (installedVersion != null) && semver.gte(installedVersion, latestPackageData.releases.latest);
const latestVersion = latestPackageData.releases.latest;
const versionShippedWithAtom = this.getPackageVersionShippedWithAtom(packageName);
const versionShippedWithPulsar = this.getPackageVersionShippedWithPulsar(packageName);
if (isCore = (versionShippedWithAtom != null)) {
if (isCore = (versionShippedWithPulsar != null)) {
// A core package is out of date if the version which is being used
// is lower than the version which normally ships with the version
// of Atom which is running. This will happen when there's a locally
// installed version of the package with a lower version than Atom's.
upToDate = (installedVersion != null) && semver.gte(installedVersion, versionShippedWithAtom);
// of Pulsar which is running. This will happen when there's a locally
// installed version of the package with a lower version than Pulsar's.
upToDate = (installedVersion != null) && semver.gte(installedVersion, versionShippedWithPulsar);
}
return {isCore, upToDate, latestVersion, installedVersion, versionShippedWithAtom};
return {isCore, upToDate, latestVersion, installedVersion, versionShippedWithPulsar};
});
}
};

View File

@ -2,7 +2,7 @@
"name": "notifications",
"main": "./lib/main",
"version": "0.72.1",
"description": "A tidy way to display Atom notifications.",
"description": "A tidy way to display Pulsar notifications.",
"repository": "https://github.com/atom/notifications",
"license": "MIT",
"engines": {
@ -24,7 +24,7 @@
"showErrorsInDevMode": {
"type": "boolean",
"default": false,
"description": "Show notifications for uncaught exceptions even if Atom is running in dev mode. If this config setting is disabled, uncaught exceptions will trigger the dev tools to open and be logged in the console tab."
"description": "Show notifications for uncaught exceptions even if Pulsar is running in dev mode. If this config setting is disabled, uncaught exceptions will trigger the dev tools to open and be logged in the console tab."
},
"defaultTimeout": {
"type": "integer",

View File

@ -24,7 +24,7 @@ describe "Notifications", ->
describe "when there are notifications before activation", ->
beforeEach ->
waitsForPromise ->
# Wrapped in Promise.resolve so this test continues to work on earlier versions of Atom
# Wrapped in Promise.resolve so this test continues to work on earlier versions of Pulsar
Promise.resolve(atom.packages.deactivatePackage('notifications'))
it "displays all non displayed notifications", ->
@ -304,7 +304,7 @@ describe "Notifications", ->
atom.onWillThrowError(handler)
# Fake an unhandled error with a call stack located outside of the source
# of Atom or an Atom package
# of Pulsar or an Pulsar package
fs.readFile(__dirname, ->
err = new Error()
err.stack = 'FakeError: foo is not bar\n at blah.fakeFunc (directory/fakefile.js:1:25)'
@ -348,12 +348,12 @@ describe "Notifications", ->
beforeEach ->
stack = """
TypeError: undefined is not a function
at Object.module.exports.Pane.promptToSaveItem [as defaultSavePrompt] (/Applications/Atom.app/Contents/Resources/app/src/pane.js:490:23)
at Object.module.exports.Pane.promptToSaveItem [as defaultSavePrompt] (/Applications/Pulsar.app/Contents/Resources/app/src/pane.js:490:23)
at Pane.promptToSaveItem (/Users/someguy/.atom/packages/save-session/lib/save-prompt.coffee:21:15)
at Pane.module.exports.Pane.destroyItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:442:18)
at HTMLDivElement.<anonymous> (/Applications/Atom.app/Contents/Resources/app/node_modules/tabs/lib/tab-bar-view.js:174:22)
at space-pen-ul.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/archive-view/node_modules/atom-space-pen-views/node_modules/space-pen/vendor/jquery.js:4676:9)
at space-pen-ul.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/archive-view/node_modules/atom-space-pen-views/node_modules/space-pen/vendor/jquery.js:4360:46)
at Pane.module.exports.Pane.destroyItem (/Applications/Pulsar.app/Contents/Resources/app/src/pane.js:442:18)
at HTMLDivElement.<anonymous> (/Applications/Pulsar.app/Contents/Resources/app/node_modules/tabs/lib/tab-bar-view.js:174:22)
at space-pen-ul.jQuery.event.dispatch (/Applications/Pulsar.app/Contents/Resources/app/node_modules/archive-view/node_modules/atom-space-pen-views/node_modules/space-pen/vendor/jquery.js:4676:9)
at space-pen-ul.elemData.handle (/Applications/Pulsar.app/Contents/Resources/app/node_modules/archive-view/node_modules/atom-space-pen-views/node_modules/space-pen/vendor/jquery.js:4360:46)
"""
detail = 'ok'
@ -364,7 +364,7 @@ describe "Notifications", ->
spyOn(fs, 'realpathSync').andCallFake (p) -> p
spyOn(fatalError.issue, 'getPackagePathsByPackageName').andCallFake ->
'save-session': '/Users/someguy/.atom/packages/save-session'
'tabs': '/Applications/Atom.app/Contents/Resources/app/node_modules/tabs'
'tabs': '/Applications/Pulsar.app/Contents/Resources/app/node_modules/tabs'
it "chooses the first package in the trace", ->
expect(fatalError.issue.getPackageName()).toBe 'save-session'
@ -398,7 +398,7 @@ describe "Notifications", ->
expect(issueTitle).toContain '$ATOM_HOME'
expect(issueTitle).not.toContain process.env.ATOM_HOME
expect(issueBody).toMatch /Atom\*\*: [0-9].[0-9]+.[0-9]+/ig
expect(issueBody).toMatch /Pulsar\*\*: [0-9].[0-9]+.[0-9]+/ig
expect(issueBody).not.toMatch /Unknown/ig
expect(issueBody).toContain 'ReferenceError: a is not defined'
expect(issueBody).toContain 'Thrown From**: [notifications](https://github.com/atom/notifications) package '
@ -468,9 +468,9 @@ describe "Notifications", ->
ReferenceError: path is not defined
at Object.module.exports.LinkedPackage.wow (#{path.join(fs.realpathSync(packageDir), 'linked-package.coffee')}:29:15)
at atom-workspace.subscriptions.add.atom.commands.add.linked-package:wow (#{path.join(packageDir, 'linked-package.coffee')}:18:102)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:238:29)
at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61
at CommandPaletteView.module.exports.CommandPaletteView.confirmed (/Applications/Atom.app/Contents/Resources/app/node_modules/command-palette/lib/command-palette-view.js:159:32)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Pulsar.app/Contents/Resources/app/src/command-registry.js:238:29)
at /Applications/Pulsar.app/Contents/Resources/app/src/command-registry.js:3:61
at CommandPaletteView.module.exports.CommandPaletteView.confirmed (/Applications/Pulsar.app/Contents/Resources/app/node_modules/command-palette/lib/command-palette-view.js:159:32)
"""
detail = "At #{path.join(packageDir, 'linked-package.coffee')}:41"
message = "Uncaught ReferenceError: path is not defined"
@ -540,7 +540,7 @@ describe "Notifications", ->
}
"""
stack = "TypeError: Cannot read property 'prototype' of undefined\n at __extends (<anonymous>:1:1)\n at Object.defineProperty.value [as .coffee] (/Applications/Atom.app/Contents/Resources/app.asar/src/compile-cache.js:169:21)"
stack = "TypeError: Cannot read property 'prototype' of undefined\n at __extends (<anonymous>:1:1)\n at Object.defineProperty.value [as .coffee] (/Applications/Pulsar.app/Contents/Resources/app.asar/src/compile-cache.js:169:21)"
detail = "TypeError: Cannot read property 'prototype' of undefined"
message = "Failed to load the broken-load package"
atom.notifications.addFatalError(message, {stack, detail, packageName: 'broken-load', dismissable: true})
@ -621,7 +621,7 @@ describe "Notifications", ->
}
"""
stack = "TypeError: Cannot read property 'command' of undefined\n at Object.module.exports.activate (<anonymous>:7:23)\n at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:232:19)"
stack = "TypeError: Cannot read property 'command' of undefined\n at Object.module.exports.activate (<anonymous>:7:23)\n at Package.module.exports.Package.activateNow (/Applications/Pulsar.app/Contents/Resources/app.asar/src/package.js:232:19)"
detail = "TypeError: Cannot read property 'command' of undefined"
message = "Failed to activate the broken-activation package"
atom.notifications.addFatalError(message, {stack, detail, packageName: 'broken-activation', dismissable: true})
@ -688,14 +688,14 @@ describe "Notifications", ->
expect(fatalError).toBeDefined()
expect(fatalError).toHaveClass 'has-close'
expect(fatalError.innerHTML).toContain 'ReferenceError: a is not defined'
expect(fatalError.innerHTML).toContain 'bug in Atom'
expect(fatalError.innerHTML).toContain 'bug in Pulsar'
expect(fatalError.issue.getPackageName()).toBeUndefined()
button = fatalError.querySelector('.btn')
expect(button.textContent).toContain 'Create issue on atom/atom'
expect(issueBody).toContain 'ReferenceError: a is not defined'
expect(issueBody).toContain '**Thrown From**: Atom Core'
expect(issueBody).toContain '**Thrown From**: Pulsar Core'
it "contains the commands that the user run in the issue body", ->
expect(issueBody).toContain 'some-package:a-command'
@ -732,7 +732,7 @@ describe "Notifications", ->
spyOn(atom, 'inDevMode').andReturn false
describe "when the message is longer than 100 characters", ->
message = "Uncaught Error: Cannot find module 'dialog'Error: Cannot find module 'dialog' at Function.Module._resolveFilename (module.js:351:15) at Function.Module._load (module.js:293:25) at Module.require (module.js:380:17) at EventEmitter.<anonymous> (/Applications/Atom.app/Contents/Resources/atom/browser/lib/rpc-server.js:128:79) at EventEmitter.emit (events.js:119:17) at EventEmitter.<anonymous> (/Applications/Atom.app/Contents/Resources/atom/browser/api/lib/web-contents.js:99:23) at EventEmitter.emit (events.js:119:17)"
message = "Uncaught Error: Cannot find module 'dialog'Error: Cannot find module 'dialog' at Function.Module._resolveFilename (module.js:351:15) at Function.Module._load (module.js:293:25) at Module.require (module.js:380:17) at EventEmitter.<anonymous> (/Applications/Pulsar.app/Contents/Resources/atom/browser/lib/rpc-server.js:128:79) at EventEmitter.emit (events.js:119:17) at EventEmitter.<anonymous> (/Applications/Pulsar.app/Contents/Resources/atom/browser/api/lib/web-contents.js:99:23) at EventEmitter.emit (events.js:119:17)"
expectedIssueTitle = "Uncaught Error: Cannot find module 'dialog'Error: Cannot find module 'dialog' at Function.Module...."
beforeEach ->
@ -812,11 +812,11 @@ describe "Notifications", ->
repository: url: 'https://github.com/atom/notifications'
releases: latest: '0.11.0'
describe "when the locally installed version is lower than Atom's version", ->
describe "when the locally installed version is lower than Pulsar's version", ->
beforeEach ->
versionShippedWithAtom = '0.10.0'
versionShippedWithPulsar = '0.10.0'
UserUtilities = require '../lib/user-utilities'
spyOn(UserUtilities, 'getPackageVersionShippedWithAtom').andCallFake -> versionShippedWithAtom
spyOn(UserUtilities, 'getPackageVersionShippedWithPulsar').andCallFake -> versionShippedWithPulsar
generateException()
fatalError = notificationContainer.querySelector('atom-notification.fatal')
@ -829,14 +829,14 @@ describe "Notifications", ->
it "tells the user that the package is a locally installed core package and out of date", ->
fatalNotification = fatalError.querySelector('.fatal-notification')
expect(fatalNotification.textContent).toContain 'Locally installed core Atom package'
expect(fatalNotification.textContent).toContain 'Locally installed core Pulsar package'
expect(fatalNotification.textContent).toContain 'is out of date'
describe "when the locally installed version matches Atom's version", ->
describe "when the locally installed version matches Pulsar's version", ->
beforeEach ->
versionShippedWithAtom = '0.9.0'
versionShippedWithPulsar = '0.9.0'
UserUtilities = require '../lib/user-utilities'
spyOn(UserUtilities, 'getPackageVersionShippedWithAtom').andCallFake -> versionShippedWithAtom
spyOn(UserUtilities, 'getPackageVersionShippedWithPulsar').andCallFake -> versionShippedWithPulsar
generateException()
fatalError = notificationContainer.querySelector('atom-notification.fatal')
@ -848,7 +848,7 @@ describe "Notifications", ->
button = fatalError.querySelector('.btn')
expect(button.textContent).toContain 'Create issue'
describe "when Atom is out of date", ->
describe "when Pulsar is out of date", ->
beforeEach ->
installedVersion = '0.179.0'
spyOn(atom, 'getVersion').andCallFake -> installedVersion
@ -868,9 +868,9 @@ describe "Notifications", ->
button = fatalError.querySelector('.btn-issue')
expect(button).not.toExist()
it "tells the user that Atom is out of date", ->
it "tells the user that Pulsar is out of date", ->
fatalNotification = fatalError.querySelector('.fatal-notification')
expect(fatalNotification.textContent).toContain 'Atom is out of date'
expect(fatalNotification.textContent).toContain 'Pulsar is out of date'
it "provides a link to the latest released version", ->
fatalNotification = fatalError.querySelector('.fatal-notification')
@ -957,7 +957,7 @@ describe "Notifications", ->
a + 1
catch e
e.code = 'ENOENT'
message = 'Error: spawn /opt/atom/Atom Helper (deleted) ENOENT'
message = 'Error: spawn /opt/atom/Pulsar Helper (deleted) ENOENT'
window.onerror.call(window, message, 'abc', 2, 3, e)
it "displays a fatal error", ->