From 58fbbb50537f2545d0aa78d94e1a8282f3c369fb Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Sun, 8 Aug 2021 10:52:18 +0200 Subject: [PATCH] Fix the quote issue in `yarn deploy` --- devEnv/deploy.mjs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/devEnv/deploy.mjs b/devEnv/deploy.mjs index def442a..d75498e 100644 --- a/devEnv/deploy.mjs +++ b/devEnv/deploy.mjs @@ -41,6 +41,26 @@ const packagesWhoseVersionsShouldBump = [ // prepublish script is only called from the `$ cd /path/to/monorepo; yarn run deploy` process.env.THEATRE_IS_PUBLISHING = true + // better quote function from https://github.com/google/zx/pull/167 + $.quote = function quote(arg) { + if (/^[a-z0-9/_.-]+$/i.test(arg)) { + return arg + } + return ( + `$'` + + arg + .replace(/\\/g, '\\\\') + .replace(/'/g, "\\'") + .replace(/\f/g, '\\f') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/\t/g, '\\t') + .replace(/\v/g, '\\v') + .replace(/\0/g, '\\0') + + `'` + ) + } + $.verbose = false const gitTags = (await $`git tag --list`).toString().split('\n')