diff --git a/templates/images/placeholder-144_200.jpg b/assets/images/placeholder-144_200.jpg similarity index 100% rename from templates/images/placeholder-144_200.jpg rename to assets/images/placeholder-144_200.jpg diff --git a/templates/images/placeholder-304_304.jpg b/assets/images/placeholder-304_304.jpg similarity index 100% rename from templates/images/placeholder-304_304.jpg rename to assets/images/placeholder-304_304.jpg diff --git a/templates/images/placeholder-320_432.jpg b/assets/images/placeholder-320_432.jpg similarity index 100% rename from templates/images/placeholder-320_432.jpg rename to assets/images/placeholder-320_432.jpg diff --git a/templates/images/placeholder-376_432.jpg b/assets/images/placeholder-376_432.jpg similarity index 100% rename from templates/images/placeholder-376_432.jpg rename to assets/images/placeholder-376_432.jpg diff --git a/templates/images/placeholder-472_432.jpg b/assets/images/placeholder-472_432.jpg similarity index 100% rename from templates/images/placeholder-472_432.jpg rename to assets/images/placeholder-472_432.jpg diff --git a/templates/images/placeholder-656_254.jpg b/assets/images/placeholder-656_254.jpg similarity index 100% rename from templates/images/placeholder-656_254.jpg rename to assets/images/placeholder-656_254.jpg diff --git a/templates/images/placeholder_1328-1200.jpg b/assets/images/placeholder_1328-1200.jpg similarity index 100% rename from templates/images/placeholder_1328-1200.jpg rename to assets/images/placeholder_1328-1200.jpg diff --git a/src/components-actions.js b/src/components-actions.js index a1d8529..e5019b1 100644 --- a/src/components-actions.js +++ b/src/components-actions.js @@ -1,6 +1,6 @@ import { validateYarn } from './validators.js' -import promiseExec from '../utils/promiseExec.js' -import { BASE_PATH } from '../constants/constants.js' +import promiseExec from './utils/promiseExec.js' +import { BASE_PATH } from './constants/constants.js' const COMPONENTS_INSTALL_ERROR_MSG = 'There was an error installing Snowdog_Components:' diff --git a/src/composer-actions.js b/src/composer-actions.js index f58bddc..651d558 100644 --- a/src/composer-actions.js +++ b/src/composer-actions.js @@ -1,5 +1,5 @@ import colors from 'colors' -import promiseExec from '../utils/promiseExec.js' +import promiseExec from './utils/promiseExec.js' export function composerRequire(composerPackage) { return promiseExec(`composer require ${composerPackage}`, (msg) => { diff --git a/constants/constants.js b/src/constants/constants.js similarity index 90% rename from constants/constants.js rename to src/constants/constants.js index 09a498c..5dcaec9 100644 --- a/constants/constants.js +++ b/src/constants/constants.js @@ -17,7 +17,8 @@ export const SNOWDOG_COMPONENTS = '/Snowdog_Components' export const MAGENTO_CHECKOUT_STYLES = '/Magento_Checkout/styles' export const ALPACA_THEME_DIR = 'vendor/snowdog/theme-frontend-alpaca' export const TEMPLATES_DIR = '../templates' -export const TEMPLATES_IMAGES_DIR = '../templates/images' +export const ASSETS_DIR = '../assets' +export const ASSETS_IMAGES_DIR = '../assets/images' export const CMS_BANNERS_DIR = 'pub/media/cms/home/banners' export const CMS_TEASERS_DIR = 'pub/media/cms/home/teasers' @@ -80,13 +81,13 @@ export const BANNED_NAMES_LIST = [ ] // PLACEHOLDER IMAGES PATHS -const PLACEHOLDER_654_254 = `${TEMPLATES_IMAGES_DIR}/placeholder-656_254.jpg` -const PLACEHOLDER_144_200 = `${TEMPLATES_IMAGES_DIR}/placeholder-144_200.jpg` -const PLACEHOLDER_320_432 = `${TEMPLATES_IMAGES_DIR}/placeholder-320_432.jpg` -const PLACEHOLDER_304_304 = `${TEMPLATES_IMAGES_DIR}/placeholder-304_304.jpg` -const PLACEHOLDER_376_432 = `${TEMPLATES_IMAGES_DIR}/placeholder-376_432.jpg` -const PLACEHOLDER_472_432 = `${TEMPLATES_IMAGES_DIR}/placeholder-472_432.jpg` -const PLACEHOLDER_1328_1200 = `${TEMPLATES_IMAGES_DIR}/placeholder_1328-1200.jpg` +const PLACEHOLDER_654_254 = `${ASSETS_IMAGES_DIR}/placeholder-656_254.jpg` +const PLACEHOLDER_144_200 = `${ASSETS_IMAGES_DIR}/placeholder-144_200.jpg` +const PLACEHOLDER_320_432 = `${ASSETS_IMAGES_DIR}/placeholder-320_432.jpg` +const PLACEHOLDER_304_304 = `${ASSETS_IMAGES_DIR}/placeholder-304_304.jpg` +const PLACEHOLDER_376_432 = `${ASSETS_IMAGES_DIR}/placeholder-376_432.jpg` +const PLACEHOLDER_472_432 = `${ASSETS_IMAGES_DIR}/placeholder-472_432.jpg` +const PLACEHOLDER_1328_1200 = `${ASSETS_IMAGES_DIR}/placeholder_1328-1200.jpg` // ALPACA CMS BLOCKS IMAGES NAMES const CMS_BLOCKS = { diff --git a/constants/directioriesList.js b/src/constants/directioriesList.js similarity index 100% rename from constants/directioriesList.js rename to src/constants/directioriesList.js diff --git a/src/create-alpaca-theme.js b/src/create-alpaca-theme.js index b2af37c..f31d9e0 100644 --- a/src/create-alpaca-theme.js +++ b/src/create-alpaca-theme.js @@ -1,7 +1,7 @@ import colors from 'colors' import Inquirer from 'inquirer' import cliProgress from 'cli-progress' -import Spinner from '../utils/spinner.js' +import Spinner from './utils/spinner.js' import runQueries from './database-actions.js' import { magentoUpgrade } from './magento-actions.js' import { composerRequire } from './composer-actions.js' @@ -10,12 +10,12 @@ import { mediaDirList, directoriesList, exemplaryComponentDirectories -} from '../constants/directioriesList.js' +} from './constants/directioriesList.js' import { CLISuccesMessage, databaseErrorMessage, notMagentoInstanceMessage -} from '../utils/messages.js' +} from './utils/messages.js' import { installFrontools, compileFiles @@ -42,7 +42,7 @@ import { PACKAGE_PATH, CHECK_MARK_CHARACTER, MEDIA_PATHS -} from '../constants/constants.js' +} from './constants/constants.js' const { log } = console const spinner = new Spinner() diff --git a/src/database-actions.js b/src/database-actions.js index 61e4e6c..176d702 100644 --- a/src/database-actions.js +++ b/src/database-actions.js @@ -2,6 +2,8 @@ import mysql from 'mysql' import { readFile } from 'fs/promises' import colors from 'colors' +const dbQueriesPath = './database/queries.sql' + // GETTING SINGULAR VALUE FROM PHP ARRAY function getValue(table, name) { return table.join('') @@ -67,7 +69,7 @@ async function execute(connection, dataSql) { } export default async function runQueries() { - const dataSql = await readFile(new URL('../templates/database/queries.sql', import.meta.url)) + const dataSql = await readFile(new URL(dbQueriesPath, import.meta.url)) const connection = mysql.createConnection(await getDatabaseDetails()) const errors = await execute(connection, dataSql) diff --git a/templates/database/queries.sql b/src/database/queries.sql similarity index 100% rename from templates/database/queries.sql rename to src/database/queries.sql diff --git a/src/frontools-actions.js b/src/frontools-actions.js index 7a934da..4d67265 100644 --- a/src/frontools-actions.js +++ b/src/frontools-actions.js @@ -1,6 +1,6 @@ -import promiseExec from '../utils/promiseExec.js' +import promiseExec from './utils/promiseExec.js' import { validateYarn } from './validators.js' -import { FRONTOOLS_PATH } from '../constants/constants.js' +import { FRONTOOLS_PATH } from './constants/constants.js' const INSTALLING_ERROR_MSG = 'There was an error installing Frontools:' const COMPILING_ERROR_MSG = 'There was an error compiling files with Frontools:' diff --git a/src/local-env-actions.js b/src/local-env-actions.js index f2deddb..a0d8e72 100644 --- a/src/local-env-actions.js +++ b/src/local-env-actions.js @@ -11,7 +11,7 @@ import { SNOWDOG_COMPONENTS, ALPACA_THEME_DIR, BASE_PATH -} from '../constants/constants.js' +} from './constants/constants.js' export function createDirectory(path) { return new Promise((resolve, reject) => { diff --git a/src/magento-actions.js b/src/magento-actions.js index bbaeda9..f8aff22 100644 --- a/src/magento-actions.js +++ b/src/magento-actions.js @@ -1,4 +1,4 @@ -import promiseExec from '../utils/promiseExec.js' +import promiseExec from './utils/promiseExec.js' export function magentoUpgrade() { return promiseExec('bin/magento setup:upgrade', (msg) => { diff --git a/utils/messages.js b/src/utils/messages.js similarity index 100% rename from utils/messages.js rename to src/utils/messages.js diff --git a/utils/promiseExec.js b/src/utils/promiseExec.js similarity index 100% rename from utils/promiseExec.js rename to src/utils/promiseExec.js diff --git a/utils/spinner.js b/src/utils/spinner.js similarity index 100% rename from utils/spinner.js rename to src/utils/spinner.js diff --git a/src/validators.js b/src/validators.js index f984177..27dbe45 100644 --- a/src/validators.js +++ b/src/validators.js @@ -1,6 +1,6 @@ import fs from 'fs' import colors from 'colors' -import promiseExec from '../utils/promiseExec.js' +import promiseExec from './utils/promiseExec.js' import { NAME_MINIMUM_LENGTH, NAME_TO_SHORT_MSG, @@ -9,7 +9,7 @@ import { BANNED_NAMES_MSG, BANNED_NAMES_LIST, NAME_NOT_LOWERCASE -} from '../constants/constants.js' +} from './constants/constants.js' function getNameValidator(customRule) { return (name) => {