Git Product home page Git Product logo

patterns's Introduction

patterns

Used when you want to install global tools which depends on Devcontainer features.

Devcontainer Share Host AWS Credentials

// .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

// .devcontainer/devcontainer.json

{
  "initializeCommand": {
    "ensure-dotenv-file": "cp --no-clobber .env.example .env || true"
  }
}

Devcontainer Preserve Fish Shell History

{
  "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

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

# pyproject.toml

[tool.poetry]
package-mode = false

Vite Multiple Entrypoints

Create multiple pages without router (at the sacrifice of performance)

// vite.config.js

import { 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")
            }
        },
    }
})

patterns's People

Contributors

sarisia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.