import { __dirname } from '@coffeekraken/sugar/fs'; import { __uniqid } from '@coffeekraken/sugar/string'; import __fs from 'fs'; import __path from 'path'; let newFolderName; export default function (api) { if (api.env.platform !== 'node') return; return { /** * @name title * @namespace config.kitchenRecipeDefault * @type String * @default Default * * Specify the recipe name * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ title: 'Generic', /** * @name description * @namespace config.kitchenRecipeDefault * @type String * @default Default s-kitchen recipe * * Specify the recipe description * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ description: 'Generic s-kitchen recipe ', /** * @name templateDir * @namespace config.kitchenRecipeDefault * @type String * @default __path.resolve(`${__dirname()}/../templates/default`)e * * Specify the recipe template directory * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ templateDir: __path.resolve(`${__dirname()}/../templates/default`), /** * @name requirements * @namespace config.kitchenRecipeDefault * @type Object * @default dev * * Specify some requirements for this recipe like commands (npm, composer, etc...) * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ requirements: { get commands() { return [api.config.package.manager, 'composer']; }, }, /** * @name defaultStack * @namespace config.kitchenRecipeDefault * @type String * @default dev * * Specify the recipe default stack * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ defaultStack: 'dev', stacks: { new: { /** * @name description * @namespace config.kitchenRecipeDefault.stacks.init * @type String * @default Init a new project with this recipe * * Specify the recipe init stack description * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ description: 'Init a new project with this recipe', actions: { /** * @name createApp * @namespace config.kitchenRecipeDefault.stacks.new.actions * @type String * * Specify the recipe init stack createApp action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ createApp: { title: 'Creating app directory', description: 'Creating the app directory', get command() { newFolderName = __uniqid(); return `mkdir ${newFolderName}`; }, after() { process.chdir(`${process.cwd()}/${newFolderName}`); __fs.writeFileSync( `${process.cwd()}/yarn.lock`, '', ); }, params: {}, settings: {}, }, /** * @name initNpm * @namespace config.kitchenRecipeDefault.stacks.new.actions * @type String * * Specify the recipe init stack initNpm action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ initNpm: { extends: 'initNpm', params: {}, settings: {}, }, /** * @name rename * @namespace config.kitchenRecipeDefault.stacks.new.actions * @type String * * Specify the recipe init stack rename action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ rename: { extends: 'rename', title: 'Rename generic template package', description: 'Renamt the generic template package with the user input', params: {}, }, /** * @name addSugarJson * @namespace config.kitchenRecipeDefault.stacks.new.actions * @type String * * Specify the recipe init stack addSugarJson action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addSugarJson: { extends: 'addSugarJson', title: 'Add the sugar.json file', description: 'Add the sugar.json file', params: {}, }, /** * @name addDefaultPackageJson * @namespace config.kitchenRecipeDefault.stacks.new.actions * @type String * * Specify the recipe init stack addDefaultPackageJson action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addDefaultPackageJson: { extends: 'addDefaultPackageJson', }, /** * @name addNvmrc * @namespace config.kitchenRecipeDefault.stacks.new.actions * @type String * * Specify the recipe init stack addNvmrc action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addNvmrc: { extends: 'addNvmrc', title: 'Add the .nvmrc file', description: 'Add the .nvmrc file', params: {}, }, /** * @name addDefaultPages * @namespace config.kitchenRecipeNextJs.stacks.new.actions * @type String * * Specify the recipe init stack addDefaultPages action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addDefaultPages: { extends: 'addDefaultPages', }, /** * @name addDefaultScripts * @namespace config.kitchenRecipeNextJs.stacks.new.actions * @type String * * Specify the recipe init stack addDefaultScripts action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addDefaultScripts: { extends: 'addDefaultScripts', }, /** * @name addManifestJson * @namespace config.kitchenRecipeDefault.stacks.new.actions * @type String * * Specify the recipe init stack addManifestJson action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addManifestJson: { extends: 'addManifestJson', title: 'Add manifest.json file', description: 'Add the manifest.json file', params: {}, }, /** * @name addSugarPostcss * @namespace config.kitchenRecipeNextJs.stacks.new.actions * @type String * * Specify the recipe init stack addSugarPostcss action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addSugarPostcss: { extends: 'addSugarPostcss', }, /** * @name addFavicon * @namespace config.kitchenRecipeNextJs.stacks.new.actions * @type String * * Specify the recipe init stack addFavicon action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addFavicon: { extends: 'addFavicon', }, /** * @name addReadme * @namespace config.kitchenRecipeNextJs.stacks.new.actions * @type String * * Specify the recipe init stack addReadme action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addReadme: { extends: 'addReadme', }, /** * @name addFrontspecJson * @namespace config.kitchenRecipeDefault.stacks.new.actions * @type String * * Specify the recipe init stack addFrontspecJson action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ addFrontspecJson: { extends: 'addFrontspecJson', title: 'Add frontspec.json file', description: 'Add the frontspec.json file in your project', params: {}, }, // /** // * @name installDependencies // * @namespace config.kitchenRecipeDefault.stacks.new.actions // * @type String // * // * Specify the recipe init stack installDependencies action // * // * @since 2.0.0 // * @author Olivier Bossel (https://coffeekraken.io) // */ // installDependencies: __deepMerge( // api.config.kitchen.actions.installDependencies, // {}, // ), }, }, dev: { /** * @name description * @namespace config.kitchenRecipeDefault.stacks.dev * @type String * @default Start the development stack * * Specify the recipe dev stack description * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ description: 'Start the development stack', runInParallel: true, actions: { /** * @name frontendServer * @namespace config.kitchenRecipeDefault.stacks.dev.actions * @type String * @default [config.kitchen.actions.frontendServer] * * Specify the recipe dev stack frontendServer action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ get frontendServer() { return api.config.kitchen.actions.frontendServer; }, /** * @name corsProxy * @namespace config.kitchenRecipeDefault.stacks.dev.actions * @type String * @default [config.kitchen.actions.corsProxy] * * Specify the recipe prod stack corsProxy action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ get corsProxy() { return api.config.kitchen.actions.corsProxy; }, /** * @name vite * @namespace config.kitchenRecipeDefault.stacks.dev.actions * @type String * @default [config.kitchen.actions.vite] * * Specify the vite action settings * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ get vite() { return api.config.kitchen.actions.vite; }, }, }, preview: { /** * @name description * @namespace config.kitchenRecipeDefault.stacks.prod * @type String * @default ... * * Specify the recipe prod stack description * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ description: 'Start the preview testing stack', runInParallel: true, sharedParams: { /** * @name env * @namespace config.kitchenRecipeDefault.stacks.prod.sharedParams * @type String * @default production * * Specify the recipe prod stack env shared param * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ env: 'production', }, actions: { /** * @name frontendServer * @namespace config.kitchenRecipeDefault.stacks.prod.actions * @type String * @default [config.kitchen.actions.frontendServer] * * Specify the recipe prod stack frontendServer action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ get frontendServer() { return api.config.kitchen.actions.frontendServer; }, /** * @name corsProxy * @namespace config.kitchenRecipeDefault.stacks.prod.actions * @type String * @default [config.kitchen.actions.corsProxy] * * Specify the recipe prod stack corsProxy action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ get corsProxy() { return api.config.kitchen.actions.corsProxy; }, }, }, build: { /** * @name description * @namespace config.kitchenRecipeDefault.stacks.build * @type String * @default ... * * Specify the recipe build stack description * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ description: 'Build your final production ready dist package', sharedParams: { /** * @name prod * @namespace config.kitchenRecipeDefault.stacks.build.sharedParams * @type String * @default true * * Specify that the build is made for production * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ prod: true, }, actions: { /** * @name postcssBuild * @namespace config.kitchenRecipeDefault.stacks.build.actions * @type String * @default [config.kitchen.actions.postcssBuild] * * Specify the recipe build stack postcssBuild action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ get postcssBuild() { return api.config.kitchen.actions.postcssBuild; }, /** * @name viteBuild * @namespace config.kitchenRecipeDefault.stacks.build.actions * @type String * @default [config.kitchen.actions.viteBuild] * * Specify the recipe build stack viteBuild action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ get viteBuild() { return api.config.kitchen.actions.viteBuild; }, /** * @name imagesBuild * @namespace config.kitchenRecipeDefault.stacks.build.actions * @type String * @default [config.kitchen.actions.imagesBuild] * * Specify the recipe build stack imagesBuild action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ get imagesBuild() { return api.config.kitchen.actions.imagesBuild; }, // /** // * @name faviconBuild // * @namespace config.kitchenRecipeDefault.stacks.build.actions // * @type String // * @default [config.kitchen.actions.faviconBuild] // * // * Specify the recipe build stack faviconBuild action // * // * @since 2.0.0 // * @author Olivier Bossel (https://coffeekraken.io) // */ // get faviconBuild() { // return api.config.kitchen.actions.faviconBuild; // }, // /** // * @name docmapBuild // * @namespace config.kitchenRecipeDefault.stacks.build.actions // * @type String // * @default [config.kitchen.actions.docmapBuild] // * // * Specify the recipe build stack docmapBuild action // * // * @since 2.0.0 // * @author Olivier Bossel (https://coffeekraken.io) // */ // get docmapBuild() { // return api.config.kitchen.actions.docmapBuild; // }, // /** // * @name sitemapBuild // * @namespace config.kitchenRecipeDefault.stacks.build.actions // * @type String // * @default [config.kitchen.actions.sitemapBuild] // * // * Specify the recipe build stack sitemapBuild action // * // * @since 2.0.0 // * @author Olivier Bossel (https://coffeekraken.io) // */ // get sitemapBuild() { // return api.config.kitchen.actions.sitemapBuild; // }, // /** // * @name markdownBuild // * @namespace config.kitchenRecipeDefault.stacks.build.actions // * @type String // * @default [config.kitchen.actions.markdownBuild] // * // * Specify the recipe build stack markdownBuild action // * // * @since 2.0.0 // * @author Olivier Bossel (https://coffeekraken.io) // */ // get markdownBuild() { // return api.config.kitchen.actions.markdownBuild; // }, /** * @name copyAssets * @namespace config.kitchenRecipeDefault.stacks.build.actions * @type String * * Specify the recipe build stack copyAssets action * * @since 2.0.0 * @author Olivier Bossel (https://coffeekraken.io) */ copyAssets: { extends: 'copy', params: { src: 'src', glob: '+(fonts|doc)', dest: 'dist', }, }, }, }, }, }; }