-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 503f2ed
Showing
20 changed files
with
6,500 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
APP_ENV=dev | ||
COOKIE_SECRET=vno64218hua | ||
SUPERADMIN_USERNAME=superadmin | ||
SUPERADMIN_PASSWORD=superadmin | ||
DB_HOST=localhost | ||
DB_PORT=5432 | ||
DB_NAME=v2-migration-testbed | ||
DB_USERNAME=admin | ||
DB_PASSWORD=secret | ||
DB_SCHEMA=public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
dist | ||
static/assets | ||
static/email/test-emails | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM node:16 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY package.json ./ | ||
COPY yarn.lock ./ | ||
RUN yarn --production | ||
COPY . . | ||
RUN yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Vendure v2 Migration Testbed | ||
|
||
This repo is being used to test migration of a Vendure v1 project to v2. | ||
|
||
## Setup | ||
|
||
You'll need a local postgres instance running, with a database named `v2-migration-testbed`. Adjust the | ||
credentials in the `.env` file as needed. | ||
|
||
## Test Sequence | ||
|
||
1. With v1.x installed, run `yarn populate`. | ||
2. Run `yarn test` to run the tests against v1.x. | ||
3. Now update all Vendure packages to v2.x. | ||
4. Run `yarn migrate` to run the migrations. | ||
5. Run `yarn test` to run the tests against v2.x. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
version: "3" | ||
services: | ||
server: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- 3000:3000 | ||
command: ["yarn", "start:server"] | ||
volumes: | ||
- /usr/src/app | ||
environment: | ||
DB_HOST: database | ||
DB_PORT: 5432 | ||
DB_NAME: vendure | ||
DB_USERNAME: postgres | ||
DB_PASSWORD: password | ||
worker: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
command: ["yarn", "start:worker"] | ||
volumes: | ||
- /usr/src/app | ||
environment: | ||
DB_HOST: database | ||
DB_PORT: 5432 | ||
DB_NAME: vendure | ||
DB_USERNAME: postgres | ||
DB_PASSWORD: password | ||
database: | ||
image: postgres | ||
volumes: | ||
- /var/lib/postgresql/data | ||
ports: | ||
- 5432:5432 | ||
environment: | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: vendure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { generateMigration, revertLastMigration, runMigrations } from '@vendure/core'; | ||
import program from 'commander'; | ||
|
||
import { config } from './src/vendure-config'; | ||
|
||
program | ||
.command('generate <name>') | ||
.description('Generate a new migration file with the given name') | ||
.action(name => { | ||
return generateMigration(config, { name, outputDir: './src/migrations' }); | ||
}); | ||
|
||
program | ||
.command('run') | ||
.description('Run all pending migrations') | ||
.action(() => { | ||
return runMigrations(config); | ||
}); | ||
|
||
program | ||
.command('revert') | ||
.description('Revert the last applied migration') | ||
.action(() => { | ||
return revertLastMigration(config); | ||
}); | ||
|
||
program.parse(process.argv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "v2-migration-testbed", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev:server": "ts-node ./src/index.ts", | ||
"dev:worker": "ts-node ./src/index-worker.ts", | ||
"dev": "concurrently yarn:dev:*", | ||
"build": "tsc", | ||
"start:server": "node ./dist/index.js", | ||
"start:worker": "node ./dist/index-worker.js", | ||
"start": "concurrently yarn:start:*", | ||
"migration:generate": "ts-node migration generate", | ||
"migration:run": "ts-node migration run", | ||
"migration:revert": "ts-node migration revert", | ||
"populate": "ts-node ./src/populate.ts" | ||
}, | ||
"dependencies": { | ||
"@vendure/admin-ui-plugin": "1.9.3", | ||
"@vendure/asset-server-plugin": "1.9.3", | ||
"@vendure/core": "1.9.3", | ||
"@vendure/email-plugin": "1.9.3", | ||
"dotenv": "16.0.3", | ||
"pg": "8.10.0", | ||
"typescript": "4.3.5" | ||
}, | ||
"devDependencies": { | ||
"@vendure/create": "^1.9.3", | ||
"concurrently": "7.6.0", | ||
"ts-node": "10.9.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export {}; | ||
|
||
// Here we declare the members of the process.env object, so that we | ||
// can use them in our application code in a type-safe manner. | ||
declare global { | ||
namespace NodeJS { | ||
interface ProcessEnv { | ||
APP_ENV: string; | ||
COOKIE_SECRET: string; | ||
SUPERADMIN_USERNAME: string; | ||
SUPERADMIN_PASSWORD: string; | ||
DB_HOST: string; | ||
DB_PORT: number; | ||
DB_NAME: string; | ||
DB_USERNAME: string; | ||
DB_PASSWORD: string; | ||
DB_SCHEMA: string; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { bootstrapWorker } from '@vendure/core'; | ||
import { config } from './vendure-config'; | ||
|
||
bootstrapWorker(config) | ||
.then(worker => worker.startJobQueue()) | ||
.catch(err => { | ||
console.log(err); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { bootstrap, runMigrations } from '@vendure/core'; | ||
import { config } from './vendure-config'; | ||
|
||
runMigrations(config) | ||
.then(() => bootstrap(config)) | ||
.catch(err => { | ||
console.log(err); | ||
}); |
Oops, something went wrong.