@heroku/skynet 1.6.11 → 1.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,7 @@ heroku skynet:<cmd>
37
37
  ```
38
38
 
39
39
  ### Unit test
40
- ```
40
+ ```bash
41
41
  # $SKYNET_CLI_HOME points to the home dir of heroku-skynet-cli
42
42
  cd $SKYNET_CLI_HOME
43
43
  unset SKYNET_HOST
@@ -45,7 +45,7 @@ npm test
45
45
  ```
46
46
 
47
47
  ### Integration test
48
- ```
48
+ ```bash
49
49
  #
50
50
  # Start local skynet
51
51
  #
@@ -55,6 +55,7 @@ $ pg_ctl -D /usr/local/var/postgres start
55
55
  $ redis-server
56
56
 
57
57
  # Update URL and KEY in .env. $REAL_KEY_IN_PRODUCTION refers to the real key in production.
58
+ $ cd $SKYNET_HOME
58
59
  $ sed -i -e 's/HEROKU_API_URL=.*/HEROKU_API_URL=https:\/\/api.heroku.com/g' .env
59
60
  $ sed -i -e 's/HEROKU_API_KEY=.*/HEROKU_API_KEY=$REAL_KEY_IN_PRODUCTION/g' .env
60
61
 
@@ -70,6 +71,10 @@ $ heroku local web,worker
70
71
  $ cd $HEROKU_SKYNET_CLI_HOME
71
72
  $ cloud production
72
73
 
74
+ # Link to the local plugin implementation
75
+ $ cd $HEROKU_SKYNET_CLI_HOME
76
+ $ heroku plugins:link
77
+
73
78
  # Pointing to the local Skynet instance
74
79
  $ export SKYNET_HOST=http://localhost:5000
75
80
 
@@ -78,18 +83,41 @@ $ export SKYNET_HOST=http://localhost:5000
78
83
  #
79
84
 
80
85
  # This unsuspend request will be sent to the local Skynet instance
81
- $ heroku skynet::unsuspend::user -u dzhuo@heroku.com
86
+ $ heroku sudo skynet::unsuspend::user -u xyz@heroku.com
82
87
 
88
+ # Verify that you can see the unsuspend record in suspension_activities table
83
89
  ```
84
90
 
85
91
  ### Publishing to `npm`
86
- 1. Request access to NPM using [this form](https://securityorg.force.com/IntakeApp/s/?entityCode=HerokuAccess&si=a1i3A0000007euiQAA)
92
+ * Request access to the NPM Heroku Organization using [this form](https://securityorg.force.com/IntakeApp/s/?entityCode=HerokuAccess&si=a1i3A0000007euiQAA).
93
+ * Request write access to @keroku/skynet package by sending email to dzhuo@salesforce.com.
94
+ * Publish the package:
87
95
 
88
- 1. Publish the package:
96
+ ```
97
+ # Check out the latest master
98
+ $ cd $HEROKU_SKYNET_CLI_HOME
99
+ $ git checkout -b master origin/master
89
100
 
90
- 1. cd into the root of the plugin
91
- 1. Run `npm run release`
92
- Note: You will get an error because np attempts to commit to master the
93
- updated version in the package.json
94
- Open a pr manually on a separate branch to resolve
95
- 1. Merge the pr once approved
101
+ # Run npm release. In case `npm run release` asks you whether
102
+ # or not you want to publish the repo publicly, answer "No".
103
+ $ npm login
104
+ $ npm test
105
+ $ npm run release
106
+ ```
107
+
108
+ * Command 'npm run release' will change the version number in package.json file and commit. but the pull request will fail due to the enabled git pull process. A follow-up manual pull request is needed to check in the new version number in Git repository.
109
+ * Verify that new package version is created on [npm website](https://www.npmjs.com/package/@heroku/skynet), or directly run command "npm view @heroku/skynet"
110
+ * Note: You will get an error at the end of `npm run release`. Np attempts to commit to master branch the updated package version in the package.json. But the commit will fail because our master branch is protected. You can ignore the error message.
111
+ * Submit a new PR to update the version in `package.json` and `package-lock.json`. Here is one [PR example](https://github.com/heroku/heroku-skynet-cli/pull/74).
112
+ * Test the newly released @heroku/skynet package
113
+
114
+ ```bash
115
+ # install the latest @heroku/skynet package
116
+ $ cd $HEROKU_SKYNET_CLI_HOME
117
+ $ heroku plugins:unlink
118
+ $ heroku plugins:install @heroku/skynet
119
+ $ heroku plugins # verify that the latest version is installed
120
+
121
+ # run tests
122
+ $ heroku sudo skynet::unsuspend::user -u xyz@heroku.com
123
+ ```
@@ -10,12 +10,13 @@ async function run (context) {
10
10
  let notes = context.flags.notes
11
11
  let category = context.flags.category
12
12
  let force = context.flags.bypass
13
+ let notify = !context.flags['no-notify']
13
14
 
14
15
  if (!user) {
15
16
  throw new Error('Required flag: --user USER')
16
17
  }
17
18
 
18
- let response = await cli.action(`deprovisioning ${cli.color.cyan(user)}`, skynet.deprovision(user, notes, category, force))
19
+ let response = await cli.action(`deprovisioning ${cli.color.cyan(user)}`, skynet.deprovision(user, notes, category, notify, force))
19
20
  response = JSON.parse(response)
20
21
  cli.log(`${response.status}. ${response.message}`)
21
22
  }
@@ -30,7 +31,8 @@ module.exports = {
30
31
  { name: 'user', char: 'u', description: 'user to deprovision', hasValue: true },
31
32
  { name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
32
33
  { name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
33
- { name: 'bypass', description: 'bypass the whitelist', hasValue: false, required: false }
34
+ { name: 'bypass', description: 'bypass the whitelist', hasValue: false, required: false },
35
+ { name: 'no-notify', description: 'skip user suspension email notification', hasValue: false, required: false }
34
36
  ],
35
37
  run: command(run)
36
38
  }
@@ -26,8 +26,8 @@ module.exports = {
26
26
  $ heroku skynet:unsuspend:app -a test-app -n "helpful unsuspend message" -c "ddos"`,
27
27
  flags: [
28
28
  { name: 'app', char: 'a', description: 'app to unsuspend', hasValue: true, required: true },
29
- { name: 'category', char: 'c', description: 'unsuspension category', hasValue: true, required: false },
30
- { name: 'notes', char: 'n', description: 'unsuspend notes', hasValue: true, required: false }
29
+ { name: 'category', char: 'c', description: 'unsuspension category', hasValue: true, required: true },
30
+ { name: 'notes', char: 'n', description: 'unsuspend notes', hasValue: true, required: true }
31
31
  ],
32
32
  run: command(run)
33
33
  }
@@ -26,8 +26,8 @@ module.exports = {
26
26
  $ heroku skynet:unsuspend:user -u foo@bar.com -n "helpful unsuspend message" -c "ddos"`,
27
27
  flags: [
28
28
  { name: 'user', char: 'u', description: 'user to unsuspend', hasValue: true },
29
- { name: 'category', char: 'c', description: 'unsuspension category', hasValue: true, required: false },
30
- { name: 'notes', char: 'n', description: 'unsuspend notes', hasValue: true, required: false }
29
+ { name: 'category', char: 'c', description: 'unsuspension category', hasValue: true, required: true },
30
+ { name: 'notes', char: 'n', description: 'unsuspend notes', hasValue: true, required: true }
31
31
  ],
32
32
  run: command(run)
33
33
  }
package/lib/skynet.js CHANGED
@@ -175,13 +175,14 @@ module.exports = class SkynetAPI {
175
175
  })
176
176
  }
177
177
 
178
- deprovision (user, notes, category, force = false) {
178
+ deprovision (user, notes, category, notify = true, force = false) {
179
179
  var body = {
180
180
  value: user,
181
181
  reason: notes,
182
182
  method: 'skynet-cli',
183
183
  category: category,
184
- force: force
184
+ force: force,
185
+ notify: notify
185
186
  }
186
187
 
187
188
  return this.request(`/deprovision`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heroku/skynet",
3
- "version": "1.6.11",
3
+ "version": "1.6.13",
4
4
  "description": "use Skynet from Heroku CLI",
5
5
  "main": "index.js",
6
6
  "author": "Bob Argenbright @byt3smith",