Skip to content

Commit

Permalink
post install message
Browse files Browse the repository at this point in the history
  • Loading branch information
Sankhadeep committed Feb 8, 2017
1 parent e8f008e commit 8b252c2
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 100 deletions.
62 changes: 10 additions & 52 deletions addEjectScript.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,10 @@
var fs = require('fs');
var util = require('util');
var path = require('path');

var printMessage = require('print-message');

fs.copy = function (src, dst, cb) {
console.warn('[Deprecated] See https://github.com/coolaj86/utile-fs');
function copy(err) {
var is
, os
;

if (!err) {
return cb(new Error("File " + dst + " exists."));
}

fs.stat(src, function (err) {
if (err) {
return cb(err);
}
is = fs.createReadStream(src);
os = fs.createWriteStream(dst);
util.pump(is, os, cb);
});
}

fs.stat(dst, copy);
};


var projectPackage = require(path.join(__dirname, 'package.json'));
if(!projectPackage.scripts) {
projectPackage.scripts = {};
}

projectPackage.scripts['eject-native-base'] = 'node node_modules/native-base/ejectTheme.js';

try {
fs.writeFileSync(path.join(__dirname, '..', '..', 'package.json'), JSON.stringify(projectPackage, null, 2));
printMessage([
'NativeBase 2.0 has been succesfully installed!',
'Run `node node_modules/native-base/ejectTheme.js` to copy over theme config and variables.',
'Head over to the docs for detailed information on how to make changes to the theme.',
], {
color: 'yellow',
borderColor: 'green',
});
} catch(err) {
console.log('Error: ' + err);
console.log('There was some error adding the eject script to your package.json. \nRefer http://docs.nativebase.io/docs/customize/SetUp.html for theming')
}
const printMessage = require('print-message');

printMessage([
'NativeBase 2.0 has been succesfully installed!',
'Run `node node_modules/native-base/ejectTheme.js` to copy over theme config and variables.',
'Head over to the docs for detailed information on how to make changes to the theme.',
], {
color: 'yellow',
borderColor: 'green',
});
43 changes: 0 additions & 43 deletions dist/addEjectScript.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/addEjectScript.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"compile": "rm -rf dist/* && babel . --out-dir dist --ignore node_modules,dist --source-maps",
"transpile": "npm run compile && cp src/basic/Icon/NBIcons.json dist/src/basic/Icon",
"test": "jest",
"prepublish": "npm run transpile"
"prepublish": "npm run transpile",
"postinstall": "node addEjectScript.js"
},
"jest": {
"preset": "react-native",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { Footer } from './basic/Footer';
import { FooterTab } from './basic/FooterTab';
import { Form } from './basic/Form';
import { PickerNB } from './basic/Picker';
import { List } from './basic/List';
import { List } from './backward/Widgets/List';
import { ListItem } from './basic/ListItem';
import { Separator } from './basic/Separator';
import { DeckSwiper } from './basic/DeckSwiper';
Expand Down

0 comments on commit 8b252c2

Please sign in to comment.