rename transform to post-build for clarity

This commit is contained in:
mbecker20
2022-03-18 18:10:49 -07:00
parent 0cbb90760b
commit 2db166ddb3
14 changed files with 47 additions and 11 deletions

View File

@@ -9,7 +9,7 @@
},
"scripts": {
"start": "yarn build && build/monitor-cli.js",
"build": "vite build && node transform.mjs && chmod +x build/monitor-cli.js",
"build": "vite build && node post-build.mjs && chmod +x build/monitor-cli.js",
"publish-cli": "yarn build && cd build && npm publish --access=public && node update-version.mjs"
},
"devDependencies": {

View File

@@ -1,7 +1,7 @@
import { CommandLogError } from "@monitor/types";
import { Box, Newline, Text, useInput } from "ink";
import React, { Fragment, useState } from "react";
import { startMongo } from "../../helpers/mongo";
import { startMongo } from "../../helpers/deploy/mongo";
import LabelledSelector from "../util/LabelledSelector";
import YesNo from "../util/YesNo";

View File

@@ -1,7 +1,7 @@
import { CommandLogError } from "@monitor/types";
import { Box, Newline, Text, useInput } from "ink";
import React, { Fragment, useState } from "react";
import { startRegistry } from "../../helpers/registry";
import { startRegistry } from "../../helpers/deploy/registry";
import LabelledSelector from "../util/LabelledSelector";
import YesNo from "../util/YesNo";

2
cli/src/config.ts Normal file
View File

@@ -0,0 +1,2 @@
export const CORE_IMAGE = "mbecker2020/monitor-core";
export const PERIPHERY_IMAGE = "mbecker2020/monitor-periphery";

View File

@@ -1,4 +1,4 @@
import { execute } from "./execute";
import { execute } from "../execute";
export async function startMongo(
name: string,

View File

@@ -0,0 +1,16 @@
import { CORE_IMAGE } from "../../config";
import { Config } from "../../types";
import { execute } from "../execute";
export async function startMonitorCore({
monitorCore: {
},
mongo: { url: mongoURL },
registry: { url: registryURL },
}: Config) {
const command = `docker run -d --name monitor-core -e MONGO_URL=${mongoURL}${
registryURL ? ` -e REGISTRY_URL=${registryURL}` : ""
} ${CORE_IMAGE}`;
return await execute(command);
}

View File

@@ -1,4 +1,4 @@
import { execute } from "./execute";
import { execute } from "../execute";
export async function startRegistry(
name: string,

24
cli/src/types.d.ts vendored
View File

@@ -1,10 +1,28 @@
export type Config = {
mongoURL: string;
registryURL: string;
monitorCore: {
name: string;
};
mongo: {
url: string;
deploymentConfig?: {
// if mongo container already exists locally running on docker and should be added as a monitor managed deployment
};
startConfig?: {
// if this is attached, the cli will start container with this config and add
};
};
registry: {
exists: boolean; // if this is false, dont use a registry and builds will be disabled
url?: string;
deploymentConfig?: {};
startConfig?: {};
};
};
export type SetConfig = (
field: keyof Config,
domain: keyof Config,
field: keyof Config[keyof Config],
val: string | number | boolean
) => void;

View File

@@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"start": "tsc && node build/main.js",
"build": "vite build && node transform.mjs && docker build -t mbecker2020/monitor-core .",
"build": "vite build && node post-build.mjs && docker build -t mbecker2020/monitor-core .",
"docker-run": "docker run -d --name monitor-core --network=\"host\" -v /Users/max/GitHub/monitor/core/secrets:/secrets -v /Users/max/GitHub/monitor/frontend/build:/frontend mbecker2020/monitor-core",
"docker-remove": "docker stop monitor-core && docker container rm monitor-core"
},

View File

@@ -17,7 +17,7 @@ const ws = fp((app: FastifyInstance, _: {}, done: () => void) => {
const messages = createObservable();
app.decorate(
"broadcast",
"broadcast", // used to sending state updates to all connected clients
<MessageType>(type: string, msg: Action & MessageType) => {
msg.type = type;
messages.publish(msg);

View File

@@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"start": "tsc && node build/main.js",
"build": "vite build && node transform.mjs && docker build -t mbecker2020/monitor-periphery ."
"build": "vite build && node post-build.mjs && docker build -t mbecker2020/monitor-periphery ."
},
"devDependencies": {
"@monitor/types": "1.0.0",