成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

3分鐘搞定NPM模塊開發(fā)

Tony_Zby / 451人閱讀

摘要:分鐘搞定模塊開發(fā)創(chuàng)建組建新建目錄初始化創(chuàng)建新建測試文件大家好,我是春哥,我的電話是執(zhí)行大家好,我是春哥,我的電話是發(fā)布到去官網(wǎng)注冊一個自己的開發(fā)賬號到注冊賬號記住自己的賬號,密碼,郵箱。

3分鐘搞定NPM模塊開發(fā) 創(chuàng)建組建 新建目錄
localhost:Desktop yuechunli$ pwd
/Users/liyuechun/Desktop
localhost:Desktop yuechunli$ mkdir liyc_hello
localhost:Desktop yuechunli$ cd liyc_hello/
初始化
localhost:liyc_hello yuechunli$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install  --save` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
name: (liyc_hello) 
version: (1.0.0) 
description: 
entry point: (index.js) 
test command: 
git repository: 
keywords: 
author: 
license: (ISC) 
About to write to /Users/liyuechun/Desktop/liyc_hello/package.json:

{
  "name": "liyc_hello",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo "Error: no test specified" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this ok? (yes) 
localhost:liyc_hello yuechunli$ 
創(chuàng)建index.js
function print_liyc_hello(name) {
        console.log(name);
}

exports.print_liyc_hello = print_liyc_hello;
新建測試文件test.js
var fn = require("./index.js");

fn.print_liyc_hello("大家好,我是春哥,我的電話是13331184066");
執(zhí)行test
localhost:liyc_hello yuechunli$ pwd
/Users/liyuechun/Desktop/liyc_hello
localhost:liyc_hello yuechunli$ ls
index.js    package.json    test.js
localhost:liyc_hello yuechunli$ node test
大家好,我是春哥,我的電話是13331184066
localhost:liyc_hello yuechunli$ 
發(fā)布到NPM 去官網(wǎng)注冊一個自己的開發(fā)賬號

到https://www.npmjs.com注冊賬號,記住自己的賬號,密碼,郵箱。

命令行連接NPM
localhost:liyc_hello yuechunli$ npm adduser
Username: liyuechun
Password: 
Email: (this IS public) [email protected]
Logged in as liyuechun on https://registry.npmjs.org/.
localhost:liyc_hello yuechunli$ npm whoami
liyuechun
localhost:liyc_hello yuechunli$ 
發(fā)布
localhost:liyc_hello yuechunli$ npm publish
+ [email protected]
localhost:liyc_hello yuechunli$ 
使用 創(chuàng)建React 項目
localhost:Desktop yuechunli$ mkdir liycDemo
localhost:Desktop yuechunli$ cd liycDemo/
localhost:liycDemo yuechunli$ create-react-app testApp
Creating a new React app in /Users/liyuechun/Desktop/liycDemo/testApp.

Installing packages. This might take a couple minutes.
Installing react-scripts...

npm WARN prefer global [email protected] should be installed with -g

> [email protected] install /Users/liyuechun/Desktop/liycDemo/testApp/node_modules/fsevents
> node-pre-gyp install --fallback-to-build

[fsevents] Success: "/Users/liyuechun/Desktop/liycDemo/testApp/node_modules/fsevents/lib/binding/Release/node-v51-darwin-x64/fse.node" is installed via remote
[email protected] /Users/liyuechun/Desktop/liycDemo/testApp
└─┬ [email protected] 
  ├─┬ [email protected] 
  │ ├─┬ [email protected] 
  │ │ └── [email protected] 
  │ ├── [email protected] 
  │ ├── [email protected] 
  │ ├── [email protected] 
  │ ├─┬ [email protected] 
  │ │ └── [email protected] 
  │ └── [email protected] 
Success! Created testApp at /Users/liyuechun/Desktop/liycDemo/testApp
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd testApp
  npm start

Happy hacking!
項目結(jié)構(gòu)圖

安裝 liyc_hello
localhost:liycDemo yuechunli$ ls
testApp
localhost:liycDemo yuechunli$ cd testApp/
localhost:testApp yuechunli$ atom ./
localhost:testApp yuechunli$ npm install --save liyc_hello
[email protected] /Users/liyuechun/Desktop/liycDemo/testApp
└── [email protected] 

localhost:testApp yuechunli$ 
安裝后package.json內(nèi)容變化

聯(lián)系我

微信&微信: 13331184066

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/83818.html

相關(guān)文章

  • Vue項目搭建、只需四步輕松搞定!

    摘要:你只要算好各種食材的比例,不用關(guān)心做菜的過程,就是那個微波爐。項目搭建步驟官網(wǎng)官網(wǎng)開發(fā)環(huán)境安裝配置項目配置如圖所示運行項目開發(fā)編譯在瀏覽器輸入看到,就跑通了。從基礎(chǔ)開始,循序漸進,含有常用實戰(zhàn)項目,貼近企業(yè)真實現(xiàn)狀。 用一個完成的Vue系列文章,讓大家全面理解Vue的實現(xiàn)原理,掌握實用技巧,能在實戰(zhàn)中使用Vue,解鎖一個開發(fā)技能。文末有文章大綱請查看。不墨跡了!馬上寫內(nèi)容: 1.為什...

    張巨偉 評論0 收藏0
  • 前端基礎(chǔ)進階(十五):詳解 ES6 Modules

    摘要:下載地址安裝一個好用的命令行工具在環(huán)境下,系統(tǒng)默認(rèn)的非常難用,所以我個人比較推薦大家使用或者。下載地址安裝在命令行工具中使用查看版本的方式確保與都安裝好之后,我們就可以安裝了。前端基礎(chǔ)進階系列目錄 showImg(https://segmentfault.com/img/remote/1460000009654403?w=1240&h=272); 對于新人朋友來說,想要自己去搞定一個E...

    Lowky 評論0 收藏0
  • webpack再看一遍

    摘要:在終端中使用可以自動創(chuàng)建這個文件輸入這個命令后,終端會問你一系列問題。百度后發(fā)現(xiàn)引入了模式,有三個狀態(tài),開發(fā)模式生產(chǎn)模式無。 什么是webpack,為什么要使用webapck * 導(dǎo)語 之前一直忙著項目,沒時間整理自己的東西,最近剛好發(fā)現(xiàn)自己對webpack又如此陌生了,于是整理了一篇關(guān)于webpack初探的干貨,這里是一點簡單的webpack配置 為什么使用webpck 現(xiàn)今很多網(wǎng)頁...

    whinc 評論0 收藏0
  • 分鐘的閱讀讓你明白node.JS的強大 走上web后端開發(fā)的道路 (一版)

    摘要:這些特性不僅帶來了大的性能提升,還減少多線程程序設(shè)計的復(fù)雜性,進而提高了開發(fā)效率。由公司建立的云計算平臺率先支持了。 前言 本文章主要寫給那些想了解node語言的開發(fā),我的目標(biāo)希望大家通過閱讀本篇文章能夠簡單使用node進行開發(fā),以及了解一些事件驅(qū)動的異步編程風(fēng)格,主要分node的背景,安裝配置,模塊創(chuàng)建引用等幾個方面描述 建議大家在閱讀本篇文章途中 可以親自嘗試一下我所帶來的小例子,...

    libxd 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<