@agilecustoms/envctl 0.1.3 → 0.2.1

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/Makefile CHANGED
@@ -19,10 +19,3 @@ app2-test:
19
19
 
20
20
  app3-build:
21
21
  @npm run build
22
-
23
- # npm cache clean --force
24
- # cd ~/.npm; open .
25
- app4-dry-run:
26
- @set -e; \
27
- echo "cd in other directory, otherwise npx picks up local package :("; cd ..; \
28
- npx -y --force @agilecustoms/envctl --version
package/README.md CHANGED
@@ -2,12 +2,12 @@
2
2
  - npm [@agilecustoms/envctl](https://www.npmjs.com/package/@agilecustoms/envctl)
3
3
  - npm [agilecustoms/packages](https://www.npmjs.com/settings/agilecustoms/packages) (admin view)
4
4
 
5
- ## setup
5
+ ## setup/update
6
6
  ```shell
7
- npm install -g @agilecustoms/envctl
8
- npm outdated
9
- npm update
7
+ npm install -g @agilecustoms/envctl # same command for update
10
8
  envctl --version
9
+ npm outdated -g
10
+ npm view @agilecustoms/envctl version # show latest version available (without installing)
11
11
  ```
12
12
 
13
13
  ## npmjs setup
@@ -23,6 +23,7 @@ envctl --version
23
23
  1. Name `NPMJS_TOKEN`
24
24
  2. Repository access: `envctl` only
25
25
 
26
+ ## History/motivation
26
27
  dev-env is a microservice hosted in 'maintenance' account and working as garbage collector: every environment first
27
28
  created in dev-env and then 'managed' by dev-env: it deletes env when it is not in use anymore OR can extend lifetime.
28
29
  Creation API yields unique ID, so you can safely manage env (delete, extend lifetime) via this ID. But creation API
@@ -40,4 +41,7 @@ Now problem is: any request needs to be signed with AWS signature v4. Originally
40
41
  quickly became bulky and hard to maintain. Then I thought about Node.js - it is available on dev machines and
41
42
  in GitHub actions (namely in Ubuntu runners). How to distribute it? First I thought about using `ncc` to bundle in one
42
43
  big .js file (as I do for `gha-upload-3` and `gha-healthcheck`) but it will be hard to use on dev machine...
43
- So I ended up with publishing this client as npm package in CodeArtifact and then running from anywhere with `npx`!
44
+
45
+ So I ended up with publishing this client as npm package in npmjs
46
+ - CI environments can install & run it with one command via `npx`
47
+ - developer will install it globally via `npm install -g @agilecustoms/envctl`
package/dist/index.js CHANGED
@@ -1,14 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module';
3
3
  import { Command } from 'commander';
4
+ import updateNotifier from 'update-notifier';
4
5
  import { deleteIt, ephemeral, register } from './commands/index.js';
5
6
  const require = createRequire(import.meta.url);
6
- const { version } = require('../package.json');
7
+ const pkg = require('../package.json');
8
+ updateNotifier({ pkg }).notify();
7
9
  const program = new Command();
8
10
  program
9
11
  .name('envctl')
10
12
  .description('CLI to manage environments')
11
- .version(version);
13
+ .version(pkg.version);
12
14
  register(program);
13
15
  ephemeral(program);
14
16
  deleteIt(program);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilecustoms/envctl",
3
3
  "description": "node.js CLI client for manage environments",
4
- "version": "0.1.3",
4
+ "version": "0.2.1",
5
5
  "author": "Alex Chekulaev",
6
6
  "type": "module",
7
7
  "bin": {
@@ -29,12 +29,14 @@
29
29
  "@aws-sdk/client-sts": "^3.716.0",
30
30
  "@aws-sdk/credential-providers": "^3.716.0",
31
31
  "aws4": "^1.13.2",
32
- "commander": "^13.0.0"
32
+ "commander": "^13.0.0",
33
+ "update-notifier": "^7.3.1"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@stylistic/eslint-plugin": "^4.2.0",
36
37
  "@types/aws4": "^1.11.6",
37
38
  "@types/node": "^22.10.2",
39
+ "@types/update-notifier": "^6.0.8",
38
40
  "@vitest/coverage-v8": "^3.0.2",
39
41
  "eslint": "^9.22.0",
40
42
  "eslint-plugin-import": "^2.31.0",
package/src/index.ts CHANGED
@@ -1,17 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'module'
3
3
  import { Command } from 'commander'
4
+ import updateNotifier from 'update-notifier'
4
5
  import { deleteIt, ephemeral, register } from './commands/index.js'
5
6
 
6
7
  // it is possible to use 'import' to load JSON files, but package.json is level higher, so such trick copies 'src' in /dist :(
7
8
  const require = createRequire(import.meta.url) // custom 'require' relative to current module’s file URL
8
- const { version } = require('../package.json')
9
+ const pkg = require('../package.json')
10
+
11
+ // Check for updates
12
+ updateNotifier({ pkg }).notify()
9
13
 
10
14
  const program = new Command()
11
15
  program
12
16
  .name('envctl') // shown when running --help: Usage: envctl [options] [command]
13
17
  .description('CLI to manage environments')
14
- .version(version)
18
+ .version(pkg.version)
15
19
  register(program)
16
20
  ephemeral(program)
17
21
  deleteIt(program)