sn-react

1.0.2 • Public • Published

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

  1. Install the CLI npm package
npm install sn-react
  1. Create a boilerplate application
sn-react create my-app

The user will be prompted to enter their ServiceNow instance url, username and password.

  1. 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:

  1. Ask for ServiceNow instance name and credentials (e.g. using npm inquire)
  2. Create a scoped application in ServiceNow named MyApp via Table API
  3. Run create-react-app MyApp
  4. Create a .json configuration file with instance url
  5. Save credentials to the OS-specific password vault via node-keytar
  6. Set up proxy for the provided instance url

Deploy App

On sn-react deploy:

For the first deploy:

  1. Set up Scripted REST API via multiple Table API requests and save sys_id's of resource records
  2. Run create-react-app native build
  3. Run sn-build.js to create a custom build folder
  4. Upload static files to the matching Scripted REST API records

For ordinary deploy:

  1. Run create-react-app native build
  2. Run sn-build.js to create a custom build folder
  3. Remove all old attachments from SN resources (maybe use ServiceNow script include for handy SN attachment class methods?)
  4. Upload static files to the matching Scripted REST API records

Dependents (0)

Package Sidebar

Install

npm i sn-react

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

3.16 kB

Total Files

3

Last publish

Collaborators

  • nick-baliesnyi
  • nbaliesnyi