Skip to content

Conversation

@Dnouv
Copy link
Member

@Dnouv Dnouv commented Sep 18, 2025

This pull request modernizes and upgrades the Rocket.Chat Apps CLI project, focusing on updating dependencies, streamlining configuration, and improving code quality and maintainability. The changes include major dependency upgrades, migration to newer CLI and linting tools, and updates to scripts and documentation to reflect these improvements.

Dependency and Tooling Upgrades

  • Upgraded core dependencies in package.json (including @oclif/core, @rocket.chat/apps-engine, chalk, conf, typescript, and others) to their latest versions, and removed deprecated packages such as @oclif/command, cli-ux, and uuid. Also updated Node.js engine requirement to >=22.0.0.
  • Migrated CLI command code (src/commands/create.ts, src/commands/deploy.ts) from @oclif/command and cli-ux to @oclif/core and @inquirer/prompts, refactored to use modern APIs, and replaced deprecated logic (e.g., using randomUUID instead of uuid). [1] [2]

Linting and Formatting Improvements

  • Added Prettier and ESLint configuration files (.prettierrc.js, eslint.config.js) with recommended settings and integrated them into the project scripts for code formatting and linting. [1] [2]
  • Added .prettierignore file to exclude build and dependency directories from formatting.

Scripts and Configuration Updates

  • Updated package.json scripts to use the new linting and formatting tools, removed TSLint, and refactored build/test commands for clarity and compatibility with upgraded dependencies.
  • Updated oclif CLI configuration in package.json to reflect new directory structure and options, including dirname, topicSeparator, and plugin settings.

Documentation Updates

  • Improved README.md formatting and updated instructions to reflect new CLI usage and configuration options. [1] [2] [3] [4]

References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Dnouv and others added 7 commits September 18, 2025 15:07
- Streamline DiagnosticReport class and improve property handling
- Update FolderDetails class for better async file handling and directory management
- Clean up index exports for better readability
- Simplify interfaces for app categories and login info
- Enhance unicodeSymbols for better structure
- Optimize VariousUtils class methods for clarity and performance
- Adjust template files for consistent formatting and readability
- Add typings for 'conf' and 'fetch-with-proxy' modules
- Comment out deploy command tests for future implementation
- Update package and watch command tests for consistency
- Clean up init.js and simplify tsconfig configurations
- Update main tsconfig for ES2022 compatibility and stricter checks
- Remove deprecated tslint.json file

This refactoring improves code maintainability, performance, and follows
modern TypeScript best practices while ensuring consistent formatting
across the codebase.
- Removed unused dependencies from package.json and package-lock.json, including figures, open, pascal-case, @types/inquirer, and others.
- Refactored import statements to use local implementations of pascalCase and openExternal.
- Updated the create and watch commands to utilize the new openExternal function for opening URLs.
- Introduced a new textTransforms module for the pascalCase function.
- Enhanced folderDetails to use unicode symbols for better logging output.
- Cleaned up the cloudAuth module to use the new openExternal function.
- Removed the usage of fetch-with-proxy and form-data from the project.
- Replaced file reading and uploading logic with native Node.js fs and File API.
- Updated the server implementation in cloudAuth to use the native http module.
- Adjusted TypeScript typings and configuration to reflect the removal of fetch-with-proxy.
- Enhanced error handling and server lifecycle management in cloudAuth.
- Removed appJsonSchema and its usage in favor of a new appJsonValidator using zod.
- Introduced a new validation structure for app.json using zod's schema validation.
- Updated FolderDetails to report validation issues using the new zod-based validator.
- Refactored CloudAuth to manage configuration storage with encryption and improved file handling.
- Cleaned up package.json by removing unused dependencies and adding zod.
- Added a minimal zod implementation for app.json validation.
if (flags.update) {
url += `/${fd.info.id}`;
}
const res = await fetch(url, {

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.
throw new Error('')
}

const response = await fetch(normalizeUrl(url, '/api/info'))

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.

// expects the `path` to start with the /

authResult = await fetch(normalizeUrl(url, '/api/v1/login'), {

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(credentials),

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.
const token = typeof flags.token === 'string' ? flags.token : undefined
const userId = typeof flags.userId === 'string' ? flags.userId : undefined

const verificationResult = await fetch(normalizeUrl(url, '/api/v1/me'), {

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(credentials),

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.
const token = typeof flags.token === 'string' ? flags.token : undefined
const userId = typeof flags.userId === 'string' ? flags.userId : undefined

const verificationResult = await fetch(normalizeUrl(url, '/api/v1/me'), {

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.
Comment on lines +262 to +266
headers: {
'Content-Type': 'application/json',
'X-Auth-Token': token ?? '',
'X-User-Id': userId ?? '',
},

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.
throw new Error('Invalid authentication response')
}

const deployResult = await fetch(normalizeUrl(url, endpoint), {

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.
Outbound network request depends on
file data
.
Comment on lines +292 to +295
headers: {
'X-Auth-Token': authResult.data.authToken,
'X-User-Id': authResult.data.userId,
},

Check warning

Code scanning / CodeQL

File data in outbound network request Medium

Outbound network request depends on
file data
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants