Skip to content

@gluonjs/core / packages/create-gluon/src / ParsedCliArguments

Interface: ParsedCliArguments ​

Extends ​

Properties ​

directory? ​

readonly optional directory?: string


explicit ​

readonly explicit: ReadonlySet<keyof GluonFeatures>


force ​

readonly force: boolean


help ​

readonly help: boolean


name? ​

readonly optional name?: string


router? ​

readonly optional router?: boolean

Inherited from ​

GluonFeatures.router


ssr? ​

readonly optional ssr?: boolean

Inherited from ​

GluonFeatures.ssr


store? ​

readonly optional store?: boolean

Inherited from ​

GluonFeatures.store


testing? ​

readonly optional testing?: boolean

Inherited from ​

GluonFeatures.testing


ui? ​

readonly optional ui?: boolean

Inherited from ​

GluonFeatures.ui


version ​

readonly version: boolean


yes ​

readonly yes: boolean

Example ​

Inspect the parsed target, command mode, feature choices, and explicitly supplied flags before prompting or scaffolding:

ts
import {
  CREATE_GLUON_VERSION,
  ScaffoldError,
  helpText,
  normalizeFeatures,
  parseCliArguments,
  scaffoldProject,
  type CliPrompt,
  type GluonFeatures,
  type ParsedCliArguments,
  type ScaffoldErrorCode,
  type ScaffoldOptions,
  type ScaffoldResult,
} from 'create-gluon';

const parsed: ParsedCliArguments = parseCliArguments(['my-shop', '--ssr', '--ui', '--testing', '--yes']);
const features: GluonFeatures = normalizeFeatures(parsed);
const options = {
  directory: parsed.directory!,
  name: '@example/my-shop',
  cwd: '/tmp',
  force: true,
  ...features,
} satisfies ScaffoldOptions;
const prompt: CliPrompt = { question: async () => 'yes', close: () => undefined };
console.log(prompt, CREATE_GLUON_VERSION, helpText.split('\n')[0]);

try {
  const result: ScaffoldResult = await scaffoldProject(options);
  console.log(result.directory, result.features, result.files);
} catch (error) {
  if (error instanceof ScaffoldError) {
    const code: ScaffoldErrorCode = error.code;
    console.error(code, error.message);
  } else throw error;
}

Version-matched documentation. Examples are checked against the public package contracts.