react-creates
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -7,2 +7,14 @@ ### Changelog | ||
#### [v1.0.6](https://github.com/tzachbon/react-creates/compare/v1.0.5...v1.0.6) | ||
> 16 August 2020 | ||
#### [v1.0.5](https://github.com/tzachbon/react-creates/compare/v1.0.4...v1.0.5) | ||
> 16 August 2020 | ||
- chore(vsc): setup [`0547519`](https://github.com/tzachbon/react-creates/commit/0547519bf84174bc49c6966c6583a9d740184f84) | ||
- test(vsc): setup [`a6e1f33`](https://github.com/tzachbon/react-creates/commit/a6e1f33fffbb794e9b32351dc238dc47de3de9aa) | ||
- refactor(cli): `create` command [`514ee50`](https://github.com/tzachbon/react-creates/commit/514ee507a6dae68b9066144fb57ca1f8b58a1c9d) | ||
#### [v1.0.4](https://github.com/tzachbon/react-creates/compare/v1.0.3...v1.0.4) | ||
@@ -9,0 +21,0 @@ |
@@ -29,6 +29,12 @@ #!/usr/bin/env node | ||
exports.componentParser = componentParser; | ||
error_1.checkForMainDependencies(); | ||
commander_1.program | ||
.addCommand(component_1.createComponent()) | ||
.parse(process.argv); | ||
async function main() { | ||
await error_1.checkForMainDependencies(); | ||
commander_1.program | ||
.addCommand(component_1.createComponent()) | ||
.parse(process.argv); | ||
} | ||
main() | ||
.catch(error => { | ||
throw error; | ||
}); | ||
//# sourceMappingURL=react-creates.js.map |
@@ -1,1 +0,3 @@ | ||
export declare const checkForMainDependencies: () => void; | ||
export declare const checkForMainDependencies: ({ target }?: { | ||
target?: string; | ||
}) => Promise<void>; |
@@ -8,18 +8,13 @@ "use strict"; | ||
const chalk_1 = __importDefault(require("chalk")); | ||
exports.checkForMainDependencies = () => { | ||
let foo, error; | ||
try { | ||
foo = require("react"); | ||
const get_package_json_1 = __importDefault(require("../get-package-json")); | ||
exports.checkForMainDependencies = async ({ target = process.cwd() } = {}) => { | ||
const { dependencies } = await get_package_json_1.default({ cwd: target, depth: 9999 }) || {}; | ||
const hasReact = Boolean(dependencies === null || dependencies === void 0 ? void 0 : dependencies['react']); | ||
if (!hasReact) { | ||
throw new Error(` | ||
Missing ${chalk_1.default.bold("React")} dependence. | ||
This CLI is made for react project 😎 ⚛ | ||
`); | ||
} | ||
catch (err) { | ||
error = err; | ||
} | ||
if (!foo) { | ||
console.error(chalk_1.default.red(` | ||
Missing ${chalk_1.default.bold("react")} dependence. | ||
This CLI is made for react project 😎 ⚛ | ||
`)); | ||
throw error; | ||
} | ||
}; | ||
//# sourceMappingURL=index.js.map |
export declare type PackageJsonType = Record<string, IPackageJson | string | number | boolean>; | ||
interface IPackageJson extends PackageJsonType { | ||
} | ||
export default function getPackageJson({ cwd, depth }: { | ||
export default function getPackageJson({ cwd, depth }?: { | ||
cwd?: string; | ||
@@ -6,0 +6,0 @@ depth?: number; |
@@ -13,3 +13,3 @@ "use strict"; | ||
; | ||
async function getPackageJson({ cwd = process.cwd(), depth = 10 }) { | ||
async function getPackageJson({ cwd = process.cwd(), depth = 10 } = {}) { | ||
const directories = cwd.split(path_1.sep); | ||
@@ -16,0 +16,0 @@ const PACKAGE_JSON = `package.json`; |
{ | ||
"name": "react-creates", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Create React Component folder works on macOS, Windows, and Linux.", | ||
@@ -13,2 +13,4 @@ "files": [ | ||
}, | ||
"homepage": "https://github.com/tzachbon/react-creates/tree/master/packages/react-creates", | ||
"readme": "https://github.com/tzachbon/react-creates/tree/master/packages/react-creates/README.md", | ||
"scripts": { | ||
@@ -27,3 +29,3 @@ "clean": "rm -rf __temp__", | ||
"deploy": "npm publish", | ||
"postdeplloy": "node deploy -g", | ||
"postdeploy": "npm run version && node deploy -g", | ||
"version": "npx auto-changelog" | ||
@@ -30,0 +32,0 @@ }, |
@@ -1,1 +0,95 @@ | ||
# React Creates | ||
<p align="center"> | ||
<h1 align="center"> | ||
React Creates (CLI) ⚛️ | ||
</h1> | ||
<p align="center"> | ||
Simple and easy to use react CLI. | ||
<br /> | ||
React creates for you useful and common tools that adapt themselves to your project for faster and easier development | ||
</p> | ||
<img src="screencast.gif"> | ||
</p> | ||
# Table of content | ||
- [Getting Started ⬇️](#getting-started-⬇️) | ||
- [Features](#features) | ||
- [Component](#component) | ||
- [Start](#start) | ||
- [Options](#options) | ||
- [Examples](#examples) | ||
- [Support 👨🔧](#support-) | ||
- [Contributing 👩💻](#contributing-) | ||
You can go to ways: | ||
- Smart (Zero configuration) | ||
- Advance (Configure by your needs) | ||
# Getting Started ⬇️ | ||
Writer this in the terminal inside your react project: | ||
`npx react-creates component MyComponent` | ||
Will generate for you: | ||
``` | ||
📦MyComponent | ||
┣ 📜MyComponent.js | ||
┣ 📜MyComponent.test.js | ||
┣ 📜index.js | ||
┗ 📜style.css | ||
``` | ||
# Features | ||
React Creates will support as many cases as it can, You need a use case it doesn't support? Please [open issue](https://github.com/tzachbon/react-creates/issues/new). | ||
You want to create flow for that use case? You are more than welcome! Learn how [here](#contributing-👩💻). | ||
Current features: | ||
## Component | ||
React lets you define components as classes or functions. | ||
But why you need to write it every time? | ||
Here how to do create one in seconds: | ||
### Start | ||
`npx react-creates component <name>` | ||
### Options | ||
| Option | Default | Description | | ||
| --------------------------- | ----------------------------------------------- | ---------------------------------------------------------------- | | ||
| `--scss` | `false` | Force `scss` style | | ||
| `--css` | `false` | Force `css` style | | ||
| `--sass` | `false` | Force `sass` style | | ||
| `-l --language <scripting>` | Calculated (Checks for `tsconfig` to determent) | Select the language you want the component to be | | ||
| `-d --directory <target>` | `process.cwd()` | Component directory | | ||
| `-t --type <component>` | `function` | What type of the component it should be. (function or class) | | ||
| `-pt --prop-types` | `false` | Should add Prop-types. Only works if inside `javascript` project | | ||
| `-f --function` | `false` | Force `function` component | | ||
| `-s --style <styling>` | `css` | Selected style | | ||
### Examples | ||
`npx react-creates component MyComponent` | ||
`npx react-creates component MyComponent --type class` | ||
`npx react-creates component MyComponent --style sass` | ||
`npx react-creates component MyComponent -d /Users/project/cool-project` | ||
`npx react-creates component MyComponent -l typescript` | ||
# Support 👨🔧 | ||
Please [open an issue](https://github.com/tzachbon/react-creates/issues/new) for support. | ||
# Contributing 👩💻 | ||
Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/tzachbon/react-creates/compare/). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
96
45677
73
624