diff options
Diffstat (limited to 'node_modules/init-package-json/example')
4 files changed, 29 insertions, 0 deletions
diff --git a/node_modules/init-package-json/example/example-basic.js b/node_modules/init-package-json/example/example-basic.js new file mode 100644 index 000000000..29b0c818d --- /dev/null +++ b/node_modules/init-package-json/example/example-basic.js @@ -0,0 +1,8 @@ +var init = require('../init-package-json.js') +var path = require('path') +var dir = process.cwd() +var initFile = require.resolve('./init/basic-init.js') + +init(dir, initFile, function (err, data) { + if (!err) console.log('written successfully') +}) diff --git a/node_modules/init-package-json/example/example-default.js b/node_modules/init-package-json/example/example-default.js new file mode 100644 index 000000000..f3aea518c --- /dev/null +++ b/node_modules/init-package-json/example/example-default.js @@ -0,0 +1,7 @@ +var init = require('../init-package-json.js') +var path = require('path') +var dir = process.cwd() + +init(dir, 'file that does not exist', function (err, data) { + if (!err) console.log('written successfully') +}) diff --git a/node_modules/init-package-json/example/example-npm.js b/node_modules/init-package-json/example/example-npm.js new file mode 100644 index 000000000..b394eeabc --- /dev/null +++ b/node_modules/init-package-json/example/example-npm.js @@ -0,0 +1,13 @@ +var init = require('../init-package-json.js') +var path = require('path') +var dir = process.cwd() +var npm = require('npm') + +npm.load(function (er, npm) { + if (er) throw er + init(dir, npm.config.get('init-module'), npm.config, function (er, data) { + if (er) throw er + console.log('written successfully') + }) +}) + diff --git a/node_modules/init-package-json/example/init/basic-init.js b/node_modules/init-package-json/example/init/basic-init.js new file mode 100644 index 000000000..c8615cc10 --- /dev/null +++ b/node_modules/init-package-json/example/init/basic-init.js @@ -0,0 +1 @@ +exports.flavor = prompt("what's your favorite flavor of ice cream buddy?", "I LIKE THEM ALL")
\ No newline at end of file |