README
ServiceNow React CLI
WARNING This package is in Early Development. There is NO working functionality yet. The README below represents the desired outcome of working on this package.
The ServiceNow React CLI is meant to bring seamless create-react-app-like experience to creating and deploying React applications for ServiceNow.
The CLI will provide the functionality to:
- Create a new React application with CRA boilerplate and connect it to ServiceNow
- Build a custom React application bundle
- Automatically deploy the custom bundle on ServiceNow
Nо pre-configuration on ServiceNow side required.
User workflow
Create App
- Install the CLI npm package
npm install sn-react
- Create a boilerplate application
sn-react create my-app
The user will be prompted to enter their ServiceNow instance url, username and password.
- Start developing ;)
NOTE: The app is preconfigured to proxy all requests to the provided instance.
Deploy App
When you are ready to deploy the application to ServiceNow, just run sn-react deploy
in your terminal, and see the latest version of your app running in ServiceNow.
Under the hood
- The CLI will run on Node.js.
- All communication with ServiceNow instance will happen via Table API and Attachments API.
- Necessary instance information and all app configuration will be stored locally in the project root
.json
file. - Credentials will be stored in OS-specific password vault
Create App
On sn-react create MyApp
:
- Ask for ServiceNow instance name and credentials (e.g. using npm
inquire
) - Create a scoped application in ServiceNow named MyApp via Table API
- Run
create-react-app MyApp
- Create a
.json
configuration file with instance url - Save credentials to the OS-specific password vault via
node-keytar
- Set up proxy for the provided instance url
Deploy App
On sn-react deploy
:
For the first deploy:
- Set up Scripted REST API via multiple Table API requests and save sys_id's of resource records
- Run create-react-app native
build
- Run
sn-build.js
to create a custom build folder - Upload static files to the matching Scripted REST API records
For ordinary deploy:
- Run create-react-app native
build
- Run
sn-build.js
to create a custom build folder - Remove all old attachments from SN resources (maybe use ServiceNow script include for handy SN attachment class methods?)
- Upload static files to the matching Scripted REST API records