DEV Community

Discussion on: Somewhat decent workflow for custom functions in Google apps script

Collapse
 
damned profile image
dan moore

thanks for this Mikael really helped me out!

FYI i've actually started using clasp with a slightly simpler setup, avoiding the gulpfile, though probs more limited:

seems like you can get a long way with those server errors just by including an exports.js file containing:

var exports = {};

then in my npm package.json scripts to turn client .js files into .js.html files:

  ...
  "scripts": {
    "test": "npm run build && mocha --exit --recursive --file test-stubs.js",
    "build": "for file in client/*.js; do cp \"$file\" \"$file.html\"; done"
  },
  ...

also ATM i have stubs for the google server bits while i work out how best to test them, a .js file (included in .claspignore) containing for me:

var localFunctions = {
    loadQueries: function() {},
    checkActivity: function() {}
}
var run = {
    withSuccessHandler: function() {
        return localFunctions
    }
}
global.google = {
    script: {
        run: run
    }
};

which works... for now!