Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Node.jsによるWebサイト制作のデプロイ環境構築

 Node.jsによるWebサイト制作のデプロイ環境構築

takanorip

April 07, 2017
Tweet

More Decks by takanorip

Other Decks in Technology

Transcript

  1. npm scripts ͱ͸ʁ • npmͷύοέʔδ + Shell • λεΫϥϯφʔ •

    ϥούʔϓϥάΠϯෆཁ • JavaScript, stylusͷwatch, build, deployͳͲ ΍ͬͯ͘ΕΔ
  2. ߏ੒ ├── package.json ├── scripts/ │ ├── ... │ ├──

    build.js │ ├── upload.js │ └── deploy.js ├── htdocs/ (公開ディレクトリ) ├── node_modules/ └── config.js
  3. ߏ଄ • package.json : npmઃఆϑΝΠϧ • deploy.js : build +

    upload • build.js : JS, stylusͷbuild • upload.js : SFTPܦ༝ͰαʔόʔʹΞοϓ • config.js : ύε΍FTPͷ৘ใͳͲΛهड़
  4. ࢖༻Ϟδϡʔϧ • bluebird : PromiseͷϥΠϒϥϦ • path : ϑΝΠϧύεΛѻ͏Ϟδϡʔϧ •

    fs : ϑΝΠϧ΁ΞΫηε͢ΔͨΊͷϞδϡʔϧ • ssh2 : SSH઀ଓ͢ΔϞδϡʔϧ
  5. package.json { "scripts": { … "build": "node scripts/build.js", "watch": "node

    scripts/watch.js”, "deploy": "node scripts/deploy.js” … }, }