diff --git a/fixtures/dual/package.json b/fixtures/dual/package.json new file mode 100644 index 0000000..ca23709 --- /dev/null +++ b/fixtures/dual/package.json @@ -0,0 +1,25 @@ +{ + "dependencies": { + "gulp-sourcemaps": "2.0.0", + "prismjs": "1.0.0", + "svgstore": "^3.0.0", + "html-webpack-plugin": "4.0.0-alpha.2", + "noty": "3.1.0", + "jpeg-buffer-orientation": "0.0.0", + "styled-components": "2.5.0-1", + "@babel/preset-env": "7.0.0", + "updates": "https://github.com/silverwind/updates/tarball/6941e05", + "ipaddr.js": "https://github.com/silverwind/ipaddr.js/tarball/ipv6_cidrs_take2", + "react": "18.0" + }, + "devDependencies": { + "updates": "file:." + }, + "peerDependencies": { + "@babel/preset-env": "~6.0.0", + "svgstore": "^1.0.0 || ^2.0.0" + }, + "resolutions": { + "versions/updates": "^1.0.0" + } +} diff --git a/fixtures/pyproject.toml b/fixtures/dual/pyproject.toml similarity index 100% rename from fixtures/pyproject.toml rename to fixtures/dual/pyproject.toml diff --git a/fixtures/poetry/pyproject.toml b/fixtures/poetry/pyproject.toml new file mode 100644 index 0000000..714e2ac --- /dev/null +++ b/fixtures/poetry/pyproject.toml @@ -0,0 +1,12 @@ +[tool.poetry] +name = "" +version = "0.0.0" +description = "" +authors = [] + +[tool.poetry.dependencies] +python = "^3.8" + +[tool.poetry.group.dev.dependencies] +djlint = "1.30.0" +PyYAML = "6.0" diff --git a/snapshots/updates.test.js.snap b/snapshots/updates.test.js.snap index b4a3079..32fc145 100644 --- a/snapshots/updates.test.js.snap +++ b/snapshots/updates.test.js.snap @@ -1,5 +1,114 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`dual 1`] = ` +{ + "npm": { + "dependencies": { + "@babel/preset-env": { + "age": "3 years", + "info": "https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env", + "new": "7.11.5", + "old": "7.0.0", + }, + "gulp-sourcemaps": { + "age": "4 years", + "info": "https://github.com/gulp-sourcemaps/gulp-sourcemaps", + "new": "2.6.5", + "old": "2.0.0", + }, + "html-webpack-plugin": { + "age": "3 years", + "info": "https://github.com/jantimon/html-webpack-plugin", + "new": "4.0.0-beta.11", + "old": "4.0.0-alpha.2", + }, + "jpeg-buffer-orientation": { + "age": "3 years", + "info": "https://github.com/fisker/jpeg-buffer-orientation", + "new": "2.0.3", + "old": "0.0.0", + }, + "noty": { + "age": "5 years", + "info": "https://github.com/needim/noty", + "new": "3.2.0-beta", + "old": "3.1.0", + }, + "prismjs": { + "age": "4 years", + "info": "https://github.com/LeaVerou/prism", + "new": "1.17.1", + "old": "1.0.0", + }, + "react": { + "age": "1 year", + "info": "https://github.com/facebook/react/tree/HEAD/packages/react", + "new": "18.2.0", + "old": "18.0", + }, + "styled-components": { + "age": "3 years", + "info": "https://github.com/styled-components/styled-components", + "new": "5.0.0-rc.2", + "old": "2.5.0-1", + }, + "svgstore": { + "age": "4 years", + "info": "https://github.com/svgstore/svgstore", + "new": "^3.0.0-2", + "old": "^3.0.0", + }, + "updates": { + "age": "3 years", + "info": "https://github.com/silverwind/updates", + "new": "537ccb7", + "old": "6941e05", + }, + }, + "peerDependencies": { + "@babel/preset-env": { + "age": "3 years", + "info": "https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env", + "new": "~7.11.5", + "old": "~6.0.0", + }, + }, + "resolutions": { + "versions/updates": { + "age": "3 years", + "info": "https://github.com/silverwind/updates", + "new": "^10.0.0", + "old": "^1.0.0", + }, + }, + }, + "pypi": { + "dependencies": { + "updates": { + "age": "3 years", + "info": "https://github.com/silverwind/updates", + "new": "537ccb7", + "old": "6941e05", + }, + }, + "tool.poetry.group.dev.dependencies": { + "PyYAML": { + "age": "1 year", + "info": "https://github.com/yaml/pyyaml", + "new": "6.0", + "old": "6.0", + }, + "djlint": { + "age": "2 months", + "info": "https://github.com/Riverside-Healthcare/djlint", + "new": "1.31.0", + "old": "1.30.0", + }, + }, + }, +} +`; + exports[`exclude 1`] = ` { "npm": { diff --git a/updates.test.js b/updates.test.js index 98e5b2c..a481bca 100644 --- a/updates.test.js +++ b/updates.test.js @@ -9,6 +9,9 @@ import {env} from "node:process"; const testFile = fileURLToPath(new URL("fixtures/npm-test/package.json", import.meta.url)); const emptyFile = fileURLToPath(new URL("fixtures/npm-empty/package.json", import.meta.url)); +const poetryFile = fileURLToPath(new URL("fixtures/poetry/pyproject.toml", import.meta.url)); +const dualFile = fileURLToPath(new URL("fixtures/dual", import.meta.url)); + const testPkg = JSON.parse(readFileSync(testFile, "utf8")); const testDir = mkdtempSync(join(tmpdir(), "updates-")); const script = fileURLToPath(new URL("updates.js", import.meta.url)); @@ -174,7 +177,5 @@ test("exclude", makeTest("-j -e gulp-sourcemaps,prismjs,svgstore,html-webpack-pl test("exclude", makeTest("-j -e gulp-sourcemaps -i /react/")); test("exclude", makeTest("-j -i gulp*")); test("exclude", makeTest("-j -i /^gulp/ -P gulp*")); - -test("pypi", makeTest( - `-j -f ${fileURLToPath(new URL("fixtures/pyproject.toml", import.meta.url))}`, -)); +test("pypi", makeTest(`-j -f ${poetryFile}`)); +test("dual", makeTest(`-j -f ${dualFile}`));