{"id":23550032,"url":"https://github.com/edwardsharp/versionz","last_synced_at":"2025-05-15T14:34:12.757Z","repository":{"id":190078798,"uuid":"681901549","full_name":"edwardsharp/versionz","owner":"edwardsharp","description":"prototype exploring versioned exports a la deno!","archived":false,"fork":false,"pushed_at":"2023-08-23T13:47:36.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T11:45:26.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edwardsharp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-23T02:27:45.000Z","updated_at":"2023-08-23T02:27:50.000Z","dependencies_parsed_at":"2023-08-23T06:21:27.607Z","dependency_job_id":null,"html_url":"https://github.com/edwardsharp/versionz","commit_stats":null,"previous_names":["edwardsharp/versionz"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwardsharp%2Fversionz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwardsharp%2Fversionz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwardsharp%2Fversionz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwardsharp%2Fversionz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edwardsharp","download_url":"https://codeload.github.com/edwardsharp/versionz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254358929,"owners_count":22058016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-26T10:12:46.924Z","updated_at":"2025-05-15T14:34:12.692Z","avatar_url":"https://github.com/edwardsharp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# versionz\n\na lil' prototype exploring versioned exports!\n\nnote: you probably shouldn't do this. just use [deno](https://deno.land)!\n\n## pretense\n\nnodejs is a ways away from [http imports](https://nodejs.org/api/esm.html#https-and-http-imports) 😬\n\nwith deno you can import stuff from different versions of the same package; and that's pretty cool.\n\nfor example:\n\n```ts\n// ramda-example.ts\nimport { add } from \"https://x.nest.land/ramda@0.27.0/source/index.js\";\nimport { multiply } from \"https://x.nest.land/ramda@0.27.2/mod.ts\";\n// note: these two fns are coming from two different versions (0.27.0 and 0.27.2) of the same package (ramda)\nconsole.log(\"add@0.27.0\", add(6, 6, 6));\nconsole.log(\"multiply@0.27.2\", multiply(6, 6, 6));\n\n// run like:\n// deno run ramda-example.ts\n```\n\n## proto\n\n...so then this lil' experiment can enable something like:\n\n```js\nimport { main as main1 } from \"versionz/0.0.1\";\nimport { main as main2 } from \"versionz/0.0.2\";\nimport { main as main3, newFn as newFn3 } from \"versionz/0.0.3\"; // newFn was introduced in v0.0.3!\nimport { main as main4, newFn as newFn4 } from \"versionz/0.0.4\";\nimport { main, newFn } from \"versionz/latest\";\n\nmain1();\nmain2();\nmain3();\nnewFn3();\nmain4();\nnewFn4();\nmain();\nnewFn();\n```\n\n`node example/index.js` then will output:\n\n```\n$ node example/index.js\nhi from version 0.0.1! 👋\nhi from version 0.0.2! 👋\nhi from version 0.0.3! 👋\nohai! this is newFn in version 0.0.3!!\nhi from version 0.0.4! 👋\nohai! this is newFn in version 0.0.4!!\nhi from version 0.0.4! 👋\nohai! this is newFn in version 0.0.4!!\n```\n\nthis is mostly achieved by the `exports` field in package.json having version identifies, like:\n\n```json\n\"exports\": {\n    \"./0.0.1\": \"./dist/0.0.1/index.js\",\n    \"./0.0.2\": \"./dist/0.0.2/index.js\",\n    \"./0.0.3\": \"./dist/0.0.3/index.js\",\n    \"./0.0.4\": \"./dist/0.0.4/index.js\"\n  },\n```\n\nthere's some package.json scripts that will:\n\n1. bump package.json's `version` using `npm version patch --no-git-tag-version`\n2. re-write (if needed) package.json's `exports` with the new version. see: [utilz/writePackageExports.js](utilz/writePackageExports.js)\n3. tsc build to `dist/latest/`\n4. and finally tsc build into a version folder in `dist/` (uses `process.env.npm_package_version` which is available to npm scripts!)\n\ncheck out the entire [package.json](package.json)\n\nsee also: [example/index.js](example/index.js)\n\n## dev\n\n`npm run bump-n-build` bump package a patch version, write package.json's `exports` with new version, `tsc` files to `dist/${new-package-version}`\n\nprofit! 💰\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwardsharp%2Fversionz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedwardsharp%2Fversionz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwardsharp%2Fversionz/lists"}