$ npm install
# or yarn
If you've never installed gapps
and authenticate it, please read here and download your credentials, then run
$ npm run auth -- [path/to/credentials.json]
(For Japanese, see GoogleAppsScriptローカル開発用の公式CLI(node-google-apps-script)がついに登場したので試してみる - Qiita)
# Open your GAS(Google Apps Script) file and get fileId.
# (fileId is like https://script.google.com/d/[fileId]/edit)
# Pass it to `init` command.
$ npm run init -- [fileId]
# Bundle scripts under lib/ directory and generate src/bundle.js.
$ npm run build
# Upload src/bundle.js to GAS.
$ npm run upload
# Run ESLint
$ npm run lint
# Watch mode: watches file updates under `lib/` directory, re-build and upload automatically.
$ npm run watch
If you use environment variables (such as process.env.FOO
), Create .env
and define them as KEY=VALUE
format.