Research Checklist: SuiteScript Compatibility with Third-Party Libraries

April 29, 2024 | 6 minute read
Mohammed Kassem
SuiteCloud Advocate
Text Size 100%:

You should start with known build time and run-time libraries that are compatible and applicable with the SuiteScript 2.1 environment because they are easier to integrate. But, if you like a library and it isn’t on the list of known libraries, use the checklist below to determine where the library fits on the spectrum of compatibility.

Click here to access a list of known SuiteScript 2.1-compatible build time and runtime libraries

Once you’ve identified a library you’d like to use in your project, ask yourself two important questions:

  1. Can I use it? Verify that the library is compatible with SuiteScript's runtime environment. The library's programming language and runtime requirements must be compatible with SuiteScript 2.1. If integrating the library impacts performance, explore alternative libraries or approaches.
  2. Should I use it? The library should be widely used, open-source, reliable, actively maintained, and written well. Also, assess the impact of the library on application performance before deciding to use it.

Disclaimer: The third-party library checklist is made to build confidence in your research. The best way to ensure compatibility with SuiteScript is to test the library in a sandbox account and perform compatibility and performance testing.

Library Compatibility & Suitability Checklist

Here’s my exclusive third-party library compatibility checklist used to assess a library’s compatibility and suitability for SuiteCloud projects:

Can I use it?

  • Language and runtime?
  • Standard library (APIs) + tools?

Should I use it?

  • Widely used?
  • Open source?
  • Popular?
  • Reliable (author, tech)?
  • Actively maintained?
  • Written well?
  • Used for core features?
  • Does it meet your specific needs?
  • Correct license to use?
  • Does it impact app performance?

Explore the library's GitHub repository to get valuable insights into the library’s functionality, maintenance, and community engagement.

For example, let’s review the Lodash GitHub Repository:

[EK3]

First, look at the package.json file since it provides details on engine compatibility and development dependencies.

  • engines: Specifies the Node.js version compatibility range for the library and provides information on the environment the library is designed to run in. However, it does not guarantee compatibility with SuiteScript.
  • devDependencies: Lists dependencies required for development but not included in the final distributed version.

Now look for the following metrics (watchers, forks, stars, last commit date, and contributors) to gauge the library's popularity, activity level, and ongoing support.

  • Watchers: The number of users who are actively tracking the repository for updates. A higher number generally indicates greater interest in the library.
  • Forks: The number of times the repository has been copied and modified by other users. It suggests potential community engagement and adaptation of the library.
  • Stars: The number of users who have "starred" the repository, signifying their interest and potential future use.
  • Last commit date: The date of the most recent code change in the repository. Frequent commits often indicate active development and maintenance.
  • Contributors: The number of individuals who have contributed code to the repository. A larger number suggests a more diverse and potentially robust codebase.

Environment Agnostic Libraries: UMD and Pure JavaScript Fallback

In addition to the research list, be on the lookout for libraries that have UMD and pure JavaScript fallbacks. These libraries are designed to work independently of any specific environment APIs and the pure JavaScript fallback that makes the library compatible across different JavaScript environments. This fallback approach ensures that the library can function even if certain environmental features are absent or behave differently than expected.

To identify if a library has a JavaScript fallback, you can find this information in the library's documentation or source code.

Can I use it?

  •  Environment agnostic language? Search for terms like "universal," "isomorphic," or "environment-agnostic" within the library's repository or documentation.
  •  UMD.js? Check the library source code for umd.js (Universal Module Definition), which is a common way to offer compatibility across different module systems. Also, libraries with fallbacks often check for the type of environment they are running in, using conditions that check for objects like window or global.
  •  Node.js + browser environment? Look into the library's package.json file for browser-specific fields or scripts. Libraries that are meant to work in both Node.js and browser environments often include these.

Some libraries that have an umd.js file include Zod, jQuery, Lodash, D3.js, and Underscore. Here’s an example of Zod’s fallback function in umd.js:

function (global, factory) {
   typeof exports === 'object'
   && typeof module !== 'undefined' ? factory(exports) :
   typeof define === 'function'
   && define.amd ? define(['exports'], factory) :
   (global = typeof globalThis !== 'undefined' ? globalThis : global    || self, factory(global.Zod = {}));

For a deeper dive into UMD library-compatible libraries and how to integrate them into your SuiteCloud project, click here.

Interested in using Zod for run-time data validation? Read my walkthrough on Enhancing SuiteScript with TypeScript, Zod, and Webpack.

Community Engagement and Resource Utilization

The SuiteScript community is rich with knowledge and resources, offering a wealth of insights and experiences. It’s likely that other SuiteScript developers have encountered and overcome similar challenges.

Here is a list of resources to research libraries and communities to keep up with the latest trends, deepen your understanding of library dependencies, find alternative solutions, and navigate through obstacles:

Platform

Description

NS Professionals

Community Slack channel with experts specializing in NetSuite.

User Groups 

Communities with shared interests within NetSuite.

Libraries.io

Platform to find new libraries and insights into dependencies.

Awesome Lists

Curated lists of awesome libraries with compatibility details.

npm

Largest JavaScript package registry for compatibility info.

GitHub

Hub for open-source projects and compatibility insights.

Stack Overflow

Q&A platform for compatibility discussions and solutions.

Conclusion

If a library satisfies all the necessary criteria in your new compatibility checklist, you’re ready to integrate it into your SuiteCloud project and test the library's performance in the SuiteScript 2.1 environment. Follow this guide to learn how to integrate AMD, non-AMD, and UMD libraries into your SuiteCloud ProjectRemember, the SuiteScript community is a valuable resource. Tap into their collective knowledge to find insights on specific libraries and share your own experiences to help others. By working together, we can continuously contribute to the developer ecosystem with a growing list of SuiteScript build-time and run-time compatible libraries.

if you'd like to take a step back and learn about SuiteScript 2.1 spectrum of compatibility and how to approach integration, then read my first article of this series on Navigating Third-Party Library Compability in SuiteScript 2.1.

Mohammed Kassem

SuiteCloud Advocate