@dgcode/gcrawl
v0.1.48
Published
typescript code generator for google apps script classes
Downloads
2
Readme
@dgcode/gcrawl
typescript code generator for google apps script classes
Install
$ npm install @dgcode/gcrawl
This can also be installed globally if desired, enabling the gcrawl
command from shell:
$ npm install @dgcode/gcrawl -g
Usage
CLI
Usage: gcrawl [options]
Options:
-v, --version output the version number
-u, --url <link> url to parse (default: null)
-e, --export [value] export each written node (default: true)
-D, --distinct [value] extract nested objects as separate structures (default: true)
-r, --root [value] for extracted distinct nodes, keep root path in name (default: true)
-c, --class [value] export nodes as classes rather than interfaces (default:
false)
-p, --prefix <value> add prefix before each node name (default: null)
-O, --object [value] export nodes and / or enums as objects (default: null)
--optional [value] make properties optional in their parents (default: null)
--eof [value] add an EOF character at the end of each file (default: null)
-o, --output <path> output path to write nodes at (default: null)
-d, --depth <depth> recursive url fetching (0 to disable) (default: null)
-s, --split write each detected node in a separate file
-i, --index [filename] write a bonus index.ts file exporting all nodes (default: false)
-h, --help output usage information
Programmatic API
// Deps --------------------------------------
import { Doc } from '../src'
import { basename } from 'path'
// Exports -----------------------------------
const doc = new Doc()
const url = 'https://developers.google.com/apps-script/reference/forms/form-app'
const outdirname = 'out-forms'
const path = `${__dirname}/${outdirname}/<name>.ts`
doc.writeNodes(url, {
path,
export: true,
distinct: true,
split: true,
index: true,
includeRoot: false
})
.then(nodes => {
console.log('Wrote Google Form nodes in %s/%s/ folder', basename(__dirname), outdirname)
})
.catch(err => {
console.error(err)
})
License
MIT