Using the ArcGIS CLI
You can quickly get started with the ArcGIS API for JavaScript using the @arcgis/cli
.
Installation
Install @arcgis/cli
using npm.
npm install -g @arcgis/cli
This will install a global arcgis
command.
Usage
Create a default template application using @arcgis/cli
.
arcgis create my-application
Use this template application as a starting point for your project. There several different types of templates you can create with the CLI. The default type creates an ArcGIS API for JavaScript template application, but you can customize your template application to use either React or Vue as the framework UI using the --type
(-t
) option .
Choose a UI framework
Use the -t
flag to create a template application with the specified UI framework
React
Use -t react
to create a template application using React.
arcgis create my-react-application -t react
Vue
Use -t vue
to create a template application using Vue as the UI framework.
arcgis create my-vue-application -t vue
Application
Template applications are written in TypeScript and include the @arcgis/webpack-plugin
along with a pre-configured webpack installation.
You can run the application in development mode with a local development server. The CLI will will watch your files and rebuild the UI when you make changes.
npm start
The application comes with unit tests that you can use as a guide for writing your own unit tests.
npm test
You can also create a production build of your application into a dist
folder.
npm run build