Giter Site home page Giter Site logo

gas-webpack-plugin's Introduction

gas-webpack-plugin NPM version Build Status Coverage percentage

Webpack plugin for Google Apps Script.

About

In Google Apps Script, an entry point called from google.script.run must be a top level function declaration on the server side. gas-webpack-plugin detects function assignment expressions to global object and generate a corresponding top level function declaration statement.

example

main.js:

var echo = require('./echo');
/**
 * Return write arguments.
 */
global.echo = echo;

echo.js:

module.exports = function(message) {
  return message;
}

webpack.config.js:

const GasPlugin = require("gas-webpack-plugin");
module.exports = {
  context: __dirname,
  entry: "./main.js",
  output: {
    path: __dirname ,
    filename: 'Code.gs'
  },
  plugins: [
    new GasPlugin()
  ]
}

build:

$ webpack --mode production

Code.gs

/**
 * Return write arguments.
 */
function echo() {
}/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;
/******/
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// identity function for calling harmony imports with the correct context
/******/ 	__webpack_require__.i = function(value) { return value; };
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 2);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {

var g;

// This works in non-strict mode
g = (function() {
	return this;
})();

try {
	// This works if eval is allowed (see CSP)
	g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
	// This works if the window reference is available
	if(typeof window === "object")
		g = window;
}

// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}

module.exports = g;


/***/ }),
/* 1 */
/***/ (function(module, exports) {

module.exports = function(message) {
  return message;
};


/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(global) {var echo = __webpack_require__(1);
global.echo = echo;

/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))

/***/ })
/******/ ]);

Installation

$ npm install gas-webpack-plugin --save-dev

Usage

CLI

$ webpack --mode production

Options

You can pass a hash of configuration options to gas-webpack-plugin. Allowed values are as follows

Name Type Default Description
comment {Boolean} true If true then generate a top level function declaration statement with comment.
autoGlobalExportsFiles {Array<String>} [] Array of source file paths that to generate global assignments expression from exports.* statements.
include {Array<String>} [**/*] Array of path patterns to detect functions to generate top level function definitions. accept glob pattern.

Geranate global assignment expressions from exports.*

Assignments expression to global object is automatically generated from named exports (exports.*) Included in the file specified by the autoGlobalExportsFiles option.

main.ts:

import './echo';

echo.ts:

// geranate global assignment expressions from named export
export const echo = (message) => message;

webpack.config.js:

const GasPlugin = require("gas-webpack-plugin");
module.exports = {
  context: __dirname,
  entry: "./main.ts",
  module: {
    rules: [
      {
        test: /(\.ts)$/,
        loader: 'ts-loader',
      },
    ],
  },
  resolve: {
    extensions: [".ts"],
  },
  output: {
    path: __dirname ,
    filename: 'Code.js'
  },
  plugins: [
    new GasPlugin({
      autoGlobalExportsFiles: ['**/*.ts']
    })
  ]
}

Webpack version support

gas-webpack-plugin is support for [email protected]

gas-webpack-plugin's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar fossamagna avatar greenkeeper[bot] avatar greenkeeperio-bot avatar pinealan avatar proudust avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gas-webpack-plugin's Issues

Compiler errors with autoGlobalExportsFiles and webpack 5

Hi @fossamagna, thanks for the work on this very useful plugin.

I've been trying to upgrade to webpack 5 and running into issues with autoGlobalExportsFiles config. It looks as though the "global" assignments are incorrectly being inserted into the webpack file.

I noticed when I take out this line, it works fine:

source.insert(source.size(), output.globalAssignments);

Here is my bundled file after I remove that line from this plugin. Interestingly, the code works fine if this line is left out -- I can still run this code in a spreadsheet and the global functions are found correctly:
Screen Shot 2022-06-12 at 11 56 14 AM

And here it is with that line left in. Notice the insertion is not happening in the right place.
Screen Shot 2022-06-12 at 11 56 47 AM

Any ideas what might be causing this?

Error ReferenceError: module is not defined (anonymous) @ echo:gs.1

Hi there,

Thanks for your resource first off.
I'm trying to set it up following the instructions but I am unable to do so as I end up having a compilation error in GAS
I had to modify some things in what you were doing in order to sort out my own way, such as installing .

Mainly I installed it the following way (note I'm using clasp)

mkdir messing06
cd messing06/
clasp create --title "messing06"
npm init -y
npm install gas-webpack-plugin
npm install webpack-cli
npm install webpack
vim package.json

On there I

    "build": "webpack --mode production"

The rest of the files are just as in the example
vim echo.js

module.exports = function(message) {
  return message;
}

vim main.js

var echo = require('./echo');
/**
 * Return write arguments.
 */
global.echo = echo;

vim webpack.config.json

const GasPlugin = require("gas-webpack-plugin");
module.exports = {
  context: __dirname,
  entry: "./main.js",
  output: {
    path: __dirname ,
    filename: 'Code.gs'
  },
  plugins: [
    new GasPlugin()
  ]
}

I proceed to build

npm run build

Which generates the Code.gs that I end up clasp push to google

Unfortunatelly I get the aforementioned error when Running it from the Website

Error ReferenceError: module is not defined (anonymous) @ echo:gs.1

Any ideas?

Here you have a sum up of the process. Thank you!!

https://asciinema.org/a/rC1So5vdpTGAHJVQx34k0OSq7

[Feature Request] JS Doc Comments for custom functions

I tried using this to write some custom functions for Spreadsheet

/**
 * Test Function
 * @param {any} input
 * @return "From test Function"
 * @customfunction
 */
global.testCustomFunction = (input) =>
{
    return `From test function: ${input}`
}

In the output

function testCustomFunction() {
}/******/ (function(modules) { // webpackBootstrap

// Webpack stuffs

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {

/**
 * Test Func
 * @param {any} input
 * @return "From test Func"
 * @customfunction
 */
global.testCustomFunction = function (input) {
  return "From test function: " + input;
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))

// Webpack stuffs

It works but the JS Doc as well as the function parameters are not brought over to the exposed function and therefore can't be detected by spreadsheet for auto completion.

GasPlugin cannot be used with decorators

Hi. Thank you for making a great plugin.

If original source code contains decorators,
this plugin does not produce working code...
When I run the transpiled file, I get the following error.

TypeError: (0 , _metadata_MetadataStorage__WEBPACK_IMPORTED_MODULE_1__.getMetadataStorage)(...).addConstraintMetadata is not a function(line 482, file "index")

minimum reproduction repository: https://github.com/soracore/gas-ts-decorator-problem
Simply removing gas-webpack-plugin from webpack config solves this problem,
but then I cannot access the main function from GAS.

Is there any way I could workaround this problem?

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash.template:4.4.0

Vulnerabilities

DepShield reports that this application's usage of lodash.template:4.4.0 results in the following vulnerability(s):


Occurrences

lodash.template:4.4.0 is a transitive dependency introduced by the following direct dependency(s):

conventional-changelog-cli:2.0.11
        └─ conventional-changelog:3.0.5
              └─ conventional-changelog-core:3.1.5
                    └─ git-raw-commits:2.0.0
                          └─ lodash.template:4.4.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Syntax Error?

Hi. Thank you for great plugin! With your plugin I tried to make a library but I got this error when I push the script produced by gas-webpack-plugin with @google/clasp.

For more detail you can see:

Push failed. Errors:
Syntax error: Missing name after . operator. line: 151 file: index
Files to push were:
└─ dist/appsscript.json
└─ dist/index.js

Whole code is here. Please don't forget change scriptId in clasp to try to push.

Thank you.

[DepShield] (CVSS 7.5) Vulnerability due to usage of debug:2.6.9

Vulnerabilities

DepShield reports that this application's usage of debug:2.6.9 results in the following vulnerability(s):


Occurrences

debug:2.6.9 is a transitive dependency introduced by the following direct dependency(s):

tap:13.1.11
        └─ import-jsx:2.0.0
              └─ babel-core:6.26.3
                    └─ debug:2.6.9
                    └─ babel-traverse:6.26.0
                          └─ debug:2.6.9
        └─ tap-mocha-reporter:4.0.1
              └─ debug:2.6.9

webpack:4.31.0
        └─ micromatch:3.1.10
              └─ extglob:2.0.4
                    └─ expand-brackets:2.1.4
                          └─ debug:2.6.9
              └─ snapdragon:0.8.2
                    └─ debug:2.6.9

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

An in-range update of conventional-changelog-cli is breaking the build 🚨

Version 1.3.12 of conventional-changelog-cli was just published.

Branch Build failing 🚨
Dependency conventional-changelog-cli
Current Version 1.3.10
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

conventional-changelog-cli is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Update from 1.0.3 -> 1.0.4 breaks build

Our project was building fine on 1.0.3 but after upgrading to 1.0.4 we get an error,

ERROR in main.js from es3ify
TypeError: asset.map is not a function
    at <redacted>/node_modules/es3ify-webpack-plugin/index.js:65:31
    at Array.forEach (<anonymous>)
    at <redacted>/node_modules/es3ify-webpack-plugin/index.js:55:10
    at _next0 (eval at create (<redacted>/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
    at eval (eval at create (<redacted>/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:21:1)
    at <redacted>/node_modules/gas-webpack-plugin/index.js:33:7
    at AsyncSeriesHook.eval [as callAsync] (eval at create (<redacted>/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:17:1)
    at AsyncSeriesHook.lazyCompileHook (<redacted>/node_modules/tapable/lib/Hook.js:154:20)
    at <redacted>/node_modules/webpack/lib/Compilation.js:1409:36
    at eval (eval at create (<redacted>/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at <redacted>/node_modules/copy-webpack-plugin/dist/index.js:101:9

Downgrading to 1.0.3 fixed the issue so not a major problem for us.

Cannot read property 'getChunkModules' of undefined

I'm trying out the latest version 2.0.1 and unfortunately my webpack build is failing with it:

 ERROR in chunk main [entry]
    code.js
    Cannot read property 'getChunkModules' of undefined

It works fine with 1.2.2 it seems. Any suggestions? Thanks!!

[DepShield] (CVSS 8.2) Vulnerability due to usage of handlebars:4.1.2

Vulnerabilities

DepShield reports that this application's usage of handlebars:4.1.2 results in the following vulnerability(s):


Occurrences

handlebars:4.1.2 is a transitive dependency introduced by the following direct dependency(s):

conventional-changelog-cli:2.0.23
        └─ conventional-changelog:3.1.10
              └─ conventional-changelog-core:4.0.0
                    └─ conventional-changelog-writer:4.0.7
                          └─ handlebars:4.1.2

nyc:14.1.1
        └─ istanbul-reports:2.2.4
              └─ handlebars:4.1.2

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash.throttle:4.1.1

Vulnerabilities

DepShield reports that this application's usage of lodash.throttle:4.1.1 results in the following vulnerability(s):


Occurrences

lodash.throttle:4.1.1 is a transitive dependency introduced by the following direct dependency(s):

tap:13.0.3
        └─ treport:0.3.0
              └─ ink:2.1.1
                    └─ lodash.throttle:4.1.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Remove JS Doc comments from custom function defintion

When bundling with a function to global space it copies the JS DOC as the purpose of the plugin but would it be possible to remove the comment from the function definition in production mode to keep comments to a minimum.

In practice would this code:

/**
 * Return write arguments.
 * @customfunction
 */
function echo() {
}

//webpack stuff

var echo = () => console.log('hello');
/**
 * Return write arguments.
 * @customfunction
 */
__webpack_require__.g.echo = echo;

/******/ })()
;

Become this:

/**
 * Return write arguments.
 * @customfunction
 */
function echo() {
}

//webpack stuff

var echo = () => console.log('hello');
__webpack_require__.g.echo = echo;

/******/ })()
;

(Sorry if I'm doing this wrong this is my first issue submission)

Google Apps Script: ReferenceError: "global" is not defined

Hi, I am trying out version 1.2.2 to try to use autoGlobalExportsFiles and I'm getting an error when I reload my spreadsheet to try my addon:

Google Apps Script: ReferenceError: "global" is not defined. 3317128802-waffle_js_prod_ritzmaestro.js:59

In webpack.config.js I have:

    new GasPlugin({
      autoGlobalExportsFiles: ['**/*.ts']
    }),

You can see code.js that this creates (that doesn't work for me) and code.js.orig that was created with my code manually adding functions to global (this does work)

https://gist.github.com/alexblack/4422e6cd41533948842f8a427a5ba253

Question - Automatically generating a typescript interface for the global functions

Hi again @fossamagna , I wanted to see if you had any ideas how to improve this:

Now that we can use gas-webpack-plugin to automatically export our functions on the global object, we've reduced our the amount of repetitive code a lot, thats great.

We have one last area of repetitive code: we're manually writing a typescript interface called ServerFunctions which has all the exported global functions on it, so that we can call them in a type-safe manner from our addon client code.

It looks like this:

export interface ServerFunctions {
  setActiveSheet: (sheetName: string) => void;
  getSpreadsheetProperties: () => SpreadsheetPropertiesGAS;
  markSpreadsheetInstalledOn: () => void;
  ...
}

Then in the client we use it like this:

const Server = require('gas-client').default;

type ServerAsync = {
  serverFunctions: Promisify<ServerFunctions>;
};

const server: ServerAsync = new Server({
  // this is necessary for local development but will be ignored in production
  allowedDevelopmentDomains: (origin: string) =>
    /https:\/\/.*\.googleusercontent\.com$/.test(origin),
  parentTargetOrigin: '*',
});

export default server;

I'd love to find a way to not have to manually add these methods to ServerFunctions above. Any ideas? I was wondering: if I initially wrote the functions on an object, then I could expose them using typescript, eg:

expost const SheetFunctions = {
  setActiveSheet: () => {
     // do stuff
  }
}
export type ServerFunctions = SheetFunctions;

but then I imagine gas-webpack-plugin wouldn't be able to automatically export SheetFunctions.setActiveSheet etc.

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash.flattendeep:4.4.0

Vulnerabilities

DepShield reports that this application's usage of lodash.flattendeep:4.4.0 results in the following vulnerability(s):


Occurrences

lodash.flattendeep:4.4.0 is a transitive dependency introduced by the following direct dependency(s):

nyc:13.1.0
        └─ caching-transform:2.0.0
              └─ package-hash:2.0.0
                    └─ lodash.flattendeep:4.4.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash.debounce:4.0.8

Vulnerabilities

DepShield reports that this application's usage of lodash.debounce:4.0.8 results in the following vulnerability(s):


Occurrences

lodash.debounce:4.0.8 is a transitive dependency introduced by the following direct dependency(s):

webpack:4.26.1
        └─ watchpack:1.6.0
              └─ chokidar:2.0.4
                    └─ lodash.debounce:4.0.8

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Webpack-cli required

When building the exact example from the homepage in a yarn workspace with node 12 or 14, webpack warned me that webpack-cli was required to build the project.
I originally used the gas plugin with webpack in a larger project that probably somehow suppressed that warning and just resulted in an error similar to the one mentioned in #460 .

Proposal: add documentation to add webpack-cli to dependencies when using yarn.


tree:

.
├── echo.js
├── main.js
├── package.json
└── webpack.config.js

Package.json contents:

{
  "name": "temp",
  "version": "1.0.0",
  "description": "temp",
  "license": "MIT",
  "devDependencies": {
    "gas-webpack-plugin": "^2.0.0",
    "webpack": "^5.28.0"
  },
  "scripts": {
    "build": "yarn webpack"
  }
}

Other files are copied verbatim from this package's homepage example.

ERROR in chunk main [entry]

Thanks for the good work.

I am getting an error after upgrading to v1.2.1.

ERROR in chunk main [entry]
090ffc44364d4dc2508e.js
/Users/labnol/node_modules/babel-loader/lib/index.js!/Users/labnol/node_modules/eslint-loader/dist/cjs.js??ref--4!/Users/labnol/src/index.js

If you can help, that would be awesome!

named export of a `const` function inside the declaration isn't exported to global

I did add two other use cases in my repo, one that works and one that isn't. They are more edge case situation I would say, nice to have.

The one not working is when doing a named export of a const function inside the declaration and not as an export list like below.

I'll leave it to you to close this issue or leave it open for this "nice to have" second part.

export const doGet = () => {
  const title = "Google Apps Script";
  const fileName = "index.html";
  return HtmlService.createHtmlOutputFromFile(fileName)
    .setTitle(title)
    .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.DEFAULT);
};

Thank you very much again!

Originally posted by @sharky98 in #794 (comment)

Remove or update and use test/fixtures/expected.gs

I was debugging an issue with comments not being included in the built bundle and ran across

which made me believe that the expected output should not include any top-level comments. However, it seems that it is just an old unused file that either should be updated and used or cleaned up (removed).
(The actual culprit of no comments was using 0.3.0 instead of the latest version. Back in 0.3.0 there was no support for top-level comments in the built bundle.)

Issue with Production mode

The top level functions are not generated when the mode is set to production. It works fine for 'none' mode.

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash.templatesettings:4.1.0

Vulnerabilities

DepShield reports that this application's usage of lodash.templatesettings:4.1.0 results in the following vulnerability(s):


Occurrences

lodash.templatesettings:4.1.0 is a transitive dependency introduced by the following direct dependency(s):

conventional-changelog-cli:2.0.11
        └─ conventional-changelog:3.0.5
              └─ conventional-changelog-core:3.1.5
                    └─ git-raw-commits:2.0.0
                          └─ lodash.template:4.4.0
                                └─ lodash.templatesettings:4.1.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

README: `Script function not found: doGet` - special requirements for gas-webapps?

Apologies if this is gross incompetence, but I'm extremely new to webpack & following the ts example in the readme throws Script function not found: doGet when attempting to access gas-deployed webapp - mind getting me pointed in the right direction?

    "webpack": "^5.65.0",
    "webpack-cli": "^4.9.1",
    "gas-webpack-plugin": "^2.1.0",

src/index.ts

import "./app/do-get";

src/app/do-get.ts

const appTitle = "Google Apps Script template";

export function doGet() {
  return HtmlService.createTemplateFromFile("page")
    .evaluate()
    .setTitle(appTitle);
}

webpack.config.js

const GasPlugin = require("gas-webpack-plugin");
module.exports = {
  mode: "production",
  context: __dirname,
  entry: "./src/index.ts",
  module: {
    rules: [
      {
        test: /(\.ts)$/,
        loader: "ts-loader",
      },
    ],
  },
  resolve: {
    extensions: [".ts"],
  },
  output: {
    path: __dirname,
    filename: "Code.js",
  },
  plugins: [
    new GasPlugin({
      autoGlobalExportsFiles: ["*.ts"],
    }),
  ],
};

Code.js (as compiled)

(() => {
  "use strict";
  var e = {
      779: (e, t) => {
        Object.defineProperty(t, "__esModule", { value: !0 }),
          (t.doGet = void 0),
          (t.doGet = () =>
            HtmlService.createTemplateFromFile("page")
              .evaluate()
              .setTitle("Google Apps Script template"));
      },
    },
    t = {};
  !(function r(o) {
    var p = t[o];
    if (void 0 !== p) return p.exports;
    var a = (t[o] = { exports: {} });
    return e[o](a, a.exports, r), a.exports;
  })(779);
})();

[DepShield] (CVSS 7.4) Vulnerability due to usage of lodash._reinterpolate:3.0.0

Vulnerabilities

DepShield reports that this application's usage of lodash._reinterpolate:3.0.0 results in the following vulnerability(s):


Occurrences

lodash._reinterpolate:3.0.0 is a transitive dependency introduced by the following direct dependency(s):

conventional-changelog-cli:2.0.11
        └─ conventional-changelog:3.0.5
              └─ conventional-changelog-core:3.1.5
                    └─ git-raw-commits:2.0.0
                          └─ lodash.template:4.4.0
                                └─ lodash._reinterpolate:3.0.0
                                └─ lodash.templatesettings:4.1.0
                                      └─ lodash._reinterpolate:3.0.0

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.5) Vulnerability due to usage of mocha:5.0.5

Vulnerabilities

DepShield reports that this application's usage of mocha:5.0.5 results in the following vulnerability(s):


Occurrences

mocha:5.0.5 is a transitive dependency introduced by the following direct dependency(s):

coveralls:3.0.8
        └─ cobertura-parse:1.0.5
              └─ mocha:5.0.5

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

[DepShield] (CVSS 7.5) Vulnerability due to usage of q:1.5.1

Vulnerabilities

DepShield reports that this application's usage of q:1.5.1 results in the following vulnerability(s):


Occurrences

q:1.5.1 is a transitive dependency introduced by the following direct dependency(s):

conventional-changelog-cli:2.0.21
        └─ conventional-changelog:3.1.8
              └─ conventional-changelog-angular:5.0.3
                    └─ q:1.5.1
              └─ conventional-changelog-atom:2.0.1
                    └─ q:1.5.1
              └─ conventional-changelog-codemirror:2.0.1
                    └─ q:1.5.1
              └─ conventional-changelog-conventionalcommits:3.0.2
                    └─ q:1.5.1
              └─ conventional-changelog-core:3.2.2
                    └─ q:1.5.1
              └─ conventional-changelog-ember:2.0.2
                    └─ q:1.5.1
              └─ conventional-changelog-eslint:3.0.2
                    └─ q:1.5.1
              └─ conventional-changelog-express:2.0.1
                    └─ q:1.5.1
              └─ conventional-changelog-jquery:3.0.4
                    └─ q:1.5.1
              └─ conventional-changelog-jshint:2.0.1
                    └─ q:1.5.1

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Default includePatterns broken in v2.2.0

Hi,

The plugin is broken for my when using v2.2.0 and I believe I've traced the issue down to this line:

    if (!this.includePatterns.some(file => minimatch(module.resource, file))) {
      return;
    }

For me it seems to be skipping all files as minimatch isn't matching files using the default include pattern.

I believe this is due to upgrading minimatch from v3.0.4 to v5.0.0 after testing the following in minimatch in both versions:

const minimatch = require('minimatch');

const resource = "C:\\Foo\\Bar.js";
const patten = "C:\\Foo\\**\\*";

const result = minimatch(resource, patten);

// v3.0.4 -> result = true;
// v5.0.0 -> result = false;

I'm using Windows so I'm not sure if this is a windows only issue.

`autoGlobalExportsFiles` not working with ECMAScript

Hello,

Today I was trying to make this plugin work with the autoGlobalExportsFiles settings. I tend to always use the "latest and greatest" version of any packages; and this may be my pitfall here.

Anyway, here a code that is working fine in GAS; but the autoGlobalExportsFiles do nothing (I still need to put the global.[fct] = fct in my code). I created a repo that replicate this: https://github.com/sharky98/es2022-gas-webpack-plugin-bug.

In there you'll see in dist folder the three output I got. You'll also have the webpack config, and tsconfig.

Note: I am using TypeScript 5, with array extends; which mean I need to use the current main for ts-node; the tgz is included in the repo, with the right config from package.json.

Note 2: I am not too familiar with webpack config and tsconfig... Just enough to make it work for me. So, feel free to tell me what I miss.

Note 3: I added you as collaborators on that repo; feel free to commit to it for any correction/test/etc.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.