adastra-cli
Version:
Adastra CLI ✨ is a CLI toolkit built on top of Shopify CLI 3.X, this means that existing Adastra commands are the same as Shopify's. The goal from this package is to allow developers to use one CLI intefrace between the Vite and Shopify development server
47 lines (44 loc) • 1.17 kB
JavaScript
import {
log
} from "./chunk-BMW4AWX2.js";
// src/commands/build/index.ts
import { Command, Flags } from "@oclif/core";
import { build, loadConfigFromFile } from "vite";
var _Build = class extends Command {
async run() {
const { flags } = await this.parse(_Build);
const configEnv = {
command: "serve",
mode: "production"
};
const config = await loadConfigFromFile(configEnv);
if (config) {
try {
await build({
// @ts-expect-error @todo
logLevel: flags["log-level"]
});
log("info", "Building files for production complete.");
} catch (error) {
log("error", error);
this.exit(1);
}
} else {
log("warn", "No Vite config was found in the theme root folder.");
}
}
};
var Build = _Build;
Build.description = "Builds all static files into the theme assets folder.";
Build.flags = {
"log-level": Flags.string({
required: false,
description: "Adjust console output verbosity when building files.",
env: "ADASTRA_FLAG_LOG_LEVEL",
options: ["info", "silent", "error", "warn"],
default: "info"
})
};
export {
Build
};