@equinor/fusion-framework-cli 11.0.0-next.0 → 11.0.0-next.3
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/CHANGELOG.md +28 -0
- package/bin/build/bin.js +21 -0
- package/bin/build/cli.js +9868 -0
- package/bin/build/create-auth-client-7P8K_6Vu.js +89 -0
- package/bin/build/portal-pack-tYUpOtku.js +12073 -0
- package/dist/esm/bin/utils/create-dev-server.js +3 -1
- package/dist/esm/bin/utils/create-dev-server.js.map +1 -1
- package/dist/esm/lib/app/create-app-manifest.js +2 -0
- package/dist/esm/lib/app/create-app-manifest.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bin/portal-build.d.ts +1 -1
- package/dist/types/bin/portal-manifest.d.ts +1 -1
- package/dist/types/bin/portal-pack.d.ts +1 -1
- package/dist/types/lib/portal/portal-manifest.schema.d.ts +6 -6
- package/dist/types/version.d.ts +1 -1
- package/docs/application.md +644 -0
- package/docs/auth.md +190 -0
- package/docs/libsecret.md +97 -0
- package/docs/migration-v10-to-v11.md +74 -0
- package/docs/portal.md +278 -0
- package/package.json +19 -7
package/docs/auth.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Fusion Framework CLI - Authorization
|
|
3
|
+
description: >
|
|
4
|
+
Comprehensive guide to authentication and authorization in the Fusion Framework CLI, covering Azure AD, MSAL, local development, CI/CD, service principals, and best practices for secure automation and integration.
|
|
5
|
+
category: cli
|
|
6
|
+
related:
|
|
7
|
+
- '@equinor/fusion-framework-module-msal-node/README.md'
|
|
8
|
+
tags:
|
|
9
|
+
- cli
|
|
10
|
+
- fusion-framework
|
|
11
|
+
- msal
|
|
12
|
+
- azure
|
|
13
|
+
- azure-ad
|
|
14
|
+
- authentication
|
|
15
|
+
- authorization
|
|
16
|
+
- service-principal
|
|
17
|
+
- github-actions
|
|
18
|
+
- ci
|
|
19
|
+
- cd
|
|
20
|
+
- devops
|
|
21
|
+
- security
|
|
22
|
+
keywords:
|
|
23
|
+
- azure ad
|
|
24
|
+
- msal
|
|
25
|
+
- access token
|
|
26
|
+
- authentication flow
|
|
27
|
+
- interactive login
|
|
28
|
+
- silent authentication
|
|
29
|
+
- token caching
|
|
30
|
+
- secure storage
|
|
31
|
+
- app registration
|
|
32
|
+
- tenant id
|
|
33
|
+
- client id
|
|
34
|
+
- scopes
|
|
35
|
+
- api permissions
|
|
36
|
+
- oidc
|
|
37
|
+
- sso
|
|
38
|
+
- cloud identity
|
|
39
|
+
- developer experience
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
# Authentication with Fusion Framework CLI
|
|
43
|
+
|
|
44
|
+
The Fusion Framework CLI provides secure, robust authentication for both automation and interactive development scenarios by leveraging Microsoft's MSAL (Microsoft Authentication Library) and Azure Active Directory (Azure AD). Authentication is handled through the Fusion Framework for Node.js, using the `@equinor/fusion-framework-module-msal-node` package, which is built on top of Microsoft's official `msal-node` library. This ensures standards-compliant, up-to-date authentication flows and seamless integration across Fusion Framework applications and tools.
|
|
45
|
+
|
|
46
|
+
Key features include:
|
|
47
|
+
- **Multiple authentication modes:**
|
|
48
|
+
- `token_only`: Use a pre-provided token (e.g., for CI/CD and automation).
|
|
49
|
+
- `silent`: Acquire tokens silently using cached or refresh tokens (background services, scripts).
|
|
50
|
+
- `interactive`: Prompt for authentication via a local HTTP server (CLI tools, development).
|
|
51
|
+
- **Secure token storage:** Tokens are encrypted at rest using platform-specific mechanisms (e.g., Secure Enclave on macOS, DPAPI on Windows).
|
|
52
|
+
- **Consistent experience:** The same authentication logic and token handling is used across CLI and app environments.
|
|
53
|
+
|
|
54
|
+
## Azure AD Concepts: Tenant, Client App, and Scopes
|
|
55
|
+
|
|
56
|
+
When configuring authentication for the Fusion Framework CLI, you will encounter several Azure Active Directory (Azure AD) concepts:
|
|
57
|
+
|
|
58
|
+
### Tenant
|
|
59
|
+
- The **tenant** is your organization's Azure AD directory. It is identified by a unique tenant ID (a GUID) or a domain name (e.g., `contoso.onmicrosoft.com`).
|
|
60
|
+
- The tenant controls user identities, app registrations, and access policies.
|
|
61
|
+
- **For most use cases, you do not need to specify the tenant—by default, the CLI uses the Equinor tenant.**
|
|
62
|
+
|
|
63
|
+
### Client App (Application Registration)
|
|
64
|
+
- The **client app** refers to an application registered in your Azure AD tenant. This registration provides a unique **client ID** used to identify your app when requesting tokens.
|
|
65
|
+
- **The Fusion Framework CLI uses the default Fusion CLI app registration for authentication, so you do not need to provide a client ID.**
|
|
66
|
+
- The client app registration defines what permissions (scopes) your app can request and how it can authenticate (e.g., client credentials, interactive login).
|
|
67
|
+
|
|
68
|
+
### Scopes
|
|
69
|
+
- **Scopes** define the permissions your app is requesting when acquiring an access token. Scopes are typically in the form of URLs (e.g., `https://my-service.com/.default` or a custom API scope).
|
|
70
|
+
- The scopes you request must be granted to your client app registration in Azure AD.
|
|
71
|
+
- When using the CLI or configuring CI/CD, you should provide the scopes required for your target environment or API.
|
|
72
|
+
|
|
73
|
+
> [!TIP]
|
|
74
|
+
> For most development and deployment scenarios, the CLI provides sensible defaults for tenant and client app. You only need to specify the scopes required for your specific target environment or API.
|
|
75
|
+
|
|
76
|
+
## Local Development
|
|
77
|
+
|
|
78
|
+
### Logging in with the CLI
|
|
79
|
+
|
|
80
|
+
For local development, you should authenticate interactively using the CLI's built-in login command. This uses the `interactive` authentication mode, which will prompt you to sign in via your browser and securely store your credentials for future CLI commands.
|
|
81
|
+
|
|
82
|
+
To log in, run:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
fusion-framework-cli auth login
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- This will open a browser window for you to complete the Azure AD sign-in process.
|
|
89
|
+
- After successful login, your credentials are securely cached using platform-specific secure storage (e.g., Secure Enclave on macOS, DPAPI on Windows).
|
|
90
|
+
- You only need to log in once per session or until your token expires.
|
|
91
|
+
|
|
92
|
+
If you ever need to clear your cached credentials, you can run:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
fusion-framework-cli auth logout
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This will remove your stored tokens and require you to log in again for future CLI operations.
|
|
99
|
+
|
|
100
|
+
### Authentication Options in Development
|
|
101
|
+
|
|
102
|
+
The CLI provides several authentication-related options for advanced scenarios or custom environments:
|
|
103
|
+
|
|
104
|
+
- **--tenantId**: The Azure Active Directory tenant ID. You can override the default using this option or the `FUSION_TENANT_ID` environment variable. For most users, this is not required.
|
|
105
|
+
- **--clientId**: The client ID of the application registered in Azure AD. You can override the default using this option or the `FUSION_CLIENT_ID` environment variable. For most users, this is not required.
|
|
106
|
+
- **--token**: The Azure AD access token. If provided (or set via `FUSION_TOKEN`), tenant and client options are ignored for that command. This is useful for advanced automation or CI/CD scenarios.
|
|
107
|
+
- **--scope**: One or more Azure audience scopes, usually the application ID URI of the API you want to access, followed by `.default`. You can override the default using this option or the `FUSION_AUTH_SCOPE` environment variable. This is the most common option to change for custom API access.
|
|
108
|
+
|
|
109
|
+
**How these options work:**
|
|
110
|
+
- If you provide a token, tenant and client options are ignored for that command.
|
|
111
|
+
- Tenant and client IDs must be valid UUIDs if specified.
|
|
112
|
+
- Scopes must be non-empty strings.
|
|
113
|
+
|
|
114
|
+
These options allow you to use the CLI with custom tenants, client apps, or tokens if needed, but for most development scenarios, the built-in defaults are sufficient and only the `--scope` option is commonly changed. This flexibility supports both simple and advanced authentication needs, making it easy to get started while enabling custom setups for more complex environments.
|
|
115
|
+
|
|
116
|
+
## CI/CD
|
|
117
|
+
|
|
118
|
+
### Setting the Fusion Token in GitHub
|
|
119
|
+
|
|
120
|
+
To publish or deploy your Fusion Framework app, you need to authenticate and set the `FUSION_TOKEN` environment variable. This token is required for secure access to Fusion APIs during CI/CD workflows.
|
|
121
|
+
|
|
122
|
+
You can obtain and set the `FUSION_TOKEN` using the Azure CLI as part of your pipeline steps. For example:
|
|
123
|
+
|
|
124
|
+
This ensures the `FUSION_TOKEN` is available as an environment variable for subsequent steps, such as publishing source code or config.
|
|
125
|
+
|
|
126
|
+
```yml
|
|
127
|
+
# This GitHub Action authenticates with Azure and retrieves an access token for use as FUSION_TOKEN.
|
|
128
|
+
#
|
|
129
|
+
# - The Azure Login step uses the azure/login action to authenticate with Azure using the provided client and tenant IDs.
|
|
130
|
+
# - The Get Access Token step runs the Azure CLI to acquire an access token for the specified scope, then sets it as the FUSION_TOKEN environment variable for subsequent steps.
|
|
131
|
+
#
|
|
132
|
+
# This makes the token available for publishing, deploying, or running Fusion CLI commands that require authentication.
|
|
133
|
+
#
|
|
134
|
+
# Example usage in a workflow:
|
|
135
|
+
#
|
|
136
|
+
# steps:
|
|
137
|
+
# - name: Acquire Fusion Token
|
|
138
|
+
# uses: ./.github/actions/fusion-token
|
|
139
|
+
# - name: Fusion CLI command
|
|
140
|
+
# run: fusion-framework-cli app check
|
|
141
|
+
#
|
|
142
|
+
# ---
|
|
143
|
+
# How to set up a Service Principal in Azure for CI/CD:
|
|
144
|
+
#
|
|
145
|
+
# 1. Sign in to Azure CLI:
|
|
146
|
+
# az login
|
|
147
|
+
# 2. Create a new service principal (replace <NAME> and <SCOPE> as needed):
|
|
148
|
+
# az ad sp create-for-rbac --name <NAME> --role contributor --scopes <SCOPE>
|
|
149
|
+
# - This will output appId (client-id), password (client-secret), and tenant.
|
|
150
|
+
# 3. Grant the service principal API permissions if needed (e.g., to call Fusion APIs):
|
|
151
|
+
# - In Azure Portal, go to Azure Active Directory > App registrations > [Your App] > API permissions.
|
|
152
|
+
# - Add the required API permissions and grant admin consent.
|
|
153
|
+
# 4. Store the client-id, client-secret, and tenant-id as GitHub Action secrets.
|
|
154
|
+
# 5. Use these secrets in your workflow as shown below.
|
|
155
|
+
# 6. (Optional) For more on setting up environment variables in GitHub Actions workflows, see:
|
|
156
|
+
# https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
|
|
157
|
+
#
|
|
158
|
+
# For more details, see:
|
|
159
|
+
# https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal
|
|
160
|
+
# https://learn.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli
|
|
161
|
+
#
|
|
162
|
+
name: Azure Login and Get Access Token
|
|
163
|
+
description: Authenticates with Azure and retrieves an access token
|
|
164
|
+
inputs:
|
|
165
|
+
client-id:
|
|
166
|
+
description: >
|
|
167
|
+
The Azure AD Application (client) ID to use for authentication. This should correspond to an app registration with permissions to request the required scopes.
|
|
168
|
+
required: true
|
|
169
|
+
tenant-id:
|
|
170
|
+
description: >
|
|
171
|
+
The Azure AD Tenant ID (directory) to authenticate against. This identifies the Azure AD instance where the app is registered.
|
|
172
|
+
required: true
|
|
173
|
+
scope:
|
|
174
|
+
description: >
|
|
175
|
+
The scope(s) for the access token, typically the Application ID URI of the API you want to access, followed by /.default (e.g., https://my-api/.default). Multiple scopes can be space-separated.
|
|
176
|
+
required: true
|
|
177
|
+
runs:
|
|
178
|
+
using: composite
|
|
179
|
+
steps:
|
|
180
|
+
- name: Azure Login
|
|
181
|
+
uses: azure/login@v2
|
|
182
|
+
with:
|
|
183
|
+
client-id: ${{ inputs.client-id }}
|
|
184
|
+
tenant-id: ${{ inputs.tenant-id }}
|
|
185
|
+
allow-no-subscriptions: true
|
|
186
|
+
- name: Get Access Token
|
|
187
|
+
shell: bash
|
|
188
|
+
run: |
|
|
189
|
+
echo "FUSION_TOKEN=$(az account get-access-token --scope ${{ inputs.scope }} --query accessToken --output tsv)" >> $GITHUB_ENV
|
|
190
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Enabling Secure Credential Storage with libsecret
|
|
3
|
+
description: Instructions for installing libsecret on Linux to enable secure credential storage for your CLI.
|
|
4
|
+
tags:
|
|
5
|
+
- cli
|
|
6
|
+
- authentication
|
|
7
|
+
- keytar
|
|
8
|
+
- libsecret
|
|
9
|
+
- linux
|
|
10
|
+
- security
|
|
11
|
+
- credentials
|
|
12
|
+
- msal
|
|
13
|
+
- nodejs
|
|
14
|
+
- keychain
|
|
15
|
+
keywords:
|
|
16
|
+
- secure credential storage
|
|
17
|
+
- keychain
|
|
18
|
+
- linux
|
|
19
|
+
- node.js
|
|
20
|
+
- password manager
|
|
21
|
+
- system keyring
|
|
22
|
+
- msal-node
|
|
23
|
+
- credential storage
|
|
24
|
+
- cross-platform
|
|
25
|
+
- token caching
|
|
26
|
+
- npm
|
|
27
|
+
- secrets
|
|
28
|
+
- cli authentication
|
|
29
|
+
- keytar troubleshooting
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
This CLI enables secure authentication and persistent token caching by storing credentials in your system's keychain. It uses [`@azure/msal-node`](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node) for authentication, which relies on the [`keytar`](https://github.com/atom/node-keytar) module for secure credential storage.
|
|
33
|
+
|
|
34
|
+
> **What is `libsecret`?**
|
|
35
|
+
> [`libsecret`](https://wiki.gnome.org/Projects/Libsecret) is a library for storing and retrieving passwords and secrets. On Linux, `keytar` depends on `libsecret` to access the system keyring.
|
|
36
|
+
|
|
37
|
+
## Platform Requirements
|
|
38
|
+
|
|
39
|
+
- **Windows:** No additional dependencies. `keytar` uses the Windows Credential Manager.
|
|
40
|
+
- **macOS:** No additional dependencies. `keytar` uses the macOS Keychain. If you encounter unusual issues (rare), you can optionally try installing `libsecret`:
|
|
41
|
+
```bash
|
|
42
|
+
brew install libsecret
|
|
43
|
+
```
|
|
44
|
+
- **Linux:** You must install `libsecret` for secure credential storage. See below for instructions.
|
|
45
|
+
|
|
46
|
+
## Linux Installation
|
|
47
|
+
Install the `libsecret` library based on your distribution:
|
|
48
|
+
|
|
49
|
+
- **Ubuntu/Debian**:
|
|
50
|
+
```bash
|
|
51
|
+
sudo apt-get update
|
|
52
|
+
sudo apt-get install -y libsecret-1-0 libsecret-1-dev
|
|
53
|
+
```
|
|
54
|
+
> Both runtime and development packages are required for building native modules.
|
|
55
|
+
- **Fedora**:
|
|
56
|
+
```bash
|
|
57
|
+
sudo dnf install -y libsecret libsecret-devel
|
|
58
|
+
```
|
|
59
|
+
> Install both runtime and development packages if you plan to build native modules.
|
|
60
|
+
- **Arch Linux**:
|
|
61
|
+
```bash
|
|
62
|
+
sudo pacman -S --noconfirm libsecret
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Verifying Installation
|
|
66
|
+
After installing `libsecret`, rebuild `keytar` to ensure it links correctly:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm rebuild keytar
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
You can verify that `keytar` is working by running your CLI and checking for credential storage warnings. Alternatively, you can test with a simple script:
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
const keytar = require('keytar');
|
|
76
|
+
keytar.setPassword('test-service', 'test-account', 'test-password')
|
|
77
|
+
.then(() => keytar.getPassword('test-service', 'test-account'))
|
|
78
|
+
.then(console.log)
|
|
79
|
+
.catch(console.error);
|
|
80
|
+
```
|
|
81
|
+
If you see errors related to `keytar` or `libsecret`, see troubleshooting below.
|
|
82
|
+
|
|
83
|
+
## Troubleshooting
|
|
84
|
+
- **Missing `libsecret` errors:** Ensure you have installed both the runtime and development packages (e.g., `libsecret-1-0` and `libsecret-1-dev` on Ubuntu/Debian).
|
|
85
|
+
- **Rebuild keytar:**
|
|
86
|
+
```bash
|
|
87
|
+
npm rebuild keytar
|
|
88
|
+
```
|
|
89
|
+
- **Still having issues?**
|
|
90
|
+
- Ensure your system keyring (e.g., GNOME Keyring or KWallet) is running and unlocked. On some headless or minimal Linux environments, you may need to start or configure the keyring daemon manually.
|
|
91
|
+
- See the [`keytar` troubleshooting guide](https://github.com/atom/node-keytar#troubleshooting).
|
|
92
|
+
- Consult your distribution's documentation for keyring setup.
|
|
93
|
+
|
|
94
|
+
## Resources
|
|
95
|
+
- [`keytar` documentation](https://github.com/atom/node-keytar)
|
|
96
|
+
- [`libsecret` project page](https://wiki.gnome.org/Projects/Libsecret)
|
|
97
|
+
- [@azure/msal-node](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migration Guide: v10 to v11 CLI Command Changes
|
|
3
|
+
description: >
|
|
4
|
+
Comprehensive guide to migrating CLI commands from v10 to v11 of the Fusion Framework, including deprecated commands, new command names, authentication changes, and best practices for updating scripts and pipelines.
|
|
5
|
+
category: cli
|
|
6
|
+
related:
|
|
7
|
+
- ./auth.md
|
|
8
|
+
- ./application.md
|
|
9
|
+
tags:
|
|
10
|
+
- cli
|
|
11
|
+
- fusion-framework
|
|
12
|
+
- migration
|
|
13
|
+
- breaking-changes
|
|
14
|
+
- upgrade
|
|
15
|
+
keywords:
|
|
16
|
+
- fusion framework
|
|
17
|
+
- cli commands
|
|
18
|
+
- v10 to v11 migration
|
|
19
|
+
- deprecated commands
|
|
20
|
+
- authentication changes
|
|
21
|
+
- service discovery
|
|
22
|
+
- environment configuration
|
|
23
|
+
- upgrade guide
|
|
24
|
+
- best practices
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Migration Guide: v10 to v11 CLI Command Changes
|
|
28
|
+
|
|
29
|
+
With v11, we switched to using the Fusion Framework itself for CLI operations. This change was made to reduce maintenance and improve consistency by reusing the same framework modules (such as service-discovery, authentication, and HTTP) in both Node.js and browser environments. By leveraging the Fusion Framework directly, CLI features and integrations stay up-to-date and benefit from shared improvements across the ecosystem.
|
|
30
|
+
|
|
31
|
+
## Why This Matters
|
|
32
|
+
- **Unified experience:** The CLI now behaves more like Fusion apps, making it easier to reason about configuration, authentication, and service discovery.
|
|
33
|
+
- **Reduced duplication:** By reusing core modules, bug fixes and new features are shared between CLI and Framework code.
|
|
34
|
+
- **Performance:** The framework is now initialized only when needed (e.g., for HTTP calls or authentication), improving startup time and resource usage.
|
|
35
|
+
|
|
36
|
+
## Deprecated App Command Aliases
|
|
37
|
+
|
|
38
|
+
This guide covers command changes for the `fusion-framework-cli app` scope.
|
|
39
|
+
|
|
40
|
+
The following table lists the old commands and their new equivalents:
|
|
41
|
+
|
|
42
|
+
| Old Command | New Command |
|
|
43
|
+
| -------------- | ----------- |
|
|
44
|
+
| build-pack | pack |
|
|
45
|
+
| build-upload | upload |
|
|
46
|
+
| build-manifest | manifest |
|
|
47
|
+
| build-publish | publish |
|
|
48
|
+
|
|
49
|
+
When using a deprecated command, the CLI will display a warning message and guide you to use the new command. Deprecated options such as `--service` are no longer supported; use `--env` instead.
|
|
50
|
+
|
|
51
|
+
> [!WARNING]
|
|
52
|
+
> The deprecated commands will continue to work for now, but they are scheduled for removal in the next major release. Please migrate to the new commands as soon as possible.
|
|
53
|
+
|
|
54
|
+
### Additional Notes
|
|
55
|
+
- The deprecated `--service` option is no longer supported. Use `--env` for environment selection.
|
|
56
|
+
- Only the new command names will be supported in future versions. Update your CI/CD pipelines and documentation as soon as possible.
|
|
57
|
+
- The deprecated commands are maintained for backward compatibility during the transition to v11, but will be removed in the next major release. Please migrate to the new commands as soon as possible.
|
|
58
|
+
|
|
59
|
+
## Authentication Changes
|
|
60
|
+
- The `FUSION_TOKEN` environment variable should only be used for CI/CD and automated deployments.
|
|
61
|
+
- For local development, users should authenticate interactively by running:
|
|
62
|
+
```sh
|
|
63
|
+
fusion-framework-cli auth login
|
|
64
|
+
```
|
|
65
|
+
before executing any commands.
|
|
66
|
+
|
|
67
|
+
## What to Check When Migrating
|
|
68
|
+
- Update all scripts, documentation, and CI/CD pipelines to use the new command names.
|
|
69
|
+
- Remove any usage of the deprecated `--service` option and replace it with `--env`.
|
|
70
|
+
- Ensure your local development workflow uses `fusion-framework-cli auth login` for authentication.
|
|
71
|
+
- Review any custom integrations that may rely on CLI startup behavior, as initialization is now on-demand.
|
|
72
|
+
|
|
73
|
+
For more details, see the CLI release notes or run `pnpm fusion-framework-cli app --help`.
|
|
74
|
+
|
package/docs/portal.md
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Developing Portals with Fusion Framework CLI
|
|
3
|
+
description: >
|
|
4
|
+
Guide to building, configuring, and deploying portal templates using the Fusion Framework CLI. Includes setup, essential commands, configuration, troubleshooting, and best practices for portal development.
|
|
5
|
+
category: cli
|
|
6
|
+
related:
|
|
7
|
+
- ./auth.md
|
|
8
|
+
tags:
|
|
9
|
+
- portal-development
|
|
10
|
+
- configuration
|
|
11
|
+
- deployment
|
|
12
|
+
- commands
|
|
13
|
+
- troubleshooting
|
|
14
|
+
- best-practices
|
|
15
|
+
keywords:
|
|
16
|
+
- fusion-framework-cli portal
|
|
17
|
+
- fusion portal dev
|
|
18
|
+
- fusion portal build
|
|
19
|
+
- fusion portal pack
|
|
20
|
+
- fusion portal upload
|
|
21
|
+
- fusion portal tag
|
|
22
|
+
- fusion portal manifest
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# Fusion Framework CLI: Portal Template Development Guide
|
|
26
|
+
|
|
27
|
+
> **Table of Contents**
|
|
28
|
+
> - [Getting Started](#getting-started)
|
|
29
|
+
> - [Portal Manifest](#portal-manifest)
|
|
30
|
+
> - [Commands](#commands)
|
|
31
|
+
> - [Troubleshooting & FAQ](#troubleshooting--faq)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
The Fusion Framework CLI enables you to build, configure, and deploy **portal templates** for the Fusion ecosystem. These commands are specifically for creating, building, and managing portal templates—not for managing actual portals.
|
|
36
|
+
|
|
37
|
+
> **What is a Portal Template?**
|
|
38
|
+
>
|
|
39
|
+
> A portal template is a reusable, versioned package that defines the structure, configuration, and capabilities of a portal. You use the CLI to develop and publish these templates.
|
|
40
|
+
>
|
|
41
|
+
> **The actual portal** is created when you register a portal in the Portal Admin app and configure it according to the schema defined in your template. Portal registration and configuration are managed outside the CLI, in the Fusion Portal Admin UI.
|
|
42
|
+
|
|
43
|
+
This guide covers the essential commands and best practices for developing and managing portal templates. For information on registering and configuring portals, see the Portal Admin documentation.
|
|
44
|
+
|
|
45
|
+
## Getting Started
|
|
46
|
+
|
|
47
|
+
### 1. Install the CLI
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
pnpm add -D @equinor/fusion-framework-cli
|
|
51
|
+
# or
|
|
52
|
+
npm install --save-dev @equinor/fusion-framework-cli
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2. Scaffold a New Portal
|
|
56
|
+
|
|
57
|
+
Create a new directory for your portal and initialize your project:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
mkdir my-fusion-portal && cd my-fusion-portal
|
|
61
|
+
pnpm init
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Create Required Files
|
|
65
|
+
|
|
66
|
+
- `portal.manifest.ts`: Defines your portal's metadata and configuration.
|
|
67
|
+
- `portal.schema.ts` (optional): Defines the schema for portal configuration.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Portal Manifest
|
|
72
|
+
|
|
73
|
+
The portal manifest (`portal.manifest.ts`) describes your portal's metadata, configuration, and capabilities. It is required for all portal templates. You may also define a schema file for advanced configuration validation.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Commands
|
|
78
|
+
|
|
79
|
+
### Command Overview
|
|
80
|
+
|
|
81
|
+
The Fusion Framework CLI provides a suite of commands to support the full portal template lifecycle, from development to deployment. Below is an overview of all available commands with quick links to their detailed usage:
|
|
82
|
+
|
|
83
|
+
- [Dev](#dev) — Start the portal development server for local development and testing.
|
|
84
|
+
- [Build](#build) — Build your portal template using Vite.
|
|
85
|
+
- [Pack](#pack) — Bundle your portal into a distributable archive for deployment.
|
|
86
|
+
- [Upload](#upload) — Upload your portal bundle to the Fusion portal registry.
|
|
87
|
+
- [Tag](#tag) — Tag a published portal template version in the Fusion portal registry.
|
|
88
|
+
- [Manifest](#manifest) — Resolve and print the portal manifest for inspection or debugging.
|
|
89
|
+
- [Schema](#schema) — Generate and validate the JSON schema for your Fusion portal application.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### Dev
|
|
94
|
+
|
|
95
|
+
Start the portal development server for local development and testing.
|
|
96
|
+
|
|
97
|
+
| Option | Description | Default / Example |
|
|
98
|
+
| ------------------- | --------------------------------------- | -------------------- |
|
|
99
|
+
| `--manifest <path>` | Path to the portal manifest file. | `portal.manifest.ts` |
|
|
100
|
+
| `--config <path>` | Path to the portal config file. | `portal.config.ts` |
|
|
101
|
+
| `--env <env>` | Runtime environment for the dev server. | `local` |
|
|
102
|
+
| `--port <port>` | Port for the development server. | `3000` |
|
|
103
|
+
|
|
104
|
+
**Usage:**
|
|
105
|
+
```sh
|
|
106
|
+
pnpm fusion-framework-cli portal dev [options]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Examples:**
|
|
110
|
+
```sh
|
|
111
|
+
pnpm fusion-framework-cli portal dev
|
|
112
|
+
pnpm fusion-framework-cli portal dev --port 4001 --manifest ./portal.manifest.ts
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### Build
|
|
118
|
+
|
|
119
|
+
Build your portal template using Vite.
|
|
120
|
+
|
|
121
|
+
| Option | Description | Default / Example |
|
|
122
|
+
| ------------------- | ---------------------------------- | -------------------- |
|
|
123
|
+
| `--manifest <path>` | Path to the portal manifest file. | `portal.manifest.ts` |
|
|
124
|
+
| `--env <env>` | Runtime environment for the build. | `production` |
|
|
125
|
+
|
|
126
|
+
**Usage:**
|
|
127
|
+
```sh
|
|
128
|
+
pnpm fusion-framework-cli portal build [options]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Examples:**
|
|
132
|
+
```sh
|
|
133
|
+
pnpm fusion-framework-cli portal build
|
|
134
|
+
pnpm fusion-framework-cli portal build --manifest ./portal.manifest.ts --env ci
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### Pack
|
|
140
|
+
|
|
141
|
+
Bundle your portal into a distributable archive for deployment.
|
|
142
|
+
|
|
143
|
+
| Option | Description | Default / Example |
|
|
144
|
+
| ------------------- | --------------------------------- | -------------------- |
|
|
145
|
+
| `--manifest <path>` | Path to the portal manifest file. | `portal.manifest.ts` |
|
|
146
|
+
| `--schema <path>` | Path to the portal schema file. | `portal.schema.ts` |
|
|
147
|
+
| `--archive <name>` | Name of the output archive file. | `portal-bundle.zip` |
|
|
148
|
+
|
|
149
|
+
**Usage:**
|
|
150
|
+
```sh
|
|
151
|
+
pnpm fusion-framework-cli portal pack [options]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Examples:**
|
|
155
|
+
```sh
|
|
156
|
+
pnpm fusion-framework-cli portal pack
|
|
157
|
+
pnpm fusion-framework-cli portal pack --archive my-portal.zip --schema ./portal.schema.ts
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### Upload
|
|
163
|
+
|
|
164
|
+
Upload your portal bundle to the Fusion portal registry.
|
|
165
|
+
|
|
166
|
+
| Option | Description | Default / Example |
|
|
167
|
+
| --------------- | ---------------------------------------- | ------------------- |
|
|
168
|
+
| `[bundle]` | Path to the portal bundle archive. | `portal-bundle.zip` |
|
|
169
|
+
| `--name <name>` | Portal name (overrides bundle metadata). | |
|
|
170
|
+
| `--token` | Authentication token for Fusion. | |
|
|
171
|
+
| `--tenantId` | Azure tenant ID for authentication. | |
|
|
172
|
+
| `--clientId` | Azure client ID for authentication. | |
|
|
173
|
+
|
|
174
|
+
**Usage:**
|
|
175
|
+
```sh
|
|
176
|
+
pnpm fusion-framework-cli portal upload [bundle] [options]
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Examples:**
|
|
180
|
+
```sh
|
|
181
|
+
pnpm fusion-framework-cli portal upload
|
|
182
|
+
pnpm fusion-framework-cli portal upload my-portal.zip --name my-portal
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### Tag
|
|
188
|
+
|
|
189
|
+
Tag a published portal template version in the Fusion portal registry.
|
|
190
|
+
|
|
191
|
+
| Option/Argument | Description | Default / Example |
|
|
192
|
+
| ----------------- | ------------------------------------- | ----------------- |
|
|
193
|
+
| `<tag>` | Tag to apply (`latest` \| `preview`). | |
|
|
194
|
+
| `--name <name>` | Portal name. | |
|
|
195
|
+
| `--version <ver>` | Version to tag. | |
|
|
196
|
+
| `--token` | Authentication token for Fusion. | |
|
|
197
|
+
| `--tenantId` | Azure tenant ID for authentication. | |
|
|
198
|
+
| `--clientId` | Azure client ID for authentication. | |
|
|
199
|
+
|
|
200
|
+
**Usage:**
|
|
201
|
+
```sh
|
|
202
|
+
pnpm fusion-framework-cli portal tag <tag> [options]
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Examples:**
|
|
206
|
+
```sh
|
|
207
|
+
pnpm fusion-framework-cli portal tag latest --name my-portal --version 1.0.0
|
|
208
|
+
pnpm fusion-framework-cli portal tag preview --name my-portal --version 1.1.0-beta
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### Manifest
|
|
214
|
+
|
|
215
|
+
Resolve and print the portal manifest for inspection or debugging.
|
|
216
|
+
|
|
217
|
+
| Option | Description | Default / Example |
|
|
218
|
+
| ------------------- | -------------------------------------------- | -------------------- |
|
|
219
|
+
| `--manifest <path>` | Path to the portal manifest file. | `portal.manifest.ts` |
|
|
220
|
+
| `--env <env>` | Runtime environment for manifest resolution. | `local` |
|
|
221
|
+
|
|
222
|
+
**Usage:**
|
|
223
|
+
```sh
|
|
224
|
+
pnpm fusion-framework-cli portal manifest [options]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Examples:**
|
|
228
|
+
```sh
|
|
229
|
+
pnpm fusion-framework-cli portal manifest
|
|
230
|
+
pnpm fusion-framework-cli portal manifest --manifest ./portal.manifest.ts --env ci
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
### Schema
|
|
236
|
+
|
|
237
|
+
Generate and validate the JSON schema for your Fusion portal application.
|
|
238
|
+
|
|
239
|
+
| Option/Argument | Description | Default / Example |
|
|
240
|
+
| ---------------- | --------------------------------------------------------------------- | ----------------- |
|
|
241
|
+
| `[schema]` | Schema build file to use (e.g., `portal.schema[.env]?.[ts,js,json]`). | |
|
|
242
|
+
| `-o, --output` | Output file name (default: stdout). | `stdout` |
|
|
243
|
+
| `-d, --debug` | Enable debug mode for verbose logging. | `false` |
|
|
244
|
+
| `-v, --validate` | Validate the generated schema against a JSON file. | |
|
|
245
|
+
| `--env <env>` | Runtime environment for schema generation (supports dev). | |
|
|
246
|
+
|
|
247
|
+
**Usage:**
|
|
248
|
+
```sh
|
|
249
|
+
pnpm fusion-framework-cli portal schema [schema] [options]
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Examples:**
|
|
253
|
+
```sh
|
|
254
|
+
# Generate schema and print to stdout
|
|
255
|
+
pnpm fusion-framework-cli portal schema
|
|
256
|
+
|
|
257
|
+
# Generate schema and write to a file
|
|
258
|
+
pnpm fusion-framework-cli portal schema --output portal.schema.json
|
|
259
|
+
|
|
260
|
+
# Validate a config file against the generated schema
|
|
261
|
+
pnpm fusion-framework-cli portal schema --validate my-config.json
|
|
262
|
+
|
|
263
|
+
# Use a specific schema file and enable debug mode
|
|
264
|
+
pnpm fusion-framework-cli portal schema portal.schema.prod.ts --debug
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Troubleshooting & FAQ
|
|
270
|
+
|
|
271
|
+
- **Manifest/config not found:** Ensure `portal.manifest.ts` exists in your project root.
|
|
272
|
+
- **Build errors:** Check your Vite config and ensure all dependencies are installed.
|
|
273
|
+
- **Authentication issues:** Make sure you have the correct permissions and tokens for uploading or tagging.
|
|
274
|
+
- **Command help:** Run any command with `--help` for detailed usage and options.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
For advanced configuration and authentication, see [Authentication](./auth.md).
|