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

@anephenix/rcg

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anephenix/rcg - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

60

__tests__/bin/rcg.test.js

@@ -42,4 +42,3 @@ // This file tests the rcg binary

const command = `./bin/rcg ${title}`;
const { stdout, stderr } = await exec(command);
assert.equal(stdout, '');
const { stderr } = await exec(command);
assert.equal(stderr, '');

@@ -96,3 +95,8 @@ const folderExists = await exists(folderPath);

recordedStdout,
`Using configuration settings found at ${exampleConfigFilePath}\n`
`Using configuration settings found at ${exampleConfigFilePath}
Created files:\n
/Users/pauljensen/Work/anephenix/rcg/components/my-test-component/MyTestComponent.jsx
/Users/pauljensen/Work/anephenix/rcg/components/my-test-component/MyTestComponent.scss
/Users/pauljensen/Work/anephenix/rcg/components/my-test-component/MyTestComponent.test.jsx
`
);

@@ -138,4 +142,3 @@ assert.equal(recordedStderr, '');

const command = `./bin/rcg ${title} --directory ${directory}`;
const { stdout, stderr } = await exec(command);
assert.equal(stdout, '');
const { stderr } = await exec(command);
assert.equal(stderr, '');

@@ -170,4 +173,3 @@ const folderExists = await exists(folderPath);

const command = `./bin/rcg ${title} --jsExtension jsx`;
const { stdout, stderr } = await exec(command);
assert.equal(stdout, '');
const { stderr } = await exec(command);
assert.equal(stderr, '');

@@ -198,4 +200,3 @@ const folderExists = await exists(folderPath);

const command = `./bin/rcg ${title} --cssExtension style.js`;
const { stdout, stderr } = await exec(command);
assert.equal(stdout, '');
const { stderr } = await exec(command);
assert.equal(stderr, '');

@@ -217,2 +218,43 @@ const folderExists = await exists(folderPath);

});
describe('universal behaviour', () => {
const title = 'MyTestComponent';
const folderName = 'my-test-component';
const folderPath = path.join(
process.cwd(),
'src',
'components',
folderName
);
beforeEach(async () => await seed(['src', 'components']));
afterEach(async () => await cleanup('src'));
it('should log all of the files that were created after executing the binary', async () => {
const command = `./bin/rcg ${title}`;
const { stdout, stderr } = await exec(command);
assert.equal(stderr, '');
const folderExists = await exists(folderPath);
assert(folderExists);
const files = await readdir(folderPath);
const expectedFiles = [
`${title}.js`,
`${title}.scss`,
`${title}.test.js`,
];
for (const file of expectedFiles) {
assert(files.indexOf(file) !== -1);
}
assert.equal(
stdout,
`Created files:
${path.join(folderPath, expectedFiles[0])}
${path.join(folderPath, expectedFiles[1])}
${path.join(folderPath, expectedFiles[2])}
`
);
});
});
});

@@ -23,3 +23,3 @@ const assert = require('assert');

it('should generate a boilerplate for a react component, given a name and a containing folder', async () => {
await generateComponent(title, srcFolderPath);
const filesCreated = await generateComponent(title, srcFolderPath);
const folderExists = await exists(folderPath);

@@ -39,3 +39,11 @@ assert(folderExists);

assert(styleExists);
assert.deepEqual(
[
path.join(folderPath, `${title}.js`),
path.join(folderPath, `${title}.scss`),
path.join(folderPath, `${title}.test.js`),
],
filesCreated
);
});
});
# CHANGELOG
### 0.0.9 - Thursday 21st May, 2020
- Added a way to log what files are created by RCG on the CLI
### 0.0.8 - Sunday 12th April, 2020

@@ -4,0 +8,0 @@

3

index.js

@@ -20,3 +20,3 @@ // NPM Dependencies

const folderName = to.slug(componentName);
await generateComponentFiles({
const filesCreated = await generateComponentFiles({
title,

@@ -30,4 +30,5 @@ folderName,

});
return filesCreated;
};
module.exports = generateComponent;

@@ -14,3 +14,4 @@ // NPM Dependencies

const filePath = path.join(folderPath, fileName);
return await writeFile(filePath, fileContent);
await writeFile(filePath, fileContent);
return filePath;
};

@@ -17,0 +18,0 @@

@@ -34,3 +34,4 @@ // NPM Dependencies

await mkdir(folderPath);
await generateStyleFile({
const filesCreated = [];
const styleFilePath = await generateStyleFile({
title,

@@ -42,3 +43,3 @@ folderName,

});
await generateComponentFile({
const componentFilePath = await generateComponentFile({
title,

@@ -51,3 +52,3 @@ folderName,

});
await generateTestFile({
const testFilePath = await generateTestFile({
title,

@@ -58,2 +59,6 @@ folderName,

});
filesCreated.push(componentFilePath);
filesCreated.push(styleFilePath);
filesCreated.push(testFilePath);
return filesCreated;
};

@@ -60,0 +65,0 @@

{
"name": "@anephenix/rcg",
"version": "0.0.8",
"version": "0.0.9",
"description": "React Component Generator",

@@ -24,14 +24,15 @@ "main": "index.js",

"devDependencies": {
"coveralls": "^3.0.11",
"eslint": "^6.8.0",
"eslint-plugin-jest": "^23.8.2",
"jest": "^25.3.0",
"coveralls": "^3.1.0",
"eslint": "^7.0.0",
"eslint-plugin-jest": "^23.13.1",
"jest": "^26.0.1",
"jsdoc": "^3.6.4",
"npm-upgrade": "^2.0.3",
"pre-commit": "^1.2.2",
"prettier": "^2.0.4"
"prettier": "^2.0.5"
},
"dependencies": {
"commander": "^5.0.0",
"commander": "^5.1.0",
"to-case": "^2.0.0"
}
}

Sorry, the diff of this file is not supported yet

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