Skip to content

karelmaxa/gas-entry-generator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gas-entry-generator NPM version  Build Status Dependency Status  Coverage percentage Greenkeeper badge

Top level function generator for Google Apps Script.

About

In Google Apps Script, it must be top level function declaration that entry point called from google.script.run. gas-entry-generator generate a top level function declaration statement, when it detect a function assignment expression to global object.

Installation

$ npm install gas-entry-generator --save-dev

example

foo.js:

/**
 * comment for foo function.
 */
global.foo = function () {
};

generate.js:

var fs = require('fs');
var gasEntryGenerator = require('gas-entry-generator');

var fooSource = fs.readFileSync('foo.js', {encoding: 'utf8'});
var options = {
  comment: true
};
var entryFunction = gasEntryGenerator(fooSource, options);
console.log(entryFunction);

Console output:

/**
 * comment for foo function.
 */
function foo() {
}

Execute to generate function as entry point.

$ node generate.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%