@appshell/config 1.0.0-alpha.8 → 1.0.0-alpha.80

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.
Files changed (66) hide show
  1. package/README.md +28 -9
  2. package/dist/main.js +9 -9
  3. package/dist/types/axios.d.ts +0 -1
  4. package/dist/types/configmap.d.ts +0 -1
  5. package/dist/types/context.d.ts +3 -4
  6. package/dist/types/credentials.d.ts +0 -2
  7. package/dist/types/generate.manifest.d.ts +30 -2
  8. package/dist/types/index.d.ts +7 -10
  9. package/dist/types/loader.d.ts +18 -0
  10. package/dist/types/mappers/appshell.config.d.ts +9 -3
  11. package/dist/types/mappers/index.d.ts +0 -1
  12. package/dist/types/outdated.d.ts +0 -1
  13. package/dist/types/publish.d.ts +79 -5
  14. package/dist/types/sync.d.ts +0 -1
  15. package/dist/types/tls.d.ts +23 -0
  16. package/dist/types/types.d.ts +164 -30
  17. package/dist/types/utils/blur.d.ts +0 -1
  18. package/dist/types/utils/compare.d.ts +0 -1
  19. package/dist/types/utils/config.d.ts +0 -1
  20. package/dist/types/utils/copy.d.ts +0 -1
  21. package/dist/types/utils/dump.d.ts +10 -0
  22. package/dist/types/utils/index.d.ts +1 -4
  23. package/dist/types/utils/list.d.ts +0 -1
  24. package/dist/types/utils/load.d.ts +0 -1
  25. package/dist/types/validators/AppshellTemplateValidator.d.ts +0 -1
  26. package/dist/types/validators/index.d.ts +0 -3
  27. package/package.json +12 -4
  28. package/dist/types/axios.d.ts.map +0 -1
  29. package/dist/types/configmap.d.ts.map +0 -1
  30. package/dist/types/context.d.ts.map +0 -1
  31. package/dist/types/credentials.d.ts.map +0 -1
  32. package/dist/types/deregister.d.ts +0 -3
  33. package/dist/types/deregister.d.ts.map +0 -1
  34. package/dist/types/generate.env.d.ts +0 -3
  35. package/dist/types/generate.env.d.ts.map +0 -1
  36. package/dist/types/generate.global-config.d.ts +0 -10
  37. package/dist/types/generate.global-config.d.ts.map +0 -1
  38. package/dist/types/generate.manifest.d.ts.map +0 -1
  39. package/dist/types/index.d.ts.map +0 -1
  40. package/dist/types/mappers/appshell.config.d.ts.map +0 -1
  41. package/dist/types/mappers/index.d.ts.map +0 -1
  42. package/dist/types/outdated.d.ts.map +0 -1
  43. package/dist/types/publish.d.ts.map +0 -1
  44. package/dist/types/register.d.ts +0 -4
  45. package/dist/types/register.d.ts.map +0 -1
  46. package/dist/types/sync.d.ts.map +0 -1
  47. package/dist/types/types.d.ts.map +0 -1
  48. package/dist/types/utils/blur.d.ts.map +0 -1
  49. package/dist/types/utils/compare.d.ts.map +0 -1
  50. package/dist/types/utils/config.d.ts.map +0 -1
  51. package/dist/types/utils/copy.d.ts.map +0 -1
  52. package/dist/types/utils/index.d.ts.map +0 -1
  53. package/dist/types/utils/isValidUrl.d.ts +0 -3
  54. package/dist/types/utils/isValidUrl.d.ts.map +0 -1
  55. package/dist/types/utils/list.d.ts.map +0 -1
  56. package/dist/types/utils/load.d.ts.map +0 -1
  57. package/dist/types/utils/loadJson.d.ts +0 -10
  58. package/dist/types/utils/loadJson.d.ts.map +0 -1
  59. package/dist/types/utils/merge.d.ts +0 -4
  60. package/dist/types/utils/merge.d.ts.map +0 -1
  61. package/dist/types/validators/AppshellGlobalConfigValidator.d.ts +0 -4
  62. package/dist/types/validators/AppshellGlobalConfigValidator.d.ts.map +0 -1
  63. package/dist/types/validators/AppshellManifestValidator.d.ts +0 -4
  64. package/dist/types/validators/AppshellManifestValidator.d.ts.map +0 -1
  65. package/dist/types/validators/AppshellTemplateValidator.d.ts.map +0 -1
  66. package/dist/types/validators/index.d.ts.map +0 -1
package/README.md CHANGED
@@ -39,21 +39,39 @@ pnpm add -D @appshell/config
39
39
 
40
40
  ## Functions
41
41
 
42
+ `@appshell/config` is the library the CLI is built on. Most of it is reachable through
43
+ `appshell` commands; reach for the package directly when you are scripting a build.
44
+
45
+ | Export | Purpose | CLI equivalent |
46
+ | ------ | ------- | -------------- |
47
+ | `generateManifest` | Template → manifest, expanding `${VAR}` | `appshell generate manifest` |
48
+ | `publish` | Publish a manifest as a package version | `appshell publish` |
49
+ | `activate` | Activate a version into an application | `appshell publish --application` |
50
+ | `outdated` | Compare shared dependencies against baselines | `appshell outdated` |
51
+ | `sync` | Install shared dependencies at the declared versions | — |
52
+ | `resolveContext` / `persistedContext` | Registry, application and token, resolved as the CLI resolves them | `appshell config list` |
53
+ | `resolveToken` / `saveCredential` / `clearCredential` / `credentialsPath` | Stored credentials, per registry | `appshell login` / `logout` |
54
+ | `configmap` | `${VAR}` placeholder expansion | — |
55
+ | `utils` | File loading, comparison and formatting helpers | — |
56
+ | `validators` | `AppshellTemplateValidator` | — |
57
+
58
+
42
59
  ### `generateManifest`
43
60
 
44
- The `generateManifest` function is given a configs dir to process and produces a merged appshell manifest.
61
+ Processes one manifest template into an appshell manifest, expanding `${VAR}`
62
+ placeholders from the current environment.
45
63
 
46
64
  ```ts
47
65
  import { generateManifest } from '@appshell/config';
48
66
 
49
- const manifest = generateManifest<MyMetadata>(process.env.CONFIGS_DIR);
67
+ const manifest = await generateManifest<MyMetadata>('dist/appshell.template.json');
50
68
  ```
51
69
 
52
- **Where does the content of CONFIGS_DIR come from?**
70
+ **Where does the template come from?**
53
71
 
54
- > Each micro-frontend configured to use [@appshell/webpack-plugin](https://www.npmjs.com/package/@appshell/webpack-plugin) emits it's configuration to the configs directory at build time, which is subsequently processed with this utility to reflect the current runtime environment.
72
+ > Each micro-frontend configured with [@appshell/webpack-plugin](https://www.npmjs.com/package/@appshell/webpack-plugin) emits `appshell.template.json` at build time. This function turns that into the manifest a package version is published with.
55
73
 
56
- Sample content from CONFIGS_DIR:
74
+ Sample template:
57
75
 
58
76
  ```json
59
77
  {
@@ -87,7 +105,7 @@ Sample content from CONFIGS_DIR:
87
105
  }
88
106
  }
89
107
  },
90
- "environment": {
108
+ "vars": {
91
109
  "RUNTIME_ARG_1": "${RUNTIME_ARG_1}",
92
110
  "RUNTIME_ARG_2": "${RUNTIME_ARG_2}"
93
111
  }
@@ -98,7 +116,7 @@ Sample content from CONFIGS_DIR:
98
116
 
99
117
  > Note the variable expansion syntax `${CRA_MFE_URL}`. When `generateManifest` is called the actual runtime environment values are injected and an appshell manifest is emitted.
100
118
 
101
- > **Note** the `environment` section defines runtime environment variables that are injected into the global namesapce `window.__appshell_env__[module_name]` when an Appshell component is loaded. See the examples for a use case.
119
+ > **Note** the `vars` section defines runtime configuration values a package reads with `getVars()` from [`@appshell/runtime/vars`](../runtime/README.md) once it is loaded. The package must share `@appshell/runtime` as a singleton to receive them. See the examples for a use case.
102
120
 
103
121
  Sample appshell manifest produced by the `generateManifest` function:
104
122
 
@@ -181,7 +199,7 @@ Sample appshell manifest produced by the `generateManifest` function:
181
199
  }
182
200
  }
183
201
  },
184
- "environment": {
202
+ "vars": {
185
203
  "CraModule": {
186
204
  "RUNTIME_ARG_1": "Foo",
187
205
  "RUNTIME_ARG_2": "Biz"
@@ -193,7 +211,8 @@ Sample appshell manifest produced by the `generateManifest` function:
193
211
  }
194
212
  ```
195
213
 
196
- This `appshell manifest` is registered with `APPSHELL_REGISTRY` consumed by the appshell host.
214
+ This manifest is what `publish` sends to the registry as a package version. The registry composes
215
+ every activated package into the payload it serves to the shell.
197
216
 
198
217
  **What if I want to generate the manifest by a startup script instead?**
199
218