node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

nsify

nsify NPM version

Build Status Coveralls Status

NetSuite-side require() the node.js

You can use require() the node.js freely on yours JavaScripts.

Required

  • node.js 4+

Install Dependency Status devDependency Status

    sudo npm install nsify -g

Command Line

Generate your SuiteScripts:

    nsify ./test/_files/RE-process-restlet.js >> suite-script-process-restlet.js

Usage NS Annotations

var nsify = require('nsify'),
    filePath = './test/_files/custom/schedule-simple.js',
    nsObj = nsify.annotation(filePath);
 
console.log(nsObj); // see output 
{
    "id": "sp-schedule",
    "type": "schedule",
    "alias": "MySchedule",
    "function": "MySchedule.process",
    "libs": [
        "my-lib.js"
    ],
    "params": {
        "param1": {"name": "Param 1", "type": "INTEGER"}
    }
}

Compatibility with nsmockup

var nsify = require('nsify'),
    nsmockup = require('nsmockup');
 
 
nsmockup.init(function() {
    let filePath = './test/_files/custom/schedule-simple.js',
        script = nsify.annotation(filePath, 'nsmockup');
 
    console.log(script); // see output 
    
    nsmockup.createSuiteScript(script.type, script, function($ctx) {
        let alias = script.alias;
        if ($ctx[alias]) {
            console.log(':D works!!');
        }
    });
});