Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-typescript-cli

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-typescript-cli - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

lib/handlebars-helpers.js

49

lib/create.js
const path = require('path');
const fs = require('fs-extra');
const componentTemplate = require("../templates/component");
const containerTemplate = require("../templates/container");
const indexTemplate = require("../templates/index");
const interfacesTemplate = require("../templates/interfaces");
const stylesTemplate = require("../templates/styles");
const utils = require('./utils');
const Handlebars = require('handlebars');
require('./handlebars-helpers');
createComponent = (name, options) => {

@@ -52,6 +49,10 @@ const root = path.resolve(utils.capitalize(name));

const root = path.resolve(utils.capitalize(componentName));
const filepath = path.join(path.join(__dirname, '..', 'templates'), 'component.hbs');
const template = fs.readFileSync(filepath, 'utf8');
fs.writeFileSync(
path.join(root, `${utils.capitalize(componentName)}.tsx`),
componentTemplate.getComponentTemplate(componentName)
Handlebars.compile(template)({
name: componentName
})
)

@@ -62,6 +63,17 @@ }

const root = path.resolve(utils.capitalize(componentName));
const filepath = path.join(path.join(__dirname, '..', 'templates'), 'container.hbs');
const template = fs.readFileSync(filepath, 'utf8');
fs.writeFileSync(
path.join(root, `${utils.capitalize(componentName)}.container.ts`),
containerTemplate.getContainerTemplate(componentName, withStyles, withConnect)
Handlebars.compile(template)({
name: componentName,
withConnect,
withStyles,
withStylesOrConnect: withStyles || withConnect,
withStylesAndConnect: withStyles && withConnect,
withOnlyStyles: withStyles && !withConnect,
withOnlyConnect: !withStyles && withConnect,
withoutConnectAndStyles: !withStyles && !withConnect
})
)

@@ -72,6 +84,11 @@ }

const root = path.resolve(utils.capitalize(componentName));
const filepath = path.join(path.join(__dirname, '..', 'templates'), 'index.hbs');
const template = fs.readFileSync(filepath, 'utf8');
fs.writeFileSync(
path.join(root, `index.ts`),
indexTemplate.getIndexTemplate(componentName, withContainer)
Handlebars.compile(template)({
name: componentName,
withContainer
})
)

@@ -82,6 +99,12 @@ }

const root = path.resolve(utils.capitalize(componentName));
const filepath = path.join(path.join(__dirname, '..', 'templates'), 'interfaces.hbs');
const template = fs.readFileSync(filepath, 'utf8');
fs.writeFileSync(
path.join(root, `${utils.capitalize(componentName)}.interfaces.ts`),
interfacesTemplate.getInterfacesTemplate(componentName, withStyles, withConnect)
Handlebars.compile(template)({
name: componentName,
withStyles,
withConnect
})
)

@@ -92,6 +115,10 @@ }

const root = path.resolve(utils.capitalize(componentName));
const filepath = path.join(path.join(__dirname, '..', 'templates'), 'styles.hbs');
const template = fs.readFileSync(filepath, 'utf8');
fs.writeFileSync(
path.join(root, `${utils.capitalize(componentName)}.styles.ts`),
stylesTemplate.getStylesTemplate()
Handlebars.compile(template)({
name: componentName
})
)

@@ -98,0 +125,0 @@ }

{
"name": "react-typescript-cli",
"version": "0.0.3",
"version": "0.1.0",
"description": "CLI tool for React with Typescript",

@@ -14,5 +14,15 @@ "files": "index.js",

"commander": "^2.9.0",
"fs-extra": "^2.0.0"
"fs-extra": "^2.0.0",
"handlebars": "^4.0.11"
},
"keywords": ["react", "typescript", "cli", "components", "generate", "styles", "material"]
"keywords": [
"react",
"typescript",
"cli",
"components",
"generate",
"styles",
"material"
],
"devDependencies": {}
}

@@ -36,2 +36,1 @@ # react-typescript-cli

- Support for functional components
- Creating components from src directory
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc