heliocrafts
Advanced tools
Comparing version 2.0.15 to 2.0.16
@@ -14,3 +14,34 @@ #!/usr/bin/env node | ||
for (const key in filesObject) { | ||
if (key.startsWith(`/${folderName}/`) && !key.startsWith(`/${folderName}/index.js`)) { | ||
if (key.startsWith(`/${folderName}/index.js` || key.startsWith(`/${folderName}/index.jsx`) || key.startsWith(`/${folderName}/index.tsx`) || key.startsWith(`/${folderName}/index.ts`))) { | ||
const filePathParts = key.split('/').filter(part => part !== ''); // Split path and remove empty parts | ||
let currentPath = './'; // Start with the current directory | ||
for (const folderName of filePathParts.slice(0, -1)) { | ||
currentPath = path.join(currentPath, folderName); | ||
// Create the folder if it doesn't exist | ||
if (!fs.existsSync(currentPath)) { | ||
fs.mkdirSync(currentPath); | ||
} | ||
} | ||
// Create and write the file | ||
const fileName = filePathParts[filePathParts.length - 1]; | ||
const fullPath = path.join(currentPath, fileName); | ||
const fileContent = (key.startsWith(`/${folderName}/index.ts`) || key.startsWith(`/${folderName}/index.tsx`)) ? `import ${newTitle} from './${newTitle}'; | ||
function App(props:any) { | ||
return <${newTitle} {...props} />;; | ||
} | ||
export default App;`: `import ${newTitle} from './${newTitle}'; | ||
function App(props) { | ||
return <${newTitle} {...props} />;; | ||
} | ||
export default App;`; | ||
if (typeof fileContent === 'string' || fileContent instanceof Buffer) { | ||
fs.writeFileSync(fullPath, fileContent); | ||
} else { | ||
console.error(`Invalid data for file: ${key}`); | ||
} | ||
} | ||
else if (key.startsWith(`/${folderName}/`)) { | ||
const filePathParts = key.split('/').filter(part => part !== ''); // Split path and remove empty parts | ||
@@ -37,30 +68,4 @@ let currentPath = './'; // Start with the current directory | ||
} | ||
else if (key.startsWith(`/${folderName}/index.js` || key.startsWith(`/${folderName}/index.jsx`) || key.startsWith(`/${folderName}/index.tsx`) || key.startsWith(`/${folderName}/index.ts`))) { | ||
const filePathParts = key.split('/').filter(part => part !== ''); // Split path and remove empty parts | ||
let currentPath = './'; // Start with the current directory | ||
for (const folderName of filePathParts.slice(0, -1)) { | ||
currentPath = path.join(currentPath, folderName); | ||
// Create the folder if it doesn't exist | ||
if (!fs.existsSync(currentPath)) { | ||
fs.mkdirSync(currentPath); | ||
} | ||
} | ||
// Create and write the file | ||
const fileName = filePathParts[filePathParts.length - 1]; | ||
const fullPath = path.join(currentPath, fileName); | ||
const fileContent = `import ${newTitle} from './${newTitle}'; | ||
function App(props) { | ||
return <${newTitle} {...props} />;; | ||
} | ||
export default App;`; | ||
if (typeof fileContent === 'string' || fileContent instanceof Buffer) { | ||
fs.writeFileSync(fullPath, fileContent); | ||
} else { | ||
console.error(`Invalid data for file: ${key}`); | ||
} | ||
} | ||
} | ||
@@ -67,0 +72,0 @@ } |
{ | ||
"name": "heliocrafts", | ||
"version": "2.0.15", | ||
"version": "2.0.16", | ||
"description": "A CLI to integrate cutting-edge and production-ready web components from heliocrafts into your project.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9489
187