UNPKG

@scania/tegel-cli

Version:

CLI tool for copying and transforming Tegel components with custom prefixes

2 lines 1.42 kB
import {a}from'./chunk-HFCPHFYJ.js';import e from'path';import i from'fs-extra';import {fileURLToPath}from'url';async function h(){let a$1=fileURLToPath(import.meta.url),o=e.dirname(a$1);a.debug(`Resolver filename: ${a$1}`),a.debug(`Resolver dirName: ${o}`);let n=null;if(await i.pathExists(e.join(o,"cli.js"))?n=o:await i.pathExists(e.join(o,"..","cli.js"))&&(n=e.join(o,"..")),!n)throw new Error(`CLI must be run from the built dist directory. Current directory: ${o}. Please run "npm run build" and use the CLI from the dist folder.`);let t=e.join(n,"tegel-source"),s=e.join(t,"metadata.json");if(a.debug(`Checking for bundled source at: ${t}`),!await i.pathExists(t))throw new Error(`Tegel source not found in dist directory at ${t}. The CLI must be properly built. Please run "npm run build" to bundle the Tegel source files.`);if(!await i.pathExists(s))throw new Error(`Tegel source metadata not found at ${s}. The bundled source appears to be incomplete. Please run "npm run build" again.`);a.debug("Using bundled Tegel source from dist");let l=await i.readJSON(s);return {root:t,componentsPath:e.join(t,"components"),utilsPath:e.join(t,"utils"),mixinsPath:e.join(t,"mixins"),globalPath:e.join(t,"global"),typesPath:e.join(t,"types"),version:l.version,isLocal:false}}export{h as resolveTegelSource};//# sourceMappingURL=tegel-source-resolver-RSPXN7WC.js.map //# sourceMappingURL=tegel-source-resolver-RSPXN7WC.js.map