Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ jobs:
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}

- run: echo 'export SYNCANO_SOCKET_REGISTRY_INSTANCE=${REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE}' >> $BASH_ENV
- run: yarn run test:e2e

test_e2e_validate:
Expand All @@ -204,8 +202,6 @@ jobs:
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}

- run: echo 'export SYNCANO_SOCKET_REGISTRY_INSTANCE=${REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE}' >> $BASH_ENV
- run: yarn run test:e2e

test_e2e_registry:
Expand All @@ -218,9 +214,7 @@ jobs:
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}

- run: echo 'export SYNCANO_SOCKET_REGISTRY_INSTANCE=${REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE}' >> $BASH_ENV
- run: yarn run test:e2e:registry
- run: SYNCANO_SOCKET_REGISTRY_INSTANCE=${REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE}-${CIRCLE_SHA1} yarn run test:e2e:registry

test_e2e_hosting:
name: E2E Tests
Expand All @@ -232,8 +226,6 @@ jobs:
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}

- run: echo 'export SYNCANO_SOCKET_REGISTRY_INSTANCE=${REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE}' >> $BASH_ENV
- run: yarn run test:e2e:hosting

test_e2e_socket:
Expand All @@ -246,8 +238,6 @@ jobs:
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}

- run: echo 'export SYNCANO_SOCKET_REGISTRY_INSTANCE=${REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE}' >> $BASH_ENV
- run: yarn run test:e2e:socket

test_e2e_anonymous:
Expand Down Expand Up @@ -337,8 +327,21 @@ jobs:
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run: echo 'export REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE=${REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE}-${CIRCLE_SHA1}' >> $BASH_ENV
- run: sh ./bin/deploy-staging

delete_registry:
name: Delete Test Registry
docker:
- image: circleci/node:latest

working_directory: ~/repo/packages/registry

steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run: SYNCANO_AUTH_KEY=${REGISTRY_TEST_SYNCANO_AUTH_KEY} npx s instance delete ${REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE}-${CIRCLE_SHA1}

publish:
name: NPM publish
docker:
Expand Down Expand Up @@ -410,6 +413,9 @@ workflows:
- test_e2e_core:
requires:
- build
- delete_registry:
requires:
- test_e2e_registry
- deploy_docs:
requires:
- build
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
"s": "./lib/cli.js",
"syncano-cli": "./lib/cli.js",
"syncano-cli-hosting": "./lib/cli-hosting.js",
"s-hosting": "./lib/cli-hosting.js",
"syncano-cli-component": "./lib/cli-component.js",
"s-component": "./lib/cli-component.js"
"syncano-cli-instance": "./lib/cli-instance.js",
"s-hosting": "./lib/cli-hosting.js",
"s-component": "./lib/cli-component.js",
"s-instance": "./lib/cli-instance.js"
},
"bugs": {
"url": "https://github.com/Syncano/syncano-node-cli/issues"
Expand Down
Empty file modified packages/cli/src/cli-component.js
100644 → 100755
Empty file.
Empty file modified packages/cli/src/cli-hosting.js
100644 → 100755
Empty file.
Empty file modified packages/cli/src/cli-instance.js
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion packages/cli/src/commands/attach.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Attach {
instanceName = await this.createNewInstance()
}

this.init.addConfigFiles({ instance: instanceName }, this.session.projectPath)
await this.init.addConfigFiles({ instance: instanceName }, this.session.projectPath)

echo()
return this.session.load()
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ class InitCmd {

if (!project && instance) {
await this.session.checkConnection(instance)
this.init.addConfigFiles({ instance })
await this.init.addConfigFiles({ instance })
return this.init.createFilesAndFolders()
}

if (!project && !instance) {
const newInstance = createInstance()

this.init.addConfigFiles({ instance: newInstance.name })
await this.init.addConfigFiles({ instance: newInstance.name })
this.init.createFilesAndFolders()
return this.session.load()
}
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/commands/socket-deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class SocketDeployCmd {
this.session = context.session
this.Socket = context.Socket
this.registry = new context.Registry()
this.init = new context.Init()
this.firstRun = true
}

Expand All @@ -32,6 +33,7 @@ export default class SocketDeployCmd {
// Create Instance if --create-instance provided
if (cmd.createInstance) {
await createInstance(cmd.createInstance, this.session)
await this.init.addConfigFiles({ instance: cmd.createInstance })
} else {
// If not, we have to check if we have a project attached to any instance
this.session.hasProject()
Expand Down Expand Up @@ -80,6 +82,7 @@ export default class SocketDeployCmd {
} else {
error(4)(err)
}
process.exit(1)
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/utils/init/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ class Init {
return fs.existsSync(this.session.projectPath) && this.session.project
}

addConfigFiles (projectParams = {}, projectPath) {
async addConfigFiles (projectParams = {}, projectPath) {
if (projectPath) {
this.session.settings.account.addProject(projectPath, projectParams)
} else {
this.session.settings.account.addProject(path.join(process.cwd(), 'syncano'), projectParams)
}
await this.session.load()

echo(4)(`Your project is attached to ${format.green(projectParams.instance)} instance now!`)
}
Expand Down
12 changes: 7 additions & 5 deletions packages/cli/tests/unit/utils-init-init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,21 @@ describe('[commands] init', function () {
})

afterEach(function () {
init.session.settings.account.addProject.restore()
if (init.session.settings.account.addProject.restore instanceof Function) {
init.session.settings.account.addProject.restore()
}
})

it('should call add project method with proper parameters', function () {
init.addConfigFiles(projectParams)
it('should call add project method with proper parameters', async function () {
await init.addConfigFiles(projectParams)

sinon.assert.calledWith(addProject, path.join(process.cwd(), 'syncano'), projectParams)
})

it('should print response about connected instance with proper padding', function () {
it('should print response about connected instance with proper padding', async function () {
const response = `Your project is attached to ${format.green(projectParams.instance)} instance now!`

init.addConfigFiles(projectParams)
await init.addConfigFiles(projectParams)

sinon.assert.calledWith(echo, 4)
sinon.assert.calledWith(interEcho, response)
Expand Down
4 changes: 1 addition & 3 deletions packages/registry/bin/deploy-staging
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env sh

export SYNCANO_PROJECT_INSTANCE=$REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE
export SYNCANO_AUTH_KEY=$REGISTRY_TEST_SYNCANO_AUTH_KEY

npx s deploy
npx s deploy --create-instance $REGISTRY_TEST_SYNCANO_PROJECT_INSTANCE

exit $?
40 changes: 0 additions & 40 deletions packages/registry/syncano/organization/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
# yarn lockfile v1


"@syncano/core@0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@syncano/core/-/core-0.6.0.tgz#a37255c1647e0b48600e9e3cfea9719669e68c57"
dependencies:
debug "^3.1.0"
form-data "^2.3.1"
lodash.get "^4.4.2"
lodash.merge "^4.6.0"
lodash.set "^4.3.2"
node-fetch "2.0.0-alpha.9"
abbrev@1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
Expand Down Expand Up @@ -719,12 +709,6 @@ debug@^2.2.0, debug@^2.6.8:
dependencies:
ms "2.0.0"

debug@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
dependencies:
ms "2.0.0"

deep-extend@~0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f"
Expand Down Expand Up @@ -835,14 +819,6 @@ forever-agent@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"

form-data@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.1.tgz#6fb94fbd71885306d73d15cc497fe4cc4ecd44bf"
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.5"
mime-types "^2.1.12"

form-data@~2.1.1:
version "2.1.4"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1"
Expand Down Expand Up @@ -1155,18 +1131,6 @@ kind-of@^4.0.0:
dependencies:
is-buffer "^1.1.5"

lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"

lodash.merge@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.0.tgz#69884ba144ac33fe699737a6086deffadd0f89c5"

lodash.set@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"

lodash@^4.17.4, lodash@latest:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
Expand Down Expand Up @@ -1233,10 +1197,6 @@ nan@^2.3.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a"

node-fetch@2.0.0-alpha.9:
version "2.0.0-alpha.9"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.0.0-alpha.9.tgz#990c0634f510f76449a0d6f6eaec96b22f273628"

node-fetch@^1.6.3:
version "1.6.3"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04"
Expand Down