Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

citydna-app-test

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

citydna-app-test

This project was bootstrapped with `create-react-app` using the `citydna` template.

  • 1.0.13
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

This project was bootstrapped with create-react-app using the citydna template.

Just FYI...

This is a Typescript project. Typescript is a superset of Javascript that provides a better developer experience. Coming from a javascript it can seem strict and annoying at first, however, once you get going you'll never look back. Importantly, it means lots of documentation is baked right into the @citydna/ packages which you can access through most good IDEs. We recommend Visual Studio Code and it's IntelliSense.

Developing your app

If you've just cloned this repository, first run yarn to install dependencies.

Then run yarn start to run the app in local development mode.

Open http://localhost:3000 to view it in the browser:

Open src/applet/Controls.dna.tsx and you'll notice how @citydna/platform is being used to emit events. Take a look at src/applet/Screen.dna.tsx and you'll see the same package being used to listen for events via the useEvent hook. This is how related devices talk to each other.

For more advanced usage and leveraging the 3D model, open src/applet/Projection.dna.tsx and see how it's possible to add deck.gl layers and manipulate the mapbox map directly.

A local event bus is used so you don't have to worry about polluting the platform with messages. In production, web sockets via pusher are used to provide near instant communication between connected devices.

What are .dna.tsx files?

As a convention, files suffixed with .dna.tsx are app screens for devices on the platform. They are the entry point for webpack and tell the platform what components are available for use on what devices.

Write tests for your app

Your app will most likely be public facing. Because of this, it's essential that you write automated tests to ensure any changes or updates don't break previously build features. We've started for you in src/__tests__/integration.tsx. @testing-library/react, @deck.gl/test-utils and mapbox-gl-js-mock are included by default.

Further reading:

Your tests will be automatically be run everytime you publish to npm.

Prep your app for the platform

Once you're happy with your app, you can build it and publish it to npm. Open package.json and ensure your name entry begins with citydna-app-, i.e. citydna-app-wayfinding. Add an entry files:

{
  name: "citydna-app-wayfinding",
  files: ["dist"]
  ...
}

Running yarn build:app will test your app and package the Control, Screen, Projection components, along with any dependencies into single files in the dist folder. The platform uses these at runtime and injects all react context, as well as several packages, to ensure the app runs as natively as possible.

Sign up for an npm account if you don't already have one, then run yarn publish. This will test, build, version your app and push it up to npm. Your package will now be available at https://npm.org/packages/citydna-app-wayfinding.

To test this in a live sandboxed mode on pusher, visit https://citydna.melbourne.vic.gov.au/sandbox/wayfinding

Submit your app

When you're happy your app works as expected, fill out this form to submit your app to the platform and we can get it running live in no time.

FAQs

Package last updated on 27 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc