UNPKG

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

105 lines (102 loc) 2.85 kB
import { BaseCommand } from "./chunk-25HWKXJ7.js"; import { globalFlags, themeFlags } from "./chunk-H7IKTGYJ.js"; import { log } from "./chunk-BMW4AWX2.js"; // src/commands/check/index.ts import { Flags } from "@oclif/core"; import { execa } from "execa"; import { loadWithRocketGradient, prefixed } from "adastra-cli-kit"; var _Check = class extends BaseCommand { async run() { const { flags } = await this.parse(_Check); const command = ["theme", "check", ...this.passThroughFlags(flags)]; try { const themeCheck = await loadWithRocketGradient( "Running theme check on the current theme." ); const { stdout } = await execa("shopify", command); themeCheck.text = prefixed(stdout); themeCheck.succeed(); } catch (error) { log("error", error); this.exit(1); } } }; var Check = _Check; Check.description = "Validate the theme using theme check same as shopify theme check command."; Check.flags = { ...globalFlags, path: themeFlags.path, "auto-correct": Flags.boolean({ char: "a", required: false, description: "Automatically fix offenses", env: "SHOPIFY_FLAG_AUTO_CORRECT" }), category: Flags.string({ char: "c", required: false, description: `Only run this category of checks Runs checks matching all categories when specified more than once`, env: "SHOPIFY_FLAG_CATEGORY" }), config: Flags.string({ char: "C", required: false, description: `Use the config provided, overriding .theme-check.yml if present Use :theme_app_extension to use default checks for theme app extensions`, env: "SHOPIFY_FLAG_CONFIG" }), "exclude-category": Flags.string({ char: "x", required: false, description: `Exclude this category of checks Excludes checks matching any category when specified more than once`, env: "SHOPIFY_FLAG_EXCLUDE_CATEGORY" }), "fail-level": Flags.string({ required: false, description: "Minimum severity for exit with error code", env: "SHOPIFY_FLAG_FAIL_LEVEL", options: ["error", "suggestion", "style"] }), init: Flags.boolean({ required: false, description: "Generate a .theme-check.yml file", env: "SHOPIFY_FLAG_INIT" }), list: Flags.boolean({ required: false, description: "List enabled checks", env: "SHOPIFY_FLAG_LIST" }), output: Flags.string({ char: "o", required: false, description: "The output format to use", env: "SHOPIFY_FLAG_OUTPUT", options: ["text", "json"], default: "text" }), print: Flags.boolean({ required: false, description: "Output active config to STDOUT", env: "SHOPIFY_FLAG_PRINT" }), version: Flags.boolean({ char: "v", required: false, description: "Print Theme Check version", env: "SHOPIFY_FLAG_VERSION" }) }; export { Check };