Skip to content

Commit

Permalink
fix(): replaced old syncano-cli with npx s (#244)
Browse files Browse the repository at this point in the history
* fix(): replaced old syncano-cli with npx s

* fix(): npx s hosting add

* fix(): npx s replacement e2e update
  • Loading branch information
maciejkorsan committed Aug 20, 2018
1 parent a6dc753 commit 0b08eac
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 7,157 deletions.
7,147 changes: 14 additions & 7,133 deletions packages/cli/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/src/commands/helpers/create-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const createInstance = async (instanceName) => {
echo()
if (err.message === 'No such API Key.') {
error(4)('It looks like your account key is invalid.')
echo(4)(`Try ${format.cyan('syncano-cli logout')} and ${format.cyan('syncano-cli login')} again.`)
echo(4)(`Try ${format.cyan('npx s logout')} and ${format.cyan('npx s login')} again.`)
} else if (err.message === 'name: This field must be unique.') {
error(4)('Instance already exist!')
echo(4)('Try another instace name.')
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/hosting-add.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class HostingAdd {

echo()
if (!this.sync) {
echo(4)(`To sync files use: ${format.cyan(`syncano-cli hosting sync ${this.hostingName}`)}`)
echo(4)(`To sync files use: ${format.cyan(`npx s hosting sync ${this.hostingName}`)}`)
echo()
return process.exit()
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/hosting-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class HostingListCmd {
static printNoHostingsInfo () {
echo()
echo(4)('You don\'t have any hostings!')
echo(4)(`Type ${format.cyan('syncano-cli hosting add')} to add hosting for your app!`)
echo(4)(`Type ${format.cyan('npx s hosting add')} to add hosting for your app!`)
echo()
}

Expand Down Expand Up @@ -56,7 +56,7 @@ class HostingListCmd {

if (hosting.error) {
const errorResponses = {
404: `Type ${format.green(`syncano-cli hosting sync ${hosting.name}`)} to sync your hosting with server.`
404: `Type ${format.green(`npx s hosting sync ${hosting.name}`)} to sync your hosting with server.`
}

echo()
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/socket-list-responses.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const socketListResponses = (session) => ({
lackSocket: ({ name }) => (
`${name ? format.yellow(name) : 'This Socket'} was not found on server nor in config!`
),
createNewOne: `Type ${format.cyan('syncano-cli create <name>')} to create new one.`,
createNewOne: `Type ${format.cyan('npx s create <name>')} to create new one.`,
installNewOne: `Type ${format.cyan('npm install <name>')} to install new one from NPM registry.`,
params: `${format.white('input')}:`,
responses: `${format.white('output')}:`,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/utils/error-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ process.on('unhandledRejection', (reason, p) => {
if (reason.name === 'RequestError' && reason.status === 403) {
if (reason.errors.detail === 'No such API Key.') {
const errorMessage =
`API key from your config file is not valid. Use ${format.cyan('syncano-cli login')} to log in once again.`
`API key from your config file is not valid. Use ${format.cyan('npx s login')} to log in once again.`
echo(errorMessage)
echo()
return
Expand Down Expand Up @@ -46,7 +46,7 @@ class ErrorResponse {

error(err, errorMessage, url)
echo()
echo(`Did you run ${format.green('syncano-cli deploy')} command?`)
echo(`Did you run ${format.green('npx s deploy')} command?`)
return
}
error(err)
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/utils/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class Session {
if (!this.settings.account.authenticated()) {
echo()
echo(4)('You are not logged in!')
echo(4)(`Type ${format.cyan('syncano-cli login')} for login to your account.`)
echo(4)(`Type ${format.cyan('npx s login')} for login to your account.`)
echo()
process.exit(1)
}
Expand Down Expand Up @@ -188,7 +188,7 @@ export class Session {

if (instanceName) return process.exit()

echo(4)(`Type ${format.cyan('syncano-cli attach')} to choose one of the existing instances.`)
echo(4)(`Type ${format.cyan('npx s attach')} to choose one of the existing instances.`)
echo()
}
process.exit(1)
Expand All @@ -203,7 +203,7 @@ export class Session {
if (!this.project) {
echo()
echo(4)('You have to attach this project to one of your instances.')
echo(4)(`Try ${format.cyan('syncano-cli attach')}.`)
echo(4)(`Try ${format.cyan('npx s attach')}.`)
echo()
process.exit()
}
Expand All @@ -212,7 +212,7 @@ export class Session {
hasProjectPath () {
if (!this.projectPath) {
echo()
echo(4)(`I don't see any project here. Try ${format.cyan('syncano-cli init')}.`)
echo(4)(`I don't see any project here. Try ${format.cyan('npx s init')}.`)
echo()
process.exit()
}
Expand All @@ -223,7 +223,7 @@ export class Session {
if (!socket.existLocally) {
echo()
echo(4)('File socket.yml was not found in a project directory!')
echo(4)(`Check your directory or try ${format.cyan('syncano-cli create')} to create a new Socket.`)
echo(4)(`Check your directory or try ${format.cyan('npx s create')} to create a new Socket.`)
echo()
process.exit()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tests/unit/commands-hosting-add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ describe('[commands] Add Hosting', function () {
})

it('should print info how to sync files and exit process if not confirmed in prompt', async function () {
const syncInfo = `To sync files use: ${format.cyan(`syncano-cli hosting sync ${hostingAdd.hostingName}`)}`
const syncInfo = `To sync files use: ${format.cyan(`npx s hosting sync ${hostingAdd.hostingName}`)}`
prompt.returns({ confirm: false })

await hostingAdd.syncNewHosting()
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/tests/unit/commands-hosting-list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('[commands] List Hosting', function () {
it('should print proper responses', function () {
HostingList.printNoHostingsInfo()

sinon.assert.calledWith(interEcho, `Type ${format.cyan('syncano-cli hosting add')} to add hosting for your app!`)
sinon.assert.calledWith(interEcho, `Type ${format.cyan('npx s hosting add')} to add hosting for your app!`)
})
})

Expand Down Expand Up @@ -241,7 +241,7 @@ describe('[commands] List Hosting', function () {
HostingList.printHosting(hosting)

sinon.assert.calledWith(interEcho,
`Type ${format.green(`syncano-cli hosting sync ${hosting.name}`)} to sync your hosting with server.`)
`Type ${format.green(`npx s hosting sync ${hosting.name}`)} to sync your hosting with server.`)
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tests/unit/commands-socket-list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe('[commands] List Sockets', function () {
socketList.printSockets([])

sinon.assert.calledWith(interEcho, 'No Socket was found on server nor in config!')
sinon.assert.calledWith(interEcho, `Type ${format.cyan('syncano-cli create <name>')} to create new one.`)
sinon.assert.calledWith(interEcho, `Type ${format.cyan('npx s create <name>')} to create new one.`)
})

it('should call printSocket with proper parameter for each socket', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tests/unit/utils-error-response.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('[error-response]', function () {
ErrorResponse.handleRequestError(err, 'This', 'thing')

sinon.assert.calledTwice(echo)
sinon.assert.calledWith(echo, `Did you run ${format.green('syncano-cli deploy')} command?`)
sinon.assert.calledWith(echo, `Did you run ${format.green('npx s deploy')} command?`)
}
})
})
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/tests/unit/utils-session.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ describe('[utils] Session', function () {
})

it('should print message about missing login information', function () {
const expectedMessage = `Type ${format.cyan('syncano-cli login')} for login to your account.`
const expectedMessage = `Type ${format.cyan('npx s login')} for login to your account.`
authenticationStub.returns(false)

session.isAuthenticated()
Expand Down Expand Up @@ -478,7 +478,7 @@ describe('[utils] Session', function () {

describe('hasProject', function () {
it('should print message about missing project if no project path exists', function () {
const expectedMessage = `I don't see any project here. Try ${format.cyan('syncano-cli init')}.`
const expectedMessage = `I don't see any project here. Try ${format.cyan('npx s init')}.`
session.projectPath = null
session.project = null

Expand Down Expand Up @@ -527,7 +527,7 @@ describe('[utils] Session', function () {
describe('hasSocket', function () {
const reasonResponse = 'File socket.yml was not found in a project directory!'
// eslint-disable-next-line max-len
const solutionResponse = `Check your directory or try ${format.cyan('syncano-cli create')} to create a new Socket.`
const solutionResponse = `Check your directory or try ${format.cyan('npx s create')} to create a new Socket.`

it('should print reason response with proper padding if socket.yml does not exists', function () {
session.hasSocket(getRandomString('session_hasSocket_socketName[0]'))
Expand Down
4 changes: 2 additions & 2 deletions packages/tests/e2e/cli/hosting.test-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('CLI Hosting', function () {
.respond('\n')
.on(/sync files now/)
.respond('\n')
.stdout(/sync files use: syncano-cli hosting sync/)
.stdout(/sync files use: npx s hosting sync/)
.code(0)
.end(done)
})
Expand All @@ -56,7 +56,7 @@ describe('CLI Hosting', function () {
.respond('\n')
.on(/sync files now/)
.respond('\n')
.stdout(/sync files use: syncano-cli hosting sync/)
.stdout(/sync files use: npx s hosting sync/)
.code(0)
.end(done)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/tests/e2e/single/cli.hosting.test-e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('CLI Commands - Hosting', function () {
.respond('\n')
.on(/sync files now/)
.respond('\n')
.stdout(/sync files use: syncano-cli hosting sync/)
.stdout(/sync files use: npx s hosting sync/)
.end(done)
})

Expand All @@ -57,7 +57,7 @@ describe('CLI Commands - Hosting', function () {
.respond('\n')
.on(/sync files now/)
.respond('\n')
.stdout(/sync files use: syncano-cli hosting sync/)
.stdout(/sync files use: npx s hosting sync/)
.end(done)
})

Expand Down

0 comments on commit 0b08eac

Please sign in to comment.