@cmflow/cli 0.76.1 → 0.76.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/bin/cm-changelog.js +2 -3
  2. package/bin/cm-clean.js +2 -3
  3. package/bin/cm-config.js +3 -4
  4. package/bin/cm-deploy.js +2 -3
  5. package/bin/cm-fetch.js +2 -3
  6. package/bin/cm-finish.js +2 -3
  7. package/bin/cm-merge.js +2 -3
  8. package/bin/cm-publish-pages.js +2 -3
  9. package/bin/cm-publish.js +2 -3
  10. package/bin/cm-push.js +2 -3
  11. package/bin/cm-rebase.js +2 -3
  12. package/bin/cm-republish.js +2 -3
  13. package/bin/cm-start.js +2 -3
  14. package/bin/cm.js +2 -7
  15. package/bin/cmrelease.js +1 -3
  16. package/package.json +16 -14
  17. package/release.config.js +1 -1
  18. package/semantic.js +1 -1
  19. package/src/commands/clean.js +2 -1
  20. package/src/commands/config.js +1 -1
  21. package/src/commands/deploy.js +2 -2
  22. package/src/commands/fetch.js +1 -1
  23. package/src/commands/finish.js +3 -3
  24. package/src/commands/index.js +11 -11
  25. package/src/commands/merge.js +2 -2
  26. package/src/commands/prompts/branches.js +1 -1
  27. package/src/commands/publish-pages.js +1 -1
  28. package/src/commands/push.js +2 -2
  29. package/src/commands/rebase.js +5 -5
  30. package/src/commands/release.js +18 -2
  31. package/src/commands/republish.js +2 -2
  32. package/src/commands/start.js +5 -5
  33. package/src/commands/tasks/merge-branch.js +1 -1
  34. package/src/commands/tasks/push-branch.js +1 -1
  35. package/src/commands/tasks/rebase-all-branches.js +1 -1
  36. package/src/commands/tasks/refresh-repository.js +2 -2
  37. package/src/commands/tasks/run-test.js +1 -1
  38. package/src/commands/tasks/update-branch.js +1 -1
  39. package/src/commands/tasks/update-dependencies.js +3 -3
  40. package/src/commands/utils/check-install.js +3 -2
  41. package/src/common/cli/cli.js +4 -2
  42. package/src/common/cli/docker.js +1 -1
  43. package/src/common/cli/docker.test.js +6 -13
  44. package/src/common/cli/git.js +1 -1
  45. package/src/common/cli/git.test.js +5 -9
  46. package/src/common/cli/heroku.js +1 -1
  47. package/src/common/cli/heroku.test.js +4 -10
  48. package/src/common/cli/lerna.js +1 -1
  49. package/src/common/cli/lerna.test.js +4 -9
  50. package/src/common/cli/npm.js +4 -4
  51. package/src/common/cli/npm.test.js +4 -10
  52. package/src/common/cli/yarn.js +4 -4
  53. package/src/common/cli/yarn.test.js +4 -9
  54. package/src/common/configure-git-workspace.js +1 -1
  55. package/src/common/get-config.js +24 -4
  56. package/src/common/index.js +10 -10
  57. package/src/common/run-command.js +2 -2
  58. package/src/common/run-command.test.js +4 -8
  59. package/src/index.js +1 -1
  60. package/src/main.js +5 -5
  61. package/src/semantic-release/actions/analyze-commits.js +2 -4
  62. package/src/semantic-release/actions/fail.js +2 -2
  63. package/src/semantic-release/actions/generate-notes.js +2 -3
  64. package/src/semantic-release/actions/index.js +8 -8
  65. package/src/semantic-release/actions/prepare.js +3 -5
  66. package/src/semantic-release/actions/publish.js +3 -3
  67. package/src/semantic-release/actions/success.js +3 -5
  68. package/src/semantic-release/actions/verify-conditions.js +2 -3
  69. package/src/semantic-release/actions/verify-release.js +2 -4
  70. package/src/semantic-release/get-semantic-config.js +2 -2
  71. package/src/semantic-release/utils/bump-packages-version.test.js +1 -4
  72. package/src/semantic-release/utils/calculate-snapshot-version.js +1 -1
  73. package/src/semantic-release/utils/calculate-snapshot-version.test.js +3 -10
  74. package/src/semantic-release/utils/display-package-info.js +1 -1
  75. package/src/semantic-release/utils/display-release-info.js +1 -1
  76. package/src/semantic-release/utils/docker-clean-tags.js +1 -1
  77. package/src/semantic-release/utils/docker-clean-tags.test.js +3 -12
  78. package/src/semantic-release/utils/docker-publish.js +2 -5
  79. package/src/semantic-release/utils/docker-publish.test.js +17 -33
  80. package/src/semantic-release/utils/ghpages-publish.js +1 -1
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import commander from 'commander'
4
-
5
- import { commands, runCommand } from '../src/index.js'
3
+ const commander = require('commander')
4
+ const { commands, runCommand } = require('../src')
6
5
 
7
6
  commander
8
7
  .usage('cmchangelog [options]')
package/bin/cm-clean.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import commander from 'commander'
3
-
4
- import { commands, runCommand } from '../src/index.js'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmclean <action> options]')
package/bin/cm-config.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { commands, release, runCommand } from '../src/index.js'
3
-
4
- import commander from 'commander'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmconfig')
@@ -12,4 +11,4 @@ commander
12
11
  runCommand(commands.Config, {
13
12
  verbose: commander.verbose
14
13
  })
15
- release()
14
+ require('../src').release()
package/bin/cm-deploy.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import commander from 'commander'
3
-
4
- import { commands, runCommand } from '../src/index.js'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmdeploy [options]')
package/bin/cm-fetch.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import commander from 'commander'
3
-
4
- import { commands, runCommand } from '../src/index.js'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmfetch [options]')
package/bin/cm-finish.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import commander from 'commander'
3
-
4
- import { commands, runCommand } from '../src/index.js'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmfinish [options]')
package/bin/cm-merge.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import commander from 'commander'
3
-
4
- import { commands, runCommand } from '../src/index.js'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmmerge')
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import commander from 'commander'
3
-
4
- import { commands, runCommand } from '../src/index.js'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmpublishpages [options]')
package/bin/cm-publish.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { commands, runCommand } from '../src/index.js'
3
-
4
- import commander from 'commander'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmpublish [options]')
package/bin/cm-push.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import commander from 'commander'
3
-
4
- import { commands, runCommand } from '../src/index.js'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmpush [options]')
package/bin/cm-rebase.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import commander from 'commander'
3
-
4
- import { commands, runCommand } from '../src/index.js'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmrebase [options]')
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { commands, runCommand } from '../src/index.js'
3
-
4
- import commander from 'commander'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  commander
7
6
  .usage('cmrepublish [options]')
package/bin/cm-start.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import commander from 'commander'
3
-
4
- import { commands, runCommand } from '../src/index.js'
2
+ const commander = require('commander')
3
+ const { commands, runCommand } = require('../src')
5
4
 
6
5
  const options = {}
7
6
 
package/bin/cm.js CHANGED
@@ -1,12 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import commander from 'commander'
4
- import fs from 'fs-extra'
5
- import url from 'url'
6
- import path from 'path'
7
-
8
- const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
9
- const cliPkg = fs.readJsonSync(path.join(__dirname, '../package.json'))
3
+ const commander = require('commander')
4
+ const cliPkg = require('../package.json')
10
5
 
11
6
  commander
12
7
  .version(cliPkg.version)
package/bin/cmrelease.js CHANGED
@@ -1,5 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { release } from '../src/index.js'
4
-
5
- release()
3
+ require('../src').release()
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@cmflow/cli",
3
- "version": "0.76.1",
3
+ "version": "0.76.2",
4
4
  "description": "An awesome Git Flow",
5
5
  "author": "camfou",
6
6
  "license": "MIT",
7
7
  "email": "camfou@gmail.com",
8
8
  "main": "./src/index.js",
9
9
  "module": "./src/main.js",
10
- "type": "module",
11
10
  "private": false,
12
11
  "bin": {
13
12
  "cm": "./bin/cm.js",
@@ -33,6 +32,7 @@
33
32
  "commander": "5.1.0",
34
33
  "conventional-changelog": "3.1.25",
35
34
  "conventional-changelog-cli": "2.2.2",
35
+ "esm": "3.2.25",
36
36
  "execa": "5.1.1",
37
37
  "figures": "3.2.0",
38
38
  "fs-extra": "^10.1.0",
@@ -42,20 +42,22 @@
42
42
  "listr": "0.14.3",
43
43
  "lodash": "4.17.20",
44
44
  "rxjs": "6.6.3",
45
- "semantic-release": "22.0.7",
45
+ "semantic-release": "19.0.5",
46
46
  "semver": "7.3.7",
47
47
  "split": "1.0.1"
48
48
  },
49
49
  "devDependencies": {
50
- "eslint": "8.53.0",
51
- "eslint-config-standard": "17.1.0",
52
- "eslint-plugin-import": "2.29.0",
50
+ "@babel/core": "7.12.10",
51
+ "@babel/preset-env": "7.12.11",
52
+ "babel-jest": "26.6.3",
53
+ "eslint": "7.15.0",
54
+ "eslint-config-standard": "16.0.2",
55
+ "eslint-plugin-import": "2.22.1",
53
56
  "eslint-plugin-node": "11.1.0",
54
- "eslint-plugin-promise": "6.1.1",
55
- "eslint-plugin-standard": "5.0.0",
56
- "eslint-plugin-n": "16.3.0",
57
+ "eslint-plugin-promise": "4.2.1",
58
+ "eslint-plugin-standard": "4.0.2",
57
59
  "husky": "4.3.6",
58
- "jest": "^29.7.0",
60
+ "jest": "^24.9.0",
59
61
  "jest-junit": "^11.0.1",
60
62
  "lint-staged": "10.5.3"
61
63
  },
@@ -77,10 +79,10 @@
77
79
  },
78
80
  "scripts": {
79
81
  "test": "yarn lint && yarn test_unit",
80
- "test_unit": "NODE_OPTIONS=--experimental-vm-modules jest",
81
- "lint": "eslint -c .eslintrc {src,bin}/**/*.js",
82
- "lint_ci": "eslint -c .eslintrc {src,bin}/**/*.js --format junit --output-file ./reports/eslint.xml",
83
- "lint_fix": "eslint -c .eslintrc {src,bin}/**/*.js --fix",
82
+ "test_unit": "jest",
83
+ "lint": "eslint -c .eslintrc src/**",
84
+ "lint_ci": "eslint -c .eslintrc src/** --format junit --output-file ./reports/eslint.xml",
85
+ "lint_fix": "eslint -c .eslintrc src/** --fix",
84
86
  "release": "node bin/cmrelease.js",
85
87
  "release_dry_run": "node bin/cmrelease.js --dry-run",
86
88
  "build_changelog": "node bin/cm-changelog.js"
package/release.config.js CHANGED
@@ -2,7 +2,7 @@ process.env.PRODUCTION_BRANCH = 'master'
2
2
  process.env.DEVELOP_BRANCH = 'master'
3
3
  process.env.DEPLOY_ON_DOCKER = 'false'
4
4
 
5
- export default {
5
+ module.exports = {
6
6
  branch: 'master',
7
7
  plugins: [
8
8
  './semantic'
package/semantic.js CHANGED
@@ -1 +1 @@
1
- export * from './src/semantic-release/actions/index.js'
1
+ module.exports = require('./src/semantic-release/actions')
@@ -1,6 +1,7 @@
1
+
1
2
  import chalk from 'chalk'
2
3
  import figures from 'figures'
3
- import { dockerCleanTags } from '../semantic-release/utils/docker-clean-tags.js'
4
+ import { dockerCleanTags } from '../semantic-release/utils/docker-clean-tags'
4
5
 
5
6
  export class Clean {
6
7
  mapContext (commander, context) {
@@ -1,4 +1,4 @@
1
- import { configureGitWorkspace, getConfig } from '../common/index.js'
1
+ import { configureGitWorkspace, getConfig } from '../common'
2
2
 
3
3
  export class Config {
4
4
  mapContext (commander, context) {
@@ -1,7 +1,7 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { deployOnDockerHub, deployOnHeroku } from '../semantic-release/utils/docker-publish.js'
4
- import { getConfig } from '../common/index.js'
3
+ import { deployOnDockerHub, deployOnHeroku } from '../semantic-release/utils/docker-publish'
4
+ import { getConfig } from '../common'
5
5
 
6
6
  export class Deploy {
7
7
  mapContext (commander, context) {
@@ -1,4 +1,4 @@
1
- import { refreshRepository } from './tasks/refresh-repository.js'
1
+ import { refreshRepository } from './tasks/refresh-repository'
2
2
 
3
3
  export class Fetch {
4
4
  mapContext (commander, context) {
@@ -1,8 +1,8 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { Rebase } from './rebase.js'
4
- import { git } from '../common/cli/git.js'
5
- import { pushBranch } from './tasks/push-branch.js'
3
+ import { Rebase } from './rebase'
4
+ import { git } from '../common/cli/git'
5
+ import { pushBranch } from './tasks/push-branch'
6
6
 
7
7
  export class Finish extends Rebase {
8
8
  mapContext (commander, context) {
@@ -1,11 +1,11 @@
1
- export * from './changelog.js'
2
- export * from './finish.js'
3
- export * from './fetch.js'
4
- export * from './push.js'
5
- export * from './start.js'
6
- export * from './republish.js'
7
- export * from './rebase.js'
8
- export * from './publish-pages.js'
9
- export * from './clean.js'
10
- export * from './deploy.js'
11
- export * from './merge.js'
1
+ export * from './changelog'
2
+ export * from './finish'
3
+ export * from './fetch'
4
+ export * from './push'
5
+ export * from './start'
6
+ export * from './republish'
7
+ export * from './rebase'
8
+ export * from './publish-pages'
9
+ export * from './clean'
10
+ export * from './deploy'
11
+ export * from './merge'
@@ -1,7 +1,7 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { mergeBranch } from './tasks/merge-branch.js'
4
- import { git } from '../common/cli/git.js'
3
+ import { mergeBranch } from './tasks/merge-branch'
4
+ import { git } from '../common'
5
5
 
6
6
  export class Merge {
7
7
  getTasks (context) {
@@ -1,5 +1,5 @@
1
1
  import inquirer from 'inquirer'
2
- import { git } from '../../common/index.js'
2
+ import { git } from '../../common'
3
3
 
4
4
  function toRemote (branch, origin) {
5
5
  branch = branch.replace(`${origin}/`)
@@ -1,6 +1,6 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { ghPagesPublish } from '../semantic-release/utils/ghpages-publish.js'
3
+ import { ghPagesPublish } from '../semantic-release/utils/ghpages-publish'
4
4
 
5
5
  export class PublishPages {
6
6
  mapContext (commander, context) {
@@ -1,7 +1,7 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { Rebase } from './rebase.js'
4
- import { pushBranch } from './tasks/push-branch.js'
3
+ import { Rebase } from './rebase'
4
+ import { pushBranch } from './tasks/push-branch'
5
5
 
6
6
  export class Push extends Rebase {
7
7
  mapContext (commander, context) {
@@ -1,10 +1,10 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { Fetch } from './fetch.js'
4
- import { git } from '../common/cli/git.js'
5
- import { updateBranch } from './tasks/update-branch.js'
6
- import { updateDependencies } from './tasks/update-dependencies.js'
7
- import { runTest } from './tasks/run-test.js'
3
+ import { Fetch } from './fetch'
4
+ import { git } from '../common/cli/git'
5
+ import { updateBranch } from './tasks/update-branch'
6
+ import { updateDependencies } from './tasks/update-dependencies'
7
+ import { runTest } from './tasks/run-test'
8
8
 
9
9
  export class Rebase extends Fetch {
10
10
  mapContext (commander, context) {
@@ -1,11 +1,27 @@
1
- import semantic_release from 'semantic-release'
1
+ const getConfig = require('semantic-release/lib/get-config')
2
+ const getNextVersion = require('semantic-release/lib/get-next-version')
3
+ const { calculateSnapshotVersion } = require('../semantic-release/utils/calculate-snapshot-version')
4
+
5
+ require.cache[require.resolve('semantic-release/lib/get-config')].exports = async (context, cliOptions) => {
6
+ context.config = require('../common/get-config').getConfig()
7
+
8
+ return getConfig(context, cliOptions)
9
+ }
10
+
11
+ require.cache[require.resolve('semantic-release/lib/get-next-version')].exports = (context) => {
12
+ if (context.branch.type === 'prerelease') {
13
+ return calculateSnapshotVersion(context)
14
+ }
15
+
16
+ return getNextVersion(context)
17
+ }
2
18
 
3
19
  delete process.env.CIRCLE_PR_NUMBER
4
20
  delete process.env.CIRCLE_PULL_REQUEST
5
21
  delete process.env.CI_PULL_REQUEST
6
22
 
7
23
  export function release (options = {}) {
8
- semantic_release({
24
+ require('semantic-release')({
9
25
  dryRun: process.argv.includes('--dry-run'),
10
26
  ci: false,
11
27
  noCi: true,
@@ -1,7 +1,7 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { Fetch } from './fetch.js'
4
- import { rebaseAllBranches } from './tasks/rebase-all-branches.js'
3
+ import { Fetch } from './fetch'
4
+ import { rebaseAllBranches } from './tasks/rebase-all-branches'
5
5
 
6
6
  export class Republish extends Fetch {
7
7
  mapContext (commander, context) {
@@ -1,11 +1,11 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { git } from '../common/cli/git.js'
4
- import { branches } from './prompts/branches.js'
5
- import { Fetch } from './fetch.js'
3
+ import { git } from '../common/cli/git'
4
+ import { branches } from './prompts/branches'
5
+ import { Fetch } from './fetch'
6
6
 
7
- import { updateDependencies } from './tasks/update-dependencies.js'
8
- import { WORKFLOW_CONFIGURATION } from '../workflow/index.js'
7
+ import { updateDependencies } from './tasks/update-dependencies'
8
+ import { WORKFLOW_CONFIGURATION } from '../workflow'
9
9
 
10
10
  function sanitize (name) {
11
11
  return name.replace(/[/\\_|. ]/gi, '-').split('-').filter(Boolean).join('-')
@@ -1,4 +1,4 @@
1
- import { git } from '../../common/index.js'
1
+ import { git } from '../../common'
2
2
 
3
3
  function setGHToken (context) {
4
4
  const {
@@ -1,4 +1,4 @@
1
- import { git } from '../../common/cli/git.js'
1
+ import { git } from '../../common/cli/git'
2
2
 
3
3
  export function pushBranch ({ origin = 'origin', featureBranch, upstream = true, noVerify = true }) {
4
4
  return ({
@@ -1,4 +1,4 @@
1
- import { git } from '../../common/cli/git.js'
1
+ import { git } from '../../common/cli/git'
2
2
 
3
3
  export function rebaseAllBranches (context) {
4
4
  const { origin = 'origin', upstream = true, noVerify = true } = context
@@ -1,7 +1,7 @@
1
1
  import { EMPTY } from 'rxjs'
2
- import { catchError } from 'rxjs/operators/index.js'
2
+ import { catchError } from 'rxjs/operators'
3
3
  import Listr from 'listr'
4
- import { git } from '../../common/index.js'
4
+ import { git } from '../../common'
5
5
 
6
6
  function pipe (observable, output) {
7
7
  observable.pipe(catchError((err) => {
@@ -1,4 +1,4 @@
1
- import { git, npm, yarn } from '../../common/index.js'
1
+ import { git, npm, yarn } from '../../common'
2
2
 
3
3
  export const runTest = ({
4
4
  E2E_CMD,
@@ -1,6 +1,6 @@
1
1
  import chalk from 'chalk'
2
2
  import Listr from 'listr'
3
- import { git } from '../../common/cli/git.js'
3
+ import { git } from '../../common/cli/git'
4
4
 
5
5
  async function checkBranchRemoteStatus ({ featureBranch, origin, force }) {
6
6
  const isBranchExists = git.branchExists(featureBranch, origin)
@@ -1,7 +1,7 @@
1
- import { npm, yarn } from '../../common/index.js'
2
- import { refreshMetadata, shouldReinstall } from '../utils/check-install.js'
1
+ import { npm, yarn } from '../../common'
2
+ import { refreshMetadata, shouldReinstall } from '../utils/check-install'
3
3
  import Listr from 'listr'
4
- import { catchError } from 'rxjs/operators/index.js'
4
+ import { catchError } from 'rxjs/operators'
5
5
 
6
6
  export const updateDependencies = ({ useYarn }) => {
7
7
  const manager = useYarn ? yarn : npm
@@ -1,5 +1,6 @@
1
- import isEqual from 'lodash/isEqual.js'
2
- import { getPackageJson, git } from '../../common/index.js'
1
+ import isEqual from 'lodash/isEqual'
2
+ import { getPackageJson } from '../../common/get-package-json'
3
+ import { git } from '../../common'
3
4
 
4
5
  function getDeps () {
5
6
  const pkg = getPackageJson()
@@ -1,9 +1,10 @@
1
- import 'any-observable/register/rxjs-all.js' // eslint-disable-line import/no-unassigned-import
1
+ import 'any-observable/register/rxjs-all' // eslint-disable-line import/no-unassigned-import
2
2
  import execa from 'execa'
3
3
  import streamToObservable from '@samverschueren/stream-to-observable'
4
- import { filter, merge } from 'rxjs/operators/index.js'
4
+ import { filter, merge } from 'rxjs/operators'
5
5
  import split from 'split'
6
6
  import { spawnSync } from 'child_process'
7
+
7
8
  export class Cli {
8
9
  constructor (cmd) {
9
10
  this.cmd = cmd
@@ -73,6 +74,7 @@ export class Cli {
73
74
 
74
75
  promise.sync = (opt) => {
75
76
  isPromise = false
77
+
76
78
  return execa.sync(cmd, args, {
77
79
  cwd: process.cwd(),
78
80
  stdio: 'inherit',
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios'
2
- import { Cli } from './cli.js'
2
+ import { Cli } from './cli'
3
3
 
4
4
  class DockerCli extends Cli {
5
5
  constructor () {
@@ -1,17 +1,10 @@
1
- import { beforeEach, describe, expect, it, jest } from '@jest/globals'
1
+ import axios from 'axios'
2
+ import execa from 'execa'
3
+ import { docker } from './docker'
4
+ import { Cli } from './cli'
2
5
 
3
- jest.unstable_mockModule('axios', () => {
4
- return { default: jest.fn() }
5
- })
6
- jest.unstable_mockModule('execa', () => {
7
- const execaMock = jest.fn()
8
- execaMock.sync = jest.fn()
9
- return { default: execaMock }
10
- })
11
- const { default: execa } = await import('execa')
12
- const { default: axios } = await import('axios')
13
- const { docker } = await import('./docker.js')
14
- const { Cli } = await import('./cli.js')
6
+ jest.mock('axios')
7
+ jest.mock('execa')
15
8
 
16
9
  execa.mockReturnValue({})
17
10
 
@@ -1,4 +1,4 @@
1
- import { Cli } from './cli.js'
1
+ import { Cli } from './cli'
2
2
 
3
3
  class GitCli extends Cli {
4
4
  constructor () {
@@ -1,13 +1,9 @@
1
- import { beforeEach, describe, expect, it, jest } from '@jest/globals'
1
+ import execa from 'execa'
2
+ import { git } from './git'
3
+ import { Cli } from './cli'
4
+
5
+ jest.mock('execa')
2
6
 
3
- jest.unstable_mockModule('execa', () => {
4
- const execaMock = jest.fn()
5
- execaMock.sync = jest.fn()
6
- return { default: execaMock }
7
- })
8
- const { default: execa } = await import('execa')
9
- const { git } = await import('./git.js')
10
- const { Cli } = await import('./cli.js')
11
7
  execa.sync.mockImplementation((...args) => {
12
8
  return {
13
9
  stdout: `CMD: ${[].concat(...args.filter(arg => typeof arg === 'string' || Array.isArray(arg))).join(' ')}`
@@ -1,4 +1,4 @@
1
- import { Cli } from './cli.js'
1
+ import { Cli } from './cli'
2
2
 
3
3
  export class HerokuCli extends Cli {
4
4
  constructor () {
@@ -1,14 +1,8 @@
1
- import { beforeEach, describe, expect, it, jest } from '@jest/globals'
1
+ import execa from 'execa'
2
+ import { Cli } from './cli'
3
+ import { heroku } from './heroku'
2
4
 
3
- jest.unstable_mockModule('execa', () => {
4
- const execaMock = jest.fn()
5
- execaMock.sync = jest.fn()
6
- return { default: execaMock }
7
- })
8
- const { default: execa } = await import('execa')
9
-
10
- const { Cli } = await import('./cli.js')
11
- const { heroku } = await import('./heroku.js')
5
+ jest.mock('execa')
12
6
 
13
7
  execa.sync.mockImplementation((...args) => {
14
8
  return {
@@ -1,4 +1,4 @@
1
- import { Cli } from './cli.js'
1
+ import { Cli } from './cli'
2
2
 
3
3
  class LernaCli extends Cli {
4
4
  constructor () {