Skip to content

Commit

Permalink
Rearrange folders structure
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykbura committed Mar 24, 2022
1 parent 0379121 commit 4b4dc12
Show file tree
Hide file tree
Showing 21 changed files with 25 additions and 22 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 2 additions & 2 deletions src/components-actions.js
Original file line number Diff line number Diff line change
@@ -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:'

Expand Down
2 changes: 1 addition & 1 deletion src/composer-actions.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
17 changes: 9 additions & 8 deletions constants/constants.js → src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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 = {
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions src/create-alpaca-theme.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand All @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion src/database-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('')
Expand Down Expand Up @@ -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)

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/frontools-actions.js
Original file line number Diff line number Diff line change
@@ -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:'
Expand Down
2 changes: 1 addition & 1 deletion src/local-env-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/magento-actions.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/validators.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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) => {
Expand Down

0 comments on commit 4b4dc12

Please sign in to comment.