New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-component

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-component - npm Package Compare versions

Comparing version
0.1.7
to
0.1.8
+1
-1
bin/index.js

@@ -11,3 +11,3 @@ #!/usr/bin/env node

.option('-p, --path [value]', 'Path of new component', '')
.version('0.1.0', '-v, --version')
.version('0.1.8', '-v, --version')
.parse(process.argv);

@@ -14,0 +14,0 @@

@@ -1,13 +0,11 @@

const path = require('path');
const { copyFile, removeFile, replaceFile } = require('./utils');
const { copyFile, replaceFile } = require('./utils');
const GENERIC_STATELESS_COMPONENT_PATH = './lib/genericStateless.js';
const GENERIC_STATELESS_COMPONENT_PATH_TMP = './lib/genericStatelessTmp.js';
const GENERIC_COMPONENT_PATH = './lib/generic.js';
const GENERIC_COMPONENT_PATH_TMP = './lib/genericTmp.js';
const GENERIC_COMPONENT_STYLES_PATH = './lib/styles.js';
const GENERIC_REGEXP = 'GenericComponent';
const GENERIC_STATELESS_COMPONENT_PATH = '/genericStateless.js';
const GENERIC_COMPONENT_PATH = '/generic.js';
const GENERIC_COMPONENT_STYLES_PATH = '/styles.js';
const createComponent = function(name, newPath, stateless) {
let created = true;
let indexNewPath = `${name}/index.js`;
let indexNewPath =`${name}/index.js`;
let stylesNewPath = `${name}/styles.js`;

@@ -24,11 +22,9 @@

const componentPath = stateless ? GENERIC_STATELESS_COMPONENT_PATH : GENERIC_COMPONENT_PATH;
const componentPathTmp = stateless ? GENERIC_STATELESS_COMPONENT_PATH_TMP : GENERIC_COMPONENT_PATH_TMP;
created = created && copyFile(componentPath, componentPathTmp);
created = created && replaceFile(componentPathTmp, /GenericComponent/g, name);
created = created && copyFile(componentPathTmp, indexNewPath);
created = created && replaceFile(componentPath, GENERIC_REGEXP, name);
created = created && copyFile(componentPath, indexNewPath);
created = created && copyFile(GENERIC_COMPONENT_STYLES_PATH, stylesNewPath);
return created && removeFile(componentPathTmp);
return created && replaceFile(componentPath, name, GENERIC_REGEXP);
};
exports.createComponent = createComponent;

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

const path = require('path');
const fse = require('fs-extra');

@@ -5,5 +6,5 @@ const replace = require('replace-in-file');

const copyFile = function (src, dest) {
const copyFile = async function (src, dest) {
try {
fse.copySync(src, dest);
fse.copySync(path.join(__dirname, src), dest);
return true;

@@ -16,16 +17,6 @@ } catch (err) {

const removeFile = function (src) {
try {
fse.removeSync(src);
return true;
} catch (err) {
console.log(colors.red(err));
return false;
}
};
const replaceFile = function(files, from, to) {
const replaceFile = async function(files, from, to) {
const options = {
files,
from,
files: path.join(__dirname, files),
from: new RegExp(from, 'g'),
to

@@ -47,3 +38,2 @@ };

copyFile,
removeFile,
replaceFile,

@@ -50,0 +40,0 @@ printMessage,

{
"name": "react-native-component",
"version": "0.1.7",
"version": "0.1.8",
"description": "Generate skeletons for react native components",

@@ -5,0 +5,0 @@ "main": "./lib/fileHandler.js",

@@ -11,5 +11,6 @@ # react-native-component

```
|- ComponentName
|--- generic.js
|--- styles.js
.
├── ComponentName
├── index.js
├── styles.js
```

@@ -16,0 +17,0 @@