-
Notifications
You must be signed in to change notification settings - Fork 6
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
Showing
10 changed files
with
171 additions
and
108 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,5 @@ | ||
--- | ||
"kopflos": patch | ||
--- | ||
|
||
Added `kopflos deploy` command |
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 @@ | ||
--- | ||
"@kopflos-cms/plugin-deploy-resources": patch | ||
--- | ||
|
||
Export function to deploy programmatically |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 @@ | ||
import log from '@kopflos-cms/logger' | ||
import { loadPlugins } from '@kopflos-cms/core/plugins.js' // eslint-disable-line import/no-unresolved | ||
import { loadConfig } from '../config.js' | ||
|
||
interface BuildArgs { | ||
config?: string | ||
} | ||
|
||
export default async function (args: BuildArgs) { | ||
const config = await loadConfig({ | ||
path: args.config, | ||
}) | ||
const plugins = await loadPlugins(config.plugins) | ||
|
||
log.info('Running build actions...') | ||
const buildActions = plugins.map(plugin => plugin.build?.()) | ||
if (buildActions.length === 0) { | ||
return log.warn('No plugins with build actions found') | ||
} else { | ||
await Promise.all(buildActions) | ||
} | ||
} |
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,28 @@ | ||
import log from '@kopflos-cms/logger' | ||
import { deploy } from '@kopflos-cms/plugin-deploy-resources' | ||
import { createEnv } from '@kopflos-cms/core/env.js' // eslint-disable-line import/no-unresolved | ||
import { loadConfig } from '../config.js' | ||
|
||
interface DeployArgs { | ||
config?: string | ||
} | ||
|
||
export default async function (args: DeployArgs) { | ||
const config = await loadConfig({ | ||
path: args.config, | ||
}) | ||
|
||
const autoDeployPluginConfig = config.plugins?.['@kopflos-cms/plugin-deploy-resources'] | ||
|
||
if (!autoDeployPluginConfig) { | ||
log.error("'@kopflos-cms/plugin-deploy-resources' not found in plugin configuration") | ||
return process.exit(1) | ||
} | ||
|
||
if (!autoDeployPluginConfig.paths?.length) { | ||
log.warn('No resource paths specified. Nothing to deploy') | ||
return process.exit(1) | ||
} | ||
|
||
return deploy(autoDeployPluginConfig.paths, createEnv(config)) | ||
} |
Oops, something went wrong.