@holistics/cli-core 0.4.1 → 0.5.0

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
@@ -8,3 +8,86 @@ The CLI core is using our private packages (such as aml, aml-std, etc...), so to
8
8
  1. We use `bun` to build all the dependencies into a single giant `commands.js` file.
9
9
  2. Publish this file to public npm registry (https://www.npmjs.com/package/@holistics/cli-core)
10
10
  3. The CLI app **directly download and use** the `commands.js` file from the npm registry. Note that it **won't** go through the normal package installation process e.g. `npm install` because it will fail since it cannot access private packages referenced by '@holistics/cli-core'
11
+
12
+ ## Publishing for cli-core
13
+
14
+ Currently, for other packages, we publish to our private Github registry
15
+ We need to change the publish flow to publish to the public npm registry instead.
16
+
17
+ We also want to support `npm install` normally for this cli-core package
18
+
19
+ This is the current package.json on npmjs.com:
20
+ ```
21
+ {
22
+ "name": "@holistics/cli-core",
23
+ "type": "module",
24
+ "version": "0.2.9",
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "main": "src/commands.js",
29
+ "module": "src/commands.mjs",
30
+ "types": "src/commands.d.ts",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/holistics/holistics-core.git",
34
+ "directory": "packages/cli-core"
35
+ },
36
+ "devDependencies": {
37
+ "tsx": "^4.19.3",
38
+ "typescript": "^5.6.2",
39
+ "@types/js-yaml": "^4.0.5",
40
+ "vitest": "^2.1.9",
41
+ "@holistics/configs": "0.2.3"
42
+ },
43
+ "dependencies": {
44
+ "@commander-js/extra-typings": "^13.1.0",
45
+ "@holistics/aml": "4.0.4",
46
+ "@holistics/aml-std": "2.58.0",
47
+ "axios": "^1.7.7",
48
+ "commander": "13.1.0",
49
+ "fast-glob": "^3.3.3",
50
+ "form-data": "^4.0.2",
51
+ "glob": "^11.0.1",
52
+ "js-yaml": "^4.1.0"
53
+ },
54
+ "scripts": {
55
+ "dev": "tsx src/cli.ts",
56
+ "build": "bun build src/commands.ts --outdir dist --target node --minify"
57
+ }
58
+ }
59
+ ```
60
+
61
+ One idea is to modify the `package.json` (in dist/, after bun build and before publishing to npm) to remove any @holistics packages
62
+ Ok, I think we can remove all the dependencies since everything is already bundled into the `commands.js` file.
63
+
64
+ Brief about our Circle CI flow (ci_config.template.yml)
65
+ - Our CI step uses 2 workflows: build (test) and publish
66
+ - Build workflow is handled by turbo_orb.yml.
67
+ - Publish workflow is handled by pnpm_orb.yml. For cli-core, the publish step will publish to npmjs.com
68
+ - npmjs.com requires a token set at `~/.npmrc` to publish
69
+
70
+
71
+ Design the CI flow:
72
+ - currently: generate_js_jobs.rb -> publish_js_packages (with proper flags) -> [pnpm_install, turbo_build, pnpm_publish]. This is for our internal private packages
73
+ Also, each of our package has a `.holistics_ci.yml` at the root of the package to customize the CI flow.
74
+ - for cli-core, there are 2 main differences: build via bun, and publish to npmjs.com
75
+ - Option 1: generate .npmrc inside the cli-core package to store the npmjs token, and hope that `pnpm publish` will use it and skip the root Github token.
76
+ Pros: reuse the current publish flow
77
+ Cons: it's very unclear about the places that the publish flow happens, can mistakenly publish internal packages to npmjs.com
78
+ - Option 2: create another job publish_js_packages_to_npmjs.com. Try to use whitelist to include packages that are allowed to publish to npmjs.com to avoid mistakenly publishing internal packages to npmjs.com
79
+ - generate_js_jobs.rb -> [publish_js_packages_to_npmjs.com, publish_js_packages] depending on the holistics_ci.yml. If it contains `publish_to_npmjs: true`, then use publish_js_packages_to_npmjs.com, otherwise use publish_js_packages
80
+
81
+
82
+ ## Context for Claude
83
+ You only need to care about these folders:
84
+ - .circleci/
85
+ - packages/* (include packages/cli-core)
86
+
87
+ The rest of the folders are not relevant to this task.
88
+
89
+ The CircleCI flow is using dynamic job: the ci_config.template.yml predefine the jobs and the commands, then the generate_config.rb -> generate_js_jobs.rb generates the actual running jobs on CircleCI.
90
+
91
+ ## Tasks
92
+ - Implement the new publish to npmjs.com flow in the ci_config.template.yml
93
+ - The special build for cli-core is already handled inside that package, here we can only call the build command like the publish_js_packages job