@equinor/fusion-framework-cli 11.2.0 → 11.3.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +172 -0
  2. package/README.md +17 -0
  3. package/bin/build/bin.mjs +1 -1
  4. package/bin/build/cli.mjs +3 -3
  5. package/dist/esm/lib/utils/assert.js +70 -15
  6. package/dist/esm/lib/utils/assert.js.map +1 -1
  7. package/dist/esm/lib/utils/is-git-dir.js +19 -0
  8. package/dist/esm/lib/utils/is-git-dir.js.map +1 -0
  9. package/dist/esm/lib/utils/package-info.js +135 -0
  10. package/dist/esm/lib/utils/package-info.js.map +1 -0
  11. package/dist/esm/lib/utils/path-security.js +56 -0
  12. package/dist/esm/lib/utils/path-security.js.map +1 -0
  13. package/dist/esm/version.js +1 -1
  14. package/dist/types/bin/app-tag.d.ts +1 -1
  15. package/dist/types/bin/helpers/ProjectTemplate.d.ts +61 -0
  16. package/dist/types/bin/helpers/ProjectTemplateRepository.d.ts +113 -0
  17. package/dist/types/bin/helpers/install-package-dependencies.d.ts +11 -0
  18. package/dist/types/bin/helpers/project-templates.schema.d.ts +301 -0
  19. package/dist/types/cli/commands/create/_helpers/check-target-directory.d.ts +12 -0
  20. package/dist/types/cli/commands/create/_helpers/cleanup-template-files.d.ts +15 -0
  21. package/dist/types/cli/commands/create/_helpers/install-dependencies.d.ts +14 -0
  22. package/dist/types/cli/commands/create/_helpers/open-in-ide.d.ts +15 -0
  23. package/dist/types/cli/commands/create/_helpers/resolve-workspace-dependencies.d.ts +27 -0
  24. package/dist/types/cli/commands/create/_helpers/select-template.d.ts +24 -0
  25. package/dist/types/cli/commands/create/_helpers/setup-repository.d.ts +23 -0
  26. package/dist/types/cli/commands/create/_helpers/start-dev-server.d.ts +17 -0
  27. package/dist/types/cli/commands/create/_helpers/update-package-json.d.ts +41 -0
  28. package/dist/types/cli/commands/create/app.d.ts +28 -0
  29. package/dist/types/cli/commands/create/index.d.ts +2 -0
  30. package/dist/types/lib/utils/assert.d.ts +61 -13
  31. package/dist/types/lib/utils/is-git-dir.d.ts +9 -0
  32. package/dist/types/lib/utils/package-info.d.ts +106 -0
  33. package/dist/types/lib/utils/path-security.d.ts +36 -0
  34. package/dist/types/version.d.ts +1 -1
  35. package/docs/creating-apps.md +275 -0
  36. package/package.json +19 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,177 @@
1
1
  # Change Log
2
2
 
3
+ ## 11.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3379](https://github.com/equinor/fusion-framework/pull/3379) [`96d319c`](https://github.com/equinor/fusion-framework/commit/96d319c64e2ccb0ad080d633b74b76cbc4f48083) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updated inquirer dependency from 12.9.4 to 12.9.6
8
+
9
+ - Updated inquirer to latest patch version 12.9.6
10
+ - Includes bug fixes and performance improvements
11
+ - No breaking changes in this patch update
12
+
13
+ - [#3381](https://github.com/equinor/fusion-framework/pull/3381) [`bae9c95`](https://github.com/equinor/fusion-framework/commit/bae9c9554f335d0384b864436874bded47d00ed8) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update rollup from 4.46.3 to 4.50.2
14
+
15
+ - Updated rollup dependency to latest patch version
16
+ - Includes bug fixes for tree-shaking array destructuring patterns
17
+ - Performance improvements and platform support updates
18
+ - No breaking changes - backward compatible update
19
+
20
+ - [#2910](https://github.com/equinor/fusion-framework/pull/2910) [`07cc985`](https://github.com/equinor/fusion-framework/commit/07cc9857e1427b574e011cc319518e701dba784d) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updated vitest from 2.1.9 to 3.2.4 across all packages.
21
+
22
+ ## Breaking Changes
23
+
24
+ - **Node.js Requirements**: Requires Node.js 18+ (already satisfied)
25
+ - **Vite Compatibility**: Updated to work with Vite 7.x (already using Vite 7.1.5)
26
+ - **Snapshot Format**: Snapshots now use backtick quotes (\`) instead of single quotes
27
+ - **Coverage API**: New coverage methods `enableCoverage()` and `disableCoverage()`
28
+ - **TypeScript Support**: Enhanced TypeScript integration and type definitions
29
+
30
+ ## Security Updates
31
+
32
+ - CVE-2025-24963: Browser mode serves arbitrary files (fixed in 2.1.9)
33
+ - CVE-2025-24964: Remote Code Execution vulnerability (fixed in 2.1.9)
34
+
35
+ ## Migration Notes
36
+
37
+ - Test snapshots may need regeneration due to quote format changes
38
+ - Some test configurations might need updates for new TypeScript support
39
+ - Peer dependency warnings for @vitest/coverage-v8 are expected and safe to ignore
40
+
41
+ ## Links
42
+
43
+ - [Vitest 3.0 Migration Guide](https://vitest.dev/guide/migration)
44
+ - [Vitest 3.2.4 Release Notes](https://github.com/vitest-dev/vitest/releases/tag/v3.2.4)
45
+
46
+ - Updated dependencies [[`bae9c95`](https://github.com/equinor/fusion-framework/commit/bae9c9554f335d0384b864436874bded47d00ed8), [`4215d80`](https://github.com/equinor/fusion-framework/commit/4215d80799d156a248feb0f195af370907332a33), [`07cc985`](https://github.com/equinor/fusion-framework/commit/07cc9857e1427b574e011cc319518e701dba784d)]:
47
+ - @equinor/fusion-framework-dev-portal@1.0.3
48
+ - @equinor/fusion-framework-module-msal-node@1.0.4
49
+ - @equinor/fusion-framework-dev-server@1.0.3
50
+ - @equinor/fusion-imports@1.1.3
51
+
52
+ ## 11.3.0
53
+
54
+ ### Minor Changes
55
+
56
+ - [#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.
57
+
58
+ **New Features**
59
+
60
+ - Added `ffc create app <name>` command with interactive template selection
61
+ - Supports both `ffc create app` and `ffc app create` command patterns for improved flexibility
62
+ - Includes template validation and interactive prompts using inquirer
63
+ - Added comprehensive template repository system with schema validation
64
+ - Implemented modular helper functions for each step of app creation
65
+
66
+ **Template Support**
67
+
68
+ - Supports both bare and basic application templates from fusion-app-template repository
69
+ - Includes template validation and interactive prompts using inquirer
70
+ - Added comprehensive template repository system with schema validation
71
+
72
+ **Developer Experience**
73
+
74
+ - Added IDE integration with automatic project opening
75
+ - Includes dependency management and dev server startup
76
+ - Added comprehensive documentation with examples and best practices
77
+ - Updated CLI README with new command documentation
78
+ - Added GitHub template integration links for alternative app creation methods
79
+
80
+ **Error Handling & Reliability**
81
+
82
+ - Enhanced error handling for spawn operations in IDE opening and dev server startup
83
+ - Migrated to execa for automatic process cleanup and better signal handling
84
+ - Fixed misleading success messages by wrapping template copy operations in try-catch blocks
85
+ - Improved error logging in repository cleanup operations for better debugging
86
+ - Added proper CLI exit codes for operation failures
87
+ - Enhanced TSDoc documentation and inline comments across helper functions
88
+
89
+ **Dependencies**
90
+
91
+ - Added new dependencies: `inquirer`, `@types/inquirer`, and `execa` for enhanced CLI experience
92
+ - Migrated process spawning from native child_process to execa for better process management
93
+
94
+ 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.
95
+
96
+ - [#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
97
+
98
+ - Added `updatePackageJson` helper for updating package.json with app name and resolving workspace dependencies
99
+ - Added `resolve-workspace-dependencies` helper to convert workspace:^ dependencies to npm versions
100
+ - Added `package-info` utility for fetching package metadata from npm registry
101
+ - Integrated workspace dependency resolution into create app workflow
102
+ - Improved error handling and logging throughout the create app process
103
+ - Added comprehensive TSDoc documentation for all new functions
104
+
105
+ This ensures that apps created from templates have proper npm versions instead of workspace references, making them deployable outside the monorepo.
106
+
107
+ ### Patch Changes
108
+
109
+ - [#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.
110
+
111
+ ## New Features
112
+
113
+ - **Path Security Validation**: Added `validateSafePath()` function to prevent path traversal attacks
114
+ - **Safe Directory Operations**: Added `safeRmSync()` function for secure directory removal
115
+ - **Enhanced Error Messages**: Improved user-friendly error messages with visual indicators
116
+
117
+ ## Security Improvements
118
+
119
+ - **Path Traversal Protection**: Prevents users from specifying paths outside the current working directory
120
+ - **Input Validation**: Validates target paths before performing file system operations
121
+ - **Safe Cleanup**: Directory removal operations now validate paths before execution
122
+
123
+ ## User Experience
124
+
125
+ - **Better Error Messages**: Clear, actionable error messages with ❌ and 💡 indicators
126
+ - **Helpful Guidance**: Users get specific suggestions when path validation fails
127
+ - **Clean Error Handling**: No more messy stack traces for path-related errors
128
+
129
+ ## Technical Details
130
+
131
+ - Uses `is-path-inside` library for robust path validation
132
+ - Integrates path security into `checkTargetDirectory` helper
133
+ - Maintains backward compatibility with existing functionality
134
+ - Added comprehensive JSDoc documentation for all new functions
135
+
136
+ - [`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.
137
+
138
+ Fixed `--version` flag conflict in CLI tag commands and improved API consistency.
139
+
140
+ - **Fixed:** Resolved conflict between custom `--version` option and Commander's built-in `--version` flag that displays CLI version
141
+ - **Refactored:** Replaced separate `--appKey`/`--version` options with unified `--package name@version` syntax for both `app tag` and `portal tag` commands
142
+ - **Improved:** Enhanced error handling with clear validation messages for package format
143
+ - **Updated:** Documentation and help text to reflect new `--package` option usage
144
+ - **Added:** Better user feedback with colored logging for successful operations
145
+
146
+ **Breaking Changes:**
147
+ 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:
148
+
149
+ 1. The `--version` flag never worked properly due to the conflict with Commander's built-in version flag
150
+ 2. The old API was fundamentally broken and unusable
151
+ 3. Limited adoption in production environments means minimal impact
152
+ 4. The same functionality is accessible through:
153
+ - The `publish` command (recommended for standard releases)
154
+ - The Fusion App Admin UI (graphical interface for release management)
155
+
156
+ **Migration:**
157
+
158
+ - Old: `fusion-framework-cli app tag --appKey my-app --version 1.2.3 latest`
159
+ - New: `fusion-framework-cli app tag --package my-app@1.2.3 latest`
160
+
161
+ 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.
162
+
163
+ **Credits:** Special thanks to [@estoksam](https://github.com/estoksam) for identifying and reporting this CLI flag conflict issue.
164
+
165
+ **Fixes:** https://github.com/equinor/fusion/issues/652
166
+
167
+ - [#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.
168
+
169
+ - Added `isGitDir` utility function to check if a directory is a valid git repository
170
+ - Added `assertGitRepository` assertion function for git repository validation
171
+ - Enhanced assert utilities with git repository checking capabilities
172
+
173
+ These utilities support the create app command's repository validation and setup process.
174
+
3
175
  ## 11.2.0
4
176
 
5
177
  ### Minor Changes
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 |