Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sarisia/patterns
Pattern Cookbooks
https://github.com/sarisia/patterns
Last synced: 20 days ago
JSON representation
Pattern Cookbooks
- Host: GitHub
- URL: https://github.com/sarisia/patterns
- Owner: sarisia
- Created: 2024-05-13T06:02:16.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-26T13:17:31.000Z (4 months ago)
- Last Synced: 2024-10-04T18:41:35.310Z (about 1 month ago)
- Language: Shell
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# patterns
### [Devcontainer Local Feature](./devcontainer-local-feature/)
Used when you want to install global tools which depends on
[Devcontainer features](https://containers.dev/features).### Devcontainer Share Host AWS Credentials
```jsonc
// .devcontainer/devcontainer.json{
"initializeCommand": {
"ensure-aws-dir": "mkdir -p ${localEnv:HOME}/.aws"
},
"mounts": [
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=consistent"
]
}
```### Devcontainer Ensure .env File
```jsonc
// .devcontainer/devcontainer.json{
"initializeCommand": {
"ensure-dotenv-file": "cp --no-clobber .env.example .env || true"
}
}
```### Devcontainer Preserve Fish Shell History
```jsonc
{
"mounts": [
"source=${devcontainerId}-fish-history,target=/home/vscode/.local/share/fish,type=volume"
]
}
```### Devcontainer Non-root User
```
RUN groupadd --gid 1000 vscode \
&& useradd --uid 1000 --gid 1000 -m vscode
```Devcontainer automatically updates UID/GID to match host's ones
[Add non-root user to a container](https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user)
### Temporary Non-root
```
RUN su node -c "npm run prod"
```### Poetry
#### Create cwd .venv
Useful for Devcontainer / CICD caching
```
$ poetry config --local virtualenvs.in-project true
```#### Disable Package Mode
This will force `poetry install --no-root` and also make
`name` and `version` optional.https://python-poetry.org/docs/basic-usage/#operating-modes
```toml
# pyproject.toml[tool.poetry]
package-mode = false
```### Vite Multiple Entrypoints
Create multiple pages without router (at the sacrifice of performance)
```js
// vite.config.jsimport { defineConfig } from "vite"
import { resolve } from "path"export default defineConfig({
base: "./",
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
othello: resolve(__dirname, "components", "othello", "index.html")
}
},
}
})
```