From 105a622d2cacd9a545035e9a48ac2fac5550788f Mon Sep 17 00:00:00 2001 From: panapol-p Date: Sun, 6 Aug 2023 20:48:15 +0700 Subject: [PATCH 1/7] fix: use io instead of io/ioutil --- codegens/golang/lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codegens/golang/lib/index.js b/codegens/golang/lib/index.js index c2fcd0dae..cb3fd6a05 100644 --- a/codegens/golang/lib/index.js +++ b/codegens/golang/lib/index.js @@ -242,7 +242,7 @@ self = module.exports = { // Setting isFile as false for further calls to this function isFile = false; } - codeSnippet += `${indent}"net/http"\n${indent}"io/ioutil"\n)\n\n`; + codeSnippet += `${indent}"net/http"\n${indent}"io"\n)\n\n`; codeSnippet += `func main() {\n\n${indent}url := "${getUrlStringfromUrlObject(request.url)}"\n`; codeSnippet += `${indent}method := "${request.method}"\n\n`; @@ -297,7 +297,7 @@ self = module.exports = { responseSnippet = `${indent}res, err := client.Do(req)\n`; responseSnippet += `${indent}if err != nil {\n${indent.repeat(2)}fmt.Println(err)\n`; responseSnippet += `${indent.repeat(2)}return\n${indent}}\n`; - responseSnippet += `${indent}defer res.Body.Close()\n\n${indent}body, err := ioutil.ReadAll(res.Body)\n`; + responseSnippet += `${indent}defer res.Body.Close()\n\n${indent}body, err := io.ReadAll(res.Body)\n`; responseSnippet += `${indent}if err != nil {\n${indent.repeat(2)}fmt.Println(err)\n`; responseSnippet += `${indent.repeat(2)}return\n${indent}}\n`; responseSnippet += `${indent}fmt.Println(string(body))\n}`; From 4de60132e67d2f2df1320537eb95473989737aef Mon Sep 17 00:00:00 2001 From: Vishal Shingala Date: Mon, 29 Jul 2024 19:18:44 +0530 Subject: [PATCH 2/7] Fixed an issue where io package was declared twice --- codegens/golang/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegens/golang/lib/index.js b/codegens/golang/lib/index.js index cb3fd6a05..b9436889c 100644 --- a/codegens/golang/lib/index.js +++ b/codegens/golang/lib/index.js @@ -238,7 +238,7 @@ self = module.exports = { } if (isFile) { codeSnippet += `${indent}"os"\n${indent}"path/filepath"\n`; - codeSnippet += `${indent}"io"\n`; + // Setting isFile as false for further calls to this function isFile = false; } From 4c48e138c0ac1d5ff83b8158ef5e95394a56622b Mon Sep 17 00:00:00 2001 From: Aman Singh Date: Tue, 10 Sep 2024 18:33:27 +0530 Subject: [PATCH 3/7] [Fix] Added Proper Installation Support for Various Node Package Managers and versions --- npm/deepinstall.js | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/npm/deepinstall.js b/npm/deepinstall.js index 3d392578a..ed26b480e 100644 --- a/npm/deepinstall.js +++ b/npm/deepinstall.js @@ -1,9 +1,10 @@ var shell = require('shelljs'), path = require('path'), async = require('async'), - { detect } = require('detect-package-manager'), + { detect, getNpmVersion } = require('detect-package-manager'), pm, - PRODUCTION_FLAG = '', + ver, + command, getSubfolders, fs = require('fs'), pwd = shell.pwd(); @@ -24,12 +25,34 @@ async.series([ return next(); }); }, + function (next) { + getNpmVersion(pm).then((res) => { + ver = res; + console.log('Detected ' + pm + ' version: ' + ver); + return next(); + }); + }, function (next) { if (args[2] && args[2] === 'dev') { console.log('Dev flag detected running ' + pm + ' install'); + command = pm + ' install'; } else { - PRODUCTION_FLAG = '--no-audit --production'; + switch (pm) { + case 'yarn': + if (ver.startsWith('1')) { + command = 'yarn install --production --frozen-lockfile'; + } + else { + command = 'touch yarn.lock && yarn workspaces focus --all --production' + } + break; + case 'pnpm': + command = 'pnpm install --prod'; + break; + default: + command = pm + ' install --no-audit --production'; + } } console.log('Running pre-package script'); @@ -51,8 +74,8 @@ async.series([ var commandOut; - console.log(codegen.name + ': ' + pm + ' install ' + PRODUCTION_FLAG); - commandOut = shell.exec(pm + ' install ' + PRODUCTION_FLAG, { silent: true }); + console.log(codegen.name + ': ' + command); + commandOut = shell.exec(command, { silent: true }); if (commandOut.code !== 0) { console.error('Failed to run ' + pm + ' install on codegen ' + codegen.name + ', here is the error:'); From 07f0abd410997f4f85fd15c0869ddad40a9ea08a Mon Sep 17 00:00:00 2001 From: Aman Singh Date: Tue, 10 Sep 2024 18:59:07 +0530 Subject: [PATCH 4/7] Update restsharp version and fix tests --- npm/ci-requirements.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ci-requirements.sh b/npm/ci-requirements.sh index f58c13a24..56336f751 100755 --- a/npm/ci-requirements.sh +++ b/npm/ci-requirements.sh @@ -39,7 +39,7 @@ pushd ./codegens/csharp-restsharp &>/dev/null; sudo apt-get install dotnet-sdk-6.0 dotnet new console -o testProject -f net6.0 pushd ./testProject &>/dev/null; - dotnet add package RestSharp --version 110.0.0 + dotnet add package RestSharp --version 120.0.0 popd &>/dev/null; popd &>/dev/null; From 123d0c80a8d8bfaf412b9514bc7fe3074b6f17bc Mon Sep 17 00:00:00 2001 From: Aman Singh Date: Tue, 10 Sep 2024 19:00:08 +0530 Subject: [PATCH 5/7] corrected restsharp version --- npm/ci-requirements.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ci-requirements.sh b/npm/ci-requirements.sh index 56336f751..8174fbf9a 100755 --- a/npm/ci-requirements.sh +++ b/npm/ci-requirements.sh @@ -39,7 +39,7 @@ pushd ./codegens/csharp-restsharp &>/dev/null; sudo apt-get install dotnet-sdk-6.0 dotnet new console -o testProject -f net6.0 pushd ./testProject &>/dev/null; - dotnet add package RestSharp --version 120.0.0 + dotnet add package RestSharp --version 112.0.0 popd &>/dev/null; popd &>/dev/null; From 7d06f098f980c56960108c20edab43b33dd94c19 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 11 Sep 2024 05:54:22 +0000 Subject: [PATCH 6/7] Prepare release v1.13.0 --- CHANGELOG.md | 12 ++++++++---- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d086d3f04..399767da0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,16 +2,18 @@ ## [Unreleased] +## [v1.13.0] - 2024-09-11 + ## [v1.12.0] - 2024-07-22 ### Chore -- Updated postman-collection sdk to version 4.4.0 in missing codegens. +- Updated postman-collection sdk to version 4.4.0 in missing codegens. ### Fixed -- Fix typo in Content-Header for audio/midi files in codegens. -- Added support for NTLM auth support in cURL codegen. +- Fix typo in Content-Header for audio/midi files in codegens. +- Added support for NTLM auth support in cURL codegen. ## [v1.11.0] - 2024-07-10 @@ -170,7 +172,9 @@ v1.0.0 (May 29, 2020) - Add ES6 syntax support for NodeJS Request, NodeJS Native and NodeJS Unirest - Fix snippet generation for powershell and jquery, where form data params had no type field -[Unreleased]: https://github.com/postmanlabs/postman-code-generators/compare/v1.12.0...HEAD +[Unreleased]: https://github.com/postmanlabs/postman-code-generators/compare/v1.13.0...HEAD + +[v1.13.0]: https://github.com/postmanlabs/postman-code-generators/compare/v1.12.0...v1.13.0 [v1.12.0]: https://github.com/postmanlabs/postman-code-generators/compare/v1.11.0...v1.12.0 diff --git a/package-lock.json b/package-lock.json index 2fee04685..c5c0623c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "postman-code-generators", - "version": "1.12.0", + "version": "1.13.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index dbf0af1bb..cb23c862a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "postman-code-generators", - "version": "1.12.0", + "version": "1.13.0", "description": "Generates code snippets for a postman collection", "main": "index.js", "directories": { From 59fd9dc42ad40d00b3f378d0404375577bc53445 Mon Sep 17 00:00:00 2001 From: Vishal Shingala Date: Wed, 11 Sep 2024 11:33:06 +0530 Subject: [PATCH 7/7] Update CHANGELOG.md for v1.13.0. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 399767da0..ee9afb1ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## [v1.13.0] - 2024-09-11 +### Fixed + +- Fix for - [#760](https://github.com/postmanlabs/postman-code-generators/issues/760) Fixed package installation issues with yarn (v4) and pnpm. + ## [v1.12.0] - 2024-07-22 ### Chore