Folder Structure for SuiteCommerce Extensions Development

Understand the folder structure for SuiteCommerce extensions, including assets, modules, and entry points for best practices.

·2 min read·View Oracle Docs

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:

none
1<TopLevelDevelopmentDirectory>
2 Workspace
3 MyCoolExtension
4 assets
5 Modules
6 MyCoolModule
7 manifest.json

Module 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:

none
1<TopLevelDevelopmentDirectory>
2 Workspace
3 MyCoolExtension
4 assets
5 Modules
6 ModuleOne
7 JavaScript
8 ModuleOne.js
9 ModuleTwo
10 JavaScript
11 ModuleTwo.js
12 manifest.json

Creating 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:

javascript
1"text-purple-400">define('ModuleOne'
2, [
3 // dependencies
4]
5, "text-purple-400">function
6 () {
7 'use strict';
8
9 "text-purple-400">return {
10 mountToApp: "text-purple-400">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/FolderDescription
ModulesContains all modules related to your extension.
manifest.jsonDefines the metadata for your extension.
assetsTypically 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?
The 'manifest.json' file defines the metadata for your extension, which is essential for integrating your extension into the SuiteCommerce framework.
Can I use a custom naming scheme for module folders within a SuiteCommerce extension?
Yes, while the default is to name each module folder after the extension, you are not required to do so. You can adopt any naming scheme that fits your project.
Where should the entry point files be located in a SuiteCommerce extension folder structure?
Entry point files should be created within your module directories to ensure proper integration with the SuiteCommerce framework.
What should I avoid doing with the generated directory files in SuiteCommerce?
Avoid manually editing files within the generated directories, as this can lead to issues in your SuiteCommerce development process.
Source: Folder Structure Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in SuiteCloud Development Framework

View all SuiteCloud Development Framework articles →