@brokenrubik/ss-build-tools
v2.0.5
Published
## Usage on existing projects:
Downloads
65
Readme
SuiteScript Build Tools
Usage on existing projects:
- Install dependency in your project (started from ss-template)
npm i -D @brokenrubik/ss-build-tools@latest
Example package.json:
{
"scripts": {
"deploy": "ss-deploy",
"build": "ss-build",
"watch": "ss-watch"
}
}
Building
The default TypeScript source path is set to "src/TypeScript"
. If you want to specify a different path you can either:
- Use the TS_SOURCE_PATH environment variable
- Use the
--source-path
command line argument
For example:
{
"scripts": {
"build": "ss-build --source-path src/ts-files"
}
}
The output of the build command will be be placed in the outDir
specified in your tsconfig.json
file.
We recomend setting the outDir
to "src/FileCabinet/SuiteScripts/<Project Name>"
.
ss-build -js
flag
You can pass the -js
flag to the build command to copy files from the src/SuiteScripts
directory to the src/FileCAbinet/SuiteScripts
directory.
Deploying
Running the deploy command will automatically build, and pass the arguments. You can specify the source path in the same way as the build command.
The files in "src/FileCabinet/SuiteScripts"
will be deployed using suitecloud
commands.
Watch Mode (Experimental)
Running the watch command will automatically build and deploy on file changes.
This is useful for development, but it is not recommended to use this in production.
The watch mode will incrementally build the TypeScript output, and deploy files that have changed.
You can specify the source path in the same way as the build command. The default is "src/TypeScript"
.
{
"scripts": {
"watch": "ss-watch --source-path src/TypeScript"
}
}
Prefixing the project's File Cabinet directory
You can use the FILE_PATH
environment variable to prefix the project's dir.
For example, if you create a .env
file with:
FILE_PATH=my-custom-scripts
Then, only files under src/FileCabinet/SuiteScripts/my-custom-scripts
will be deployed.