chore: introduce docker compose
This commit is contained in:
1
packages/backend/database-utils.d.ts
vendored
Normal file
1
packages/backend/database-utils.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './dist/bin/database/utils';
|
2
packages/backend/database-utils.js
Normal file
2
packages/backend/database-utils.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
module.exports = require('./dist/bin/database/utils');
|
3
packages/backend/database.d.ts
vendored
3
packages/backend/database.d.ts
vendored
@@ -1,2 +1 @@
|
|||||||
export * as utils from './dist/bin/database/utils';
|
export * from './dist/src/config/database';
|
||||||
export * as database from './dist/src/config/database';
|
|
||||||
|
@@ -1,3 +1,2 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
module.exports.utils = require('./dist/bin/database/utils');
|
module.exports = require('./dist/src/config/database');
|
||||||
module.exports.database = require('./dist/src/config/database');
|
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
"db:migration:create": "knex migrate:make",
|
"db:migration:create": "knex migrate:make",
|
||||||
"db:rollback": "knex migrate:rollback",
|
"db:rollback": "knex migrate:rollback",
|
||||||
"db:migrate": "knex migrate:latest",
|
"db:migrate": "knex migrate:latest",
|
||||||
"copy-statics": "copyfiles src/**/*.{graphql,json,svg} dist"
|
"copy-statics": "copyfiles src/**/*.{graphql,json,svg} dist",
|
||||||
|
"prepack": "yarn build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@automatisch/web": "0.1.0",
|
"@automatisch/web": "0.1.0",
|
||||||
@@ -75,6 +76,7 @@
|
|||||||
"test": "__tests__"
|
"test": "__tests__"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"dist",
|
||||||
"bin",
|
"bin",
|
||||||
"src",
|
"src",
|
||||||
"server.js",
|
"server.js",
|
||||||
@@ -82,7 +84,9 @@
|
|||||||
"logger.js",
|
"logger.js",
|
||||||
"logger.d.ts",
|
"logger.d.ts",
|
||||||
"database.js",
|
"database.js",
|
||||||
"database.d.ts"
|
"database.d.ts",
|
||||||
|
"database-utils.js",
|
||||||
|
"database-utils.d.ts"
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@@ -13,6 +13,10 @@ export default class Start extends Command {
|
|||||||
'env-file': Flags.string(),
|
'env-file': Flags.string(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isProduction() {
|
||||||
|
return process.env.APP_ENV === 'production';
|
||||||
|
}
|
||||||
|
|
||||||
async prepareEnvVars(): Promise<void> {
|
async prepareEnvVars(): Promise<void> {
|
||||||
const { flags } = await this.parse(Start);
|
const { flags } = await this.parse(Start);
|
||||||
|
|
||||||
@@ -38,7 +42,7 @@ export default class Start extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createDatabaseAndUser(): Promise<void> {
|
async createDatabaseAndUser(): Promise<void> {
|
||||||
const { utils } = await import('@automatisch/backend/database');
|
const utils = await import('@automatisch/backend/database-utils');
|
||||||
|
|
||||||
await utils.createDatabaseAndUser(
|
await utils.createDatabaseAndUser(
|
||||||
process.env.POSTGRES_DATABASE,
|
process.env.POSTGRES_DATABASE,
|
||||||
@@ -48,7 +52,7 @@ export default class Start extends Command {
|
|||||||
|
|
||||||
async runMigrationsIfNeeded(): Promise<void> {
|
async runMigrationsIfNeeded(): Promise<void> {
|
||||||
const { logger } = await import('@automatisch/backend/logger');
|
const { logger } = await import('@automatisch/backend/logger');
|
||||||
const { database } = await import('@automatisch/backend/database');
|
const database = await import('@automatisch/backend/database');
|
||||||
const migrator = database.client.migrate;
|
const migrator = database.client.migrate;
|
||||||
|
|
||||||
const [, pendingMigrations] = await migrator.list();
|
const [, pendingMigrations] = await migrator.list();
|
||||||
@@ -66,7 +70,7 @@ export default class Start extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async seedUser(): Promise<void> {
|
async seedUser(): Promise<void> {
|
||||||
const { utils } = await import('@automatisch/backend/database');
|
const utils = await import('@automatisch/backend/database-utils');
|
||||||
|
|
||||||
await utils.createUser();
|
await utils.createUser();
|
||||||
}
|
}
|
||||||
@@ -78,7 +82,9 @@ export default class Start extends Command {
|
|||||||
async run(): Promise<void> {
|
async run(): Promise<void> {
|
||||||
await this.prepareEnvVars();
|
await this.prepareEnvVars();
|
||||||
|
|
||||||
await this.createDatabaseAndUser();
|
if (!this.isProduction) {
|
||||||
|
await this.createDatabaseAndUser();
|
||||||
|
}
|
||||||
|
|
||||||
await this.runMigrationsIfNeeded();
|
await this.runMigrationsIfNeeded();
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
"name": "@automatisch/docs",
|
"name": "@automatisch/docs",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "> TODO: description",
|
"description": "> TODO: description",
|
||||||
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vitepress dev pages --port 3002",
|
"dev": "vitepress dev pages --port 3002",
|
||||||
"build": "vitepress build pages",
|
"build": "vitepress build pages",
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
"homepage": "https://github.com/automatisch/automatisch",
|
"homepage": "https://github.com/automatisch/automatisch",
|
||||||
"types": "./index.d.ts",
|
"types": "./index.d.ts",
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"dependencies": {},
|
|
||||||
"typeScriptVersion": "4.1",
|
"typeScriptVersion": "4.1",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@@ -47,8 +47,12 @@
|
|||||||
"build:watch": "yarn nodemon --exec react-scripts build --watch 'src/**/*.ts' --watch 'public/**/*' --ext ts,html",
|
"build:watch": "yarn nodemon --exec react-scripts build --watch 'src/**/*.ts' --watch 'public/**/*' --ext ts,html",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"lint": "eslint . --ignore-path ../../.eslintignore"
|
"lint": "eslint . --ignore-path ../../.eslintignore",
|
||||||
|
"prepack": "REACT_APP_GRAPHQL_URL=/graphql yarn build"
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"/build"
|
||||||
|
],
|
||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
{
|
||||||
"name": "automatisch contributors",
|
"name": "automatisch contributors",
|
||||||
|
@@ -47,8 +47,7 @@ const processOpenWithPopup = (step: IAuthenticationStep, variables: IJSONObject)
|
|||||||
popup?.focus();
|
popup?.focus();
|
||||||
|
|
||||||
const messageHandler = async (event: MessageEvent) => {
|
const messageHandler = async (event: MessageEvent) => {
|
||||||
// check origin and data.source to trust the event
|
if (event.data.source !== 'automatisch') {
|
||||||
if (event.origin !== appConfig.baseUrl || event.data.source !== 'automatisch') {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user