Functions to new module. Tidies up reused code into
private function.
Throws warning due to line 11 in command.rs - unused import
Import is used for the StructOpt derive macro, so is needed
but still throws this warning
Because the toml error only spits out the error for the first thing it
runs into it doesn't parse all of the missing fields. We first serialize
the data to a generic toml type to check this ourselves. If everything
is there we serialize directly to the type we expected. Otherwise we
throw an error with all the fields that are missing.
npm allows scopes to avoid name collisions. In order to support this
optional feature a flag has been added so that the name in the generated
package.json is correct.
Example for a package named wasm-add:
```bash
wasm-pack init
```
package.json
```json
{
"name": "wasm-add"
}
```
```bash
wasm-pack init --scope mgattozzi
```
package.json
```json
{
"name": "@mgattozzi/wasm-add"
}
```