Skip to content

Commit 4f56cef

Browse files
committed
Merge pull request #559 from steelbrain/steelbrain/migrate-to-package-deps
Use atom-package-deps
2 parents c644fef + 6ba73fa commit 4f56cef

File tree

4 files changed

+3
-52
lines changed

4 files changed

+3
-52
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,6 @@ Advantage: you only need to define the query/response interface once (in `projec
9797
## Language Service Documentation
9898
The TypeScript Language service docs: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
9999

100-
## Depending upon other atom packages
101-
There isn't a documented way : https://discuss.atom.io/t/depending-on-other-packages/2360/16
102-
103-
So using https://www.npmjs.com/package/atom-package-dependencies
104-
105-
```js
106-
var apd = require('atom-package-dependencies');
107-
108-
var mdp = apd.require('markdown-preview');
109-
mdp.toggle();
110-
111-
// Also
112-
apd.install();
113-
```
114-
115100
## Showing errors in atom
116101
Done using the `linter` plugin. If you think about it. TypeScript is really just a super powerful version of `jshint` and that is the reason to use `linter` for errors.
117102

lib/main/atom/commands/commands.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import autoCompleteProvider = require("../autoCompleteProvider");
55
import path = require('path');
66
import documentationView = require("../views/documentationView");
77
import renameView = require("../views/renameView");
8-
var apd = require('atom-package-dependencies');
98
import contextView = require("../views/contextView");
109
import fileSymbolsView = require("../views/fileSymbolsView");
1110
import projectSymbolsView = require("../views/projectSymbolsView");

lib/main/atomts.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import path = require('path');
66
import fs = require('fs');
77
import os = require('os');
88

9-
// Make sure we have the packages we depend upon
10-
var apd = require('atom-package-dependencies');
11-
129
import {errorView} from "./atom/views/mainPanelView";
1310

1411
///ts:import=autoCompleteProvider
@@ -285,35 +282,7 @@ function readyToActivate() {
285282
}
286283

287284
export function activate(state: PackageState) {
288-
289-
// Don't activate if we have a dependency that isn't available
290-
var linter = apd.require('linter');
291-
var acp = apd.require('autocomplete-plus');
292-
293-
if (!linter || !acp) {
294-
var notification = atom.notifications.addInfo('AtomTS: Some dependencies not found. Running "apm install" on these for you. Please wait for a success confirmation!', { dismissable: true });
295-
apd.install(function() {
296-
atom.notifications.addSuccess("AtomTS: Dependencies installed correctly. Enjoy TypeScript \u2665", { dismissable: true });
297-
notification.dismiss();
298-
299-
if (atom.packages.isPackageDisabled('linter')) atom.packages.enablePackage('linter');
300-
if (atom.packages.isPackageDisabled('autocomplete-plus')) atom.packages.enablePackage('autocomplete-plus');
301-
302-
// Packages don't get loaded automatically as a result of an install
303-
if (!apd.require('linter')) atom.packages.loadPackage('linter');
304-
if (!apd.require('autocomplete-plus')) atom.packages.loadPackage('autocomplete-plus');
305-
306-
// Hazah activate them and then activate us!
307-
atom.packages.activatePackage('linter')
308-
.then(() => atom.packages.activatePackage('autocomplete-plus'))
309-
.then(() => waitForGrammarActivation())
310-
.then(() => readyToActivate());
311-
});
312-
313-
return;
314-
}
315-
316-
waitForGrammarActivation().then(() => readyToActivate());
285+
require('atom-package-deps').install('atom-typescript').then(waitForGrammarActivation).then(readyToActivate)
317286
}
318287

319288
export function deactivate() {

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"url": "https://github.com/TypeStrong/atom-typescript/issues"
4141
},
4242
"dependencies": {
43-
"atom-package-dependencies": "https://github.com/basarat/atom-package-dependencies/archive/cb2.tar.gz",
43+
"atom-package-deps": "^2.0.3",
4444
"atom-space-pen-views": "^2.0.4",
4545
"babel": "^5.6.23",
4646
"basarat-text-buffer": "6.0.0",
@@ -62,9 +62,7 @@
6262
"grunt": "^0.4.5",
6363
"grunt-ts": "^3.0.0"
6464
},
65-
"package-dependencies": {
66-
"linter": "//this field will be ignored right now"
67-
},
65+
"package-deps": ["linter"],
6866
"keywords": [
6967
"typescript",
7068
"javascript",

0 commit comments

Comments
 (0)