Git Product home page Git Product logo

hub.js's Introduction

npm version build status Coverage Status apache licensed

@esri/hub.js

compact, modular JavaScript wrappers for ArcGIS Hub that run in Node.js and modern browsers.

Table of Contents

Example

npm install @esri/hub-initiatives
import { fetchInitiative  } from '@esri/hub-initiatives';

// pass in an initiative id
fetchInitiative("abc123")
    .then(
        response => // get back initiative metadata
    );

API Reference

The documentation is published at http://esri.github.io/hub.js/ (source code here).

Instructions

You can install dependencies by cloning the repository and running:

npm install

Note: This project uses volta to manage node/npm versions. We strongly suggest you do to :)

Afterward, for a list of all available commands run npm run.

Some useful commands include:

  • npm test runs all the tests and confirms the API is functioning as expected.
  • There is also a Debug Node Tests configuration in the .vscode/launch.json which will run the Node tests in the VS Code debugger.
  • npm run test:chrome:debug runs all the tests in a browser, and will re-run when changes are made. Note: in some situations, spies/stubs will fail on subsequent test runs. We are not certain why this occurs, but the resolution is to stop/start the test runner.
  • npm run docs:serve will run the documentation site locally at http://localhost:3000
  • npm run build will run the ES5, ESM, CJS and UMD build for all the packages

Packages

Deprecated Packages

Design Philosophy

hub.js is designed as a set of data manipulation functions, not persistent objects with behavior. You should not use new in conjunction with this library. Just include the modules your application needs and use them to hide lower-level abstractions for making API calls for hub related things. Your application should manage the state of the data you receive from these methods.

This project builds on the packages in arcgis-rest-js, so if you want even lower-level access, you can also use them directly.

Why Not Objects?

Persistent objects often introduce memory leaks in JavaScript applications. As soon as you instantiate a new object, you need to consider its lifespan. If you happen to assign that object inside a closure or somewhere else long-lived, you might end up with references that cannot be destroyed by the garbage collector. Creating clean separation between functions-that-fetch-or-manipulate-data and application-state-as-a-javascript-object helps to avoid this problem.

We are aiming for functional equivalence to hub-py so that the objects and capabilities are familiar, not necessarily to make the APIs identical.

More about Javascript Memory Leaks

Frequently Asked Questions

Issues

If something isn't working the way you expected, please take a look at previously logged issues first. Have you found a new bug? Want to request a new feature? We'd love to hear from you.

If you're looking for help you can also post issues on GIS Stackexchange.

Versioning

For transparency into the release cycle and in striving to maintain backward compatibility, @esri/hub.js is maintained under Semantic Versioning guidelines and will adhere to these rules whenever possible.

For more information on SemVer, please visit http://semver.org/.

Contributing

Release Process

This project uses semantic release which is automated release tooling that uses commit messages to determine the correct semantic version for any given release.

The process of initiating a release is simple: merge a PR into the master or beta branches, and semantic release will look at the included commits, compute the next version, and release the packages to NPM.

Semantic Commit Messages

This system is founded in the use of the Angular Commit Message Format

Commit Message Format

<type>(<scope>): <short summary>
  │       │             │
  │       │             └─⫸ Summary in present tense. Not capitalized. No period at the end.
  │       │
  │       └─⫸ Commit Scope: hub-common | hub-content | hub-discussions | hub-downloads | hub-events | hub-initiatives | hub-search | hub-sites | hub-surveys | hub-teams (can also be left blank)
  │
  └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test

The <type> and <summary> fields are mandatory, the (<scope>) field is optional.

Type

Must be one of the following:

  • build: Changes that affect the build system or external dependencies
  • ci: Changes to our CI configuration files and scripts
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • test: Adding missing tests or correcting existing tests

Important Note:

Not all of the commit types above will result in a new release being published to Github and NPM. Specifically, docs, refactor and test do not automatically trigger a release. If you need a release to be automatically published when you merge your pull request, please be sure to include at least one commit message using one of the other types listed above. If you find yourself in this situation after having already merged, you can manually trigger a build by issuing an empty commit directly against the master or beta branches, e.g. git commit --allow-empty -m "fix(): A descriptive patch message" or git commit --allow-empty -m "feat(): A descriptive minor message".

Breaking Changes

To specify a breaking change, you need to use a multi-line commit message, and start a line with BREAKING CHANGE.

fix(): solve i18n issue in arcgis-hub-content-gallery

BREAKING CHANGE: i18n strings must be loaded from a new location

If you are writing commit messages at the console, you can do this by just hitting enter twice while writing the commit message, before closing the quotes.

$ git commit -m 'fix(): solve i18n issue in arcgis-hub-content-gallery

BREAKING CHANGE: i18n strings must be loaded from a new location'

Commit messages are run through commitlint using husky pre-commit hooks.

Please do not use --no-verify unless you are really sure you must.

License

Copyright © 2018-2019 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file.

hub.js's People

Contributors

semantic-release-bot avatar tomwayson avatar drewdaemon avatar dbouwman avatar jgravois avatar rweber-esri avatar drspacemanphd avatar pranavkulkarni avatar vivzhang avatar sonofflynn89 avatar mjuniper avatar r00b avatar benstoltz avatar rgwozdz avatar trescube avatar miketschudi avatar juliannemarik avatar haoliangyu avatar marvinperry avatar jpurush avatar ajturner avatar juliannaeapicella avatar joppa27 avatar markhamshofner avatar ghudgins avatar jeromesteve202 avatar tannerjt avatar hamhands avatar gavinr avatar robertvo824 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.