{"id":16959868,"url":"https://github.com/jondotsoy/use-workspace","last_synced_at":"2026-05-04T23:33:55.929Z","repository":{"id":226971307,"uuid":"770096122","full_name":"JonDotsoy/use-workspace","owner":"JonDotsoy","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-10T01:26:53.000Z","size":79,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2024-04-11T00:17:42.906Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JonDotsoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-10T22:28:33.000Z","updated_at":"2024-04-15T02:27:11.378Z","dependencies_parsed_at":"2024-04-15T02:27:08.580Z","dependency_job_id":"e58811ed-13a1-4361-826d-a37d11cc7ddf","html_url":"https://github.com/JonDotsoy/use-workspace","commit_stats":null,"previous_names":["jondotsoy/use-workspace"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonDotsoy%2Fuse-workspace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonDotsoy%2Fuse-workspace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonDotsoy%2Fuse-workspace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonDotsoy%2Fuse-workspace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JonDotsoy","download_url":"https://codeload.github.com/JonDotsoy/use-workspace/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244819801,"owners_count":20515646,"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-10-13T22:46:26.441Z","updated_at":"2026-05-04T23:33:55.837Z","avatar_url":"https://github.com/JonDotsoy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# use-workspace\n\n`use-workspace` is a set of tools designed to facilitate the creation, configuration, and maintenance of workspaces for development projects. It provides a simple API for managing directories, files, and configurations related to the development environment.\n\n**Sample:**\n\n```ts\nimport { useWorkspace } from \"use-workspace\";\nimport { useGit } from \"use-workspace/git\";\n\nconst workspace = await useWorkspace(\"foo\");\n\nworkspace.toURL(); // 'file://$WORKSPACE_LOCATION/foo/'\nworkspace.toURL(\"biz.txt\"); // 'file://$WORKSPACE_LOCATION/foo/biz.txt'\n\n// $ ls $WORKSPACE_LOCATION/foo/\n// .gitignore\n\nconst git = await useGit(workspace);\n// $ ls $WORKSPACE_LOCATION/foo/\n// .git/\n// .gitignore\n\nawait git.config.set(\"taz.bar\", \"Bar\");\nawait git.config.get(\"taz.bar\"); // =\u003e \"Bar\"\n```\n\n### Git integration\n\nAllows for easy initialization of Git repositories within the workspace and their configuration.\n\n```ts\nimport { useGit } from \"use-workspace/git\";\n\nconst git = await useGit(workspace);\n\nconst editor = await git.config.get(\"core.editor\");\n\nexpect(editor).toEqual(\"vim\");\n```\n\n### Server integration\n\nIncludes the ability to launch a local server associated with the workspace for testing and development purposes.\n\n```ts\nimport { useServer } from \"use-workspace/server\";\n\nawait using server = useServer(workspace);\n\nserver.toURL(\"foo.txt\"); // 'https://localhost:3000/foo.txt'\n```\n\n**Create server instance**\n\n```ts\nawait using server = useServer(workspace);\n```\n\n**Get url of file**\n\n```ts\nserver.toURL(\"foo.txt\"); // 'https://localhost:3000/foo.txt'\n```\n\n**Custom fetcher**\n\n```ts\nawait using server = useServer(workspace, {\n  fetchers: [(req: Request) =\u003e new Response(\"ok\")],\n});\n```\n\n**Custom URL**\n\n```ts\nawait using server = useServer(workspace, {\n  publicUrl: \"https://my-url/with-subpath/\",\n});\n```\n\n## NPM Pack Integration\n\nThe `useNpmPack` API provided by the module `\"use-workspace/use-npm-pack\"` enables the packaging of workspaces for distribution and deployment. The first argument specifies a workspace for a package, and the second argument is an array describing the list of files to observe for changes since the last packaging.\n\nInternally, it executes the `npm pack` command to create a `.tgz` file, allowing it to be used in any other workspace seamlessly.\n\n**Example**\n\n```ts\nimport {useNpmPack} from \"use-workspace/use-npm-pack\"\n\nconst pack = await useNpmPack(workspace, [\"package.json\", \"src/index.ts\",...])\npack // =\u003e 'file://.../package.tgz'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjondotsoy%2Fuse-workspace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjondotsoy%2Fuse-workspace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjondotsoy%2Fuse-workspace/lists"}