From 3f4b6b0565f83bd19d64f8ba6097855a589c2f60 Mon Sep 17 00:00:00 2001 From: Jay Collett Date: Tue, 22 Feb 2022 00:28:01 +0400 Subject: [PATCH] provisioning --- README.md | 7 ++++ _frontend/project.config.js | 4 +-- _setup/provision.js | 65 ++++++++++++++++++++----------------- 3 files changed, 45 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 715c007..f00b716 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,13 @@ Install the wrapper with `npm i`. #### Project Setup Install all project dependencies and configure the project with `npm run setup`. +#### Provision CraftCMS and Nitro +Firstly make a new `_craft` directory and cd into it then run `composer create-project JayBox325/JayCraft .` to install a CraftCMS project in here. + +Set up a CraftCMS Security Key with `./craft setup/security-key`. + +Add this project to Nitro (provided you have it installed and setup on your machine) with `nitro add`. + ### Shopify `theme open -e development` Open the development theme in the browser. diff --git a/_frontend/project.config.js b/_frontend/project.config.js index 3865d60..7ebbbee 100644 --- a/_frontend/project.config.js +++ b/_frontend/project.config.js @@ -1,7 +1,7 @@ const projectConfig = { - name: 'lagoon', + name: 'test', framework: 'craft', // static, craft or shopify - domain: 'local.lagoon.com', + domain: 'local.test.com', init: true } diff --git a/_setup/provision.js b/_setup/provision.js index 6dfd939..4a3ec6e 100644 --- a/_setup/provision.js +++ b/_setup/provision.js @@ -1,5 +1,6 @@ import inquirer from 'inquirer' import run from './run.js' +import { exec } from 'child_process' import projectConfig from '../_frontend/project.config.js' async function provision(options) { @@ -25,7 +26,6 @@ async function provision(options) { ]) .then((answers) => { if (answers.provision) { - console.log(answers.framework) switch (answers.framework) { case 'Shopify': run('mkdir', ['_shopify']) @@ -35,40 +35,47 @@ async function provision(options) { case 'Craft': Promise.resolve() + // THIS IS IN PROGRESS, BUT cd-ing into ./_craft doesn't work + // Make Craft directory - .then(() => - run('mkdir', ['_craft']) + .then(() => + run('take', ['_craft']) ) - // Create project from scaffold repo - .then(() => - run('composer', ['create-project', 'JayBox325/JayCraft', '_craft']) - ) + // // CD into _craft + // .then(() => + // exec('_craft', function (error, stdout, stderr) { + // if (error) { + // console.error(`exec error: ${error}`); + // return; + // } + // }) + // ) - // CD into _craft - .then(() => - run('cd', ['_craft']) - ) + // // Create project from scaffold repo + // .then(() => + // run('composer', ['create-project', 'JayBox325/JayCraft', '.']) + // ) - // Create security key - .then(() => - run('php', ['craft', 'setup/security-key']) - ) + // // Create security key + // .then(() => + // run('php', ['craft', 'setup/security-key']) + // ) - // Build in Nitro - .then(() => - run('nitro', ['add']) - ) - // .then(() => - // run('nitro', ['db', 'import', 'DATABASE FILE']) - // ) + // // Build in Nitro + // .then(() => + // run('nitro', ['add']) + // ) + // .then(() => + // run('nitro', ['db', 'import', 'DATABASE FILE']) + // ) break; case 'Static': run('mkdir', ['_build']) console.log('Move Nunjucks into _src') break; - + default: break; } @@ -76,12 +83,12 @@ async function provision(options) { }) .catch((error) => console.log(error)) - /* - - Setup local project based on framework choice - - download and setup jaycraft for craftcms - - download and setup themekit for shopify - - move the nunjucks directory into _frontend for static - */ + /* + - Setup local project based on framework choice + - download and setup jaycraft for craftcms + - download and setup themekit for shopify + - move the nunjucks directory into _frontend for static + */ }) }