Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@sap-ux/cap-config-writer
Advanced tools
Adds or removes configuration to a SAP CAP projects.
Npm
npm install --save @sap-ux/cap-config-writer
Yarn
yarn add @sap-ux/cap-config-writer
Pnpm
pnpm add @sap-ux/cap-config-writer
import { enableCdsUi5Plugin } from '@sap-ux/cap-config-writer';
const fs = await enableCdsUi5Plugin('path/to/cap-project');
fs.commit();
This utility function updates the pom.xml file for Java-based CAP projects. The function reads the contents of the pom.xml file specified by pomPath, parses it, and searches for the spring-boot-maven-plugin configuration. If found, it adds certain workspace elements to it and writes back the updated pom.xml.
import { updatePomXml } from '@sap-ux/cap-config-writer';
// Usage example
const fsMock: Editor = {}; // mem-fs file editor
const pomPath: string = 'path/to/pom.xml';
const logger: Logger = {}; // logger instance from @sap-ux/logger
updatePomXml(fsMock, pomPath, logger);
The function constructs the path to the tsconfig.json file based on the provided appRoot. If the file exists, it reads its contents and checks if the typeRoots property is defined in the compilerOptions. The function extends the tsconfig.json file with the modified compilerOptions.
import { updateTsConfig } from '@sap-ux/cap-config-writer';
// Usage example
const fsMock: Editor = {}; // mem-fs file editor
const appRoot: string = 'path/to/your/app'; // The root directory of the application
updateTsConfig(fsMock, appRoot);
The function reads the contents of the application YAML file specified by applicationYamlPath, parses it, and checks if the static resource locations are already defined. If not, it adds the custom paths specified by capCustomPathsApp to the web.resources.static-locations property.
import { updateStaticLocationsInApplicationYaml } from '@sap-ux/cap-config-writer';
// Usage example
const fsMock: Editor = {}; // mem-fs file editor
const applicationYamlPath: string = 'path/to/application.yaml';
const capCustomPathsApp: string = 'path/to/static/resources'; // Custom paths for CAP application
const logger: Logger = {}; // logger instance from @sap-ux/logger
await updateStaticLocationsInApplicationYaml(fsMock, applicationYamlPath, capCustomPathsApp, logger);
Updates the package.json file of a CAP project app based on project requirements such as enableNPMWorkspaces
import { updateRootPackageJson } from '@sap-ux/cap-config-writer';
// Usage example
const fsMock: Editor = {}; // mem-fs file editor
const projectName: string = 'your-project-name';
const sapux: boolean = true; // Whether to add the app name to the sapux array
const capService: CapService = {}; // CAP service instance
const appId: string = 'your-app-id';
const log: Logger = {}; //// mem-fs file editor
const enableNPMWorkspaces: boolean = true; // npm workspaces (optional)
await updateRootPackageJson(fsMock, projectName, sapux, capService, appId, log, enableNPMWorkspaces);
The function constructs the path to the package.json file based on the provided appRoot. It then reads the contents of the package.json file and removes the sapux property, the int-test script, and any scripts starting with 'start' that are not required for the app.
import { updateAppPackageJson } from '@sap-ux/cap-config-writer';
// Usage example
const fsMock: Editor = {}; // mem-fs file editor
const appRoot: string = 'path/to/your/app'; // The root directory of the application
updateAppPackageJson(fsMock, appRoot);
SAP Fiori elements SAP CAP SAP CAP writer SAP UI5
FAQs
Add or update configuration for SAP CAP projects
The npm package @sap-ux/cap-config-writer receives a total of 1,792 weekly downloads. As such, @sap-ux/cap-config-writer popularity was classified as popular.
We found that @sap-ux/cap-config-writer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.