Skip to content

Commit 80c2604

Browse files
committed
fix(themeprepare.js): changed config folder name
1 parent d204184 commit 80c2604

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

__application/utils/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export const getDirPath = (env, CURRENT_APP_DIR, COMPONENT_CONFIG_PATH) => {
1212
let createDir;
1313

1414
if (env === 'local') {
15-
createDir = `${CURRENT_APP_DIR}/${COMPONENT_CONFIG_PATH}/fe-theme`;
15+
createDir = `${CURRENT_APP_DIR}/${COMPONENT_CONFIG_PATH}/fe-theme-config`;
1616
} else {
17-
createDir = path.resolve(`${__dirname}`, `../../../${process.env.COMPONENT_CONFIG_PATH}/fe-theme`);
17+
createDir = path.resolve(`${__dirname}`, `../../../${process.env.COMPONENT_CONFIG_PATH}/fe-theme-config`);
1818
}
1919

2020
return createDir;

__appset/themePrepare.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,20 @@ const { CURRENT_APP_DIR } = process.env; // My project Location
1818
const { COMPONENT_CONFIG_PATH } = process.env; // Where to place in My project Location
1919
const { COMPONENT_NAME } = process.env;
2020

21-
let appDir;
22-
if (ENVIRONMENT === 'local') {
23-
appDir = `${CURRENT_APP_DIR}/${COMPONENT_CONFIG_PATH}fe-theme`;
24-
} else {
25-
appDir = path.resolve(`${__dirname}`, `../../../${process.env.COMPONENT_CONFIG_PATH}fe-theme`);
26-
}
21+
const dirPath = getDirPath(ENVIRONMENT, CURRENT_APP_DIR, COMPONENT_CONFIG_PATH);
22+
const components = getComponents(COMPONENT_NAME);
2723

28-
const manageThemeFile = async (component, dirPath) => {
29-
const themeFile = process.env.ENVI === 'local' ? `${appDir}/theme.js` : path.resolve(dirPath, 'theme.js');
24+
const manageThemeFile = async (component) => {
25+
const themeFile = `${path.resolve(dirPath)}/theme.js`;
3026

3127
try {
32-
const data = await fs.promises.readFile(`${appDir}/theme.js`, 'utf8');
28+
const data = await fs.promises.readFile(`${dirPath}/theme.js`, 'utf8');
3329
addComponentInExistingThemeFile(component, themeFile, data);
3430
} catch (err) {
3531
await addComponentInNewThemeFile(component, themeFile);
3632
}
3733
};
3834

39-
const dirPath = getDirPath(ENVIRONMENT, CURRENT_APP_DIR, COMPONENT_CONFIG_PATH);
40-
const components = getComponents(COMPONENT_NAME);
41-
4235
mkdirp(dirPath).then(async () => {
4336
for (const component of components) {
4437
if (component !== 'theme.js' && component !== 'normalise.js' && component !== 'themePrepare copy.js') {
@@ -48,9 +41,9 @@ mkdirp(dirPath).then(async () => {
4841

4942
components.map(async (component, index) => {
5043
const fileData = fs.readFileSync(`${path.resolve('__appset')}/${component}`).toString();
51-
const fileName = ENVIRONMENT === 'local' ? `${appDir}/${component}` : path.resolve(dirPath, component);
44+
const fileName = `${path.resolve(dirPath)}/${component}`;
5245

53-
if (await isFileExist(appDir, component)) {
46+
if (await isFileExist(dirPath, component)) {
5447
fileGeneratedLog(index, fileName, true);
5548
setUpCompletedLog(index, components.length);
5649
return false;

0 commit comments

Comments
 (0)