SuiteScript Generator will create SuiteScript file with predefined values
npm install suitescript-generator* author: Michal Tvrdy | mich510 |
* The original scripts snippets are taken from: !GitHub burkybang
Run:
``sh`
npm install suitescript-generator
After installation the config folder will be created in your project root directory.
Go to config/default.json and set the paths where the generated SuiteScripts files will be stored including the default author name and the file name will contain pre-defined prefix and suffix for each script type
`json`
{
"scriptPaths": {
"defaultPath": "./generatedScripts/",
"uePath": "./generatedScripts/UserEvent/",
"clPath": "./generatedScripts/Client/",
"mrPath": "./generatedScripts/MapReduce/",
"slPath": "./generatedScripts/Suitelet/",
"wfaPath": "./generatedScripts/WorkflowAction/"
},
"userDetails": {
"defaultAuthorName": "Jan Novak",
},
"fileOptions": {
"scriptPrefix_UE": "xyz_",
"scriptSuffix_UE": "_UE",
"scriptPrefix_CL": "xyz_",
"scriptSuffix_CL": "_CL",
"scriptPrefix_MR": "xyz_",
"scriptSuffix_MR": "_MR",
"scriptPrefix_WFA": "xyz_",
"scriptSuffix_WFA": "_WFA",
"scriptPrefix_SL": "xyz_",
"scriptSuffix_SL": "_SL"
}
}
Go to package.json and add following line to scripts section:
`json`
{
"suitescript-generator": "node node_modules/suitescript-generator/index.js"
}
`shell`
$ npm run suitescript-generator
The interactive guide will popup. Select the script type, provide your credentials and info. App will then create a new SuiteScript script file with the information in the folder defined in the config file.
`shell`
$ npm run suitescript-generator -- -n
Using the parameters you can create a script without interactive mode on single line. If the author_name is defined in the config, it can be excluded.
For the script type parameter, use following:
* Client Script
* User Event
* Map Reduce
* Workflow Action
* Suitelet
`shell``
$ npm run suitescript-generator -- --help
Using -help param you can list all the required params
Copyright (c) 2022 Michal Tvrdy
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.