Socket
Socket
Sign inDemoInstall

g4c

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

g4c - npm Package Compare versions

Comparing version 0.0.12 to 1.0.0-alpha.1

docs/g4c.js

21

package.json
{
"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"
}
}

73

README.md
# 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc