@servicenow/sdk 1.0.2 → 1.0.6
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
CHANGED
|
@@ -1,24 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ServiceNow SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use the ServiceNow software development kit (SDK) to add JavaScript modules and third-party libraries to applications locally and upload changes to an instance of the Now Platform.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# Overview
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
With the ServiceNow SDK, developers can create and modify scoped applications with custom modules and third-party libraries in Visual Studio Code and deploy those applications to a non-production instance on the Washington DC release. Writing ServiceNow applications outside of a ServiceNow instance enables you to use industry-standard development practices and familiar tools and catch errors at build-time rather than at run-time only.
|
|
8
|
+
|
|
9
|
+
For more information see the [SDK Overview documentation](https://docs.servicenow.com/bundle/washingtondc-api-reference/page/script/sdk/concept/servicenow-sdk.html) or the [CLI Overview](https://docs.servicenow.com/bundle/washingtondc-api-reference/page/script/sdk/reference/servicenow-sdk-cli-commands.html)
|
|
9
10
|
|
|
10
11
|
## Installation
|
|
11
12
|
|
|
13
|
+
Install the ServiceNow software development kit (SDK) locally using Node Package Manager (npm).
|
|
14
|
+
|
|
15
|
+
### Before you begin
|
|
16
|
+
|
|
17
|
+
Your system must meet the following requirements to use npm to install the SDK:
|
|
18
|
+
* Node.js v16.16.0 or later
|
|
19
|
+
* npm v8.11.0 or later
|
|
20
|
+
|
|
21
|
+
To install or upgrade Node.js or npm, see the [installation instructions](https://docs.npmjs.com/cli/v8/configuring-npm/install) on the npm website.
|
|
22
|
+
|
|
23
|
+
### Procedure
|
|
24
|
+
|
|
25
|
+
1. Open a command-line tool on your system.
|
|
26
|
+
2. Verify that your system meets the requirements.
|
|
27
|
+
a. Enter `node –v` to check if you have Node.js installed and which version.
|
|
28
|
+
b. Enter `npm –v` to check if you have npm installed and which version.
|
|
29
|
+
3. Enter the following command to install the SDK:
|
|
12
30
|
```bash
|
|
13
31
|
npm install --global @servicenow/sdk
|
|
14
32
|
```
|
|
15
33
|
|
|
16
34
|
## Usage
|
|
17
35
|
|
|
18
|
-
###
|
|
36
|
+
### Authentication
|
|
37
|
+
|
|
38
|
+
Authenticate with a ServiceNow instance using a user account with an `admin` role.
|
|
19
39
|
|
|
20
40
|
```bash
|
|
21
|
-
now-sdk
|
|
41
|
+
now-sdk auth save default
|
|
22
42
|
```
|
|
23
43
|
|
|
24
|
-
|
|
44
|
+
View credentials saved in the device keychain or credential manager on your system.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
now-sdk auth list
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Creating an app
|
|
51
|
+
|
|
52
|
+
Create a new scoped application, optionally including a sample table.
|
|
53
|
+
|
|
54
|
+
**Note**: Replace `{vendorprefix}` with your organization's unique scope prefix.
|
|
55
|
+
```bash
|
|
56
|
+
now-sdk create sdk_demo x_{vendorprefix}_demo --sampleTable
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Building code changes
|
|
60
|
+
|
|
61
|
+
Compile source files and generate a deployable package. Third-party library dependencies are converted into XML files that can be installed with the application.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
now-sdk build
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Deploying app updates
|
|
68
|
+
|
|
69
|
+
Deploy an application to an instance. Before using the deploy command, you must use the build command to generate a deployable package.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
now-sdk deploy
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Synchronizing changes from the instance
|
|
76
|
+
|
|
77
|
+
Download application metadata from an instance and update the metadata XML files in your local application to match.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
now-sdk fetch
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## What to do next
|
|
84
|
+
|
|
85
|
+
Use the ServiceNow SDK to create a scoped application or convert an existing application for use with the SDK. For more information, see [Create or convert an application with the ServiceNow SDK](https://docs.servicenow.com/bundle/washingtondc-api-reference/page/script/sdk/task/create-application-now-sdk.html).
|
|
86
|
+
|
|
@@ -83,7 +83,11 @@ exports.build = {
|
|
|
83
83
|
writeMetrics(workingDir);
|
|
84
84
|
}
|
|
85
85
|
catch (error) {
|
|
86
|
-
|
|
86
|
+
const errorMessage = error instanceof Error ? error.message : error;
|
|
87
|
+
if (args.debug) {
|
|
88
|
+
logger.error(error instanceof Error ? (_a = error.stack) !== null && _a !== void 0 ? _a : error.message : error, error);
|
|
89
|
+
}
|
|
90
|
+
logger.error(errorMessage);
|
|
87
91
|
}
|
|
88
92
|
});
|
|
89
93
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/command/build/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,0DAA4B;AAC5B,qCAAgC;AAWnB,QAAA,KAAK,GAAsC;IACpD,OAAO,EAAE,gBAAgB;IACzB,QAAQ,EAAE,gEAAgE;IAC1E,OAAO,EAAE,CAAC,KAAW,EAAE,EAAE;QACrB,OAAO,KAAK;aACP,UAAU,CAAC,QAAQ,EAAE;YAClB,QAAQ,EAAE,wBAAwB;YAClC,OAAO,EAAE,IAAA,UAAG,GAAE;YACd,IAAI,EAAE,QAAQ;SACjB,CAAC;aACD,MAAM,CAAC,OAAO,EAAE;YACb,QAAQ,EAAE,oBAAoB;YAC9B,KAAK,EAAE,GAAG;YACV,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,SAAS;SAClB,CAAC;aACD,MAAM,CAAC,kBAAkB,EAAE;YACxB,QAAQ,EAAE,iEAAiE;YAC3E,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,SAAS;SAClB,CAAC;aACD,MAAM,CAAC,MAAM,EAAE;YACZ,QAAQ,EAAE,8BAA8B;YACxC,OAAO,EAAE,IAAI;YACb,IAAI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ACD,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAC9B,CAAC;;KACJ;CACJ,CAAA;AAED,SAAe,YAAY,CAAC,UAAkB;;QAC1C,MAAM,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAClE,gDAAgD,CACnD,CAAA;QAED,oBAAoB,CAAC,CAAC,4BAA4B,EAAE,2BAA2B,CAAC,EAAE,UAAU,CAAC,CAAA;QAC7F,uBAAuB,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;IACtD,CAAC;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicenow/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "ServiceNow SDK CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@inquirer/prompts": "3.1.1",
|
|
27
|
-
"@servicenow/sdk-cli-core": "
|
|
27
|
+
"@servicenow/sdk-cli-core": "1.0.6",
|
|
28
28
|
"chalk": "4.1.2",
|
|
29
29
|
"yargs": "17.6.2",
|
|
30
30
|
"semver": "7.5.4"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"keytar": "7.9.0"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
|
-
"node": "16.16.0",
|
|
40
|
-
"npm": "8.11.0"
|
|
39
|
+
"node": ">=16.16.0",
|
|
40
|
+
"npm": ">=8.11.0"
|
|
41
41
|
}
|
|
42
|
-
}
|
|
42
|
+
}
|
|
@@ -81,7 +81,11 @@ export const build: CommandModule<unknown, Arguments> = {
|
|
|
81
81
|
moveDependencyXmls(workingDir)
|
|
82
82
|
writeMetrics(workingDir)
|
|
83
83
|
} catch (error) {
|
|
84
|
-
|
|
84
|
+
const errorMessage = error instanceof Error ? error.message : (error as string)
|
|
85
|
+
if (args.debug) {
|
|
86
|
+
logger.error(error instanceof Error ? error.stack ?? error.message : (error as string), error)
|
|
87
|
+
}
|
|
88
|
+
logger.error(errorMessage)
|
|
85
89
|
}
|
|
86
90
|
},
|
|
87
91
|
}
|