【问题标题】:How to include "build" directory when travis-ci builds and deploys npm moduletravis-ci 构建和部署 npm 模块时如何包含“构建”目录
【发布时间】:2016-03-02 18:01:16
【问题描述】:

目前我有带有 ./src 目录的 Typescript 模块

还有 travic-ci

language: node_js
node_js:
- 5.1.0

install:
- npm install
- npm install -g mocha
- npm install -g gulp
- npm install -g tsd

- tsd rate
- tsd install

script: gulp

after_success: npm test

deploy:
  provider: npm
  email: secret
  api_key:
    secure: secret

Gulp 任务在“./build”目录中生成文件

问题是当它尝试部署时

# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   build/
#
nothing added to commit but untracked files present (use "git add" to track)

所以它迫使我在本地构建项目并将其添加到 github,并使用 travis-ci 作为无用的步骤

【问题讨论】:

    标签: javascript git npm typescript travis-ci


    【解决方案1】:

    刚刚通过以下步骤解决了这个问题:

    1:将./build 目录添加到.gitignore 文件中

    build
    typings
    test/**/*.js
    test/**/*.map
    

    2:创建.npmignore 以省略.gitignore 规则(我还将.src dir 放入其中)

    src
    test
    typings
    

    【讨论】:

    • 感谢您留下您的解决方案,正是我想要的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-06
    • 1970-01-01
    相关资源
    最近更新 更多