@equinor/fusion-framework-cli 11.1.4 → 11.3.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +18 -0
  3. package/bin/build/cli.mjs +3 -3
  4. package/dist/esm/lib/utils/assert.js +70 -15
  5. package/dist/esm/lib/utils/assert.js.map +1 -1
  6. package/dist/esm/lib/utils/is-git-dir.js +19 -0
  7. package/dist/esm/lib/utils/is-git-dir.js.map +1 -0
  8. package/dist/esm/lib/utils/package-info.js +135 -0
  9. package/dist/esm/lib/utils/package-info.js.map +1 -0
  10. package/dist/esm/lib/utils/path-security.js +56 -0
  11. package/dist/esm/lib/utils/path-security.js.map +1 -0
  12. package/dist/esm/version.js +1 -1
  13. package/dist/types/bin/helpers/ProjectTemplate.d.ts +61 -0
  14. package/dist/types/bin/helpers/ProjectTemplateRepository.d.ts +113 -0
  15. package/dist/types/bin/helpers/install-package-dependencies.d.ts +11 -0
  16. package/dist/types/bin/helpers/project-templates.schema.d.ts +301 -0
  17. package/dist/types/cli/commands/create/_helpers/check-target-directory.d.ts +12 -0
  18. package/dist/types/cli/commands/create/_helpers/cleanup-template-files.d.ts +15 -0
  19. package/dist/types/cli/commands/create/_helpers/install-dependencies.d.ts +14 -0
  20. package/dist/types/cli/commands/create/_helpers/open-in-ide.d.ts +15 -0
  21. package/dist/types/cli/commands/create/_helpers/resolve-workspace-dependencies.d.ts +27 -0
  22. package/dist/types/cli/commands/create/_helpers/select-template.d.ts +24 -0
  23. package/dist/types/cli/commands/create/_helpers/setup-repository.d.ts +23 -0
  24. package/dist/types/cli/commands/create/_helpers/start-dev-server.d.ts +17 -0
  25. package/dist/types/cli/commands/create/_helpers/update-package-json.d.ts +41 -0
  26. package/dist/types/cli/commands/create/app.d.ts +28 -0
  27. package/dist/types/cli/commands/create/index.d.ts +2 -0
  28. package/dist/types/lib/utils/assert.d.ts +61 -13
  29. package/dist/types/lib/utils/is-git-dir.d.ts +9 -0
  30. package/dist/types/lib/utils/package-info.d.ts +106 -0
  31. package/dist/types/lib/utils/path-security.d.ts +36 -0
  32. package/dist/types/version.d.ts +1 -1
  33. package/docs/creating-apps.md +275 -0
  34. package/docs/dev-server.md +367 -0
  35. package/docs/migration-v10-to-v11.md +13 -0
  36. package/package.json +14 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,153 @@
1
1
  # Change Log
2
2
 
3
+ ## 11.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#3377](https://github.com/equinor/fusion-framework/pull/3377) [`70638da`](https://github.com/equinor/fusion-framework/commit/70638da56c0dad3f349a2d063e8d8bcea3b71b12) Thanks [@odinr](https://github.com/odinr)! - Add comprehensive create app command for generating Fusion applications from templates.
8
+
9
+ **New Features**
10
+
11
+ - Added `ffc create app <name>` command with interactive template selection
12
+ - Supports both `ffc create app` and `ffc app create` command patterns for improved flexibility
13
+ - Includes template validation and interactive prompts using inquirer
14
+ - Added comprehensive template repository system with schema validation
15
+ - Implemented modular helper functions for each step of app creation
16
+
17
+ **Template Support**
18
+
19
+ - Supports both bare and basic application templates from fusion-app-template repository
20
+ - Includes template validation and interactive prompts using inquirer
21
+ - Added comprehensive template repository system with schema validation
22
+
23
+ **Developer Experience**
24
+
25
+ - Added IDE integration with automatic project opening
26
+ - Includes dependency management and dev server startup
27
+ - Added comprehensive documentation with examples and best practices
28
+ - Updated CLI README with new command documentation
29
+ - Added GitHub template integration links for alternative app creation methods
30
+
31
+ **Error Handling & Reliability**
32
+
33
+ - Enhanced error handling for spawn operations in IDE opening and dev server startup
34
+ - Migrated to execa for automatic process cleanup and better signal handling
35
+ - Fixed misleading success messages by wrapping template copy operations in try-catch blocks
36
+ - Improved error logging in repository cleanup operations for better debugging
37
+ - Added proper CLI exit codes for operation failures
38
+ - Enhanced TSDoc documentation and inline comments across helper functions
39
+
40
+ **Dependencies**
41
+
42
+ - Added new dependencies: `inquirer`, `@types/inquirer`, and `execa` for enhanced CLI experience
43
+ - Migrated process spawning from native child_process to execa for better process management
44
+
45
+ The new command provides an intuitive way for developers to bootstrap new Fusion applications using predefined templates from the ecosystem while maintaining backward compatibility and providing robust error handling.
46
+
47
+ - [#3377](https://github.com/equinor/fusion-framework/pull/3377) [`70638da`](https://github.com/equinor/fusion-framework/commit/70638da56c0dad3f349a2d063e8d8bcea3b71b12) Thanks [@odinr](https://github.com/odinr)! - Add workspace dependency resolution to create app command
48
+
49
+ - Added `updatePackageJson` helper for updating package.json with app name and resolving workspace dependencies
50
+ - Added `resolve-workspace-dependencies` helper to convert workspace:^ dependencies to npm versions
51
+ - Added `package-info` utility for fetching package metadata from npm registry
52
+ - Integrated workspace dependency resolution into create app workflow
53
+ - Improved error handling and logging throughout the create app process
54
+ - Added comprehensive TSDoc documentation for all new functions
55
+
56
+ This ensures that apps created from templates have proper npm versions instead of workspace references, making them deployable outside the monorepo.
57
+
58
+ ### Patch Changes
59
+
60
+ - [#3377](https://github.com/equinor/fusion-framework/pull/3377) [`70638da`](https://github.com/equinor/fusion-framework/commit/70638da56c0dad3f349a2d063e8d8bcea3b71b12) Thanks [@odinr](https://github.com/odinr)! - Enhanced CLI security with path validation and improved error handling for create command.
61
+
62
+ ## New Features
63
+
64
+ - **Path Security Validation**: Added `validateSafePath()` function to prevent path traversal attacks
65
+ - **Safe Directory Operations**: Added `safeRmSync()` function for secure directory removal
66
+ - **Enhanced Error Messages**: Improved user-friendly error messages with visual indicators
67
+
68
+ ## Security Improvements
69
+
70
+ - **Path Traversal Protection**: Prevents users from specifying paths outside the current working directory
71
+ - **Input Validation**: Validates target paths before performing file system operations
72
+ - **Safe Cleanup**: Directory removal operations now validate paths before execution
73
+
74
+ ## User Experience
75
+
76
+ - **Better Error Messages**: Clear, actionable error messages with ❌ and 💡 indicators
77
+ - **Helpful Guidance**: Users get specific suggestions when path validation fails
78
+ - **Clean Error Handling**: No more messy stack traces for path-related errors
79
+
80
+ ## Technical Details
81
+
82
+ - Uses `is-path-inside` library for robust path validation
83
+ - Integrates path security into `checkTargetDirectory` helper
84
+ - Maintains backward compatibility with existing functionality
85
+ - Added comprehensive JSDoc documentation for all new functions
86
+
87
+ - [`7983d30`](https://github.com/equinor/fusion-framework/commit/7983d302f5269d70646c3c5231944b8081844e86) Thanks [@odinr](https://github.com/odinr)! - **Note:** This changeset documents changes that were already implemented and released in [PR #3341](https://github.com/equinor/fusion-framework/pull/3341) (merged 2025-09-05) and included in the [🤖 Bip Bop - Fusion Framework Release](https://github.com/equinor/fusion-framework/pull/3342) (merged 2025-09-08). This changeset serves as a historical record and comprehensive documentation of the CLI tag command improvements, ensuring the changelog contains detailed information about the breaking changes, migration path, and technical details that may be referenced by users upgrading or troubleshooting CLI issues.
88
+
89
+ Fixed `--version` flag conflict in CLI tag commands and improved API consistency.
90
+
91
+ - **Fixed:** Resolved conflict between custom `--version` option and Commander's built-in `--version` flag that displays CLI version
92
+ - **Refactored:** Replaced separate `--appKey`/`--version` options with unified `--package name@version` syntax for both `app tag` and `portal tag` commands
93
+ - **Improved:** Enhanced error handling with clear validation messages for package format
94
+ - **Updated:** Documentation and help text to reflect new `--package` option usage
95
+ - **Added:** Better user feedback with colored logging for successful operations
96
+
97
+ **Breaking Changes:**
98
+ This introduces a breaking change to the CLI API by removing the `--version` and `--appKey` options in favor of the `--package` option. However, we're releasing this as a patch since:
99
+
100
+ 1. The `--version` flag never worked properly due to the conflict with Commander's built-in version flag
101
+ 2. The old API was fundamentally broken and unusable
102
+ 3. Limited adoption in production environments means minimal impact
103
+ 4. The same functionality is accessible through:
104
+ - The `publish` command (recommended for standard releases)
105
+ - The Fusion App Admin UI (graphical interface for release management)
106
+
107
+ **Migration:**
108
+
109
+ - Old: `fusion-framework-cli app tag --appKey my-app --version 1.2.3 latest`
110
+ - New: `fusion-framework-cli app tag --package my-app@1.2.3 latest`
111
+
112
+ This resolves the issue where `--version` would show CLI version (11.1.2) instead of using it as a bundle version parameter. Now `--version` correctly displays CLI version, and `--package` specifies the bundle to tag.
113
+
114
+ **Credits:** Special thanks to [@estoksam](https://github.com/estoksam) for identifying and reporting this CLI flag conflict issue.
115
+
116
+ **Fixes:** https://github.com/equinor/fusion/issues/652
117
+
118
+ - [#3377](https://github.com/equinor/fusion-framework/pull/3377) [`70638da`](https://github.com/equinor/fusion-framework/commit/70638da56c0dad3f349a2d063e8d8bcea3b71b12) Thanks [@odinr](https://github.com/odinr)! - Add git repository validation utilities to CLI package.
119
+
120
+ - Added `isGitDir` utility function to check if a directory is a valid git repository
121
+ - Added `assertGitRepository` assertion function for git repository validation
122
+ - Enhanced assert utilities with git repository checking capabilities
123
+
124
+ These utilities support the create app command's repository validation and setup process.
125
+
126
+ ## 11.2.0
127
+
128
+ ### Minor Changes
129
+
130
+ - [#3362](https://github.com/equinor/fusion-framework/pull/3362) [`6151ff4`](https://github.com/equinor/fusion-framework/commit/6151ff429fc5dc221a4cb43f11362cf39c2a3136) Thanks [@odinr](https://github.com/odinr)! - Added comprehensive dev-server documentation with architecture overview and configuration guide.
131
+
132
+ - Added new `docs/dev-server.md` with complete dev-server documentation
133
+ - Updated README.md to include dev-server documentation link
134
+ - Covers dev-server features, architecture, configuration, and troubleshooting
135
+
136
+ ### Patch Changes
137
+
138
+ - [#3345](https://github.com/equinor/fusion-framework/pull/3345) [`0b53fa8`](https://github.com/equinor/fusion-framework/commit/0b53fa8dcd31b0b333a172bfcc15b342c5548bf9) Thanks [@odinr](https://github.com/odinr)! - Documented missing breaking change for Vite configuration file naming in CLI v11 migration guide and changelog.
139
+
140
+ - Added detailed explanation of `app.vite.config.ts` → `vite.config.ts` file naming change
141
+ - Emphasized that `vite.config.ts` should be a last resort for custom setups
142
+ - Recommended using `dev-server.config.js` instead to avoid unexpected behavior
143
+ - Updated migration checklist to include the file rename requirement
144
+ - Enhanced v11.0.0 changelog with the breaking change documentation
145
+
146
+ This addresses the undocumented breaking change that could cause time-consuming debugging for developers upgrading from v10 to v11.
147
+
148
+ - Updated dependencies [[`1f629b5`](https://github.com/equinor/fusion-framework/commit/1f629b556c4e26170b1eb6ad8823c082cb2ac59d)]:
149
+ - @equinor/fusion-framework-module-msal-node@1.0.3
150
+
3
151
  ## 11.1.4
4
152
 
5
153
  ### Patch Changes
@@ -213,6 +361,7 @@
213
361
  - **Dev Portal Modularization:** The dev portal has been moved to a separate package `@equinor/fusion-framework-dev-server`, enabling modular architecture and independent updates. The dev portal can be configured via `dev-server.config.js` and supports live preview and API mocking.
214
362
  - **Command Structure:** CLI is now divided into three main groups: `bin` (executable functions), `commands` (CLI commands), and `lib` (for consumers, config, and utilities). This improves organization and modularity.
215
363
  - **BREAKING:** The `--service` flag has been removed. The CLI now uses service discovery via Fusion environment variables. All `app -build-???` commands are deprecated and will be removed in the next major version.
364
+ - **BREAKING:** Vite configuration file naming has changed to follow Vite's standard convention. Rename `app.vite.config.ts` to `vite.config.ts` to ensure your Vite configurations are applied correctly. Note: Using `vite.config.ts` should be a last resort for custom setups - prefer dev-server configuration to avoid unexpected behavior.
216
365
 
217
366
  - **Dev Server Abstraction:** Vite configuration and dev server functionality has been abstracted into the `@equinor/fusion-framework-dev-server` package. The CLI now provides a higher-level API that handles Vite configuration internally, eliminating the need for users to manage Vite configuration directly while still allowing for customization through configuration options.
218
367
 
package/README.md CHANGED
@@ -7,6 +7,7 @@ Fusion Framework CLI is a command-line tool for developing, building, and publis
7
7
  - **Portal Templates**: Customizable portal configurations for different business contexts
8
8
 
9
9
  **Key capabilities:**
10
+ - **Template-based app creation**: Generate new Fusion applications from predefined templates
10
11
  - Development server with hot reload and service discovery
11
12
  - Application manifest and configuration management
12
13
  - Automated building, bundling, and deployment
@@ -40,6 +41,21 @@ Fusion Framework CLI is a command-line tool for developing, building, and publis
40
41
  pnpm add -D @equinor/fusion-framework-cli
41
42
  ```
42
43
 
44
+ **Create a new Fusion application from template**
45
+
46
+ Generate a new Fusion application using predefined templates:
47
+
48
+ ```sh
49
+ # Create a new app with interactive template selection
50
+ pnpm fusion-framework-cli app create my-new-app
51
+
52
+ # Create with a specific template
53
+ pnpm fusion-framework-cli app create my-app --template react-app
54
+
55
+ # Create in a specific directory with debug logging
56
+ pnpm fusion-framework-cli app create my-app --directory ./projects --debug
57
+ ```
58
+
43
59
  **Initialize or update your app's manifest and config files**
44
60
 
45
61
  Create the required configuration files for your app:
@@ -79,6 +95,7 @@ pnpm fusion-framework-cli app config --publish --env <environment>
79
95
 
80
96
  | Command | Description |
81
97
  | -------------------------------------- | ------------------------------------ |
98
+ | `pnpm fusion-framework-cli app create` | Create new Fusion applications from templates |
82
99
  | `pnpm fusion-framework-cli auth ...` | Authenticate with Fusion |
83
100
  | `pnpm fusion-framework-cli app ...` | Working with Fusion applications |
84
101
  | `pnpm fusion-framework-cli portal ...` | Working with Fusion portal templates |
@@ -122,6 +139,7 @@ A minimal example for a Fusion Framework app:
122
139
  **Getting Started**
123
140
  - [Developing Apps](docs/application.md): Complete guide to building, configuring, and deploying Fusion applications
124
141
  - [Developing Portals](docs/portal.md): Guide to building, configuring, and publishing portal templates
142
+ - [Dev Server](docs/dev-server.md): Understanding how the development server works, including architecture and configuration
125
143
 
126
144
  **Setup & Configuration**
127
145
  - [Authentication](docs/auth.md): Setting up authentication for local development and CI/CD environments