Comparing version 0.0.12 to 1.0.0-alpha.1
{ | ||
"type": "module", | ||
"name": "g4c", | ||
"description": "CodeSandbox basic git commands wrapper.", | ||
"repository": "gitlab:vblip/g4c", | ||
"description": "A basic pure js git CLI implementation based on isomorphic-git.", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://gitlab.com/vblip/g4c.git" | ||
}, | ||
"author": { | ||
@@ -9,3 +13,3 @@ "name": "Ray Foss", | ||
}, | ||
"version": "0.0.12", | ||
"version": "1.0.0-alpha.1", | ||
"license": "GPL-3.0", | ||
@@ -27,5 +31,14 @@ "scripts": { | ||
"dependencies": { | ||
"isomorphic-git": "^1.19.2", | ||
"rsyncjs": "^0.0.12" | ||
}, | ||
"keywords": ["codesandbox", "gitlab"] | ||
"keywords": [ | ||
"codesandbox", | ||
"gitlab" | ||
], | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none" | ||
} | ||
} |
# g4c - Git for CodeSandbox | ||
## Summary | ||
A basic pure js git CLI implementation based on isomorphic-git. | ||
Aims to seamlessly support basic git | ||
commands via a bash alias in CodeSandbox. | ||
- [Master sandbox](https://codesandbox.io/s/g4c-git-for-codesandbox-r3f01) | ||
- [Git tracker](https://gitlab.com/vblip/g4c) | ||
@@ -13,51 +9,42 @@ | ||
Note: To bypass the bash alias and access the real git, use `\git` | ||
- g4c checkout // done | ||
- g4c checkout --force // done | ||
- g4c pull // done | ||
- g4c pull --ff-only // done | ||
- g4c status | ||
- g4c add --all | ||
- g4c commit -m "My commit message" | ||
- g4c push | ||
- git add . | ||
- git commit -m "My commit message" | ||
- git push | ||
- git pull | ||
- git status | ||
**TODO:** | ||
- g4c install | ||
- To be run after install through the package.json "prestart" script. Reads the env vars and modifies the container with a stable private key and a `.bashrc` alias. | ||
- g4c keygen | ||
- Runs ssh-keygen and escapes the new lines for use in G4C_ED25519 | ||
- g4c add FILE | ||
- git baremetal passthrough | ||
- git clone URL | ||
## Setup | ||
First, `yarn add --dev g4c`. This will give you access to the g4c command. | ||
`npm i -D g4c` | ||
Second, generate your ssh-keys with `npx g4c keygen` | ||
### Configuration Precedence | ||
Third, configure the CodeSandbox secret environment variables | ||
- First the long form package.json -> repository field is read | ||
- Then, package.json g4c | ||
- Finally, SECRETS.g4c.json can veto all others | ||
- G4C_EMAIL | ||
- eg: `12345-CrashOverride@users.noreply.gitlab.com` | ||
- G4C_REMOTE | ||
- a valid git ssh URI | ||
- eg: git@gitlab.com:evilcorp/e-coin.git | ||
- G4C_ED25519 | ||
- Your private key, with new lines replaced by \$ signs | ||
- G4C_RSA (alternatively) | ||
- same thing, but for RSA | ||
All of these are optional: | ||
Finally, add `"predev": "npx -y g4c i || :"` under your package.json scripts. Replace prestart with predevelop, preserve or prestart if you do not have a "dev" script. | ||
``` | ||
// SECRETS.g4c.json | ||
{ | ||
"proxy": "https://cors.isomorphic-git.org", | ||
"username": "inu", | ||
"password": "neko", | ||
"authorName": "John Doe", | ||
"authorEmail": "john@example.com" | ||
} | ||
``` | ||
"install" scripts **won't work** as we need access to the secrets which are not available at install time, only at final runtime. | ||
## Known Issues | ||
- Binaries like PNGs are problematic. They are modified by CSB every time they are written, so keeping the exact same binary in git as in CSB is impossible. It may be possible to hide this issue by handling exif data. | ||
- `npx -y g4c i` should install latest if not found | ||
Also, | ||
Every call to rsyncjs copies all files, even if they are the same or have been copied before. As read calls are cheaper than write ones, one solution is to add support for a checksum function which will compare the file if the destination is younger. Hardlinks are not an option in CSB, as `/sandbox` has it's own device. | ||
``` | ||
# How does git find changes? | ||
Indexing. For every tracked file, Git records information such as its size, creation time and last modification time in a file known as the index. To determine whether a file has changed, Git compares its current stats with those cached in the index. If they match, then Git can skip reading the file again. | ||
``` | ||
CodeSandbox it's self uses a similar strategy, because of it, the git clone files and the sandbox directory will have very similar mtime/ctime. | ||
[Issue tracker](https://gitlab.com/vblip/g4c/-/issues) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
20025
9
651
9
Yes
2
50
4
+ Addedisomorphic-git@^1.19.2
+ Addedasync-lock@1.4.1(transitive)
+ Addedclean-git-ref@2.0.1(transitive)
+ Addedcrc-32@1.2.2(transitive)
+ Addeddecompress-response@6.0.0(transitive)
+ Addeddiff3@0.0.3(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisomorphic-git@1.27.1(transitive)
+ Addedmimic-response@3.1.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedminimisted@2.0.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpako@1.0.11(transitive)
+ Addedpify@4.0.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsha.js@2.4.11(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@4.0.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwrappy@1.0.2(transitive)