+31
-10
@@ -1,18 +0,39 @@ | ||
| This demo showcase how to run Git in browser but write to a real user file system | ||
| folder. It is possible through File System Access API. The API allows to request | ||
| a folder from user and then use it as a real file system in browser. | ||
| # Git in a real browser folder | ||
| In this demo we use `memfs` to create a Node `fs`-like file system in browser | ||
| out of the folder provided by File System Access API. We then use `isomorphic-git` | ||
| to run Git commands on that file system. | ||
| This demo shows how to run Git in a browser while writing to a real folder on | ||
| the user's device. It uses the File System Access API to select a folder, | ||
| `memfs` to expose that folder through a Node.js `fs`-like API, and | ||
| `isomorphic-git` to run Git commands. | ||
| In the demo itself we initiate a Git repo, then we create a `README.md` file, we | ||
| stage it, and finally we commit it. | ||
| The first time a folder is selected, the demo creates a repository in its | ||
| `repo` subdirectory, writes and stages a `README.md`, and creates an initial | ||
| commit. The selected directory handle is saved in IndexedDB. On later visits, | ||
| the demo reopens the repository or asks the user to restore permission with a | ||
| button click. | ||
| https://github.com/streamich/memfs/assets/9773803/c15212e8-3ee2-4d2a-b325-9fbdcc377c12 | ||
| Run: | ||
| ## Run | ||
| From the repository root: | ||
| ``` | ||
| yarn demo:git-fsa | ||
| yarn build | ||
| yarn workspace memfs demo:git-fsa | ||
| ``` | ||
| Open `http://localhost:9876` in Chrome or Edge. Browsers treat localhost as a | ||
| secure context for the File System Access API. | ||
| ## Manual test | ||
| 1. Select a new empty folder and confirm that it receives `repo/README.md` and | ||
| a `repo/.git` directory. | ||
| 2. Reload the page. If the browser asks for permission again, click | ||
| **Reconnect saved folder** and grant read/write access. | ||
| 3. Confirm that the page reports that it reopened the repository and that no | ||
| second repository or initial commit is created. | ||
| 4. Deny a reconnect request and confirm that the page reports the denial | ||
| without changing the folder. | ||
| 5. Click **Forget saved folder**, reload, and confirm that the page asks for a | ||
| new folder. |
+10
-9
| { | ||
| "name": "memfs", | ||
| "version": "4.66.1", | ||
| "version": "4.67.0", | ||
| "publishConfig": { | ||
@@ -105,2 +105,3 @@ "access": "public" | ||
| "buffer": "^6.0.3", | ||
| "events": "^3.3.0", | ||
| "html-webpack-plugin": "^5.5.3", | ||
@@ -129,10 +130,10 @@ "husky": "^8.0.1", | ||
| "dependencies": { | ||
| "@jsonjoy.com/fs-core": "4.66.1", | ||
| "@jsonjoy.com/fs-fsa": "4.66.1", | ||
| "@jsonjoy.com/fs-node": "4.66.1", | ||
| "@jsonjoy.com/fs-node-builtins": "4.66.1", | ||
| "@jsonjoy.com/fs-node-to-fsa": "4.66.1", | ||
| "@jsonjoy.com/fs-node-utils": "4.66.1", | ||
| "@jsonjoy.com/fs-print": "4.66.1", | ||
| "@jsonjoy.com/fs-snapshot": "4.66.1", | ||
| "@jsonjoy.com/fs-core": "4.67.0", | ||
| "@jsonjoy.com/fs-fsa": "4.67.0", | ||
| "@jsonjoy.com/fs-node": "4.67.0", | ||
| "@jsonjoy.com/fs-node-builtins": "4.67.0", | ||
| "@jsonjoy.com/fs-node-to-fsa": "4.67.0", | ||
| "@jsonjoy.com/fs-node-utils": "4.67.0", | ||
| "@jsonjoy.com/fs-print": "4.67.0", | ||
| "@jsonjoy.com/fs-snapshot": "4.67.0", | ||
| "@jsonjoy.com/json-pack": "^1.11.0", | ||
@@ -139,0 +140,0 @@ "@jsonjoy.com/util": "^1.9.0", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
69658
1.22%28
3.7%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated