Skip to content

Commit

Permalink
Merge pull request #12 from kadirahq/rn-set-appname
Browse files Browse the repository at this point in the history
Set the app name if possible
  • Loading branch information
Muhammed Thanish authored Aug 26, 2016
2 parents ef5714f + d0398bf commit 34ef924
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions generators/REACT_NATIVE/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
var mergeDirs = require('merge-dirs').default;
var helpers = require('../../lib/helpers');
var path = require('path');
var shell = require('shelljs');

// copy all files from the template directory to project directory
mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite');

// set correct project name on entry files if possible
var dirname = shell.ls('-d', 'ios/*.xcodeproj').stdout;
var projectName = dirname && dirname.slice(
'ios/'.length,
dirname.length - '.xcodeproj'.length - 1
);
if (projectName) {
shell.sed('-i', '%APP_NAME%', projectName, 'storybook/index.ios.js');
}

var packageJson = helpers.getPackageJson();

// TODO: Get the latest version of storybook here.
Expand Down
2 changes: 1 addition & 1 deletion generators/REACT_NATIVE/template/storybook/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ configure(() => {
}, module);

const StorybookUI = getStorybookUI({port: 7007, host: 'localhost'});
AppRegistry.registerComponent('HelloWorld', () => StorybookUI);
AppRegistry.registerComponent('%APP_NAME%', () => StorybookUI);

0 comments on commit 34ef924

Please sign in to comment.