由于 Google Apps Script 强行将“Rhino”推送到“V8”引擎,应用程序正在自动从 Rhino 迁移到 V8。所以我们的应用程序正在询问需要在“ appscript.json ”文件中手动指定的“范围”。
请检查下图:
文件 :-
当我像下面这样更新时,它工作正常。
我们担心的是我们有超过 100 个生产应用程序,我们不能每次都手动更新。你能帮助我们如何在生产中没有任何问题的更新吗?
由于 Google Apps Script 强行将“Rhino”推送到“V8”引擎,应用程序正在自动从 Rhino 迁移到 V8。所以我们的应用程序正在询问需要在“ appscript.json ”文件中手动指定的“范围”。
请检查下图:
文件 :-
当我像下面这样更新时,它工作正常。
我们担心的是我们有超过 100 个生产应用程序,我们不能每次都手动更新。你能帮助我们如何在生产中没有任何问题的更新吗?
Using clasp
You can update the manifest files in batch by using the CLASP project (it uses Apps Script API under the hood) and a utility script in Node.js or your poison of choice to control the workflow. General steps you need to take are:
clasp clone "YourScriptIdHere"
appsscript.json
file with the required scopes. Since manifest is saved at the root of the project, I would do something like this (with Node.js):const { writeFile } = require("fs").promises;
const addScope = async (scopes) => {
const pathToManifest = "appscript.json";
const manifest = require(pathToManifest);
const { oauthScopes = [] } = manifest;
oauthScopes || ( manifest.oauthScopes = oauthScopes ); //guard against first scope
oauthScopes.push(...scopes);
await writeFile(pathToManifest, JSON.stringify(manifest));
}
clasp push
. Since you are changing the manifest, use the --force
option or you will have to approve each upload. Note that as of 2020, the project does not yet support partial updates, so all files will be replaced. Use .claspignore
file to ensure you do not accidentally push the whole node_modules
folder or similar.clasp deploy
. The command is customizable, so do not worry about having multiple deployments.