Jacdac TypeScript library
Перейти к файлу
Peli de Halleux 3a6b9176e3
Eslint (#164)
* linting and prettiyin

* configure eslint

* removing lint staged

* linted bus

* udpated spec

* linnting

* more linting

* disble tslint

* linting

* more linting

* more linting

* more linting

* configure prettier

* remove duplicated settings files

* linting

* more linting

* linting

* lint

* more linting

* add lint in readme

* fix build

* non-quiet

* linting

* address codeql warnings
2021-02-26 03:26:22 -08:00
.devcontainer
.github/workflows Eslint (#164) 2021-02-26 03:26:22 -08:00
.vscode Eslint (#164) 2021-02-26 03:26:22 -08:00
assets/icons
config
docs Eslint (#164) 2021-02-26 03:26:22 -08:00
etc
jacdac-spec@55577e7b79 Eslint (#164) 2021-02-26 03:26:22 -08:00
pxt-jacdac@3e28295a7d disable microbit warning 2021-02-25 10:17:03 -08:00
src Eslint (#164) 2021-02-26 03:26:22 -08:00
tests allow using full typescript in unit tests 2021-02-25 01:27:54 -08:00
tools
.eslintrc.json Eslint (#164) 2021-02-26 03:26:22 -08:00
.gitattributes
.gitignore Eslint (#164) 2021-02-26 03:26:22 -08:00
.gitmodules
.npm-ignore
.prettierrc Eslint (#164) 2021-02-26 03:26:22 -08:00
CODE_OF_CONDUCT.md
LICENSE
README.md Eslint (#164) 2021-02-26 03:26:22 -08:00
SECURITY.md
lighthouserc.js
package-lock.json Eslint (#164) 2021-02-26 03:26:22 -08:00
package.json Eslint (#164) 2021-02-26 03:26:22 -08:00
rollup.config.ts allow using full typescript in unit tests 2021-02-25 01:27:54 -08:00
tsconfig.json Mocha (#162) 2021-02-24 07:44:31 -08:00
tslint.json

README.md

Jacdac TypeScript and Documentation

Jacdac is a bus-based plug-and-play hardware/software stack for microcontrollers and their peripherals (sensors/actuators), with applications to rapid prototyping, making, and physical computing.

This repository contains a TypeScript/JavaScript client library for the Jacdac protocol, as well as the source of https://aka.ms/jacdac under /docs.

The rest of this page is for developers of the jacdac-ts library.

Developer setup

Codespaces

Edit this project directly from your browser using GitHub Codespaces. If you have access to them,

  • open project in a new codespace
  • launch the docs server
yarn docs
  • click on the generated URL in the terminal output and voila!

Local Setup

  • clone this repository and pull all submodules
git clone https://github.com/microsoft/jacdac-ts
git submodule update --init --recursive
git pull
  • install node.js
  • install yarn
npm install -g yarn
  • install dependencies
yarn installdev

VS Code

You are welcome to use any editor you want! Visual Studio Code provides seamless support for git sub-modules and is our preferred editor.

code .

Specs build

To regenerate the service definition JSON files from the .md files in jacdac-spec, run

yarn buildspecs

Unit tests

We use Mocha to run the unit test suite from /tests. To execute the tests,

yarn test

Linting

Run the following command to detect linting issues

yarn lint

Docs build

Launch the gatsbdy develop mode and navigate to http://localhost:8000 . This build does not require to load dist as the library is compiled directly into the web site.

  • install the docs packages
yarn installdocs
  • run the docs web site locally
yarn docs
  • browse to the local server
http://localhost:8000?dbg=1

To analyze the webpack bundle size,

cd docs
gatsby build
gatsby serve
nav to http://127.0.0.1:3001

Jacdac+MakeCode

Local build

Run this command to rebuild the makecode packages

yarn buildpxt

Local debugging

Open the multi editor to test MakeCode devices with the Jacdac view. You can select to run Jacdac and/or MakeCode on localhost/web from the drop downs.

https://makecode.com/multi?jacdac=1&localhost=1&beta=1

Adding a new MakeCode client

Create a new issue in https://github.com/microsoft/jacdac and select the MakeCode client template.

HTML tools

You can do npm run watch to watch/build bundles. Bundles are placed under the dist folder.

yarn watch

On another terminal, launch a small web server and try all the tools under docs/static/tools/* at http://localhost:8080/docs/static/tools/js/console.html . These tools load the files under dist so you'll want to also run npm run watch on the side.

yarn tools

Commits create releases

The releases are automatically created by the build system based on the title of the commit:

  • patch|fix:... patch
  • minor:feature:... minor

NPM scripts

  • npm run watch: Run npm run build in watch mode
  • npm run lint: Lints code
  • npm run docs: Launch docs web service

Microsoft Open Source Code of Conduct

This project is hosted at https://github.com/microsoft/jacdac-ts. This project has adopted the Microsoft Open Source Code of Conduct.

Resources: