@equinor/fusion-framework-cli 11.2.0 → 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 (34) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/README.md +17 -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/package.json +14 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,128 @@
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
+
3
126
  ## 11.2.0
4
127
 
5
128
  ### 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 |