diff --git a/CHANGELOG.md b/CHANGELOG.md index d086d3f04..ee9afb1ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,16 +2,22 @@ ## [Unreleased] +## [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 -- 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 +176,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/codegens/golang/lib/index.js b/codegens/golang/lib/index.js index c2fcd0dae..b9436889c 100644 --- a/codegens/golang/lib/index.js +++ b/codegens/golang/lib/index.js @@ -238,11 +238,11 @@ 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; } - 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}`; diff --git a/npm/ci-requirements.sh b/npm/ci-requirements.sh index f58c13a24..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 110.0.0 + dotnet add package RestSharp --version 112.0.0 popd &>/dev/null; popd &>/dev/null; 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:'); 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": {