UNPKG

2.6 kBMarkdownView Raw
1# Atom-Package-Deps
2
3Atom-Package-Deps is a module that lets your atom package depend on other atom packages, It's quite simple and shows a nice progress bar as a notification as the packages are installed.
4
5#### How it works?
6
7You need to have an array of package deps in your package manifest, like
8
9```js
10{
11 "name": "linter-ruby",
12 ...
13 "package-deps": [{ "name": "linter" }]
14}
15```
16
17If only the name of the package is needed, you can specify the name directly as a string instead of an object for that entry:
18
19```js
20 "package-deps": ["linter"]
21```
22
23You can also specify the minimum required version (version not semver-range!) of the package, or give users a choice by specifying multiple ones.
24
25```js
26{
27 "name": "linter-ruby",
28 ...
29 "package-deps": [
30 // Add a dependency on a package:
31 { "name": "linter", "minimumVersion": "2.0.0" },
32 // Add a dependency in any of the following packages,
33 // so if one is already installed, user is not prompted to install the other
34 [ { "name": "linter" }, { "name": "atom-ide-ui" } ]
35 ]
36}
37```
38
39Because the package installation is async, it returns a promise that resolves when all the dependencies have been installed.
40
41```js
42'use babel'
43
44module.exports = {
45 activate() {
46 // replace the example argument 'linter-ruby' with the name of this Atom package
47 require('atom-package-deps')
48 .install('linter-ruby')
49 // ^ NOTE: This is the name of YOUR package, NOT the package you want to install.
50 .then(function() {
51 console.log('All dependencies installed, good to go')
52 })
53 },
54}
55```
56
57#### API
58
59You can use this package programatically via this exported interface:
60
61```js
62export function install(packageName: string, hideUserPrompt: boolean = false)
63```
64
65Alternatively, if you want to install dependencies via CLI, this package exposes a bin for that
66
67```
68Usage: atom-package-deps <directory> <hideUserPrompt = true>
69```
70
71#### Screenshots
72
73Installation Prompt
74
75<img src="https://cloud.githubusercontent.com/assets/4278113/22874485/10df8086-f1e8-11e6-8270-9b9823ba07f3.png">
76
77Installation Prompt with choices:
78
79<img src="https://user-images.githubusercontent.com/4278113/90339581-26e49c80-e00b-11ea-9488-fb5d64ee3f28.png">
80
81Installation Progress
82
83<img src="https://cloud.githubusercontent.com/assets/4278113/22874527/59b37c22-f1e8-11e6-968e-dfa857db7664.png">
84
85Installation Complete
86
87<img src="https://cloud.githubusercontent.com/assets/4278113/22874504/32294a88-f1e8-11e6-8741-81e368bb1649.png">
88
89#### License
90
91This project is licensed under the terms of MIT license, See the LICENSE file for more info.