Folder Structure for SuiteCommerce Extensions Development
Understand the folder structure for SuiteCommerce extensions, including assets, modules, and entry points for best practices.
The folder structure for SuiteCommerce extensions is crucial for organizing your development environment effectively. It dictates how your code is structured and how various components interact. Below, we'll break down the key aspects of the folder structure and provide useful code samples to assist in your development process.
Understanding the Folder Structure
The primary directory for your extension will reside in a top-level development directory under a folder named after your extension. Each extension gets its own subdirectory within the Workspace directory. Within this subdirectory, a Modules folder usually contains your extension’s modules. Here’s an example layout:
1<TopLevelDevelopmentDirectory>2 Workspace3 MyCoolExtension4 assets5 Modules6 MyCoolModule7 manifest.jsonModule Folder Flexibility
It's important to note that while the default convention is to name each module folder after the extension, you are not strictly required to do so. Your directory can adopt any naming scheme that fits your project. Below is another potential structure:
1<TopLevelDevelopmentDirectory>2 Workspace3 MyCoolExtension4 assets5 Modules6 ModuleOne7 JavaScript8 ModuleOne.js9 ModuleTwo10 JavaScript11 ModuleTwo.js12 manifest.jsonCreating Entry Point Files
To allow your modules to integrate properly with the SuiteCommerce framework, you will create entry point files in your module directories. Below is an example of how to structure these files:
1define('ModuleOne'2, [3 // dependencies4]5, function6 () {7 'use strict';8 9 return {10 mountToApp: function () {11 console.log('ModuleOne loaded!');12 }13 };14})Note that for ModuleTwo.js, you should change ModuleOne in the definition to ModuleTwo accordingly. This modular approach allows flexibility in your coding strategy and promotes reusability across your SuiteCommerce projects.
Best Practices
- Consistency: Maintain a consistent naming convention for your modules to ensure clarity.
- Documentation: Keep your modules well-documented to assist future development or team collaboration.
- Avoid Manual Edits: As a best practice, do not manually edit files within the generated directories to prevent issues.
By adhering to this structure and following these best practices, you will facilitate a more organized and manageable development experience in SuiteCommerce.
Key Components of the Directory:
| File/Folder | Description |
|---|---|
Modules | Contains all modules related to your extension. |
manifest.json | Defines the metadata for your extension. |
assets | Typically contains static files required by your extension. |
Understanding the folder structure not only improves your workflow but also leverages the full potential of SuiteCommerce development capabilities.
Frequently Asked Questions (4)
What is the purpose of the 'manifest.json' file in a SuiteCommerce extension?
Can I use a custom naming scheme for module folders within a SuiteCommerce extension?
Where should the entry point files be located in a SuiteCommerce extension folder structure?
What should I avoid doing with the generated directory files in SuiteCommerce?
Was this article helpful?
More in SuiteCloud Development Framework
- Enhancements to Custom Tool Scripts in NetSuite 2026.1
NetSuite 2026.1 improves custom tool scripts with execution logs, management page, and binary file support. TL;DR Opening
- SuiteCloud CLI for Node.js: New Features in NetSuite 2026.1
Explore new features in SuiteCloud CLI for Node.js for streamlined development in NetSuite 2026.1.
- beforeUndeploy Installation Hook in NetSuite 2026.1
Introducing the beforeUndeploy installation hook in NetSuite 2026.1 for custom pre-uninstall logic in SuiteApps.
- SuiteCloud CLI for Java: Features and Automation in NetSuite
Enhance development workflows with SuiteCloud CLI for Java in NetSuite 2026.1. Explore its automation features and benefits.
Advertising
Reach SuiteCloud Development Framework Professionals
Put your product in front of NetSuite experts who work with SuiteCloud Development Framework every day.
Sponsor This Category