-
Notifications
You must be signed in to change notification settings - Fork 1
/
feed.xml
82 lines (73 loc) · 3.75 KB
/
feed.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>NodeSchool Istanbul</title>
<atom:link href="http://nodeschool.io/istanbul/feed.xml" rel="self" type="application/rss+xml"></atom:link>
<link>http://nodeschool.io/istanbul</link>
<description>nodeshool.io/istanbul static page generator</description>
<pubDate>Tue, 03 Nov 2015 23:30:00 +0300</pubDate>
<generator>Wintersmith - https://github.com/jnordberg/wintersmith</generator>
<language>en</language>
<item>
<title>Npm modulleri - Inquirerjs nedir?</title>
<link>http://nodeschool.io/istanbul/articles/npm-moduleri-inquirerjs-nedir/</link>
<pubDate>Tue, 03 Nov 2015 23:30:00 +0300</pubDate>
<guid isPermaLink="true">http://nodeschool.io/istanbul/articles/npm-moduleri-inquirerjs-nedir/</guid>
<author></author>
<description><p>Yeoman ile proje oluşturduğumuzda ya da <code>npm init</code> yaptığımızda karşımıza bazı sorular gelir. Inquirerjs’le tam olarak bunu yapcağız.</p>
<p>Kullanıcıya bazı sorular sorup cevaplarına göre işlem yapacağız.</p>
<hr>
<p><a href="https://youtu.be/qGWs6qI4sw8"><img src="http://img.youtube.com/vi/qGWs6qI4sw8/0.jpg" alt="Nodejs dersleri"></a></p>
<h3 id="package-json">package.json</h3>
<p>Npm init ile başlıyoruz.</p>
<pre><code>npm init
</code></pre><p>package.json dosyamız oluştu.</p>
<h3 id="index-js">index.js</h3>
<p>Şimdi <code>index.js</code> dosyası oluşturuyoruz.</p>
<p><img src="/articles/npm-moduleri-inquirerjs-nedir/main.png" alt="main.js"></p>
<pre><code>// inquirer modülünü çağırıyoruz
var inquirer = require(&#39;inquirer&#39;);
// gelen veriye göre bir dosya oluşturacağız bunun içinde `fs` modülünü kullanacağız.
var fs = require(&#39;fs&#39;);
// Sorularımızı oluşturuyoruz
var questions = [
{
type: &quot;input&quot;,
name: &quot;name&quot;,
message: &quot;Project name?&quot;
},
{
type: &quot;list&quot;,
name: &quot;main&quot;,
message: &quot;Main file&quot;,
choices: [ &quot;app.js&quot;, &quot;app2.js&quot;, &quot;npm.js&quot; ],
},
{
type: &quot;password&quot;,
name : &#39;checkbox&#39;,
message : &#39;Password&#39;
}
];
// şimdi inquirerjs&#39;i çalıştırıyoruz
inquirer.prompt(questions, function( answers ) {
// Eğer main dosyası var ise fs ile, seçilen dosyayı oluşturacağız
if(answers.main){
// @ oluşturulacak dosya
// @ dosyaya yazacağımız data
// @ işlem sonucu
fs.writeFile(answers.main, &#39;var main =&quot;&quot;;&#39;, function(){
console.log(&#39;dosya yazıldı! Şimdi dizininizi kontrol edin&#39;)
});
}
console.log(JSON.stringify(answers, null , &#39; &#39;));
});
</code></pre><p>Çıktı olarak console’a json datayı yazacak ve seçilen dosyayı dizin klasörüne oluşturacak.</p>
<h3 id="okudu-unuz-i-in-te-ekk-r-ederim-">Okuduğunuz için teşekkür ederim.</h3>
<ul>
<li><a href="https://github.com/nodejs-dersleri">Tüm Github repositorileri</a></li>
</ul>
<hr>
</description>
</item>
</channel>
</rss>