diff --git a/README.md b/README.md index 8d14606..a76b504 100644 --- a/README.md +++ b/README.md @@ -32,29 +32,33 @@ ![React Native Elements UI Toolkit](https://github.com/react-native-elements/playground/blob/master/public/thumbnail.png) - ### Installation - 1. Clone the repo + ```sh git clone https://github.com/react-native-elements/playground.git cd playground ``` + 2. Install NPM packages + ```sh npm i ``` + 3. Prepare (File path is UNIX based, might not work with Windows. PR Appreciated) + ```sh npm run prepare ``` + 4. Run the development server + ```sh npm start ``` - ## Releated Projects @@ -69,19 +73,14 @@ npm start ## Documentation -[View the full docs of React Native elements here](https://reactnativeelements.com/docs/overview) +[View the full docs of React Native elements here](https://reactnativeelements.com/docs/overview) ## Contributing - - - Interested in contributing to this repo? Check out our [Contributing Guide](https://reactnativeelements.com/docs/contributing) and submit a PR for a new feature/bug fix. - - ### First Contributors We encourage everyone to contribute & submit PR's especially first-time @@ -95,7 +94,6 @@ an or a [pull request](https://github.com/react-native-elements/playground/pulls). - ### Slack Community In case you have any other question or would like to come say **Hi!** to the RNE @@ -161,5 +159,3 @@ Do you use React Native Elements in production? If so, consider supporting this [![React Native Elements Backer](https://opencollective.com/react-native-elements/sponsor/17/avatar)](https://opencollective.com/react-native-elements/sponsor/17/website) [![React Native Elements Backer](https://opencollective.com/react-native-elements/sponsor/18/avatar)](https://opencollective.com/react-native-elements/sponsor/18/website) [![React Native Elements Backer](https://opencollective.com/react-native-elements/sponsor/19/avatar)](https://opencollective.com/react-native-elements/sponsor/19/website) - - diff --git a/injectLatestProps.js b/injectLatestProps.js index 2137d2b..5ed7f6e 100644 --- a/injectLatestProps.js +++ b/injectLatestProps.js @@ -1,25 +1,48 @@ -const { exec } = require("child_process"); -exec( - "git clone https://github.com/react-native-elements/react-native-elements --depth=1", - (err, stdout, stderr) => { - if (err) { - // node couldn't execute the command - return; - } +const { execSync } = require("child_process"); +const findRemoveSync = require("find-remove"); +const cpDir = require("copy-dir"); + +/* + * 1. find and delete any directory named react-native-elements + * 2. find and delete any directory named Props + * 3. clone the react-native-elements(https://github.com/react-native-elements/react-native-elements) repo + * 4. copy Props folder from cloned repo into our project + */ + +try { + // Point 1. depth=1 required (to avoid deleting node_modules/react-native-elements) + let result = findRemoveSync(".", { + maxLevel: 1, + dir: "react-native-elements", + }); + console.log("✔️ Removed ?: ", result); + + // Point 2 + result = findRemoveSync("./src/content", { dir: "Props" }); + console.log("✔️ Removed ?: ", result); - // the *entire* stdout and stderr (buffered) - console.log(`stdout: ${stdout}`); - console.log(`stderr: ${stderr}`); - } -); -exec("cp -r ./react-native-elements/website/docs/props ./src/content/Props"), - (err, stdout, stderr) => { - if (err) { - // node couldn't execute the command - return; + /* Point 3 */ + execSync( + "git clone https://github.com/react-native-elements/react-native-elements --depth=1", + (err, stdout, stderr) => { + if (err) { + // node couldn't execute the command + return; + } + // the *entire* stdout and stderr (buffered) + console.log(`stdout: ${stdout}`); + console.log(`stderr: ${stderr}`); } + ); + console.log("✔️ Cloned react-native-elements"); - // the *entire* stdout and stderr (buffered) - console.log(`stdout: ${stdout}`); - console.log(`stderr: ${stderr}`); - }; + // Point 4 + cpDir.sync( + "./react-native-elements/website/docs/props", + "./src/content/Props" + ); + console.log("✔️ Copied Props to src/content/Props"); +} catch (err) { + console.error(err); + return; +} diff --git a/package.json b/package.json index 7553999..8e7ce2c 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "@material-ui/icons": "^4.9.1", "@material-ui/styles": "^4.10.0", "@react-native-community/toolbar-android": "^0.1.0-rc.2", + "copy-dir": "^1.3.0", + "find-remove": "^3.0.0", "history": "^5.0.0", "mdx.macro": "^0.2.9", "modal-react-native-web": "^0.2.0",