Skip to content
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

build: add environment create helper from cli #339

Merged
merged 7 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "pnpm install"
},
{
"name": "Create docker container",
"command": "docker-compose -f apps/api/docker-compose.dev.yml -p codeimage up -d"
},
{
"name": "Create env file",
"command": "pnpm prepare:env:codesandbox"
},
{
"name": "Build core libraries",
"command": "pnpm libs:build"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"prepare": {
"name": "prepare",
"command": "pnpm prepare",
"runAtStart": false
},
"dev": {
"name": "dev",
"command": "pnpm dev",
"runAtStart": true
},
"dev:api": {
"name": "dev:api",
"command": "pnpm dev:api",
"runAtStart": true
},
"libs:build": {
"name": "libs:build",
"command": "pnpm libs:build",
"runAtStart": false
},
"libs:build:core": {
"name": "libs:build:core",
"command": "pnpm libs:build:core",
"runAtStart": false
},
"libs:build:config": {
"name": "libs:build:config",
"command": "pnpm libs:build:config",
"runAtStart": false
},
"libs:build:watch": {
"name": "libs:build:watch",
"command": "pnpm libs:build:watch",
"runAtStart": false
},
"lint": {
"name": "lint",
"command": "pnpm lint",
"runAtStart": false
},
"typecheck": {
"name": "typecheck",
"command": "pnpm typecheck",
"runAtStart": false
},
"build:prod": {
"name": "build:prod",
"command": "pnpm build:prod",
"runAtStart": false
},
"changeset:pr": {
"name": "changeset:pr",
"command": "pnpm changeset:pr",
"runAtStart": false
},
"pre-commit": {
"name": "pre-commit",
"command": "pnpm pre-commit",
"runAtStart": false
},
"pre-commit-prettier": {
"name": "pre-commit-prettier",
"command": "pnpm pre-commit-prettier",
"runAtStart": false
},
"pre-commit-eslint": {
"name": "pre-commit-eslint",
"command": "pnpm pre-commit-eslint",
"runAtStart": false
},
"prepare:env": {
"name": "prepare:env",
"command": "pnpm prepare:env",
"runAtStart": false
},
"prepare:env:codesandbox": {
"name": "prepare:env:codesandbox",
"command": "pnpm prepare:env:codesandbox",
"runAtStart": false
},
"prepare:api:deploy": {
"name": "prepare:api:deploy",
"command": "pnpm prepare:api:deploy",
"runAtStart": false
},
"docker-compose -f ./apps/api/docker-compose.dev.yml -p codeimage up -d": {
"name": "docker-compose -f ./apps/api/docker-compose.dev.yml -p codeimage up -d",
"command": "docker-compose -f ./apps/api/docker-compose.dev.yml -p codeimage up -d"
}
}
}
11 changes: 4 additions & 7 deletions apps/api/docker-compose.yml → apps/api/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# docker-compose -f docker-compose.yml -p codeimage up -d
# docker-compose -f docker-compose.dev.yml -p codeimage up -d

version: '3.8'

Expand All @@ -10,16 +10,13 @@ services:
- postgres_data:/var/lib/postgresql/data/
ports:
- '5432:5432'
env_file:
- .env
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=codeimage
test_db:
image: postgres:13-alpine
restart: always
container_name: integration-tests-prisma
ports:
- '5433:5432'
environment:
Expand Down
6 changes: 4 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
"typecheck:ci": "tsc --skipLibCheck --project tsconfig.dts.json",
"build:ts": "tsc",
"watch:ts": "tsc -w",
"prisma:migrate:dev": "prisma migrate dev",
"prisma:migrate:test": "dotenv -e .env.test -- pnpm exec prisma migrate dev",
"prisma:migrate:deploy": "prisma migrate deploy",
"prisma:migrate:deploy-test": "dotenv -e .env.test -- pnpm exec prisma migrate deploy",
"prisma:generate": "prisma generate dev && pnpm --filter=@codeimage/prisma-models build",
"prisma:migrate:test": "dotenv -e .env.test -- pnpm exec prisma migrate dev --name init",
"dev": "npm run build:ts && concurrently -k -p \"[{name}]\" -n \"TypeScript,App\" -c \"yellow.bold,cyan.bold\" \"npm:watch:ts\" \"npm:dev:start\"",
"dev:start": "fastify start --ignore-watch=.ts$ -w -l info -P dist/app.js"
},
Expand Down Expand Up @@ -56,7 +59,6 @@
"fastify-tsconfig": "^1.0.1",
"sinon": "^14.0.0",
"tap": "^16.3.0",
"ts-node": "^10.9.1",
"typescript": "^4.7.4"
}
}
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@
"lint": "pnpm --filter='@codeimage/*' --parallel -r lint",
"typecheck": "pnpm --filter='@codeimage/*' --recursive --parallel typecheck",
"build:prod": "pnpm patch-solid-exports && pnpm libs:build && pnpm --filter=@codeimage/app build",
"changeset:pr": "changeset version && ts-node scripts/sync-package.ts",
"changeset:pr": "changeset version && tsx scripts/sync-package.ts",
"pre-commit": "lint-staged --relative",
"pre-commit-prettier": "prettier --write",
"pre-commit-eslint": "eslint --ext .js,.jsx,.mjs,.ts,.tsx -c .eslintrc.js --fix",
"prepare:env": "tsx ./scripts/make-env.ts",
"prepare:env:codesandbox": "RUN_ON_CODESANDBOX=true tsx ./scripts/make-env",
"prepare:api:deploy": "pnpm-bundle-workspace-package @codeimage/api --outDir=dist/api-bundle && rm -rf dist/api-bundle/workspace-dependencies/prisma-models/.gitignore"
},
"devDependencies": {
Expand All @@ -64,17 +66,20 @@
"@types/prettier": "^2.6.3",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"chalk": "4.1.2",
"cross-env": "^7.0.3",
"enquirer": "2.3.6",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-solid": "^0.4.7",
"husky": "7.0.4",
"lint-staged": "^12.5.0",
"pnpm-bundle-workspace-package": "^1.0.2",
"prettier": "^2.6.2",
"ts-node": "^10.8.1",
"typescript": "^4.7.3",
"pnpm-bundle-workspace-package": "^1.0.2"
"tslib": "^2.4.0",
"tsx": "^3.8.2",
"typescript": "^4.7.3"
},
"engines": {
"pnpm": ">=7"
Expand Down
1 change: 0 additions & 1 deletion packages/atomic-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"pre-commit-prettier": "prettier --write",
"pre-commit-eslint": "eslint --ext .js,.jsx,.mjs,.ts,.tsx -c ../../.eslintrc.js --fix",
"lint": "eslint . --ext .js,.jsx,.mjs,.ts,.tsx -c ../../.eslintrc.js",
"generate:theme": "ts-node scripts/generate-theme.ts",
"clean": "rimraf dist",
"build-esm": "tsc -p tsconfig.esm.json",
"build-dts": "tsc -p tsconfig.dts.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/highlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"pre-commit-prettier": "prettier --write",
"pre-commit-eslint": "eslint --ext .js,.jsx,.mjs,.ts,.tsx -c ../../.eslintrc.js --fix",
"lint": "eslint . --ext .js,.jsx,.mjs,.ts,.tsx -c ../../.eslintrc.js",
"generate:theme": "ts-node scripts/generate-theme.ts",
"generate:theme": "tsx scripts/generate-theme.ts",
"clean": "rimraf dist",
"build-esm": "tsc -p tsconfig.esm.json",
"build-dts": "tsc -p tsconfig.dts.json",
Expand Down
Loading