-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fa0905
commit 02fdf21
Showing
3 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import {foreachClasp, runClasp} from "./common"; | ||
|
||
interface CommandOption { | ||
readonly retry?: string; | ||
readonly force?: boolean; | ||
} | ||
|
||
/** | ||
* Get Clasp Arguments. | ||
* | ||
* @param options.nondev {boolean} If we want to push the last deployed version vs the latest code. | ||
* @param options.retry {number} If the push of an App Script fail with it will retry n times | ||
* @returns {string} the command arguments | ||
*/ | ||
function getPushClaspArgs(options: CommandOption): string{ | ||
let claspArgs = ""; | ||
|
||
if (!options) { | ||
return claspArgs; | ||
} | ||
|
||
claspArgs += options.force?" --force":""; | ||
|
||
return claspArgs; | ||
} | ||
|
||
/** | ||
* Uploads all files into the script.google.com filesystem. | ||
* @param options.watch {boolean} If true, runs `clasp push` when any local file changes. Exit with ^C. | ||
* @param options.retry {number} If the push of an App Script fail with it will retry n times | ||
*/ | ||
export default async (options: CommandOption): Promise<void> => { | ||
const retry = parseInt(options.retry); | ||
|
||
foreachClasp(async (claspConfig)=>{ | ||
let retVal = false; | ||
|
||
for (let r = 0; r < retry; r++) { | ||
retVal = await runClasp(claspConfig, process.argv[2], getPushClaspArgs(options)); | ||
if(retVal){ | ||
break; | ||
} | ||
} | ||
if(!retVal){ | ||
process.exit(1); | ||
} | ||
}); | ||
}; |