Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(utils): added utils folder #116

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Clone the repository and run the following commands from the root directory
#### 1. Go to the fe-theme repo location in your terminal and do
```
npm install
npm run build
npm start
```

Expand Down
60 changes: 30 additions & 30 deletions __application/scripts/buildPrepare.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
/* eslint-disable no-console */
const fs = require("fs")
const path = require("path")
const { mkdirp } = require("mkdirp")
const fs = require('fs');
const path = require('path');
const { mkdirp } = require('mkdirp');

const ignoreFiles = [
".DS_Store",
"scripts",
"utils",
"WIP-"
]
'.DS_Store',
'scripts',
'utils',
'WIP-',
];

function getRandomInt(max) {
return Math.floor(Math.random() * max)
return Math.floor(Math.random() * max);
}

const color = [
{ "name": "FgRed", "value": "\x1b[31m%s\x1b[0m" },
{ "name": "FgGreen", "value": "\x1b[32m%s\x1b[0m" },
{ "name": "FgYellow", "value": "\x1b[33m%s\x1b[0m" },
{ "name": "FgMagenta", "value": "\x1b[35m%s\x1b[0m" },
{ "name": "FgCyan", "value": "\x1b[36m%s\x1b[0m" }
]
{ name: 'FgRed', value: '\x1b[31m%s\x1b[0m' },
{ name: 'FgGreen', value: '\x1b[32m%s\x1b[0m' },
{ name: 'FgYellow', value: '\x1b[33m%s\x1b[0m' },
{ name: 'FgMagenta', value: '\x1b[35m%s\x1b[0m' },
{ name: 'FgCyan', value: '\x1b[36m%s\x1b[0m' },
];

// generate exports for all platforms
const srcPath = path.resolve(__dirname, "../component")
const components = fs.readdirSync(srcPath).filter((files) => !ignoreFiles.includes(files) && !files.includes("WIP-"))
let count = 0
const srcPath = path.resolve(__dirname, '../component');
const components = fs.readdirSync(srcPath).filter((files) => !ignoreFiles.includes(files) && !files.includes('WIP-'));
let count = 0;

components.forEach((component) => {
const componentDir = path.resolve(`${__dirname}`, `../../${component}`)
const componentDir = path.resolve(`${__dirname}`, `../../${component}`);
mkdirp(componentDir).then(() => {
const componentFile = path.resolve(componentDir, "index.js")
const componentContent = `export { default } from '../__build-es/${component}';\nexport * from '../__build-es/${component}';\n`
const componentFile = path.resolve(componentDir, 'index.js');
const componentContent = `export { default } from '../__build-es/${component}';\nexport * from '../__build-es/${component}';\n`;
fs.writeFile(componentFile, componentContent, (writeFileErr) => {
if (writeFileErr) throw writeFileErr
console.log(color[getRandomInt(color.length)].value, ` ${count + 3}. generated: ${componentFile} \n`)
count += 1
if (writeFileErr) throw writeFileErr;
console.log(color[getRandomInt(color.length)].value, ` ${count + 3}. generated: ${componentFile} \n`);
count += 1;
if (count === components.length) {
console.log(color[0].value, ` ${count + 3}. Generated: Package index files for package for direct import \n`)
console.log("\x1b[44m%s\x1b[0m", ` ${count + 4}. Final: Setup Completed Successfully`)
console.log("")
console.log(color[0].value, ` ${count + 3}. Generated: Package index files for package for direct import \n`);
console.log('\x1b[44m%s\x1b[0m', ` ${count + 4}. Final: Setup Completed Successfully`);
console.log('');
}
})
})
})
});
});
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"styled-components": "^6.1.6"
},
"files": [
"__application/utils/**",
"__build-es/**",
"__appset/**",
"Box/",
Expand Down
Loading