@govuk-pay/cli 0.0.20 → 0.0.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govuk-pay/cli",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "description": "GOV.UK Pay Command Line Interface",
5
5
  "bin": {
6
6
  "pay": "bin/cli.js",
@@ -10,12 +10,16 @@
10
10
  "keywords": [],
11
11
  "author": "",
12
12
  "license": "MIT",
13
+ "engines": {
14
+ "node": ">= 18.x"
15
+ },
13
16
  "dependencies": {
14
17
  "@aws-sdk/client-ec2": "^3.641.0",
15
18
  "@aws-sdk/client-ecs": "^3.637.0",
16
19
  "@aws-sdk/client-rds": "^3.637.0",
17
20
  "@aws-sdk/client-ssm": "^3.651.1",
18
21
  "openurl": "^1.1.1",
22
+ "semver": "^7.6.3",
19
23
  "ts-standard": "^12.0.2"
20
24
  },
21
25
  "files": [
package/readme.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # pay-cli
2
2
  GOV.UK Pay Command Line Interface
3
3
 
4
+ ## Installation and migration guide
5
+
6
+ If you have used the Ruby CLI in the past, there are some additional steps required:
7
+
8
+ - Remove references to `pay` from your `.bashrc` (or other autostart shell script, `.bash_profile`, `.zshrc`, `.zprofile`, etc).
9
+ - Check `which pay`, if it points to `~/.rbenv/shims/pay` or similar, remove that script. Ideally, it should return `pay not found`.
10
+ - Restart your shell to clear functions and environment variables leftover.
11
+
12
+ To install the Node.js CLI:
13
+
14
+ - Run `npm install -g @govuk-pay/cli`. If npm was installed through Homebrew, you shouldn't need to use sudo to install packages.
15
+ - Run `pay` to see if you are running the new version (new features such as `pay tunnel` should be available), if not check `which pay` in case you are using an older version.
16
+
17
+ There is nothing more to do, you're done! To update, run `npm install -g @govuk-pay/cli` again, there are version check notifications if you are behind a version.
18
+
4
19
  ## Usage
5
20
 
6
21
  This is published to NPM, you can install it globally using `npm install -g @govuk-pay/cli`,
@@ -85,7 +85,7 @@ module PayCLI::Commands::Local::AppClient
85
85
 
86
86
  def self.create_service()
87
87
  service_data = {
88
- service_name: 'My service'
88
+ service_name: {en: 'My service', cy: 'Welsh name for My service'}
89
89
  }
90
90
 
91
91
  post("#{base_url 'adminusers'}/v1/api/services", service_data)
@@ -122,6 +122,7 @@ selfservice:
122
122
  - admin
123
123
  - endtoend
124
124
  - webhooks
125
+ - toolbox
125
126
  products-ui:
126
127
  name: products-ui
127
128
  proxy: true
@@ -3,6 +3,7 @@ services:
3
3
  adminusers_db:
4
4
  image: postgres:15.6
5
5
  environment:
6
+ - BIND_HOST=0.0.0.0
6
7
  - POSTGRES_PASSWORD=mysecretpassword
7
8
  mem_limit: 250M
8
9
  logging:
@@ -23,6 +24,7 @@ services:
23
24
  connector_db:
24
25
  image: postgres:15.6
25
26
  environment:
27
+ - BIND_HOST=0.0.0.0
26
28
  - POSTGRES_PASSWORD=mysecretpassword
27
29
  mem_limit: 250M
28
30
  logging:
@@ -43,6 +45,7 @@ services:
43
45
  publicauth_db:
44
46
  image: postgres:15.6
45
47
  environment:
48
+ - BIND_HOST=0.0.0.0
46
49
  - POSTGRES_PASSWORD=mysecretpassword
47
50
  mem_limit: 250M
48
51
  logging:
@@ -63,6 +66,7 @@ services:
63
66
  products_db:
64
67
  image: postgres:15.6
65
68
  environment:
69
+ - BIND_HOST=0.0.0.0
66
70
  - POSTGRES_PASSWORD=mysecretpassword
67
71
  mem_limit: 250M
68
72
  logging:
@@ -83,6 +87,7 @@ services:
83
87
  ledger_db:
84
88
  image: postgres:15.6
85
89
  environment:
90
+ - BIND_HOST=0.0.0.0
86
91
  - POSTGRES_PASSWORD=mysecretpassword
87
92
  mem_limit: 250M
88
93
  logging:
@@ -103,6 +108,7 @@ services:
103
108
  webhooks_db:
104
109
  image: postgres:15.6
105
110
  environment:
111
+ - BIND_HOST=0.0.0.0
106
112
  - POSTGRES_PASSWORD=mysecretpassword
107
113
  mem_limit: 250M
108
114
  logging:
@@ -132,6 +138,7 @@ services:
132
138
  - services/java_app.env
133
139
  - services/adminusers.env
134
140
  environment:
141
+ - BIND_HOST=0.0.0.0
135
142
  - RUN_MIGRATION=true
136
143
  - RUN_APP=true
137
144
  - PORT=9700
@@ -194,6 +201,7 @@ services:
194
201
  - services/java_app.env
195
202
  - services/connector.env
196
203
  environment:
204
+ - BIND_HOST=0.0.0.0
197
205
  - RUN_MIGRATION=true
198
206
  - RUN_APP=true
199
207
  - PORT=9300
@@ -255,6 +263,7 @@ services:
255
263
  - services/java_app.env
256
264
  - services/cardid.env
257
265
  environment:
266
+ - BIND_HOST=0.0.0.0
258
267
  - RUN_MIGRATION=true
259
268
  - RUN_APP=true
260
269
  - PORT=9900
@@ -303,6 +312,7 @@ services:
303
312
  - services/java_app.env
304
313
  - services/publicauth.env
305
314
  environment:
315
+ - BIND_HOST=0.0.0.0
306
316
  - RUN_MIGRATION=true
307
317
  - RUN_APP=true
308
318
  - PORT=9600
@@ -352,6 +362,7 @@ services:
352
362
  - services/java_app.env
353
363
  - services/publicapi.env
354
364
  environment:
365
+ - BIND_HOST=0.0.0.0
355
366
  - RUN_MIGRATION=true
356
367
  - RUN_APP=true
357
368
  - PORT=9100
@@ -401,6 +412,7 @@ services:
401
412
  - services/java_app.env
402
413
  - services/products.env
403
414
  environment:
415
+ - BIND_HOST=0.0.0.0
404
416
  - RUN_MIGRATION=true
405
417
  - RUN_APP=true
406
418
  - PORT=18000
@@ -454,6 +466,7 @@ services:
454
466
  - services/java_app.env
455
467
  - services/ledger.env
456
468
  environment:
469
+ - BIND_HOST=0.0.0.0
457
470
  - RUN_MIGRATION=true
458
471
  - RUN_APP=true
459
472
  - PORT=10700
@@ -514,8 +527,9 @@ services:
514
527
  networks:
515
528
  - pay_local_mimic_aws_vpc
516
529
 
530
+
517
531
  webhooks:
518
- image: governmentdigitalservice/pay-webhooks:latest-master
532
+ image: governmentdigitalservice/pay-webhooks:local
519
533
 
520
534
  depends_on:
521
535
  webhooks_db:
@@ -525,6 +539,7 @@ services:
525
539
  - services/java_app.env
526
540
  - services/webhooks.env
527
541
  environment:
542
+ - BIND_HOST=192.168.0.111
528
543
  - RUN_MIGRATION=true
529
544
  - RUN_APP=true
530
545
  - PORT=10800
@@ -566,23 +581,25 @@ services:
566
581
  - PRODUCTS-UI_URL=http://localhost:10400
567
582
  - STUBS_URL=http://localhost:3030
568
583
  - TOOLBOX_URL=http://localhost:3040
584
+ working_dir: '/app'
569
585
  mem_limit: 2G
586
+ user: root
570
587
  logging:
571
588
  driver: "json-file"
572
589
  ports:
573
- - "10800:10800"
574
- - "10801:10801"
590
+ - "10800:10800"
591
+ - "10801:10801"
575
592
  container_name: webhooks
576
593
  networks:
577
594
  - pay_local_mimic_aws_vpc
578
595
 
579
596
 
580
-
581
597
  frontend:
582
598
  image: governmentdigitalservice/pay-frontend:latest-master
583
599
 
584
600
  env_file: services/frontend.env
585
601
  environment:
602
+ - BIND_HOST=0.0.0.0
586
603
  - SECURE_COOKIE_OFF=true
587
604
  - RUN_APP=true
588
605
  - DISABLE_INTERNAL_HTTPS=true
@@ -625,6 +642,7 @@ services:
625
642
 
626
643
  env_file: services/selfservice.env
627
644
  environment:
645
+ - BIND_HOST=0.0.0.0
628
646
  - SECURE_COOKIE_OFF=true
629
647
  - RUN_APP=true
630
648
  - DISABLE_INTERNAL_HTTPS=true
@@ -667,6 +685,7 @@ services:
667
685
 
668
686
  env_file: services/products-ui.env
669
687
  environment:
688
+ - BIND_HOST=0.0.0.0
670
689
  - SECURE_COOKIE_OFF=true
671
690
  - RUN_APP=true
672
691
  - DISABLE_INTERNAL_HTTPS=true
@@ -709,6 +728,7 @@ services:
709
728
 
710
729
  env_file: services/stubs.env
711
730
  environment:
731
+ - BIND_HOST=0.0.0.0
712
732
  - SECURE_COOKIE_OFF=true
713
733
  - RUN_APP=true
714
734
  - DISABLE_INTERNAL_HTTPS=true
@@ -751,6 +771,7 @@ services:
751
771
 
752
772
  env_file: services/toolbox.env
753
773
  environment:
774
+ - BIND_HOST=0.0.0.0
754
775
  - SECURE_COOKIE_OFF=true
755
776
  - RUN_APP=true
756
777
  - DISABLE_INTERNAL_HTTPS=true
@@ -3,6 +3,7 @@ services:
3
3
  <%= db[:name] %>:
4
4
  image: postgres:15.6
5
5
  environment:
6
+ - BIND_HOST=0.0.0.0
6
7
  - POSTGRES_PASSWORD=mysecretpassword
7
8
  mem_limit: 250M
8
9
  logging:
@@ -32,6 +33,7 @@ services:
32
33
  - services/java_app.env
33
34
  - services/<%= app[:name] %>.env
34
35
  environment:
36
+ - BIND_HOST=0.0.0.0
35
37
  - RUN_MIGRATION=true
36
38
  - RUN_APP=true
37
39
  - PORT=<%= app[:port] %>
@@ -115,6 +117,7 @@ services:
115
117
  - services/java_app.env
116
118
  - services/<%= app[:name] %>.env
117
119
  environment:
120
+ - BIND_HOST=0.0.0.0
118
121
  - RUN_MIGRATION=true
119
122
  - RUN_APP=true
120
123
  - PORT=<%= app[:port] %>
@@ -198,6 +201,7 @@ services:
198
201
  <% end %>
199
202
  env_file: services/<%= app[:name] %>.env
200
203
  environment:
204
+ - BIND_HOST=0.0.0.0
201
205
  - SECURE_COOKIE_OFF=true
202
206
  - RUN_APP=true
203
207
  - DISABLE_INTERNAL_HTTPS=true
@@ -256,6 +260,7 @@ services:
256
260
  - "$WORKSPACE/pay-<%= app[:name] %>:/app"
257
261
  <% end %>
258
262
  environment:
263
+ - BIND_HOST=0.0.0.0
259
264
  - SECURE_COOKIE_OFF=true
260
265
  - RUN_APP=true
261
266
  - DISABLE_APPMETRICS=true
@@ -306,6 +311,7 @@ services:
306
311
  <%= app[:name] %>:
307
312
  image: governmentdigitalservice/pay-docker-nginx-proxy:latest-master
308
313
  environment:
314
+ - BIND_HOST=0.0.0.0
309
315
  - PROXY_SERVICE_HOST=http://<%= app[:proxy_host] %>
310
316
  - PROXY_SERVICE_PORT=<%= app[:proxy_port] %>
311
317
  - HTTPS_LISTEN_PORT=<%= app[:port] %>
@@ -89,7 +89,6 @@ class PayCLI::Commands::Local < Thor
89
89
  threads = []
90
90
  (@local_java_apps + @local_node_apps).each do |app|
91
91
  check_for_local_repo("pay-#{app[:name]}")
92
- check_cardid_data if app[:name] == 'cardid'
93
92
 
94
93
  threads << Thread.new do
95
94
  ws_dir = Pathname.new(ENV['WORKSPACE']).join("pay-#{app[:name]}")
@@ -406,16 +405,6 @@ class PayCLI::Commands::Local < Thor
406
405
  end
407
406
  end
408
407
 
409
- def check_cardid_data
410
- cardid_path = File.join(ENV['WORKSPACE'], 'pay-cardid')
411
-
412
- unless Dir.exist?(File.join(cardid_path, 'data', 'sources'))
413
- abort '❌ pay-cardid does not have the cardid-data submodule updated. '\
414
- 'Run `git submodule update --init && git -C data pull origin master` in '\
415
- "#{cardid_path} to init and update the cardid-data submodule"
416
- end
417
- end
418
-
419
408
  def npm_install(repo_name)
420
409
  repo_path = File.join(ENV['WORKSPACE'], repo_name)
421
410
  `cd #{repo_path} && npm install >>/dev/null 2>&1`
@@ -10,6 +10,7 @@ const legacy_1 = __importDefault(require("../commands/legacy"));
10
10
  const help_1 = __importDefault(require("../commands/help"));
11
11
  const tunnel_js_1 = __importDefault(require("../commands/tunnel.js"));
12
12
  const package_json_1 = __importDefault(require("../../package.json"));
13
+ const semver_1 = __importDefault(require("semver"));
13
14
  const handlers = new Map();
14
15
  handlers.set('browse', {
15
16
  handler: browse_js_1.default
@@ -87,7 +88,10 @@ async function runHandler(commandName, commandHandler) {
87
88
  }
88
89
  async function checkVersion() {
89
90
  try {
90
- const { version: currentVersion } = package_json_1.default;
91
+ const { version: currentVersion, engines: { node: requiredNodeVersion } } = package_json_1.default;
92
+ if (!semver_1.default.satisfies(process.version, requiredNodeVersion)) {
93
+ console.log(`Required Node.js version is ${requiredNodeVersion}, you are running ${process.version}. Please upgrade before continuing.`);
94
+ }
91
95
  const { version: remoteVersion } = await fetch('https://registry.npmjs.org/@govuk-pay/cli/latest')
92
96
  .then(async (r) => await r.json());
93
97
  if (currentVersion !== remoteVersion) {