From 5c7b3fd30dd6602008ee41ba885b71fc1b70b93b Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:05:02 +0530 Subject: [PATCH] chore: make build scripts compatible on windows (#146) --- go.mod | 8 ++++---- go.sum | 12 ++++++------ scripts/helpers.js | 9 +++++++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 2fd81af..3333735 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.14 require ( github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 - github.com/davecgh/go-spew v1.1.1 + github.com/davecgh/go-spew v1.1.1 // indirect github.com/gorilla/websocket v1.4.2 - github.com/h2non/filetype v1.1.0 - github.com/stretchr/testify v1.6.1 - gopkg.in/square/go-jose.v2 v2.5.1 + github.com/h2non/filetype v1.1.1 + github.com/stretchr/testify v1.7.0 + gopkg.in/square/go-jose.v2 v2.6.0 ) diff --git a/go.sum b/go.sum index 6e26a86..d3a3224 100644 --- a/go.sum +++ b/go.sum @@ -5,16 +5,16 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/h2non/filetype v1.1.0 h1:Or/gjocJrJRNK/Cri/TDEKFjAR+cfG6eK65NGYB6gBA= -github.com/h2non/filetype v1.1.0/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY= +github.com/h2non/filetype v1.1.1 h1:xvOwnXKAckvtLWsN398qS9QhlxlnVXBjXBydK2/UFB4= +github.com/h2non/filetype v1.1.1/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w= -gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= +gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/scripts/helpers.js b/scripts/helpers.js index a044e6b..cc53ddb 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -15,6 +15,8 @@ const getCacheDirectory = () => { return path.join(os.homedir(), '.cache'); case "darwin": return path.join(os.homedir(), 'Library', 'Caches'); + case 'win32': + return path.join(os.homedir(), 'AppData', 'Local'); default: throw new Error(`Not implemented for: ${os.platform()}`) } @@ -23,12 +25,15 @@ const getCacheDirectory = () => { const getCliLocation = () => { const cacheDirectory = getCacheDirectory() const cliVersion = getCliVersion() - return path.join(cacheDirectory, "ms-playwright-go", cliVersion, "playwright.sh") + if (os.platform() !== "win32") + return path.join(cacheDirectory, "ms-playwright-go", cliVersion, "playwright.sh") + return path.join(cacheDirectory, "ms-playwright-go", cliVersion, "playwright.cmd") } const getAPIDocs = () => { - return JSON.parse(child_process.execSync(`${getCliLocation()} print-api-json`, { + return JSON.parse(child_process.execSync(`"${getCliLocation()}" print-api-json`, { maxBuffer: 1024 * 1024 * 10, + shell: true }).toString()) }