Extra SDF commands for your project.
sdfx
is a utility package providing additional commands for SuiteScript Development Framework (SDF) projects. It aims to streamline and enhance your SDF workflow.
- Additional commands for managing SDF objects and files
- Simplified import and update processes
- Branch protection and validation before commits or deployments
To install sdfx
, you need to have Node.js and npm installed on your machine.
-
Install Husky (if not already installed):
npm install husky --save-dev
-
Initialize Husky:
npx husky init
-
Install sdfx:
npm install sdfx
After installation, you can use the additional SDF commands provided by sdfx. Once sdfx is installed, you should be able to see the new commands in your package.json file. Additionally, branches named "main" or "master" will be automatically protected. This means that every commit to these branches will require a successful validation.
suitecloud project:deploy --dryrun
This command runs a dry run deployment to validate your project against the current account. It helps ensure that all configurations and customizations in your SuiteScript Development Framework (SDF) project are correct and compatible with the target account. By performing a dry run, you can identify and address any potential issues before performing an actual deployment, reducing the risk of errors during the deployment process.
suitecloud project:deploy --dryrun && suitecloud project:deploy && npm run sdf:create:checkpoint
This command runs a validation, deploys the project, and then creates a "checkpoint." The checkpoint is a commit that includes the name of the account and a timestamp in the following format:
Account: <account_name> | Checkpoint: <timestamp>
This ensures that the project is validated and deployed successfully, and a historical record of the deployment is maintained for reference and rollback purposes.
The import-files script.
This command allows you to update all files in a project at once by executing the import-files script. This ensures that all the latest changes are imported and synchronized with the project files, streamlining the update process.
The update-objects script.
This command updates all objects in a project at once by executing the update-objects script. It ensures that all the latest changes to objects are imported and synchronized with the project, streamlining the update process.
The update-objects script and then the import-files script.
This command combines the update-objects script and the import-files script to update both objects and files in the project. It ensures that all changes to objects and files are imported and synchronized with the project, streamlining the update process by handling everything together.
npm run sdf:update:all
and then executes the commit-changes script.
This command first runs npm run sdf:update:all, which updates both objects and files in the project. It then executes the commit-changes script, which creates a commit message containing the name of the account and a timestamp. Additionally, if the current branch is protected (main/master by default), it will run the pre-commit validation to ensure all changes meet the required standards before committing.
The create-branch script.
This command executes the create-branch script, which automates the process of creating a new branch in the project. The script performs the following steps:
- Runs npm run sdf:create:checkpoint to create an initial checkpoint.
- Prompts the user to specify the purpose of the branch (either "feature" or "fix").
- Prompts the user to provide the name for the new branch.
- Creates the new branch using the specified purpose and name.
- Prompts the user to select the account from which the new branch will be updated by running suitecloud account:setup -i.
- Runs npm run sdf:create:checkpoint again to create a checkpoint for the new branch.
The commit-changes script creates a commit message with the account name and a timestamp. If the current branch is protected (main/master by default), it will run the pre-commit validation.