-
Notifications
You must be signed in to change notification settings - Fork 0
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
Evgeny Zakharov
committed
Nov 14, 2021
1 parent
299ae1a
commit bb0776c
Showing
5 changed files
with
105 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@medusa-frontends/cli", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A CLI interface for bootstrapping and managing MFEs", | ||
"main": "bin/medusa.js", | ||
"repository": "[email protected]:mfe-playground/medusa-cli.git", | ||
|
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,43 @@ | ||
import 'zx/globals' | ||
import { readEnvironment } from '../configs/environment' | ||
import { foreachApp } from '../lib/apps/foreach' | ||
import { appHasScript, runAppScript } from '../lib/apps/scripts' | ||
import { readCLIConfig } from '../lib/config' | ||
import { EnvironmentNotFoundException } from '../lib/exceptions' | ||
import { showStatus } from '../model/status' | ||
import { AppMeta, ScriptKey } from '../types' | ||
import { generate } from './generate' | ||
|
||
type BuildOptions = { | ||
buildScriptKey: ScriptKey | ||
prebuildScriptKey: ScriptKey | ||
} | ||
|
||
export async function build({ buildScriptKey, prebuildScriptKey }: BuildOptions) { | ||
await generate() | ||
|
||
const { apps } = await readCLIConfig() | ||
|
||
const buildApp = async ({ app }: AppMeta) => { | ||
const environment = await readEnvironment(app) | ||
if (!environment) throw new EnvironmentNotFoundException(app) | ||
|
||
const { port } = environment | ||
|
||
if (await appHasScript(app, prebuildScriptKey)) { | ||
showStatus({ text: `Running prebuild for "${app}"..` }) | ||
const wrapped = await runAppScript(app, prebuildScriptKey) | ||
await wrapped.processPromise() | ||
} | ||
|
||
showStatus({ text: `Building "${app}"..` }) | ||
const wrapped = await runAppScript(app, buildScriptKey, { port }) | ||
await wrapped.processPromise() | ||
} | ||
|
||
await foreachApp({ | ||
apps, | ||
deep: true, | ||
callback: buildApp, | ||
}) | ||
} |
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
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
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,4 @@ | ||
import React from 'react' | ||
import { DefaultTemplate } from '../templates' | ||
|
||
export const BuildScreen = () => <DefaultTemplate /> |