-
Notifications
You must be signed in to change notification settings - Fork 326
/
Copy pathchakraUi.command.js
42 lines (35 loc) · 1.09 KB
/
chakraUi.command.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const { wrapTagAround, ifNotDot } = require("configure-react/utils");
const shell = require("shelljs");
const path = require("path");
const fs = require("fs");
const editIndexJs = (currentPath) => {
const indexJsPath = path.join(currentPath, "./src/index.js");
wrapTagAround(
"ChakraProvider",
indexJsPath,
"ChakraProvider",
"@chakra-ui/react"
);
};
const editPackageJson = () => {
console.log("editPackageJson function called");
const currentPath = process.cwd();
// const packageJsonPath = path.join(currentPath, "./package.json");
// const packageJson = require("./package.json");
console.log(currentPath);
editIndexJs(currentPath);
// editIndexJs();
};
const chakraUi = async ([projectName]) => {
function run() {
ifNotDot(projectName);
editPackageJson();
}
run();
// ifNotDot(projectName);
// editPackageJson();
};
module.exports = chakraUi;
// Language: javascript
// ======================= Add Provider in index.js ======================= // add provider in index.js file
// Add the provider in index.js file keeping the other code as it is