Skip to content

Commit

Permalink
fix(theme prepare): theme prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
opensrc0 committed Dec 24, 2023
1 parent b66e83f commit ffbc363
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 31 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Copy
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
src_path: /__appset
dst_path: /
dst_owner: andstor
dst_repo_name: copycat-action

- run: npm ci
- run: npm run build
- run: npm run semantic-release
Expand Down
21 changes: 0 additions & 21 deletions __appset/theme.js

This file was deleted.

43 changes: 42 additions & 1 deletion __appset/themePrepare.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable max-len */
/* eslint-disable no-console */
const fs = require('fs');
const path = require('path');
Expand All @@ -8,7 +9,6 @@ const ignoreFiles = [
'scripts',
'utils',
'themePrepare.js',
'theme.js',
'universal',
];

Expand All @@ -31,11 +31,20 @@ const srcPath = path.resolve(__dirname, '../__appset');
const components = fs.readdirSync(srcPath).filter((files) => !ignoreFiles.includes(files) && !files.includes('WIP-'));
let count = 0;

// Prod:
const createDir = path.resolve(`${__dirname}`, '../../../fe-theme');

// Local
// const createDir = path.resolve(`${__dirname}`, '../../jio-fiber-chat-bot/fe-theme');

mkdirp(createDir).then(() => {
components.map((component) => {
// Prod:
const defaultDir = path.resolve(`${__dirname}`, '../../../node_modules/fe-theme/__appset');

// Local:
// const defaultDir = path.resolve(`${__dirname}`, '../__appset');

const appDir = path.resolve(`${__dirname}`, '../../../fe-theme');
const defaultDirData = fs.readFileSync(`${defaultDir}/${component}`).toString().split('export')[0].split('=')[1];

Expand Down Expand Up @@ -68,4 +77,36 @@ const ${replaceComponentName} =${defaultDirData}export default ${replaceComponen

return null;
});
}).catch((err) => {
console.log('err', err);
});

const srcPathInner = path.resolve(__dirname, '../__appset/universal');
const componentsInner = fs.readdirSync(srcPathInner).filter((files) => !ignoreFiles.includes(files) && !files.includes('WIP-'));

// Prod:
const createInnerDir = path.resolve(`${__dirname}`, '../../../fe-theme/universal');

// Local
// const createInnerDir = path.resolve(`${__dirname}`, '../../jio-fiber-chat-bot/fe-theme/universal');

mkdirp(createInnerDir).then(() => {
componentsInner.map((component) => {
// Prod: const defaultDir = path.resolve(`${__dirname}`, '../../../node_modules/fe-theme/__appset');

const appDir = path.resolve(`${__dirname}`, '../../fe-theme/__appset/universal');

fs.readFile(`${appDir}/${component}`, 'utf8', (err, data) => {
console.log(err, data);
const componentFile = path.resolve(createInnerDir, component);
const componentContent = data;
fs.writeFile(componentFile, componentContent, () => {

});
});

return null;
});
}).catch((err) => {
console.log('err', err);
});
21 changes: 21 additions & 0 deletions __appset/universal/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import PXL from './configPXL';
import Color from './configColor';
import FontSize from './configFontSize';
import FontFamily from './configFontFamily';
import FontWeight from './configFontWeight';

import Button from '../configButton';
import Input from '../configInput';

export default {
Universal: {
PXL,
Color,
FontSize,
FontFamily,
FontWeight,
},
Button,
Input,

};

0 comments on commit ffbc363

Please sign in to comment.