Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
gas-entry-generator
Advanced tools
Top level function generator for Google Apps Script.
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.
$ npm install gas-entry-generator --save-dev
foo.js:
/**
* comment for foo function.
*/
global.foo = function () {
};
generate.js:
const fs = require('fs');
const { generate } = require('gas-entry-generator');
const fooSource = fs.readFileSync('foo.js', {encoding: 'utf8'});
const options = {
comment: true
};
const output = generate(fooSource, options);
console.log(output.entryPointFunctions);
Console output:
/**
* comment for foo function.
*/
function foo() {
}
Execute to generate function as entry point.
$ node generate.js
foo.ts:
/**
* comment for foo function.
*/
exports.foo = () => 'bar';
generate.js:
const fs = require('fs');
const { generate } = require('gas-entry-generator');
const fooSource = fs.readFileSync('foo.js', {encoding: 'utf8'});
const options = {
comment: true,
autoGlobalExports: true // Enable to detect exports.* to generate entry point functions.
};
const output = generate(fooSource, options);
console.log(output.entryPointFunctions);
console.log('-----');
console.log(output.globalAssignments);
Console output:
/**
* comment for foo function.
*/
function foo() {
}
-----
global.foo = exports.foo;
FAQs
Generator of Google Apps Script entry point function
We found that gas-entry-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.