Commit d0e2af3d authored by Eric T Grubaugh's avatar Eric T Grubaugh 🎯
Browse files

Initial repo creation and addition of hello-world examples

parents
# Name <email> (url)
Eric T Grubaugh <eric@stoic.software> (https://stoic.software/)
Have an example to add? Great! Here's how you can help:
1. Clone the repo
`git clone git@gitlab.com:stoicsoftware/learn-suitescript.git`
1. Create a new feature branch for your example
`git checkout -b feature/my-example-name`
1. Create and commit your example
1. Submit a Merge Request for your example's feature branch
The MIT License (MIT)
Copyright (c) 2016 Stoic Software
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.
## NetSuite Scaffolding
A project scaffold for npm-based NetSuite projects.
#### Example Directory structure
```
/
FileCabinet/SuiteScripts/ - Corresponds to the SuiteScripts directory of the NetSuite account
app1/ - The top-level directory for your SuiteApp source
lib/ - Common/helper modules for your SuiteApp
module1/ - source files for module named "module1"
anotherModule/ - source files for module named "anotherModule"
mySuitelet.js - Suitelet entry point script
aUserEvent.js - User Event entry point script
test/ - Test source
module1/ - test files for module named "module1"
doCalculationTest.js - test file for "doCalculation" function in module1
doAnotherCalculationTest.js - test file for "doAnotherCalculation" function in module1
anotherModule/ - test files for "anotherModule" module
doc/ - Documentation for your SuiteApp
examples/ - Example scripts/code for using your SuiteApp
```
*Recommendations*
* Place your NetSuite entry-point source files (e.g. User Events, Suitelets, etc) in the root of the SuiteApp source folder
* Extract the common business logic into library files/modules, and place them in their own module folders under `lib`
* Organize your `test` directory by the file and function under test
#### Default dependencies
* [jsdoc](https://www.npmjs.com/package/jsdoc) - Documentation generator
* [eslint](https://www.npmjs.com/package/eslint) - Code linter
* [eslint-plugin-suitescript](https://www.npmjs.com/package/eslint-plugin-suitescript) - Environment plugin for `eslint` that adds SuiteScript globals
* [mocha](https://www.npmjs.com/package/mocha) - Test framework
* [should](https://www.npmjs.com/package/should) - BDD-style assertion library
/**
* A simple "Hello, World!" example of a Client Script. Uses the `pageInit`
* event to write a message to the console log.
*/
function pageInit(type) {
console.log("Hello, World from a 1.0 Client Script!");
}
define([], function () {
/**
* A simple "Hello, World!" example of a Client Script. Uses the `pageInit`
* event to write a message to the console log.
*
* @NApiVersion 2.x
* @NModuleScope Public
* @NScriptType ClientScript
*/
var exports = {};
function pageInit(context) {
console.log("Hello, World from a 2.0 Client Script!");
}
exports.pageInit = pageInit;
return exports;
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment