Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #242 from shipitjs/upgrade-dependencies
Browse files Browse the repository at this point in the history
chore: upgrade dependencies
  • Loading branch information
gregberge authored Jul 15, 2019
2 parents 641800c + 9a47774 commit e5ee1e3
Show file tree
Hide file tree
Showing 18 changed files with 2,404 additions and 2,521 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: node_js

node_js:
- 6
- 8
- 10

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.28.4
Expand All @@ -18,8 +18,8 @@ notifications:
cache:
yarn: true
directories:
- ".eslintcache"
- "node_modules"
- '.eslintcache'
- 'node_modules'

addons:
ssh_known_hosts: test.shipitjs.com
53 changes: 27 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[![Tweet][twitter-badge]][twitter]

## Install shipit command line tools and shipit-deploy in your project

```
npm install --save-dev shipit-cli
npm install --save-dev shipit-deploy
Expand All @@ -25,10 +26,10 @@ Shipit provides a good alternative to Capistrano or other build tools. It is eas

**Features:**

* Write your task using JavaScript
* Task flow based on [orchestrator](https://github.com/orchestrator/orchestrator)
* Login and interactive SSH commands
* Easily extendable
- Write your task using JavaScript
- Task flow based on [orchestrator](https://github.com/orchestrator/orchestrator)
- Login and interactive SSH commands
- Easily extendable

## Deploy using Shipit

Expand Down Expand Up @@ -194,9 +195,9 @@ Type: `String` or `Array<String>`

The server can use the shorthand syntax or an object:

* `user@host`: user and host
* `user@host:4000`: user, host and port
* `{ user, host, port }`: an object
- `user@host`: user and host
- `user@host:4000`: user, host and port
- `{ user, host, port }`: an object

### Shipit Deploy configuration

Expand Down Expand Up @@ -331,36 +332,36 @@ shipit.log('hello %s', 'world')

## Dependencies

* [OpenSSH](http://www.openssh.com/) 5+
* [rsync](https://rsync.samba.org/) 3+
- [OpenSSH](http://www.openssh.com/) 5+
- [rsync](https://rsync.samba.org/) 3+

## Known Plugins

### Official

* [shipit-deploy](https://github.com/shipitjs/shipit/tree/master/packages/shipit-deploy)
- [shipit-deploy](https://github.com/shipitjs/shipit/tree/master/packages/shipit-deploy)

### Third Party

* [shipit-shared](https://github.com/timkelty/shipit-shared)
* [shipit-db](https://github.com/timkelty/shipit-db)
* [shipit-assets](https://github.com/timkelty/shipit-assets)
* [shipit-ssh](https://github.com/timkelty/shipit-ssh)
* [shipit-utils](https://github.com/timkelty/shipit-utils)
* [shipit-npm](https://github.com/callerc1/shipit-npm)
* [shipit-aws](https://github.com/KrashStudio/shipit-aws)
* [shipit-captain](https://github.com/timkelty/shipit-captain/)
* [shipit-bower](https://github.com/willsteinmetz/shipit-bower)
* [shipit-composer](https://github.com/jeremyzahner/shipit-composer)
* [shipit-bastion](https://github.com/BrokerageEngine/shipit-bastion)
* [shipit-yaml](https://github.com/davidbernal/shipit-yaml)
* [shipit-conditional](https://github.com/BrokerageEngine/shipit-conditional)
- [shipit-shared](https://github.com/timkelty/shipit-shared)
- [shipit-db](https://github.com/timkelty/shipit-db)
- [shipit-assets](https://github.com/timkelty/shipit-assets)
- [shipit-ssh](https://github.com/timkelty/shipit-ssh)
- [shipit-utils](https://github.com/timkelty/shipit-utils)
- [shipit-npm](https://github.com/callerc1/shipit-npm)
- [shipit-aws](https://github.com/KrashStudio/shipit-aws)
- [shipit-captain](https://github.com/timkelty/shipit-captain/)
- [shipit-bower](https://github.com/willsteinmetz/shipit-bower)
- [shipit-composer](https://github.com/jeremyzahner/shipit-composer)
- [shipit-bastion](https://github.com/BrokerageEngine/shipit-bastion)
- [shipit-yaml](https://github.com/davidbernal/shipit-yaml)
- [shipit-conditional](https://github.com/BrokerageEngine/shipit-conditional)

## Who use Shipit?

* [Le Monde](http://www.lemonde.fr)
* [Ghost blogging platform](https://ghost.org/)
* [Fusionary](http://fusionary.com)
- [Le Monde](http://www.lemonde.fr)
- [Ghost blogging platform](https://ghost.org/)
- [Fusionary](http://fusionary.com)

## License

Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,18 @@
"chalk": "^2.4.1",
"codecov": "^3.1.0",
"conventional-github-releaser": "^3.1.2",
"eslint": "^5.8.0",
"eslint": "^6.0.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-prettier": "^3.1.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-import": "^2.14.0",
"glob": "^7.1.3",
"jest": "^24.8.0",
"jest-watch-typeahead": "^0.3.1",
"lerna": "^3.4.3",
"micromatch": "^3.1.9",
"mkdirp": "^0.5.1",
"mock-utf8-stream": "^0.1.1",
"prettier": "^1.14.3",
"std-mocks": "^1.0.1",
"string-length": "^2.0.0"
"std-mocks": "^1.0.1"
},
"workspaces": [
"packages/*"
Expand Down
28 changes: 16 additions & 12 deletions packages/shipit-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,28 @@ shipit.log('hello %s', 'world')

## Workflow tasks

When the system initializes it automatically emits events:
* Emit event "init"
* Emit event "init:after_ssh_pool"
When the system initializes it automatically emits events:

- Emit event "init"
- Emit event "init:after_ssh_pool"

Each shipit task also generates events:
* Emit event "task_start"
* Emit event "task_stop"
* Emit event "task_err"
* Emit event "task_not_found"

- Emit event "task_start"
- Emit event "task_stop"
- Emit event "task_err"
- Emit event "task_not_found"

Inside the task events, you can test for the task name.

```js
shipit.on("task_start", (event) => {
if (event.task == "first_task"){
shipit.log("I'm the first task");
}
});
shipit.on('task_start', event => {
if (event.task == 'first_task') {
shipit.log("I'm the first task")
}
})
```

## License

MIT
Expand Down
2 changes: 1 addition & 1 deletion packages/shipit-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"chalk": "^2.4.1",
"commander": "^2.15.0",
"interpret": "^1.1.0",
"liftoff": "^2.5.0",
"liftoff": "^3.1.0",
"orchestrator": "^0.3.7",
"pretty-hrtime": "^1.0.0",
"ssh-pool": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/shipit-cli/src/Shipit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-console */
/* eslint-disable no-console, no-underscore-dangle */
import { ConnectionPool, exec } from 'ssh-pool'
import LineWrapper from 'stream-line-wrapper'
import Orchestrator from 'orchestrator'
Expand Down
21 changes: 10 additions & 11 deletions packages/shipit-cli/src/Shipit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ describe('Shipit', () => {
expect(shipit.initSshPool).toBeCalled()
})
it('should emit a "init" event', async () => {
const spy = jest.fn()
shipit.on('init', spy)
expect(spy).toHaveBeenCalledTimes(0)
shipit.initialize()
expect(spy).toHaveBeenCalledTimes(1)
const spy = jest.fn()
shipit.on('init', spy)
expect(spy).toHaveBeenCalledTimes(0)
shipit.initialize()
expect(spy).toHaveBeenCalledTimes(1)
})

})

describe('#initSshPool', () => {
Expand All @@ -73,11 +72,11 @@ describe('Shipit', () => {
})
it('should emit a "init:after_ssh_pool" event', async () => {
shipit.config = { servers: ['deploy@my-server'] }
const spy = jest.fn()
shipit.on('init:after_ssh_pool', spy)
expect(spy).toHaveBeenCalledTimes(0)
shipit.initSshPool()
expect(spy).toHaveBeenCalledTimes(1)
const spy = jest.fn()
shipit.on('init:after_ssh_pool', spy)
expect(spy).toHaveBeenCalledTimes(0)
shipit.initSshPool()
expect(spy).toHaveBeenCalledTimes(1)
})
})

Expand Down
4 changes: 2 additions & 2 deletions packages/shipit-cli/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ async function asyncInvoke(env) {
const shipit = new Shipit({ environment })

try {
/* eslint-disable global-require, import/no-dynamic-import, import/no-dynamic-require */
/* eslint-disable global-require, import/no-dynamic-require */
const module = require(env.configPath)
/* eslint-enable global-require, import/no-dynamic-import, import/no-dynamic-require */
/* eslint-enable global-require, import/no-dynamic-require */
const initialize =
typeof module.default === 'function' ? module.default : module
await initialize(shipit)
Expand Down
62 changes: 24 additions & 38 deletions packages/shipit-cli/tests/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,30 @@ const shipitCli = path.resolve(__dirname, '../src/cli.js')
const shipitFile = path.resolve(__dirname, './sandbox/shipitfile.babel.js')

describe('shipit-cli', () => {
it(
'should run a local task',
async () => {
const { stdout } = await exec(
`babel-node ${shipitCli} --shipitfile ${shipitFile} test localHello`,
)
expect(stdout).toMatch(/Running 'localHello' task.../)
expect(stdout).toMatch(/Running "echo "hello"" on local./)
expect(stdout).toMatch(/@ hello/)
expect(stdout).toMatch(/Finished 'localHello' after/)
},
10000,
)
it('should run a local task', async () => {
const { stdout } = await exec(
`babel-node ${shipitCli} --shipitfile ${shipitFile} test localHello`,
)
expect(stdout).toMatch(/Running 'localHello' task.../)
expect(stdout).toMatch(/Running "echo "hello"" on local./)
expect(stdout).toMatch(/@ hello/)
expect(stdout).toMatch(/Finished 'localHello' after/)
}, 10000)

it(
'should run a remote task',
async () => {
const { stdout } = await exec(
`babel-node ${shipitCli} --shipitfile ${shipitFile} test remoteUser`,
)
expect(stdout).toMatch(/Running 'remoteUser' task.../)
expect(stdout).toMatch(
/Running "echo \$USER" on host "test.shipitjs.com"./,
)
expect(stdout).toMatch(/@test.shipitjs.com deploy/)
expect(stdout).toMatch(/Finished 'remoteUser' after/)
},
10000,
)
it('should run a remote task', async () => {
const { stdout } = await exec(
`babel-node ${shipitCli} --shipitfile ${shipitFile} test remoteUser`,
)
expect(stdout).toMatch(/Running 'remoteUser' task.../)
expect(stdout).toMatch(/Running "echo \$USER" on host "test.shipitjs.com"./)
expect(stdout).toMatch(/@test.shipitjs.com deploy/)
expect(stdout).toMatch(/Finished 'remoteUser' after/)
}, 10000)

it(
'should work with "~"',
async () => {
const { stdout } = await exec(
`babel-node ${shipitCli} --shipitfile ${shipitFile} test cwdSsh`,
)
expect(stdout).toMatch(/@test.shipitjs.com \/home\/deploy\/\.ssh/)
},
10000,
)
it('should work with "~"', async () => {
const { stdout } = await exec(
`babel-node ${shipitCli} --shipitfile ${shipitFile} test cwdSsh`,
)
expect(stdout).toMatch(/@test.shipitjs.com \/home\/deploy\/\.ssh/)
}, 10000)
})
12 changes: 6 additions & 6 deletions packages/shipit-deploy/docs/Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ Here is where I had problems. On one side, shipit will use the current drive let

#### `"workspace" : "/workspace/"`

* Copies project to `d:\workspace`
* rsync fails to find the folder
- Copies project to `d:\workspace`
- rsync fails to find the folder

#### `"workspace" : "d:/workspace/"`

* Copies project to `d:\workspace`
* rsync fails to find the folder
- Copies project to `d:\workspace`
- rsync fails to find the folder

#### `"workspace" : "/d/workspace/"`

* rsync would work and properly sync from `D:\workspace` but...
* ... the copy of the project goes Copies project to `d:\d\workspace`
- rsync would work and properly sync from `D:\workspace` but...
- ... the copy of the project goes Copies project to `d:\d\workspace`

In the end, I had picked option 1. and I had to make a change in the source code to append the drive letter to rsync's source path. Everything is described in [that commit of my pull request](https://github.com/vpratfr/shipit-deploy/commit/4bbf262a7d7036a2b534ab7233d0152e0d09ba20). You can then simply add a configuration variable to "default": `"rsyncDrive": "/d"`.

Expand Down
4 changes: 2 additions & 2 deletions packages/shipit-deploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"lodash": "^4.17.10",
"moment": "^2.21.0",
"path2": "^0.1.0",
"rmfr": "^1.0.8",
"rmfr": "^2.0.0",
"shipit-utils": "^1.1.3",
"tmp-promise": "^1.0.4"
"tmp-promise": "^2.0.2"
}
}
4 changes: 1 addition & 3 deletions packages/shipit-deploy/src/extendShipit.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ function extendShipit(shipit) {
const compareRevision = `${remotes[0]}/${this.config.branch}`

const response = await this.local(
`git log --pretty=format:"${
shipit.config.gitLogFormat
}" ${deployedRevision}..${compareRevision}`,
`git log --pretty=format:"${shipit.config.gitLogFormat}" ${deployedRevision}..${compareRevision}`,
{ cwd: shipit.workspace },
)
const commits = response.stdout.trim()
Expand Down
Loading

0 comments on commit e5ee1e3

Please sign in to comment.