Skip to content

Commit 5271449

Browse files
committed
📝 Updating Docs [ci skip]
1 parent 38421bf commit 5271449

7 files changed

Lines changed: 330 additions & 315 deletions

File tree

README.md

Lines changed: 88 additions & 111 deletions
Large diffs are not rendered by default.

docs/assets/templates/clean-jsdoc-theme.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/private/data/web.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<configuration>
3+
<system.web>
4+
<compilation debug="false" />
5+
<!-- Unless specified in a sub-folder's Web.config file,
6+
any user can access any resource in the site -->
7+
<authorization>
8+
<allow users="*" />
9+
</authorization>
10+
</system.web>
11+
</configuration>

docs/private/web.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0"?>
2+
<configuration>
3+
<system.web>
4+
<!-- Anonymous users are denied access to this folder (and its subfolders) -->
5+
<authorization>
6+
<deny users="?" />
7+
</authorization>
8+
</system.web>
9+
</configuration>

test-report.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuites>
3+
<testsuite id="0" name="/home/runner/work/NetSuite-CustomModules-Template/NetSuite-CustomModules-Template/__tests__/Modules/aModule-test.js" errors="0" package="/home/runner/work/NetSuite-CustomModules-Template/NetSuite-CustomModules-Template/__tests__/Modules/aModule-test.js" hostname="localhost" tests="5" failures="0" time="0.64" timestamp="2023-12-04T04:57:31">
4+
<properties>
5+
</properties>
6+
<testcase classname="test exec GetVendorPrefix" name="should not throw any errors" time="0">
7+
</testcase>
8+
<testcase classname="test exec GetVendorPrefix" name="Should be JD- when VendorId == 55321" time="0">
9+
</testcase>
10+
<testcase classname="test exec GetVendorPrefix" name="Should be AJ- when VendorId == 55322" time="0">
11+
</testcase>
12+
<testcase classname="test exec RunQuery" name="should not throw any errors" time="0">
13+
</testcase>
14+
<testcase classname="test exec RunQuery" name="Should be JD- when VendorId == 55321" time="0">
15+
</testcase>
16+
<system-out/>
17+
<system-err/>
18+
</testsuite>
19+
<testsuite id="1" name="/home/runner/work/NetSuite-CustomModules-Template/NetSuite-CustomModules-Template/__tests__/CS/customModule_CS-test.js" errors="0" package="/home/runner/work/NetSuite-CustomModules-Template/NetSuite-CustomModules-Template/__tests__/CS/customModule_CS-test.js" hostname="localhost" tests="8" failures="0" time="0.705" timestamp="2023-12-04T04:57:31">
20+
<properties>
21+
</properties>
22+
<testcase classname="pageInit error handling" name="should catch any errors" time="0">
23+
</testcase>
24+
<testcase classname="pageInit error handling" name="should catch error when currentRecord property is not available" time="0">
25+
</testcase>
26+
<testcase classname="test pageInit" name="should call set_CustomFieldValue using bModule" time="0">
27+
</testcase>
28+
<testcase classname="test pageInit" name="should run 2 log audits &amp; 1 debug log" time="0">
29+
</testcase>
30+
<testcase classname="test pageInit" name="Should call GetVendorPrefix from aModule" time="0">
31+
</testcase>
32+
<testcase classname="test errors" name="Should not throw any errors" time="0">
33+
</testcase>
34+
<testcase classname="test errors" name="Should catch errors" time="0">
35+
</testcase>
36+
<testcase classname="test errors" name="Doesn&apos;t allow save if no currentRecord property found" time="0">
37+
</testcase>
38+
<system-out/>
39+
<system-err/>
40+
</testsuite>
41+
</testsuites>

wiki/HOME.md

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# 🚀 NetSuite SuiteScript Project Template: Module Testing & CI/CD Integration
2+
3+
## 🚀 Introduction
4+
5+
Welcome to the NetSuite SuiteScript Project Template - a cutting-edge solution tailored for module testing and CI/CD integration within the NetSuite ecosystem. This project is meticulously aligned with **NS 2023.2**, ensuring up-to-date compatibility and performance.
6+
7+
Designed to work seamlessly with the [NetSuite-Cust-Jest-Stubs-Template](https://github.com/devnetkc/NetSuite-Cust-Jest-Stubs-Template), this template stands as a pivotal tool for NetSuite developers. It facilitates the creation, testing, and deployment of custom SuiteScript modules, promoting efficiency and reliability in the development process.
8+
9+
### Core Features
10+
11+
- **SuiteScript Module Development:** Crafted specifically for SuiteScript, it acts as an essential starting point for scripting, adhering to NetSuite's best practices and standards.
12+
- **Automated Module Testing:** Integrating Jest for automated testing, it ensures your SuiteScript modules function flawlessly, enhancing code reliability.
13+
- **Custom Stub Integration:** Allows for the integration of custom Jest stubs, simulating NetSuite's API for isolated testing.
14+
- **CI/CD Integration:** Comes with pre-configured Azure Pipeline configurations, automating the integration and deployment processes.
15+
- **Documentation Generation:** Utilizes JSDoc comments and Markdown for automatic, detailed documentation of SuiteScript modules.
16+
17+
Local aliases for SuiteScript modules are effectively managed using the `/SuiteScript/...` path, ensuring compatibility with the NetSuite SuiteScript root directory `/SuiteScripts/`. This feature simplifies the management of scripts and aligns with NetSuite's directory structure.
18+
19+
### Targeted Use Cases
20+
21+
- **NetSuite SuiteScript Developers:** Ideal for crafting and managing custom scripts within NetSuite.
22+
- **Quality Assurance and Testing:** Ensures rigorous testing routines for NetSuite customizations.
23+
- **CI/CD Pipeline Integration:** Seamlessly integrates SuiteScript development into CI/CD workflows.
24+
- **Documentation and Maintenance:** Automates documentation for easy maintenance and understanding of scripts.
25+
26+
Leverage this template to elevate your SuiteScript development workflow, ensuring robust, well-tested, and efficiently integrated scripts within your NetSuite environment.
27+
28+
## 🎉 Getting Started
29+
30+
1. Open [`./package.json`](./package.json) and customize the project configuration.
31+
2. Add your `ExcludeStubs` path aliases to [`jest.config.js`](./jest.config.js).
32+
3. Create a local environment variable `NPM_TOKEN` using your NPM token (variable name can be changed in [`.npmrc`](./.npmrc)).
33+
4. Run `npm i` to install project dependencies.
34+
5. Run `npm run generate-manifests` to create `deploy.xml` and `manifest.xml`, essential for SuiteCloud tools.
35+
6. Setup SuiteCloud account details:
36+
- CLI (update `$()` variables with your values): `npm run setup-server --sourcebranch=$(SOURCEBRANCH) --headbranch=$(HEADBRANCH) --account=$(ACCOUNT) --authid=$(AUTHID) --tokenid=$(TOKENID) --tokensecret=$(TOKENSECRET)`
37+
- VSCode: Open command pallet (`CMD + SHIFT + p` on MacOS, `CTRL + SHIFT + p` on Windows), then select & run `SuiteCloud: Set Up Account`.
38+
39+
## 🧐 Notable Files
40+
41+
- [`manifest.tpl.xml`](./ci/templates/manifest.tpl.xml) - Template for SuiteCloud project manifest. (Project Name Change Required)
42+
- [`README.hbs`](./.ci/templates/README.hbs) - Base template for generating project README.md.
43+
- [`npmrc`](./.npmrc) - NPM environment token loader for publishing (variable name `NPM_TOKEN` can be changed).
44+
- [`docsMD.config`](./.ci/config/docsMD.config.js) - Generator for Markdown documentation from JSDoc notations.
45+
- [`jsDocsConf.json`](./.ci/config/jsDocsConf.json) - Configuration for JSDoc generation. Update `base_url` from `localhost` for hosted documentation.
46+
- New scripts like `flattenObjectPath.sh`, `rmDependents.sh`, and `web.config.private` for improved project management.
47+
48+
## 🔨 Scripts
49+
50+
Use `npm run <script>` to execute various project commands:
51+
52+
- `npm run test` - Run tests using Jest. (See [Running Tests](#-running-tests) for details.)
53+
- `npm run docs` - Generate project documentation from JSDoc notations (configure with [docsMD.config](./.ci/config/docsMD.config.js) & [jsDocsConf.json](./.ci/config/jsDocsConf.json)).
54+
- `npm run open-docs` - Open documentation in a browser for viewing.
55+
- `npm run generate-manifests` - Generate `deploy.xml` & `manifest.xml` for SuiteCloud.
56+
- `npm run generate-manifests --headbranch=main --sourcebranch=dev` - Generate change-based `deploy.xml` & `manifest.xml`.
57+
58+
### ✅ Running Tests
59+
60+
- `npm run test` - Run Jest tests in `./__tests__`.
61+
- `npm run test-ci` - Run Jest tests in CI mode, creating junit reports.
62+
- `npm run test --watch=watch` - Run Jest tests in watch mode.
63+
- `npm run view-coverage` - Run tests and open coverage report.
64+
65+
#### Wallaby.js
66+
67+
[![Wallaby.js](https://img.shields.io/badge/wallaby.js-powered-blue.svg?style=flat&logo=github)](https://wallabyjs.com/oss/)
68+
69+
Repository contributors can use the [Wallaby.js OSS License](https://wallabyjs.com/oss/) for immediate test results.
70+
71+
## 👷 CI/CD
72+
73+
Azure yaml pipeline files in [`.ci/workflows`](./.ci/workflows) are designed to automate and streamline the CI/CD processes for different deployment scenarios:
74+
75+
- [`azure-pipelines-docs.yml`](./.ci/workflows/azure-pipelines-docs.yml): Generates project documentation based on JSDoc comments, commits the changes, and pushes them back to the current PR or branch. This ensures that the documentation is always up-to-date with the codebase.
76+
- [`azure-pipelines-build-deploy.yml`](./.ci/workflows/azure-pipelines-build-deploy.yml): Executes Jest tests, generates a change-based `deploy.xml`, updates manifest dependencies, and uses the SuiteCloud CLI to deploy the project to NetSuite. This pipeline ensures that only tested and verified changes are deployed.
77+
- [`azure-pipelines-build-prod.yml`](./.ci/workflows/azure-pipelines-build-prod.yml): Tailored for production environment deployments. It validates production pull requests and creates a release for the main branch.
78+
- [`azure-pipelines-build-sb.yml`](./.ci/workflows/azure-pipelines-build-sb.yml): Focused on deployments to a Sandbox 1 environment. It facilitates testing and validation in a sandbox before changes are moved to production.
79+
- [`azure-pipelines-build-sb2.yml`](./.ci/workflows/azure-pipelines-build-sb2.yml): Similar to `azure-pipelines-build-sb.yml` but targets a Sandbox 2 environment, providing an additional layer of testing or for separate feature testing.
80+
- [`azure-pipelines-select-branch.yml`](./.ci/workflows/azure-pipelines-select-branch.yml): Assists in determining the source branch for a pull request, ensuring that the correct branch is used for comparisons and deployments in CI/CD processes.
81+
- [`azure-pipelines-validate-prod-pr.yml`](./.ci/workflows/azure-pipelines-validate-prod-pr.yml): Validates pull requests against the production branch, ensuring that only approved and compliant changes are merged.
82+
83+
These pipelines collectively support a robust and flexible CI/CD process, enabling automatic testing, documentation updates, and deployment to various environments, ensuring consistency and reliability in software delivery.
84+
85+
86+
## 📝 Documentation
87+
88+
Comprehensive project documentation is available, detailing setup, configuration, and usage instructions.
89+
90+
## Modules
91+
92+
<dl>
93+
<dt><a href="#module_csExampleModule_CS">csExampleModule_CS</a></dt>
94+
<dd><p>Your custom NetSuite Client Script module</p>
95+
</dd>
96+
<dt><a href="#module_aModule">aModule</a></dt>
97+
<dd><p>This is example custom NetSuite module A. It may or may not be in your SuiteCloud project.
98+
Update your <code>jest.config.js</code> to map this module from the stub pkg to your local project if it is available.
99+
See project <code>jest.config.js</code> for further examples of this.</p>
100+
</dd>
101+
<dt><a href="#module_/SuiteScripts/Modules/aModule">/SuiteScripts/Modules/aModule</a></dt>
102+
<dd><p>NetSuite module A export function</p>
103+
</dd>
104+
</dl>
105+
106+
## Functions
107+
108+
<dl>
109+
<dt><a href="#exp_module_/SuiteScripts/CS/csExampleModule_CS--csExampleModule_CS">csExampleModule_CS(log, aModule, bModule)</a> ⏏</dt>
110+
<dd><p>Custom NetSuite Client Script module export function</p>
111+
</dd>
112+
</dl>
113+
114+
<a name="module_csExampleModule_CS"></a>
115+
116+
## csExampleModule\_CS
117+
Your custom NetSuite Client Script module
118+
119+
**Summary**: This is example custom NetSuite Client Script module. It may or may not be in your SuiteCloud project.
120+
Update your `jest.config.js` to map this module from the stub pkg to your local project if it is available.
121+
See project `jest.config.js` for further examples of this.
122+
**Format**:
123+
**Napiversion**: 2.1
124+
**Since**: 2022.2
125+
**Version**: 1.0.0
126+
**License**: NApiVersion
127+
<a name="module_aModule"></a>
128+
129+
## aModule
130+
This is example custom NetSuite module A. It may or may not be in your SuiteCloud project.
131+
Update your `jest.config.js` to map this module from the stub pkg to your local project if it is available.
132+
See project `jest.config.js` for further examples of this.
133+
134+
**Format**:
135+
**Napiversion**: 2.1
136+
**Since**: 2022.2
137+
**Version**: 1.0.0
138+
**License**: NApiVersion
139+
<a name="module_/SuiteScripts/Modules/aModule"></a>
140+
141+
## /SuiteScripts/Modules/aModule
142+
NetSuite module A export function
143+
144+
145+
| Param | Type | Description |
146+
| --- | --- | --- |
147+
| query | <code>Object</code> | NS query module |
148+
| log | <code>Object</code> | NS log module |
149+
150+
151+
* [/SuiteScripts/Modules/aModule](#module_/SuiteScripts/Modules/aModule)
152+
* [.GetVendorPrefix(vendorId)](#module_/SuiteScripts/Modules/aModule.GetVendorPrefix) ⇒ <code>String</code>
153+
* [.RunQuery(vendorId)](#module_/SuiteScripts/Modules/aModule.RunQuery) ⇒ <code>String</code>
154+
155+
<a name="module_/SuiteScripts/Modules/aModule.GetVendorPrefix"></a>
156+
157+
### /SuiteScripts/Modules/aModule.GetVendorPrefix(vendorId) ⇒ <code>String</code>
158+
Returns preferred vendor prefix from record or blank if no prefix is located
159+
160+
**Kind**: static method of [<code>/SuiteScripts/Modules/aModule</code>](#module_/SuiteScripts/Modules/aModule)
161+
162+
| Param | Type | Description |
163+
| --- | --- | --- |
164+
| vendorId | <code>String</code> | Entity ID of vendor Ex: `4321` |
165+
166+
<a name="module_/SuiteScripts/Modules/aModule.RunQuery"></a>
167+
168+
### /SuiteScripts/Modules/aModule.RunQuery(vendorId) ⇒ <code>String</code>
169+
Returns query result of vendor prefix from vendor record
170+
171+
**Kind**: static method of [<code>/SuiteScripts/Modules/aModule</code>](#module_/SuiteScripts/Modules/aModule)
172+
**Returns**: <code>String</code> - - Returns vendor prefix string from query result
173+
**Access**: protected
174+
175+
| Param | Type | Description |
176+
| --- | --- | --- |
177+
| vendorId | <code>String</code> | Vendor entity ID to run query on |
178+
179+
180+
Happy Coding! 🥳

0 commit comments

Comments
 (0)