Skip to content

Commit

Permalink
Merge pull request #89 from upneet-bit/PathWindowFixes
Browse files Browse the repository at this point in the history
Path window fixes
  • Loading branch information
ShreyDhyani authored Oct 10, 2023
2 parents 93b67ed + 6ec0040 commit f10763b
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion scripts/createExample.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (!exampleName) {
process.exit(2);
}

const sourcePath = "./scripts/scaffold/dev-app/components/<to-replace>";
const sourcePath = "./scripts/scaffold/dev-app/components/_to-replace_";
const targetPath = `./development/${devAppName}-app/components/${devAppName}`;

const renameFolders = () => {
Expand Down
2 changes: 1 addition & 1 deletion scripts/scaffold/component/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@locoworks/reusejs-react-<to-replace>",
"name": "@locoworks/reusejs-react-_to-replace_",
"version": "0.0.0",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
Expand Down
4 changes: 2 additions & 2 deletions scripts/scaffold/dev-app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "<to-replace>-app",
"name": "_to-replace_-app",
"version": "0.0.1",
"private": true,
"prettier": "@betalectic-reusejs/shared-config-prettier-ts",
Expand All @@ -11,7 +11,7 @@
},
"dependencies": {
"@locoworks/reusejs-react-code-preview": "*",
"@locoworks/reusejs-react-<to-replace>": "*",
"@locoworks/reusejs-react-_to-replace_": "*",
"@mdx-js/loader": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.4.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
HEAD OBJECT
title: "ReuseJS <to-replace>"
title: "ReuseJS _to-replace_"
author: "John Doe"
---

Expand Down
18 changes: 9 additions & 9 deletions scripts/scaffold/dev-app/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React, { useEffect } from "react";
import { useRouter } from "next/router";

export default function Home() {
const router = useRouter();
const router = useRouter();

useEffect(() => {
router.push("/<to-replace>");
}, []);
useEffect(() => {
router.push("/_to-replace_");
}, []);

return (
<main
className={`flex min-h-screen flex-col items-center justify-between p-24`}
></main>
);
return (
<main
className={`flex min-h-screen flex-col items-center justify-between p-24`}
></main>
);
}
2 changes: 1 addition & 1 deletion scripts/scaffold/dev-app/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"../../components/<to-replace>/**/*.{js,jsx.ts.tsx,mdx}",
"../../components/_to-replace_/**/*.{js,jsx.ts.tsx,mdx}",
"../../components/code-preview/**/*.{js,jsx.ts.tsx,mdx}",
],
theme: {
Expand Down
8 changes: 4 additions & 4 deletions scripts/scaffoldComponent.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const { ncp } = pkg;

const replacementText = process.argv[2];

//Function to Replace all occurances of <to-replace> wuth the given component name
//Function to Replace all occurances of _to-replace_ wuth the given component name
function reformat(folderPath) {
try {
fs.readdirSync(folderPath).forEach((file) => {
const filePath = path.join(folderPath, file);
if (fs.existsSync(filePath) && fs.statSync(filePath).isFile()) {
let fileContent = fs.readFileSync(filePath, "utf-8");
fileContent = fileContent.replace(/<to-replace>/g, replacementText);
fileContent = fileContent.replace(/_to-replace_/g, replacementText);
fs.writeFileSync(filePath, fileContent, "utf-8");
} else {
reformat(path.join(folderPath, file));
Expand Down Expand Up @@ -68,10 +68,10 @@ const addToPackageJSON = () => {

//Rename folders in dev-app
const renameFolders = () => {
const folderpath2 = `./development/${replacementText}-app/pages/<to-replace>`;
const folderpath2 = `./development/${replacementText}-app/pages/_to-replace_`;
const foldernewName2 = `./development/${replacementText}-app/pages/${replacementText}`;

const folderpath3 = `./development/${replacementText}-app/components/<to-replace>`;
const folderpath3 = `./development/${replacementText}-app/components/_to-replace_`;
const foldernewName3 = `./development/${replacementText}-app/components/${replacementText}`;

const renameFolder = (oldFolderPath, newFolderPath) => {
Expand Down

0 comments on commit f10763b

Please sign in to comment.