@suitegeezus/suitecloud-stacker 25.2.129-5 → 25.2.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -124
- package/package.json +1 -1
- package/templates/customizations.projectroot.d.ts +1 -1
- package/CONTRIBUTING.md +0 -72
- package/commands/CONTRIBUTING.md +0 -7
- package/demo.md +0 -26
package/README.md
CHANGED
|
@@ -1,62 +1,12 @@
|
|
|
1
1
|
Contains helpers for SDF (Node CLI edition)
|
|
2
2
|
|
|
3
3
|
# Features
|
|
4
|
-
- Collection of pre-configured hooks (commands) to manage
|
|
4
|
+
- Collection of pre-configured hooks (commands) to manage customer accounts
|
|
5
5
|
- Collection of pre-configured hooks to manage the outer project
|
|
6
6
|
- Pre-defined handlers that you can pick and choose from for a given "command"
|
|
7
7
|
- Types for SDF commands
|
|
8
8
|
- command line enhancements
|
|
9
9
|
|
|
10
|
-
Missing: Collection of hooks to manage an entire instance -- Cuz we (ACS) don't do this but if you have your own instance / demo account then feel free to create your own suitecloud.config file and use the stackable structure. Note that most customers don't really do this either -- they often have outside devs who contribute at least sometimes
|
|
11
|
-
|
|
12
|
-
# Demos
|
|
13
|
-
|
|
14
|
-
## `account:setup:ci` : Token Auth Memory
|
|
15
|
-
Setup token auth for an account from existing token auths that you have with detection for conflicts and valid naming
|
|
16
|
-

|
|
17
|
-
|
|
18
|
-
## `project:create`: New Account
|
|
19
|
-
Create project to work on a case
|
|
20
|
-

|
|
21
|
-
|
|
22
|
-
## `project:create`: New Case on Account
|
|
23
|
-

|
|
24
|
-
|
|
25
|
-
## `file:upload`: Globbing that filters out irrelevant files
|
|
26
|
-

|
|
27
|
-
|
|
28
|
-
## `file:upload`: Upload all files from a deploy.xml file
|
|
29
|
-

|
|
30
|
-
|
|
31
|
-
## `file:upload`: Compile and / or run tests on files you are uploading
|
|
32
|
-

|
|
33
|
-
|
|
34
|
-
## `file:import`: Compare your current file with what is in the account
|
|
35
|
-

|
|
36
|
-
|
|
37
|
-
## `file:import`: Import files that match a glob pattern
|
|
38
|
-

|
|
39
|
-
|
|
40
|
-
## `file:import`: Import all files from a deploy.xml file
|
|
41
|
-
```shell
|
|
42
|
-
cd /SuiteScripts/ACS/casefolder
|
|
43
|
-
suitecloud file:import --paths ./deploy/deploy.xml
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## `object:import`: import objects that match a glob pattern
|
|
47
|
-

|
|
48
|
-
|
|
49
|
-
## `object:import`: import all objects that are listed in a chosen deploy.xml file
|
|
50
|
-

|
|
51
|
-
|
|
52
|
-
## `project:deploy`: Choose which project definition to deploy
|
|
53
|
-
|
|
54
|
-
## `object:import`: Import Objects will organize them into folders by type automatically
|
|
55
|
-

|
|
56
|
-
|
|
57
|
-
## Compile and test typescript as you write
|
|
58
|
-
;
|
|
59
|
-
|
|
60
10
|
# How SDF works in this project
|
|
61
11
|
|
|
62
12
|
SDF by default has a certain structure that makes the following (annoying?) assumptions:
|
|
@@ -67,8 +17,6 @@ The reason you would NOT want to use `src` is if you wanted to use the plugin to
|
|
|
67
17
|
- has extra stuff you don't want to put into the account by accident
|
|
68
18
|
- want to keep it separate
|
|
69
19
|
|
|
70
|
-
One emample in this project is that to do diffs it will automatically create a root `temp` for you.
|
|
71
|
-
|
|
72
20
|
## Attempts to facilitate any activity in an account-based project to be only for that account
|
|
73
21
|
For example, if you try to `file:upload` or `project:deploy` code it will prompt you for the account with only choices relevant to that project.
|
|
74
22
|
|
|
@@ -80,29 +28,19 @@ For example, if you try to `file:upload` or `project:deploy` code it will prompt
|
|
|
80
28
|
Should work same on Windows but i haven't tested it and i might have messed something up for windows so let me know if you have issues and you can help me fix them
|
|
81
29
|
|
|
82
30
|
1. Install SuiteCloud globally using the latest release version
|
|
31
|
+
see [`@suitegeezus/suitecloud-cli`](https://www.npmjs.com/package/@suitegeezus/suitecloud-cli)
|
|
32
|
+
read the documentation for it, to see the additional command line switches.
|
|
33
|
+
|
|
83
34
|
2. Optional: Install nodemon globally
|
|
84
35
|
```shell
|
|
85
36
|
npm install -g nodemon
|
|
86
37
|
```
|
|
87
|
-
3. Install a nice terminal that you like to use.
|
|
38
|
+
3. Optional: Install a nice terminal that you like to use.
|
|
88
39
|
- Highly recommend enhancing the mac shell with iTerm AND [Oh my Zsh!](https://ohmyz.sh/)
|
|
89
|
-
4. Optional:
|
|
90
|
-
- These are entitlements that will help you stay on the latest version of this repo and use customer repos
|
|
91
|
-
- If you can't then you can still use this for your testdrive accounts -- just ask me how
|
|
92
|
-
5. Optional: define `oraclegit` in your ssh **config** (highly recommended)
|
|
93
|
-
```txt
|
|
94
|
-
HOST oraclegit
|
|
95
|
-
User gerald.gillespie@fullscript.com
|
|
96
|
-
HostName alm.oraclecorp.com
|
|
97
|
-
TCPKeepAlive yes
|
|
98
|
-
AddKeysToAgent yes
|
|
99
|
-
UseKeyChain yes
|
|
100
|
-
IdentityFile ~/.ssh/ed25519ggoracle2
|
|
101
|
-
```
|
|
102
|
-
6. Optional: Create an environment variable for DIFF_TOOL
|
|
40
|
+
4. Optional: Create an environment variable for SUITECLOUD_DIFF_TOOL
|
|
103
41
|
```shell
|
|
104
|
-
#➜
|
|
105
|
-
export
|
|
42
|
+
#➜ set | grep 'DIFF'
|
|
43
|
+
export SUITECLOUD_DIFF_TOOL='/Applications/./IntelliJ\ IDEA.app/Contents/MacOS/idea'
|
|
106
44
|
```
|
|
107
45
|
|
|
108
46
|
### NetSuite pre-requisites
|
|
@@ -112,13 +50,10 @@ You will need to have:
|
|
|
112
50
|
- SuiteScript, etc enabled
|
|
113
51
|
|
|
114
52
|
## Install on Mac / Linux / Windows
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
git clone oraclegit:/nscs_suitecloud-stacker_114170/suitecloud-stacker-root.git
|
|
118
|
-
```
|
|
119
|
-
2. Run npm install
|
|
53
|
+
|
|
54
|
+
Run npm install
|
|
120
55
|
```shell
|
|
121
|
-
npm install
|
|
56
|
+
npm install @suitegeezus/suitecloud-stacker
|
|
122
57
|
```
|
|
123
58
|
|
|
124
59
|
# Usage: Hello World Example
|
|
@@ -128,29 +63,8 @@ npm install
|
|
|
128
63
|
|
|
129
64
|
|
|
130
65
|
|
|
131
|
-
## Pre-Defined Stacks for the Common scenario
|
|
132
|
-
- Collection of hooks meant for ACP subprojects (e.g. a specific case/ project)
|
|
133
|
-
```js
|
|
134
|
-
const safeCommands = require('suitecloud-stacker/safeCommands.js');
|
|
135
|
-
module.exports = {
|
|
136
|
-
...projectJson,
|
|
137
|
-
commands: {...safeCommands.caseCommands},
|
|
138
|
-
},
|
|
139
|
-
{debug: false, block: false},
|
|
140
|
-
module
|
|
141
|
-
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Spin up a new SDF project for a case
|
|
145
|
-
You can use this command to create your own case
|
|
146
|
-
```bash
|
|
147
|
-
cd ~/code/projectRoot
|
|
148
|
-
suitecloud project:create
|
|
149
|
-
# follow-the prompts
|
|
150
|
-
```
|
|
151
|
-
|
|
152
66
|
## Stackable / chaining structure for SDF command hooks
|
|
153
|
-
This means your
|
|
67
|
+
This means your sdf.config.js can specify or replace commands something like this:
|
|
154
68
|
|
|
155
69
|
```js
|
|
156
70
|
const commands = {
|
|
@@ -175,33 +89,29 @@ Also, don't bother with the IDE plugins. not only do they have their own limitat
|
|
|
175
89
|
|
|
176
90
|
This has the following usage
|
|
177
91
|
|
|
178
|
-
### `--authid`
|
|
179
|
-
supports a format like this `2452352:wut` where the value before the `:` is the authid and the value after the colon is the folder name.
|
|
180
|
-
|
|
181
|
-
if you only specify the first part without any colon then the same value is used for both. i.e. `2452352` is equivalent to `2452352:2452352`
|
|
182
|
-
|
|
183
|
-
you can create this anywhere. Wherever you create it you should invoke it from there.
|
|
184
|
-
e.g.
|
|
185
|
-
```bash
|
|
186
|
-
cd FileCabinet/SuiteScripts/folder
|
|
187
|
-
suitecloud
|
|
188
|
-
```
|
|
189
92
|
|
|
190
93
|
## working directory
|
|
191
|
-
|
|
94
|
+
`sdf` must be called from a directory that has a `sdf.config.js` file.
|
|
192
95
|
|
|
193
|
-
As such if you setup a project using native command and run it then it will work because that process will create a `
|
|
96
|
+
As such if you setup a project using native command and run it then it will work because that process will create a `sdf.config.js`.
|
|
194
97
|
|
|
195
|
-
It is recommended that you set your `
|
|
98
|
+
It is recommended that you set your `sdf.config.js` file to be the following:
|
|
196
99
|
|
|
197
100
|
```js
|
|
198
|
-
const
|
|
101
|
+
const safeCommands = require('@suitegeezus/suitecloud-stacker/safeCommands');
|
|
199
102
|
|
|
200
103
|
// create the commands that you want
|
|
201
104
|
const commands = {};
|
|
202
105
|
|
|
203
|
-
// pass them through the
|
|
204
|
-
|
|
106
|
+
// pass them through the stacker
|
|
107
|
+
safeCommands.makeSafeExports(
|
|
108
|
+
{
|
|
109
|
+
defaultProjectFolder: 'src',
|
|
110
|
+
commands: stackerCommands,
|
|
111
|
+
},
|
|
112
|
+
{debug: false, block: false, autoCreateProjectJson: false,},
|
|
113
|
+
module
|
|
114
|
+
);
|
|
205
115
|
```
|
|
206
116
|
|
|
207
117
|
# Errors
|
|
@@ -223,20 +133,18 @@ This should also be true of objects.
|
|
|
223
133
|
|
|
224
134
|
We can use SDF for both code (suitescripts) and objects.
|
|
225
135
|
|
|
226
|
-
Regardless of how many sandboxen
|
|
227
|
-
Regardless of what weird branching strategies
|
|
228
|
-
|
|
229
|
-
Regardless of how many cases are concurrently being worked on for a customer...
|
|
230
|
-
When we write code or create objects it is hella convenient and powerful to have both under source control and to use merging strategies that support the work we are doing for the customer.
|
|
136
|
+
Regardless of how many sandboxen you have...
|
|
137
|
+
Regardless of what weird branching strategies you might have... or don't have.
|
|
138
|
+
When we write code or create objects it is hella convenient and powerful to have both under source control and to use merging strategies that support the work we are doing...
|
|
231
139
|
|
|
232
|
-
In all of the above you can
|
|
140
|
+
In all of the above you can be end-user or a partner
|
|
233
141
|
|
|
234
|
-
So we have one folder for
|
|
142
|
+
So we have one folder for an account.
|
|
235
143
|
|
|
236
|
-
If
|
|
144
|
+
If you have sandboxes then we probably have multiple branches, but it doesn't matter. A "master" branch is our statement that this code is production worthy and ready to be vetted.
|
|
237
145
|
|
|
238
146
|
## But I don't want my customer to be a sub-folder in this project!
|
|
239
147
|
You don't have to.
|
|
240
|
-
There is nothing stopping you in git from (in fact it supports) having a subfolder be for a different repository.
|
|
148
|
+
There is nothing stopping you in git from (in fact it supports) having a subfolder be for a different repository.
|
|
241
149
|
|
|
242
150
|
Further, the ability to `pull` from source control does not mean that you will be able to `file:deploy` to the customer account. You still need to have an authenticated token to do that. And that probably means you'll need to have login privileges to the customer's account (production, sandbox or whatever).
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @file {1}
|
|
6
6
|
* - only use this once per account
|
|
7
|
-
* - this is auto-generated file based on a search of the account.
|
|
7
|
+
* - this is auto-generated file based on a search of the account.
|
|
8
8
|
* @author Gerald Gillespie <gerald.gillespie@fullscript.com>
|
|
9
9
|
*/
|
|
10
10
|
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
## the project type is 'commonjs'
|
|
2
|
-
suitecloud-cli will only look for a config with a `.js` and never a `.cjs` extension!! 😓
|
|
3
|
-
this conflicts with how suitescript unit tests are written which is with es6 modules.
|
|
4
|
-
It is possible to use modules with flags on node so that is what we will need to do.
|
|
5
|
-
This means certain files such as suitecloud.config.js may show some resolve errors. There are some other ways to get around this b
|
|
6
|
-
|
|
7
|
-
## Your authentication is setup correctly and you are definitely pushing or pulling from the implied environment
|
|
8
|
-
Unfortunately, we are human and make mistakes. But SDF doesn't care
|
|
9
|
-
When authentication is set it will just assume this is what you want and has no safety net.
|
|
10
|
-
|
|
11
|
-
this project solves this problem by:
|
|
12
|
-
- Using the `@suitegeezus/suitecloud-cli` which has an authid argument available
|
|
13
|
-
- requiring the authid to be passed onto the command line
|
|
14
|
-
- detecting it is set in the hooks
|
|
15
|
-
- optional: erasing the project.json file before and after every execution.
|
|
16
|
-
- prompting you to enter the same authid a second time during the action
|
|
17
|
-
|
|
18
|
-
# Testing
|
|
19
|
-
|
|
20
|
-
This project lacks unit tests. It was initially difficult to figure out how to test a cli such as suitecloud more effectively in a unit test than in on the command line itself especially because it did not publish its hook behaviour. So it was often better to test by running the commands locally.
|
|
21
|
-
|
|
22
|
-
However, there should be unit tests and the stackable system makes it easy to do so.
|
|
23
|
-
|
|
24
|
-
Running the compiler with `map` files and in watch mode helps a lot.
|
|
25
|
-
|
|
26
|
-
# Writing Code
|
|
27
|
-
All code needs to be in Typescript
|
|
28
|
-
|
|
29
|
-
Anything that is a stackable handler should be for a specific command and be in the `commands/` directory.
|
|
30
|
-
|
|
31
|
-
e.g. something for `file:import` goes in `commands/fileImport.ts`
|
|
32
|
-
|
|
33
|
-
Each handler should be function that return `SdfCommand` type. Which has this shape:
|
|
34
|
-
```ts
|
|
35
|
-
interface SdfCommand{
|
|
36
|
-
beforeExecuting?: <O>(options:O)=>Promise<O>;
|
|
37
|
-
onCompleted?: <O>(options:O)=>Promise<O>;
|
|
38
|
-
onError?: <S>(err:S)=>Promise<S>;
|
|
39
|
-
projectFolder?: string;
|
|
40
|
-
/** @description - non native but added for detection */
|
|
41
|
-
stacked: true;
|
|
42
|
-
isStackable: true;
|
|
43
|
-
_origin: string;
|
|
44
|
-
}
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Throwing Errors
|
|
48
|
-
- SDF only passes strings to `onError`
|
|
49
|
-
- SDF always prints the message
|
|
50
|
-
|
|
51
|
-
- so ....
|
|
52
|
-
You should call `makeError` when throwing errors. This will throw a serialized string but log the stack first.
|
|
53
|
-
```ts
|
|
54
|
-
throw onErrorHelper.makeError(origin, new Error('whatever'));
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Your `onError` method should be the returnType of `detectOriginAndReturn`
|
|
58
|
-
|
|
59
|
-
```ts
|
|
60
|
-
onError : async (error:string)=> onErrorHelper.detectOriginAndReturn(
|
|
61
|
-
origin, // : string,
|
|
62
|
-
error, // string-- the non-serialized message
|
|
63
|
-
(e: string /* this will only be the message portion */)=>{
|
|
64
|
-
// you can do things in here like
|
|
65
|
-
// - print a friendlier message when it's not a catastropich error
|
|
66
|
-
// - print a usage
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
```
|
|
70
|
-
If you need the results of an SDF command that is supported and you'll see examples
|
|
71
|
-
|
|
72
|
-
Anything that is re-usable should be somewhere in `sdf/lib`.
|
package/commands/CONTRIBUTING.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
In this folder each library should export handlers related to an SDF command.
|
|
2
|
-
|
|
3
|
-
e.g. fileImport.ts serves `file:import` related commands.
|
|
4
|
-
|
|
5
|
-
These handler should return sdf-expected methods and each method should be stackable / chainable. See [sdf/safeCommands/stack](../safeCommands.ts);
|
|
6
|
-
|
|
7
|
-
Tests would be great. Use proxies to glean the arguments that SDF passed in and use those as your mock options.
|
package/demo.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Overview / Features
|
|
2
|
-
|
|
3
|
-
* build a UserEvent that will help with adhoc debugging
|
|
4
|
-
* 3 different UEs
|
|
5
|
-
* separation of beforeLoad, beforeSubmit, afterSubmit
|
|
6
|
-
* deployable to any record
|
|
7
|
-
* easier ordering of rank
|
|
8
|
-
* each can launch other UEs
|
|
9
|
-
|
|
10
|
-
# Requirements
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Objects & Scripts
|
|
14
|
-
|
|
15
|
-
## Objects
|
|
16
|
-
1. UserEvent record for each entry point method
|
|
17
|
-
2. script parameter that will accept a scriptid / filepath (string)
|
|
18
|
-
|
|
19
|
-
## Scripts
|
|
20
|
-
1. Script for beforeLoad
|
|
21
|
-
2. Script for beforeSubmit
|
|
22
|
-
3. Script for afterSubmit
|
|
23
|
-
4. A generic function to proxy an unknown script
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|