# Iotize Tap Schematics

## Installation


```shell
# Install schematics cli tool 
npm install -g @angular-devkit/schematics-cli
# Install package globally
npm install --global @iotize/ionic-toolkit
# if you have permission errors try with
npm install --global @iotize/ionic-toolkit --unsafe-perm --allow-root
```

Gettings started:

```shell
rm -rf ./sensordemo/ && schematics @iotize/ionic-toolkit:workspace --name sensordemo && cd sensordemo/ && schematics @iotize/ionic-toolkit:workspace-init --tapConfig ../tapconfig.json && npm i && ionic cordova run android
```

This repository is a basic Schematic implementation that serves as a starting point to create and publish Schematics to NPM.

## Usage

This generator is based on [angular schematics](https://angular.io/guide/schematics). See their documentation for more information.
```shell
schematics @iotize/ionic-toolkit <your_cmd>
```

### Generate an app

First create your project 

```shell
# With schematics CLI
schematics @iotize/ionic-toolkit:workspace my-new-app-name
```

Then setup with a configuration file

```shell
# Go to project directory
cd ./my-new-app-name
# With schematics CLI
schematics @iotize/ionic-toolkit:workspace-init 
# With angu CLI
# ng add @iotize/ionic
```



## App Generator 

Generated project files

- **.iotize/**
  - **appconfig.json** application configuration file
  - **tapconfig.json** tap configuration file

### Developing

Install package globally and run build in watch mode:

```
npm i -g . && npm run watch
```

Then test commands with 

```shell
schematics @iotize/ionic-toolkit <your_cmd>
```

### Testing

To test locally, install `@angular-devkit/schematics-cli` globally and use the `schematics` command line tool. That tool acts the same as the `generate` command of the Angular CLI, but also has a debug mode.

Check the documentation with
```bash
schematics --help
```

### Unit Testing

`npm run test` will run the unit tests, using Jasmine as a runner and test framework.

### Publishing

To publish, simply do:

```bash
npm run build
npm publish
```

That's it!
 
