-
Notifications
You must be signed in to change notification settings - Fork 10
Add devcontainer configuration #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,236 @@ | ||
| # DMNO Development Container | ||
|
|
||
| This devcontainer provides a complete development environment for contributing to the DMNO project across all packages, plugins, integrations, and platforms. | ||
|
|
||
| ## What's Included | ||
|
|
||
| - **Node.js 22** - Latest stable version on Debian Bookworm | ||
| - **pnpm** - Fast, disk space efficient package manager (globally installed) | ||
| - **Build Tools** - turbo, tsup, and TypeScript (globally installed) | ||
| - **VS Code Extensions**: | ||
| - TypeScript support | ||
| - ESLint and Prettier for code formatting | ||
| - Astro extension for the docs site | ||
| - Tailwind CSS support | ||
| - Markdown and MDX support | ||
| - YAML support | ||
|
|
||
| ## Setup Process | ||
|
|
||
| The devcontainer uses a two-stage setup for optimal performance and reliability: | ||
|
|
||
| ### 1. **onCreate** (Container-level setup - cached) | ||
| - Installs pnpm globally | ||
| - Installs build tools (turbo, tsup, TypeScript) globally | ||
| - Verifies all tools are properly installed | ||
| - Runs once and gets cached with the container image | ||
|
|
||
| ### 2. **postCreate** (Project-level setup - runs every time) | ||
| - Validates workspace structure | ||
| - Installs all dependencies with `pnpm install` | ||
| - Builds all packages with `pnpm run build` | ||
| - Includes fallback strategies if any step fails | ||
| - Shows progress and can be debugged if needed | ||
|
|
||
| ## Getting Started | ||
|
|
||
| 1. **Open in VS Code**: Click the "Reopen in Container" button when VS Code detects the devcontainer | ||
| 2. **Wait for setup**: The container will automatically run both setup stages | ||
| 3. **Start developing**: The environment is ready for any DMNO development! | ||
|
|
||
| ## Port Forwarding | ||
|
|
||
| The following ports are automatically forwarded: | ||
| - **4321** - Docs site (Astro) | ||
| - **5173** - Dev UI (Vite) | ||
| - **3000** - Example applications | ||
| - **8080** - API server | ||
|
|
||
| ## Development Commands | ||
|
|
||
| ```bash | ||
| # Test DMNO CLI | ||
| pnpm dmno --help | ||
|
|
||
| # Run docs site | ||
| cd packages/docs-site && pnpm run dev | ||
|
|
||
| # Run dev UI | ||
| cd packages/dev-ui && pnpm run dev | ||
|
|
||
| # Build all packages | ||
| pnpm run build | ||
|
|
||
| # Build a specific package | ||
| cd packages/<package-name> && pnpm build | ||
|
|
||
| # Install dependencies | ||
| pnpm install | ||
|
|
||
| # Run tests (if available) | ||
| pnpm test | ||
| ``` | ||
|
|
||
| ## Available Packages | ||
|
|
||
| ### Core Packages | ||
| - `packages/core` - Core DMNO functionality and CLI | ||
| - `packages/configraph` - Configuration graph library | ||
| - `packages/docs-site` - Documentation website | ||
| - `packages/dev-ui` - Development UI | ||
| - `packages/dmno-api` - API server | ||
|
|
||
| ### Integrations | ||
| - `packages/integrations/astro` - Astro integration | ||
| - `packages/integrations/vite` - Vite integration | ||
| - `packages/integrations/nextjs` - Next.js integration | ||
| - `packages/integrations/remix` - Remix integration | ||
| - `packages/integrations/fastify` - Fastify integration | ||
|
|
||
| ### Plugins | ||
| - `packages/plugins/1password` - 1Password plugin | ||
| - `packages/plugins/encrypted-vault` - Encrypted vault plugin | ||
| - `packages/plugins/bitwarden` - Bitwarden plugin | ||
| - `packages/plugins/infisical` - Infisical plugin | ||
|
|
||
| ### Platforms | ||
| - `packages/platforms/netlify` - Netlify platform support | ||
| - `packages/platforms/vercel` - Vercel platform support | ||
| - `packages/platforms/cloudflare` - Cloudflare platform support | ||
|
|
||
| ## Development Workflow | ||
|
|
||
| 1. **Make changes** to any package | ||
| 2. **Build dependencies** if you modified a package that others depend on | ||
| 3. **Test your changes** by running the relevant dev servers or examples | ||
| 4. **Submit a PR** following the contribution guidelines | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Common Issues | ||
|
|
||
| #### 1. `Cannot find module '@dmno/tsconfig/tsconfig.node.json'` | ||
|
|
||
| **Cause**: This happens when packages with workspace dependencies try to build before the workspace is properly linked. | ||
|
|
||
| **Solution**: | ||
| ```bash | ||
| # Run the quick setup script | ||
| bash .devcontainer/quick-setup.sh | ||
|
|
||
| # Or manually build in dependency order: | ||
| cd packages/tsconfig && pnpm build # Config packages first | ||
| cd packages/configraph && npx pnpm build # Use npx for workspace deps | ||
| cd packages/core && npx pnpm build | ||
| ``` | ||
|
|
||
| **Why this works**: Using `npx pnpm build` ensures the build happens in the workspace context where workspace dependencies are properly resolved. | ||
|
|
||
| #### 2. `pnpm install` hangs or fails | ||
|
|
||
| **Cause**: Network issues, registry problems, or interactive prompts in non-interactive environment. | ||
|
|
||
| **Solution**: | ||
| ```bash | ||
| # Set non-interactive environment | ||
| export CI=true | ||
|
|
||
| # Try alternative install methods | ||
| pnpm install --ignore-scripts --no-optional | ||
| # or | ||
| pnpm install --frozen-lockfile=false --force | ||
| ``` | ||
|
|
||
| #### 3. Global tools not found (`turbo`, `tsup`, etc.) | ||
|
|
||
| **Cause**: Tools weren't installed in the onCreate phase or installation failed. | ||
|
|
||
| **Solution**: | ||
| ```bash | ||
| # Install missing tools | ||
| npm install -g turbo@latest tsup@latest typescript@latest | ||
|
|
||
| # Verify installation | ||
| turbo --version | ||
| tsup --version | ||
| tsc --version | ||
| ``` | ||
|
|
||
| #### 4. Build fails with "Local package.json exists, but node_modules missing" | ||
|
|
||
| **Cause**: Package-level node_modules weren't installed properly. | ||
|
|
||
| **Solution**: | ||
| ```bash | ||
| # Force reinstall from workspace root | ||
| pnpm install --force | ||
|
|
||
| # Or reinstall specific package | ||
| cd packages/failing-package | ||
| pnpm install | ||
| ``` | ||
|
|
||
| #### 5. Workspace packages can't find each other | ||
|
|
||
| **Cause**: Workspace linking isn't working properly. | ||
|
|
||
| **Solution**: | ||
| ```bash | ||
| # Verify workspace structure | ||
| pnpm list --depth=0 | ||
|
|
||
| # Check if packages are properly linked | ||
| ls -la packages/tsconfig/ # Should show config files | ||
| ls -la packages/configraph/node_modules/@dmno/ # Should show linked packages | ||
| ``` | ||
|
|
||
| ## Package Dependencies | ||
|
|
||
| Understanding the dependency order helps with troubleshooting: | ||
|
|
||
| ### Configuration Packages (no dependencies) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only concern here is keeping this info up to date as it is written in many places. Obviously AI helps a lot, but maybe better to just include a link to somewhere else? |
||
| - `@dmno/tsconfig` - TypeScript configurations | ||
| - `@dmno/eslint-config` - ESLint configurations | ||
|
|
||
| ### Core Libraries (minimal dependencies) | ||
| - `@dmno/encryption-lib` - Encryption utilities | ||
| - `@dmno/ts-lib` - TypeScript utilities | ||
| - `@dmno/ui-lib` - UI components | ||
|
|
||
| ### Engine Packages (depend on config + core) | ||
| - `@dmno/configraph` - Configuration graph engine | ||
| - `@dmno/core` - Main DMNO engine | ||
|
|
||
| ### Integrations (depend on core) | ||
| - `@dmno/vite-integration` | ||
| - `@dmno/astro-integration` | ||
| - `@dmno/nextjs-integration` | ||
| - `@dmno/remix-integration` | ||
| - `@dmno/fastify-integration` | ||
|
|
||
| ### Plugins (depend on core) | ||
| - `@dmno/encrypted-vault-plugin` | ||
| - `@dmno/1password-plugin` | ||
| - `@dmno/bitwarden-plugin` | ||
| - `@dmno/infisical-plugin` | ||
|
|
||
| ### Platforms (depend on core) | ||
| - `@dmno/netlify-platform` | ||
| - `@dmno/vercel-platform` | ||
| - `@dmno/cloudflare-platform` | ||
|
|
||
| **Build Rule**: Always build packages in dependency order. Configuration packages first, then core libraries, then everything else. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hopefully folks wont have to think about this too much. A single run of |
||
|
|
||
| ## Performance Benefits | ||
|
|
||
| - **Faster rebuilds**: Global tools are cached with the container | ||
| - **Better debugging**: Project setup is visible and can be troubleshooted | ||
| - **Consistent environment**: Always uses Node 22 on Debian Bookworm | ||
| - **Complete workspace**: All packages are built and ready for development | ||
| - **Robust error handling**: Multiple fallback strategies for common issues | ||
|
|
||
| ## More Information | ||
|
|
||
| - See [CONTRIBUTING.md](../CONTRIBUTING.md) for detailed contribution guidelines | ||
| - Join the [Discord](https://chat.dmno.dev) for questions and support | ||
| - Check out the [docs](https://dmno.dev/docs) for more information about DMNO | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Basic Powerlevel10k configuration | ||
| # Run 'p10k configure' to customize | ||
|
|
||
| # Temporarily change options | ||
| 'builtin' 'local' '-a' 'p10k_config_opts' | ||
| [[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases') | ||
| [[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob') | ||
| [[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand') | ||
| 'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' | ||
|
|
||
| # Basic elements for a clean prompt | ||
| typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( | ||
| dir # current directory | ||
| vcs # git status | ||
| prompt_char # prompt symbol | ||
| ) | ||
|
|
||
| typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( | ||
| status # exit code of the last command | ||
| command_execution_time # duration of the last command | ||
| background_jobs # presence of background jobs | ||
| time # current time | ||
| ) | ||
|
|
||
| # Restore options | ||
| (( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]} | ||
| 'builtin' 'unset' 'p10k_config_opts' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Only load plugins in interactive shells | ||
| [[ $- == *i* ]] || return | ||
|
|
||
| # Enable Powerlevel10k instant prompt | ||
| if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | ||
| source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | ||
| fi | ||
|
|
||
| # Initialize Zinit | ||
| ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" | ||
| [ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)" | ||
| [ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" | ||
| source "${ZINIT_HOME}/zinit.zsh" | ||
|
|
||
| # Load Powerlevel10k theme | ||
| zinit ice depth=1; zinit load romkatv/powerlevel10k | ||
|
|
||
| # Load plugins | ||
| zinit load zsh-users/zsh-autosuggestions | ||
| zinit load zsh-users/zsh-syntax-highlighting | ||
| zinit load zsh-users/zsh-completions | ||
| zinit load agkozak/zsh-z | ||
|
|
||
| # Autoload completions | ||
| autoload -Uz compinit && compinit | ||
|
|
||
| # History configuration | ||
| HISTFILE=~/.zsh_history | ||
| HISTSIZE=10000 | ||
| SAVEHIST=10000 | ||
| setopt HIST_EXPIRE_DUPS_FIRST | ||
| setopt HIST_IGNORE_DUPS | ||
| setopt HIST_IGNORE_ALL_DUPS | ||
| setopt HIST_IGNORE_SPACE | ||
| setopt HIST_FIND_NO_DUPS | ||
| setopt HIST_SAVE_NO_DUPS | ||
| setopt SHARE_HISTORY | ||
|
|
||
| # Useful aliases | ||
| alias ll='ls -alF' | ||
| alias la='ls -A' | ||
| alias l='ls -CF' | ||
| alias ..='cd ..' | ||
| alias ...='cd ../..' | ||
| alias grep='grep --color=auto' | ||
| alias fgrep='fgrep --color=auto' | ||
| alias egrep='egrep --color=auto' | ||
|
|
||
| # Git aliases | ||
| alias gs='git status' | ||
| alias ga='git add' | ||
| alias gc='git commit' | ||
| alias gp='git push' | ||
| alias gl='git pull' | ||
| alias gd='git diff' | ||
| alias gb='git branch' | ||
| alias gco='git checkout' | ||
|
|
||
| # Bun aliases | ||
| alias bi='bun install' | ||
| alias ba='bun add' | ||
| alias br='bun remove' | ||
| alias bd='bun add -d' | ||
| alias bs='bun start' | ||
| alias bt='bun test' | ||
|
|
||
| # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | ||
| [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not quite sure I understand what's going on here. If you run
pnpm installwithin the workspace, shouldn't everything get symlinked properly?