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GAAG,MAAM;IAMhE,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAGrF","file":"build.d.ts","sourcesContent":["/**\n *\tMIT License\n *\n *\tCopyright (c) 2019 - 2022 Toreda, Inc.\n *\n *\tPermission is hereby granted, free of charge, to any person obtaining a copy\n *\tof this software and associated documentation files (the \"Software\"), to deal\n *\tin the Software without restriction, including without limitation the rights\n *\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n *\tcopies of the Software, and to permit persons to whom the Software is\n *\tfurnished to do so, subject to the following conditions:\n\n * \tThe above copyright notice and this permission notice shall be included in all\n * \tcopies or substantial portions of the Software.\n *\n * \tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n *\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n *\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * \tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n *\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n *\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * \tSOFTWARE.\n *\n */\n\nimport type {BuildOptions} from './build/options';\nimport {Clean} from './clean';\nimport {Cli} from './cli';\nimport type {CliArgs} from './cli/args';\nimport {Config} from './config';\nimport {Create} from './create';\nimport {EventEmitter} from 'events';\nimport type {FileOptions} from './file/options';\nimport {GulpSteps} from './gulp/steps';\nimport {Linter} from './linter';\nimport {Log} from '@toreda/log';\nimport {Run} from './run';\nimport {fileContents} from './file/contents';\n\n/**\n * Top level build class accepting configuration options on init and creating\n * all required classes and objects needed for most common use cases.\n *\n * @category Build\n */\nexport class Build {\n\t/** Global EventEmitter instance. */\n\tpublic readonly events: EventEmitter;\n\t/** Global config instance. */\n\tpublic readonly cfg: Config;\n\t/** Wrappers to run build processes. */\n\tpublic readonly run: Run;\n\t/** Clean files and folders. */\n\tpublic readonly clean: Clean;\n\t/** Create files and folders. */\n\tpublic readonly create: Create;\n\t/** Build steps wrapped in Gulp compatible functions. */\n\tpublic readonly gulpSteps: GulpSteps;\n\t/** Perform linter operations using ESLint. */\n\tpublic readonly linter: Linter;\n\t/** Global log instance. */\n\tpublic readonly log: Log;\n\t/** Command line args */\n\tpublic readonly cli: Cli;\n\n\t/**\n\t *\n\t * @param options \t\tConfiguration options used to initialize Build config.\n\t */\n\tconstructor(options: BuildOptions) {\n\t\tthis.events = this.initEvents();\n\n\t\tthis.log = this.initLog(options);\n\t\tthis.cli = new Cli(this.log);\n\n\t\tthis.cfg = this.initConfig(this.cli.getArgs(), options, this.log);\n\t\tthis.run = new Run(this.cfg, this.events, this.log);\n\t\tthis.clean = new Clean(this.cfg, this.events, this.log);\n\t\tthis.create = new Create(this.cfg, this.events, this.log);\n\t\tthis.linter = new Linter(this.cfg, this.events, this.log);\n\n\t\tthis.gulpSteps = new GulpSteps(this.run, this.create, this.linter, this.clean, this.log);\n\t}\n\n\t/**\n\t * Initialize log property for Build class. Uses log instance in options if provided,\n\t * otherwise creates a new Log instance.\n\t * @param options\n\t * @returns\n\t */\n\tpublic initLog(options?: BuildOptions): Log {\n\t\tif (!options || !options.log) {\n\t\t\treturn new Log().makeLog('Build');\n\t\t}\n\n\t\tif (!(options.log instanceof Log)) {\n\t\t\treturn new Log(options.log).makeLog('Build');\n\t\t}\n\n\t\treturn options.log.makeLog('Build');\n\t}\n\n\t/**\n\t * Initialize events property for Build class. Uses events instance in options if provided,\n\t * otherwise creates a new EventEmitter instance.\n\t * @param options\n\t * @returns\n\t */\n\tpublic initEvents(options?: BuildOptions): EventEmitter {\n\t\tif (!options || !options.events) {\n\t\t\treturn new EventEmitter();\n\t\t}\n\n\t\tif (!(options.events instanceof EventEmitter)) {\n\t\t\treturn new EventEmitter();\n\t\t}\n\n\t\treturn options.events;\n\t}\n\n\t/**\n\t * Initialize config property for Build class. Reads in CLI arguments to\n\t * set initial config keys.\n\t * @param argv\n\t * @returns\n\t */\n\tpublic initConfig(args: CliArgs, options: BuildOptions, baseLog: Log): Config {\n\t\tconst log = baseLog.makeLog('initConfig');\n\n\t\treturn new Config(args, options, log);\n\t}\n\n\tpublic async getContents(path: string, options?: FileOptions): Promise<string | null> {\n\t\treturn fileContents(path, options);\n\t}\n}\n"]}