create-gluon / packages/create-gluon/src / ScaffoldResult
Interface: ScaffoldResult
Properties
directory
readonlydirectory:string
features
readonlyfeatures:GluonFeatures
files
readonlyfiles: readonlystring[]
name
readonlyname:string
Example
Report the resolved directory, package name, normalized features, and sorted files actually written by scaffolding:
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;
}