Skip to content

Commit

Permalink
resolve-cloud fix
Browse files Browse the repository at this point in the history
  • Loading branch information
max-vasin committed Mar 17, 2021
1 parent bd09933 commit d6547d2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions deploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
"semver": "7.3.4",
"latest-version": "5.1.0",
"lodash.set": "4.3.2",
"lodash.unset": "4.5.2",
"lodash.isempty": "4.4.0"
},
"devDependencies": {
"@types/semver": "7.3.4",
"@types/lodash.omit": "4.5.6",
"@types/lodash.set": "4.3.6",
"@types/lodash.isempty": "4.4.6",
"@types/lodash.unset": "4.5.6",
"jest": "26.6.3",
"ts-jest": "26.5.1",
"lodash.omit": "4.5.0",
Expand Down
3 changes: 3 additions & 0 deletions deploy/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { URL } from 'url'
import * as path from 'path'
import * as core from '@actions/core'
import setByPath from 'lodash.set'
import unsetByPath from 'lodash.unset'
import isEmpty from 'lodash.isempty'
import { execSync } from 'child_process'
import { readFileSync, writeFileSync } from 'fs'
Expand Down Expand Up @@ -56,6 +57,8 @@ export const main = async (): Promise<void> => {

core.debug(`setting cloud CLI version to (${cliVersion})`)
setByPath(pkg, 'devDependencies.resolve-cloud', cliVersion)
} else {
unsetByPath(pkg, 'devDependencies.resolve-cloud')
}

core.debug(`writing patched: ${pkgFile}`)
Expand Down
22 changes: 22 additions & 0 deletions deploy/test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,3 +457,25 @@ test('deployed application info retrieved on failed deploy operation', async ()
'event-store-id'
)
})

test('fix: specifying CLI sources should remove dev dependencies', async () => {
actionInput.cli_sources = '/cli/sources'
mReadFile.mockReturnValue(
Buffer.from(
JSON.stringify(
{
name: 'package',
devDependencies: {
'resolve-cloud': '*',
},
},
null,
2
)
)
)

await main()

expect(getPackageContent()?.devDependencies).toEqual({})
})
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,13 @@
dependencies:
"@types/lodash" "*"

"@types/lodash.unset@4.5.6":
version "4.5.6"
resolved "https://registry.yarnpkg.com/@types/lodash.unset/-/lodash.unset-4.5.6.tgz#a9c9937fcfc80a30b7c2e808c1ad2d1ed592e055"
integrity sha512-KRMd2I4kKsfUsJfXRKMuleZHG4LAvacUatvaBcMup1OAPAlNdQXWm3q3BhusPFsS0/4rl7XXAnLxjHeaS/XU8w==
dependencies:
"@types/lodash" "*"

"@types/lodash@*":
version "4.14.168"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
Expand Down Expand Up @@ -3847,6 +3854,11 @@ lodash.sortby@^4.7.0:
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=

lodash.unset@4.5.2:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.unset/-/lodash.unset-4.5.2.tgz#370d1d3e85b72a7e1b0cdf2d272121306f23e4ed"
integrity sha1-Nw0dPoW3Kn4bDN8tJyEhMG8j5O0=

lodash@4.x, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
Expand Down

0 comments on commit d6547d2

Please sign in to comment.