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

generator-wolmo-bootstrap-rn

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generator-wolmo-bootstrap-rn - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

generators/app/constants.js

4

generators/app/index.js

@@ -33,5 +33,5 @@ const Generator = require('yeoman-generator');

validate: val =>
(String(val).match(/^[$A-Z_][0-9A-Z_$]*$/i)
String(val).match(/^[$A-Z_][0-9A-Z_$]*$/i)
? true
: `${val} is not a valid name for a project. Please use a valid identifier name (alphanumeric).`)
: `${val} is not a valid name for a project. Please use a valid identifier name (alphanumeric).`
},

@@ -38,0 +38,0 @@ {

@@ -0,104 +1,64 @@

const { copyFile, copyTemplateFile } = require('../../utils');
const {
CIRCLE_CONFIG,
PULL_REQUEST_TEMPLATE,
API_CONFIG,
CONFIG,
MAIN,
APP_NAVIGATOR,
CUSTOM_TEXT,
CUSTOM_TEXT_STYLES,
PLATFORM_CONSTANTS,
COLORS_CONSTANTS,
ROUTES_CONSTANTS,
ARRAY_UTILS,
ARRAY_UTILS_TESTS,
TEST_ESLINT_CONFIG,
HOME_STYLES,
README,
REDUX_STORE,
REACTOTRON_CONFIG,
ANDROID_INDEX,
IOS_INDEX,
APP,
SCREENS
} = require('../../files');
const FILES = [
CIRCLE_CONFIG,
PULL_REQUEST_TEMPLATE,
API_CONFIG,
CONFIG,
MAIN,
APP_NAVIGATOR,
CUSTOM_TEXT,
CUSTOM_TEXT_STYLES,
PLATFORM_CONSTANTS,
COLORS_CONSTANTS,
ARRAY_UTILS,
ARRAY_UTILS_TESTS,
TEST_ESLINT_CONFIG,
HOME_STYLES
];
const TEMPLATE_FILES = [
README,
REDUX_STORE,
ROUTES_CONSTANTS,
REACTOTRON_CONFIG,
ANDROID_INDEX,
IOS_INDEX,
APP,
SCREENS
];
module.exports = function baseFilesTemplate() {
// circle.yml
this.fs.copy(this.templatePath('circle.yml'), this.destinationPath(this.projectName, 'circle.yml'));
// README.md
this.fs.copyTpl(this.templatePath('README.ejs'), this.destinationPath(this.projectName, 'README.md'), {
projectName: this.projectName
});
// pull_request_template.md
this.fs.copy(
this.templatePath('pull_request_template.md'),
this.destinationPath(this.projectName, 'pull_request_template.md')
);
// src/config/api.js
this.fs.copy(
this.templatePath('src', 'config', 'api.js'),
this.destinationPath(this.projectName, 'src', 'config', 'api.js')
);
// src/config/index.js
this.fs.copy(
this.templatePath('src', 'config', 'index.js'),
this.destinationPath(this.projectName, 'src', 'config', 'index.js')
);
// src/redux/store.js
TEMPLATE_FILES.forEach(copyTemplateFile.bind(this));
FILES.forEach(copyFile.bind(this));
this.fs.copyTpl(
this.templatePath('src', 'redux', 'store.ejs'),
this.destinationPath(this.projectName, 'src', 'redux', 'store.js'),
{ features: this.features }
);
// main.js
this.fs.copy(this.templatePath('main.js'), this.destinationPath(this.projectName, 'main.js'));
// src/config/ReactotronConfig.js
this.fs.copyTpl(
this.templatePath('src', 'config', 'ReactotronConfig.ejs'),
this.destinationPath(this.projectName, 'src', 'config', 'ReactotronConfig.js'),
{ projectName: this.projectName }
);
// index.android.js
this.fs.copyTpl(
this.templatePath('index.android.ejs'),
this.destinationPath(this.projectName, 'index.android.js'),
{ projectName: this.projectName }
);
// index.ios.js
this.fs.copyTpl(
this.templatePath('index.ios.ejs'),
this.destinationPath(this.projectName, 'index.ios.js'),
{ projectName: this.projectName }
);
// src/App.js
this.fs.copyTpl(
this.templatePath('src', 'App.ejs'),
this.destinationPath(this.projectName, 'src', 'App.js'),
this.templatePath('src', 'app', 'screens', 'home', this.features.login ? 'index.js' : 'layout.ejs'),
this.destinationPath(this.projectName, 'src', 'app', 'screens', 'home', 'index.js'),
{ projectName: this.projectName, features: this.features }
);
// src/AppNavigator.js
this.fs.copyTpl(
this.templatePath('src', 'AppNavigator.js'),
this.destinationPath(this.projectName, 'src', 'AppNavigator.js'),
{ projectName: this.projectName, features: this.features }
);
// src/screens.ejs
this.fs.copyTpl(
this.templatePath('src', 'screens.ejs'),
this.destinationPath(this.projectName, 'src', 'screens.js'),
{ projectName: this.projectName, features: this.features }
);
// src/screens/home/Home.js
this.fs.copyTpl(
this.templatePath('src', 'screens', 'home', 'Home.ejs'),
this.destinationPath(this.projectName, 'src', 'screens', 'home', 'Home.js'),
{ projectName: this.projectName, features: this.features }
);
// src/screens/home/Home.styles.js
this.fs.copyTpl(
this.templatePath('src', 'screens', 'home', 'Home.styles.js'),
this.destinationPath(this.projectName, 'src', 'screens', 'home', 'Home.styles.js'),
{ projectName: this.projectName, features: this.features }
);
// src/utils/constants.js
this.fs.copy(
this.templatePath('src', 'utils', 'constants.js'),
this.destinationPath(this.projectName, 'src', 'utils', 'constants.js')
);
// src/utils/reduxUtils.js
this.fs.copy(
this.templatePath('src', 'utils', 'reduxUtils.js'),
this.destinationPath(this.projectName, 'src', 'utils', 'reduxUtils.js')
);
// src/utils/colors.js
this.fs.copy(
this.templatePath('src', 'utils', 'colors.js'),
this.destinationPath(this.projectName, 'src', 'utils', 'colors.js')
);
// test/utils/reduxUtils.spec.js
this.fs.copy(
this.templatePath('test', 'utils', 'reduxUtils.spec.js'),
this.destinationPath(this.projectName, 'test', 'utils', 'reduxUtils.spec.js')
);
// test/.eslintrc.js
this.fs.copy(
this.templatePath('test', '.eslintrc.js'),
this.destinationPath(this.projectName, 'test', '.eslintrc.js')
);
};

@@ -0,37 +1,26 @@

const { copyFile } = require('../../utils');
const {
DRAWER_INDEX,
DRAWER_MENU_INDEX,
DRAWER_MENU_STYLES,
DRAWER_MENU_LAYOUT,
DRAWER_OVERLAY_INDEX,
DRAWER_OVERLAY_STYLES,
DRAWER_REDUX_ACTIONS,
DRAWER_REDUX_REDUCER
} = require('../../files');
const FILES = [
DRAWER_INDEX,
DRAWER_MENU_INDEX,
DRAWER_MENU_STYLES,
DRAWER_MENU_LAYOUT,
DRAWER_OVERLAY_INDEX,
DRAWER_OVERLAY_STYLES,
DRAWER_REDUX_ACTIONS,
DRAWER_REDUX_REDUCER
];
module.exports = function drawerFeatureFiles() {
// src/components/Drawer/DrawerContainer.js
this.fs.copy(
this.templatePath('src', 'components', 'Drawer', 'DrawerContainer.js'),
this.destinationPath(this.projectName, 'src', 'components', 'Drawer', 'DrawerContainer.js')
);
// src/components/Drawer/DrawerMenu.js
this.fs.copy(
this.templatePath('src', 'components', 'Drawer', 'DrawerMenu.js'),
this.destinationPath(this.projectName, 'src', 'components', 'Drawer', 'DrawerMenu.js')
);
// src/components/Drawer/DrawerMenu.styles.js
this.fs.copy(
this.templatePath('src', 'components', 'Drawer', 'DrawerMenu.styles.js'),
this.destinationPath(this.projectName, 'src', 'components', 'Drawer', 'DrawerMenu.styles.js')
);
// src/components/Drawer/DrawerMenuContainer.js
this.fs.copy(
this.templatePath('src', 'components', 'Drawer', 'DrawerMenuContainer.js'),
this.destinationPath(this.projectName, 'src', 'components', 'Drawer', 'DrawerMenuContainer.js')
);
// src/components/Drawer/DrawerOverlay.js
this.fs.copy(
this.templatePath('src', 'components', 'Drawer', 'DrawerOverlay.js'),
this.destinationPath(this.projectName, 'src', 'components', 'Drawer', 'DrawerOverlay.js')
);
// src/components/Drawer/DrawerOverlay.styles.js
this.fs.copy(
this.templatePath('src', 'components', 'Drawer', 'DrawerOverlay.styles.js'),
this.destinationPath(this.projectName, 'src', 'components', 'Drawer', 'DrawerOverlay.styles.js')
);
// src/redux/drawerHandlers.js
this.fs.copy(
this.templatePath('src', 'redux', 'drawerHandlers.js'),
this.destinationPath(this.projectName, 'src', 'redux', 'drawerHandlers.js')
);
FILES.forEach(copyFile.bind(this));
};

@@ -8,3 +8,4 @@ module.exports = function fixBundleIndentifier() {

replaceRegex,
`PRODUCT_BUNDLE_IDENTIFIER = ${this.bundleId};\n\t\t\t\tPRODUCT_NAME = ${this.projectName};\n\t\t\t\tTARGETED_DEVICE_FAMILY = "1,2";`
`PRODUCT_BUNDLE_IDENTIFIER = ${this.bundleId};\n\t\t\t\tPRODUCT_NAME = ${this
.projectName};\n\t\t\t\tTARGETED_DEVICE_FAMILY = "1,2";`
);

@@ -11,0 +12,0 @@ this.fs.write(`${this.projectName}/ios/${this.projectName}.xcodeproj/project.pbxproj`, fixedProjectContent);

@@ -0,33 +1,18 @@

const { copyFile, copyTemplateFile } = require('../../utils');
const {
AUTH_REDUCER,
AUTH_ACTIONS,
AUTH_SERVICE,
LOGIN,
LOGIN_LAYOUT,
LOGIN_STYLE,
HOME
} = require('../../files');
const FILES = [AUTH_REDUCER, AUTH_ACTIONS, AUTH_SERVICE, LOGIN, LOGIN_LAYOUT, LOGIN_STYLE];
const TEMPLATE_FILES = [HOME];
module.exports = function loginFeatureFiles() {
// src/redux/authHandlers.js
this.fs.copy(
this.templatePath('src', 'redux', 'authHandlers.js'),
this.destinationPath(this.projectName, 'src', 'redux', 'authHandlers.js')
);
// src/services/AuthService.js
this.fs.copy(
this.templatePath('src', 'services', 'AuthService.js'),
this.destinationPath(this.projectName, 'src', 'services', 'AuthService.js')
);
// src/screens/home/HomeContainer.js
this.fs.copyTpl(
this.templatePath('src', 'screens', 'home', 'HomeContainer.js'),
this.destinationPath(this.projectName, 'src', 'screens', 'home', 'HomeContainer.js'),
{ projectName: this.projectName, features: this.features }
);
// src/screens/login/LoginContainer.js
this.fs.copy(
this.templatePath('src', 'screens', 'login', 'LoginContainer.js'),
this.destinationPath(this.projectName, 'src', 'screens', 'login', 'LoginContainer.js')
);
// src/screens/login/Login.js
this.fs.copy(
this.templatePath('src', 'screens', 'login', 'Login.js'),
this.destinationPath(this.projectName, 'src', 'screens', 'login', 'Login.js')
);
// src/screens/login/Login.styles.js
this.fs.copy(
this.templatePath('src', 'screens', 'login', 'Login.styles.js'),
this.destinationPath(this.projectName, 'src', 'screens', 'login', 'Login.styles.js')
);
TEMPLATE_FILES.forEach(copyTemplateFile.bind(this));
FILES.forEach(copyFile.bind(this));
};

@@ -0,22 +1,20 @@

const { copyFile } = require('../../utils');
const {
PUSH_NOTIFICATIONS_REDUCER,
PUSH_NOTIFICATIONS_ACTIONS,
PUSH_NOTIFICATIONS_SERVICE,
PUSH_NOTIFICATIONS_CONFIG,
HUAWEI_DEVICES_CONFIG
} = require('../../files');
const FILES = [
PUSH_NOTIFICATIONS_REDUCER,
PUSH_NOTIFICATIONS_ACTIONS,
PUSH_NOTIFICATIONS_SERVICE,
PUSH_NOTIFICATIONS_CONFIG,
HUAWEI_DEVICES_CONFIG
];
module.exports = function pushNotificationsFeatureFiles() {
// src/redux/pushNotificationHandlers.js
this.fs.copy(
this.templatePath('src', 'redux', 'pushNotificationHandlers.js'),
this.destinationPath(this.projectName, 'src', 'redux', 'pushNotificationHandlers.js')
);
// src/services/PushNotificationsService.js
this.fs.copy(
this.templatePath('src', 'services', 'PushNotificationsService.js'),
this.destinationPath(this.projectName, 'src', 'services', 'PushNotificationsService.js')
);
// src/config/PushNotifications.js
this.fs.copy(
this.templatePath('src', 'config', 'PushNotifications.js'),
this.destinationPath(this.projectName, 'src', 'config', 'PushNotifications.js')
);
// src/config/Huawei.js
this.fs.copy(
this.templatePath('src', 'config', 'HuaweiPushNotifications.js'),
this.destinationPath(this.projectName, 'src', 'config', 'HuaweiPushNotifications.js')
);
FILES.forEach(copyFile.bind(this));
};

@@ -10,3 +10,3 @@ const runCommand = require('./runCommand');

})
.then(spinner =>
.then(({ spinner }) =>
// git add .

@@ -13,0 +13,0 @@ runCommand({

@@ -0,1 +1,4 @@

const latestSemver = require('latest-semver');
const semverRegex = require('semver-regex');
const runCommand = require('./runCommand');

@@ -13,2 +16,3 @@

'reselect',
'prop-types',
'seamless-immutable',

@@ -35,5 +39,34 @@ 'react-native-dotenv'

/**
* The eslint config we use may have issues between the different plugins we use.
* The solution for this is installing the proper version of each plugin declared in the eslint config package
* More info here: https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb#usage
*/
function getLinterPluginVersions(projectName, options) {
// Get peer dependencies of eslint-config-airbnb and its versions
// This command will return something like the following:
// { eslint: '^3.19.0 || ^4.3.0', 'eslint-plugin-jsx-a11y': '^5.1.1', 'eslint-plugin-import': '^2.7.0', 'eslint-plugin-react': '^7.1.0' }
return runCommand({
command: [
'npm',
['info', 'eslint-config-airbnb@latest', 'peerDependencies', '--json'],
{ cwd: `${process.cwd()}/${projectName}` }
],
loadingMessage: `Getting eslint plugins' versions`,
successMessage: `Successfuly download plugins version info`,
failureMessage: `Error getting info of eslint plugins. Turn verbose mode on for detailed logging`,
context: options
}).then(({ result }) => {
// keep latest if the dependency has different versions. e.g: eslint: '^3.19.0 || ^4.3.0'
const dependencies = JSON.parse(result);
Object.keys(dependencies).forEach(eachDependency => {
const latestDependencyVersion = latestSemver(dependencies[eachDependency].match(semverRegex()));
dependencies[eachDependency] = `^${latestDependencyVersion}`;
});
return dependencies;
});
}
function yarnInstall(projectName, deps, options, dev) {
const yarnArgs = dev ? ['add', '--dev'].concat(deps) : ['add'].concat(deps);
return runCommand({

@@ -55,10 +88,19 @@ command: ['yarn', yarnArgs, { cwd: `${process.cwd()}/${projectName}` }],

}
if (this.features.drawerios || this.features.drawerandroid) {
DEPENDENCIES.push('react-native-drawer');
}
return yarnInstall(this.projectName, DEPENDENCIES, this.options)
.then(() => yarnInstall(this.projectName, DEV_DEPENDENCIES, this.options, true))
.catch(() => {
process.exit(1);
});
return getLinterPluginVersions(this.projectName, this.options).then(plugins => {
const pluginNames = Object.keys(plugins);
const fixedDevDeps = DEV_DEPENDENCIES.map(
// Use a specific version of a dependency to avoid conflicts with other dependencies.
dependency => (pluginNames.includes(dependency) ? `${dependency}@${plugins[dependency]}` : dependency)
);
return yarnInstall(this.projectName, DEPENDENCIES, this.options)
.then(() => yarnInstall(this.projectName, fixedDevDeps, this.options, true))
.catch(() => {
process.exit(1);
});
});
};
require('colors');
const { CRASHLYTICS_LINKS, PUSH_NOTIFICATIONS_SETUP_LINK } = require('../constants');
module.exports = function nextSteps() {

@@ -7,4 +9,4 @@ console.log(`\n ${'NEXT STEPS!'.bold.underline.white} \n`);

console.log(
`● Your project folder has been created and it already includes the kickoff commit. ${`cd ${this.projectName}/`.italic}`
.cyan
`● Your project folder has been created and it already includes the kickoff commit. ${`cd ${this
.projectName}/`.italic}`.cyan
);

@@ -18,9 +20,9 @@ if (this.repoUrl) {

console.log(
`● Fabric and crashlytics are two ${'MANDATORY'.bold.underline} tools in every react-native project in Wolox.`
.cyan
`● Fabric and crashlytics are two ${'MANDATORY'.bold
.underline} tools in every react-native project in Wolox.`.cyan
);
console.log(' Follow these guides in order to complete their installation:'.cyan);
console.log(` ${'https://fabric.io/kits/ios/crashlytics/manual-install'.cyan.underline}`);
console.log(` ${'https://fabric.io/kits/android/crashlytics/install'.cyan.underline}`);
console.log(` ${'https://github.com/corymsmith/react-native-fabric#installation'.cyan.underline}`);
console.log(` ${CRASHLYTICS_LINKS.IOS_INSTALL.cyan.underline}`);
console.log(` ${CRASHLYTICS_LINKS.ANDROID_INSTALL.cyan.underline}`);
console.log(` ${CRASHLYTICS_LINKS.RN_INSTALL.cyan.underline}`);
console.log(' (*) Remember to ask your team lead for the Fabric token'.cyan);

@@ -34,6 +36,3 @@

);
console.log(
` Further instructions can be found here: ${'https://facebook.github.io/react-native/docs/pushnotificationios.html'.underline}`
.cyan
);
console.log(` Further instructions can be found here: ${PUSH_NOTIFICATIONS_SETUP_LINK.underline}`.cyan);
}

@@ -40,0 +39,0 @@

@@ -8,3 +8,3 @@ const runCommand = require('./runCommand');

context: this.options
}).then(spinner =>
}).then(({ spinner }) =>
runCommand({

@@ -11,0 +11,0 @@ command: ['rm', ['-rf', '__tests__'], { cwd: `${process.cwd()}/${this.projectName}` }],

require('colors');
const ora = require('ora');
const spawn = require('child_process').spawn;
const ora = require('ora');
/**

@@ -22,2 +24,3 @@ * Receives only one argument which is an object of options:

const command = spawn(...options.command);
const result = [];

@@ -44,4 +47,7 @@ let killTimeout;

}
if (options.context && options.context.verbose && data) {
console.log(data.toString());
if (data) {
result.push(data);
if (options.context && options.context.verbose) {
console.log(data.toString()); // eslint-disable-line no-console
}
}

@@ -56,3 +62,3 @@ });

const msg = data.toString();
console.log(/warning/.test(msg) ? msg.yellow : msg.red);
console.log(/warning/.test(msg) ? msg.yellow : msg.red); // eslint-disable-line no-console
}

@@ -69,3 +75,3 @@ });

}
resolve(spinner);
resolve({ spinner, result: result.join('\n') });
} else {

@@ -72,0 +78,0 @@ if (spinner && options.failureMessage) {

@@ -6,3 +6,3 @@ import React from 'react';

import store from './src/redux/store';
import App from './src/App';
import App from './src/app';

@@ -9,0 +9,0 @@ export default function index() {

@@ -6,3 +6,3 @@ let PushNotification;

import { actionCreators as notificationActions } from '../redux/pushNotificationHandlers'; // eslint-disable-line import/first
import { actionCreators as notificationActions } from '../redux/pushNotifications/actions'; // eslint-disable-line import/first

@@ -9,0 +9,0 @@ const formatReceivedNotification = push => {

import { AsyncStorage } from 'react-native';
import api from '../config/api';
import { actionCreators as authActions } from '../redux/auth/actions';
import { actionCreators as authActions } from '../redux/authHandlers';
export const setCurrentUser = async currentUser => {

@@ -17,1 +17,9 @@ api.setHeader('Authorization', currentUser.sessionToken);

};
export const login = async () =>
// TODO: Implement call to authentication API here
new Promise(resolve => {
setTimeout(() => {
resolve({ ok: true, data: { sessionToken: 'token' } });
}, 750);
});
{
"name": "generator-wolmo-bootstrap-rn",
"version": "0.0.4",
"version": "0.1.0",
"description": "",

@@ -19,3 +19,5 @@ "files": [

"colors": "^1.1.2",
"latest-semver": "^1.0.0",
"ora": "^1.1.0",
"semver-regex": "^1.0.0",
"yeoman-generator": "^1.1.1"

@@ -25,14 +27,14 @@ },

"babel-eslint": "^7.1.1",
"eslint": "^3.17.1",
"eslint-config-airbnb": "^14.1.0",
"eslint-config-prettier": "^1.5.0",
"eslint": "^4.3.0",
"eslint-config-airbnb": "^15.1.0",
"eslint-config-prettier": "^2.3.0",
"eslint-plugin-flowtype": "^2.30.3",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-prettier": "^2.0.1",
"eslint-plugin-react": "^6.10.0",
"husky": "^0.13.2",
"eslint-plugin-react": "^7.1.0",
"husky": "^0.14.3",
"prettier": "^1.1.0",
"prettier-eslint": "^5.1.0"
"prettier-eslint": "^6.4.2"
}
}

@@ -31,3 +31,3 @@ # Wolmo Bootstrap: React Native

- [Reactotron config](/generators/app/templates/src/config/ReactotronConfig.ejs)
- [Basic](/generators/app/templates/src/utils/colors.js) [constants](/generators/app/templates/src/utils/constants.js)
- [Basic constants](/generators/app/templates/src/constants)
- [Http client config](/generators/app/templates/src/config/api.js)

@@ -34,0 +34,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