Socket
Socket
Sign inDemoInstall

react-code-generator-library

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-code-generator-library - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

3

bin/bundle.cjs.js

@@ -1,1 +0,2 @@

"use strict";const e=process.argv[5]||".",t=require(e+"/default.config");function a(e){let t=!0;return e&&""!==e||(t="Please provide a name"),e.length<2&&(t="Please provide a longer name"),t}module.exports=function(s){console.log({config:t}),console.log(t.componentsPath);const{componentsPath:n,withTypescript:p,jsx:l,withStyles:o,withModels:m,utilsPath:i}=t,c=p?"ts":"js",r=`${c}${l?"x":""}`;s.setGenerator("Component",{description:"Generate a React component ⚛️",prompts:[{type:"input",name:"name",message:"Component name?",validate:a},{when:o,type:"confirm",name:"withStyles",message:"Do you want a separate file for styles?"},{when:p&&m,type:"confirm",name:"withModels",message:"Do you want a separate file for models?"}],actions:function({withStyles:t,withModels:a}){const s=[{type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.${r}`,templateFile:e+"/templates/components/component.hbs"},{type:"add",path:`${e}/${n}{{ pascalCase name }}/index.${c}`,templateFile:e+"/templates/components/index.hbs"}];return t&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.styles.${c}`,templateFile:e+"/templates/components/styles.hbs"}),a&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.models.ts`,templateFile:e+"/templates/components/models.hbs"}),s}}),s.setGenerator("Util",{description:"Generate a util function 🛠",prompts:[{type:"input",name:"name",message:"Util name?",validate:a},{type:"input",name:"path",message:"What path shall we put it in?",default:i||"src/utils"}],actions:function({path:t}){return[{type:"add",path:`${e}/${t}/{{ camelCase name }}/{{ camelCase name }}.${c}`,templateFile:e+"/templates/utils/util.hbs",data:{withTypescript:p}},{type:"add",path:`${e}/${t}/{{ camelCase name }}/index.${c}`,templateFile:e+"/templates/utils/index.hbs"}]}})};
#!/usr/bin/env node
"use strict";const e=process.argv[5]||".",t=require(e+"/default.config");function a(e){let t=!0;return e&&""!==e||(t="Please provide a name"),e.length<2&&(t="Please provide a longer name"),t}module.exports=function(s){const{componentsPath:n,withTypescript:p,jsx:l,withStyles:m,withModels:i,utilsPath:o}=t,c=p?"ts":"js",r=`${c}${l?"x":""}`;s.setGenerator("Component",{description:"Generate a React component ⚛️",prompts:[{type:"input",name:"name",message:"Component name?",validate:a},{when:m,type:"confirm",name:"withStyles",message:"Do you want a separate file for styles?"},{when:p&&i,type:"confirm",name:"withModels",message:"Do you want a separate file for models?"}],actions:function({withStyles:t,withModels:a}){const s=[{type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.${r}`,templateFile:e+"/templates/components/component.hbs"},{type:"add",path:`${e}/${n}{{ pascalCase name }}/index.${c}`,templateFile:e+"/templates/components/index.hbs"}];return t&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.styles.${c}`,templateFile:e+"/templates/components/styles.hbs"}),a&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.models.ts`,templateFile:e+"/templates/components/models.hbs"}),s}}),s.setGenerator("Util",{description:"Generate a util function 🛠",prompts:[{type:"input",name:"name",message:"Util name?",validate:a},{type:"input",name:"path",message:"What path shall we put it in?",default:o||"src/utils"}],actions:function({path:t}){return[{type:"add",path:`${e}/${t}/{{ camelCase name }}/{{ camelCase name }}.${c}`,templateFile:e+"/templates/utils/util.hbs",data:{withTypescript:p}},{type:"add",path:`${e}/${t}/{{ camelCase name }}/index.${c}`,templateFile:e+"/templates/utils/index.hbs"}]}})};

@@ -1,1 +0,2 @@

const e=process.argv[5]||".",t=require(e+"/default.config");function a(e){let t=!0;return e&&""!==e||(t="Please provide a name"),e.length<2&&(t="Please provide a longer name"),t}module.exports=function(s){console.log({config:t}),console.log(t.componentsPath);const{componentsPath:n,withTypescript:p,jsx:l,withStyles:o,withModels:m,utilsPath:i}=t,c=p?"ts":"js",h=`${c}${l?"x":""}`;s.setGenerator("Component",{description:"Generate a React component ⚛️",prompts:[{type:"input",name:"name",message:"Component name?",validate:a},{when:o,type:"confirm",name:"withStyles",message:"Do you want a separate file for styles?"},{when:p&&m,type:"confirm",name:"withModels",message:"Do you want a separate file for models?"}],actions:function({withStyles:t,withModels:a}){const s=[{type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.${h}`,templateFile:e+"/templates/components/component.hbs"},{type:"add",path:`${e}/${n}{{ pascalCase name }}/index.${c}`,templateFile:e+"/templates/components/index.hbs"}];return t&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.styles.${c}`,templateFile:e+"/templates/components/styles.hbs"}),a&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.models.ts`,templateFile:e+"/templates/components/models.hbs"}),s}}),s.setGenerator("Util",{description:"Generate a util function 🛠",prompts:[{type:"input",name:"name",message:"Util name?",validate:a},{type:"input",name:"path",message:"What path shall we put it in?",default:i||"src/utils"}],actions:function({path:t}){return[{type:"add",path:`${e}/${t}/{{ camelCase name }}/{{ camelCase name }}.${c}`,templateFile:e+"/templates/utils/util.hbs",data:{withTypescript:p}},{type:"add",path:`${e}/${t}/{{ camelCase name }}/index.${c}`,templateFile:e+"/templates/utils/index.hbs"}]}})};
#!/usr/bin/env node
const e=process.argv[5]||".",t=require(e+"/default.config");function a(e){let t=!0;return e&&""!==e||(t="Please provide a name"),e.length<2&&(t="Please provide a longer name"),t}module.exports=function(s){const{componentsPath:n,withTypescript:p,jsx:l,withStyles:m,withModels:o,utilsPath:i}=t,c=p?"ts":"js",r=`${c}${l?"x":""}`;s.setGenerator("Component",{description:"Generate a React component ⚛️",prompts:[{type:"input",name:"name",message:"Component name?",validate:a},{when:m,type:"confirm",name:"withStyles",message:"Do you want a separate file for styles?"},{when:p&&o,type:"confirm",name:"withModels",message:"Do you want a separate file for models?"}],actions:function({withStyles:t,withModels:a}){const s=[{type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.${r}`,templateFile:e+"/templates/components/component.hbs"},{type:"add",path:`${e}/${n}{{ pascalCase name }}/index.${c}`,templateFile:e+"/templates/components/index.hbs"}];return t&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.styles.${c}`,templateFile:e+"/templates/components/styles.hbs"}),a&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.models.ts`,templateFile:e+"/templates/components/models.hbs"}),s}}),s.setGenerator("Util",{description:"Generate a util function 🛠",prompts:[{type:"input",name:"name",message:"Util name?",validate:a},{type:"input",name:"path",message:"What path shall we put it in?",default:i||"src/utils"}],actions:function({path:t}){return[{type:"add",path:`${e}/${t}/{{ camelCase name }}/{{ camelCase name }}.${c}`,templateFile:e+"/templates/utils/util.hbs",data:{withTypescript:p}},{type:"add",path:`${e}/${t}/{{ camelCase name }}/index.${c}`,templateFile:e+"/templates/utils/index.hbs"}]}})};

@@ -1,1 +0,2 @@

!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e=process.argv[5]||".",t=require(e+"/default.config");function a(e){let t=!0;return e&&""!==e||(t="Please provide a name"),e.length<2&&(t="Please provide a longer name"),t}module.exports=function(s){console.log({config:t}),console.log(t.componentsPath);const{componentsPath:n,withTypescript:p,jsx:o,withStyles:l,withModels:i,utilsPath:m}=t,c=p?"ts":"js",d=`${c}${o?"x":""}`;s.setGenerator("Component",{description:"Generate a React component ⚛️",prompts:[{type:"input",name:"name",message:"Component name?",validate:a},{when:l,type:"confirm",name:"withStyles",message:"Do you want a separate file for styles?"},{when:p&&i,type:"confirm",name:"withModels",message:"Do you want a separate file for models?"}],actions:function({withStyles:t,withModels:a}){const s=[{type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.${d}`,templateFile:e+"/templates/components/component.hbs"},{type:"add",path:`${e}/${n}{{ pascalCase name }}/index.${c}`,templateFile:e+"/templates/components/index.hbs"}];return t&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.styles.${c}`,templateFile:e+"/templates/components/styles.hbs"}),a&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.models.ts`,templateFile:e+"/templates/components/models.hbs"}),s}}),s.setGenerator("Util",{description:"Generate a util function 🛠",prompts:[{type:"input",name:"name",message:"Util name?",validate:a},{type:"input",name:"path",message:"What path shall we put it in?",default:m||"src/utils"}],actions:function({path:t}){return[{type:"add",path:`${e}/${t}/{{ camelCase name }}/{{ camelCase name }}.${c}`,templateFile:e+"/templates/utils/util.hbs",data:{withTypescript:p}},{type:"add",path:`${e}/${t}/{{ camelCase name }}/index.${c}`,templateFile:e+"/templates/utils/index.hbs"}]}})}}));
#!/usr/bin/env node
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";const e=process.argv[5]||".",t=require(e+"/default.config");function a(e){let t=!0;return e&&""!==e||(t="Please provide a name"),e.length<2&&(t="Please provide a longer name"),t}module.exports=function(s){const{componentsPath:n,withTypescript:p,jsx:l,withStyles:i,withModels:m,utilsPath:o}=t,c=p?"ts":"js",d=`${c}${l?"x":""}`;s.setGenerator("Component",{description:"Generate a React component ⚛️",prompts:[{type:"input",name:"name",message:"Component name?",validate:a},{when:i,type:"confirm",name:"withStyles",message:"Do you want a separate file for styles?"},{when:p&&m,type:"confirm",name:"withModels",message:"Do you want a separate file for models?"}],actions:function({withStyles:t,withModels:a}){const s=[{type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.${d}`,templateFile:e+"/templates/components/component.hbs"},{type:"add",path:`${e}/${n}{{ pascalCase name }}/index.${c}`,templateFile:e+"/templates/components/index.hbs"}];return t&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.styles.${c}`,templateFile:e+"/templates/components/styles.hbs"}),a&&s.push({type:"add",path:`${e}/${n}/{{ pascalCase name }}/{{ pascalCase name }}.models.ts`,templateFile:e+"/templates/components/models.hbs"}),s}}),s.setGenerator("Util",{description:"Generate a util function 🛠",prompts:[{type:"input",name:"name",message:"Util name?",validate:a},{type:"input",name:"path",message:"What path shall we put it in?",default:o||"src/utils"}],actions:function({path:t}){return[{type:"add",path:`${e}/${t}/{{ camelCase name }}/{{ camelCase name }}.${c}`,templateFile:e+"/templates/utils/util.hbs",data:{withTypescript:p}},{type:"add",path:`${e}/${t}/{{ camelCase name }}/index.${c}`,templateFile:e+"/templates/utils/index.hbs"}]}})}}));

@@ -13,3 +13,3 @@ {

"module": "bin/bundle.esm.js",
"version": "0.0.1",
"version": "0.0.2",
"license": "MIT",

@@ -31,4 +31,5 @@ "scripts": {

"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-preserve-shebang": "^1.0.1",
"rollup-plugin-terser": "^6.1.0"
}
}

@@ -0,1 +1,2 @@

#!/usr/bin/env node
const rootPath = process.argv[5] || '.'

@@ -2,0 +3,0 @@ const config = require(`${rootPath}/default.config`)

import babel from 'rollup-plugin-babel'
import resolve from 'rollup-plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import shebang from 'rollup-plugin-preserve-shebang'

@@ -31,2 +32,3 @@ import pkg from './package.json'

plugins: [
shebang(),
resolve(),

@@ -33,0 +35,0 @@ babel({

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