@cmflow/cli 0.73.7 → 0.76.0

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 +3 -2
  2. package/bin/cm-clean.js +3 -2
  3. package/bin/cm-config.js +4 -3
  4. package/bin/cm-deploy.js +3 -2
  5. package/bin/cm-fetch.js +3 -2
  6. package/bin/cm-finish.js +3 -2
  7. package/bin/cm-merge.js +3 -2
  8. package/bin/cm-publish-pages.js +3 -2
  9. package/bin/cm-publish.js +3 -2
  10. package/bin/cm-push.js +3 -2
  11. package/bin/cm-rebase.js +3 -2
  12. package/bin/cm-republish.js +3 -2
  13. package/bin/cm-start.js +3 -2
  14. package/bin/cm.js +7 -2
  15. package/bin/cmrelease.js +3 -1
  16. package/package.json +15 -17
  17. package/release.config.js +1 -1
  18. package/semantic.js +1 -1
  19. package/src/commands/clean.js +1 -2
  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 +2 -18
  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 -3
  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 +2 -3
  41. package/src/common/cli/cli.js +2 -4
  42. package/src/common/cli/docker.js +1 -1
  43. package/src/common/cli/docker.test.js +13 -6
  44. package/src/common/cli/git.js +1 -1
  45. package/src/common/cli/git.test.js +9 -5
  46. package/src/common/cli/heroku.js +1 -1
  47. package/src/common/cli/heroku.test.js +10 -4
  48. package/src/common/cli/lerna.js +1 -1
  49. package/src/common/cli/lerna.test.js +9 -4
  50. package/src/common/cli/npm.js +4 -4
  51. package/src/common/cli/npm.test.js +10 -4
  52. package/src/common/cli/yarn.js +4 -4
  53. package/src/common/cli/yarn.test.js +9 -4
  54. package/src/common/configure-git-workspace.js +1 -1
  55. package/src/common/get-config.js +4 -24
  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 +8 -4
  59. package/src/index.js +1 -1
  60. package/src/main.js +5 -5
  61. package/src/semantic-release/actions/analyze-commits.js +4 -2
  62. package/src/semantic-release/actions/fail.js +2 -2
  63. package/src/semantic-release/actions/generate-notes.js +3 -2
  64. package/src/semantic-release/actions/index.js +8 -8
  65. package/src/semantic-release/actions/prepare.js +5 -3
  66. package/src/semantic-release/actions/publish.js +3 -3
  67. package/src/semantic-release/actions/success.js +5 -3
  68. package/src/semantic-release/actions/verify-conditions.js +3 -2
  69. package/src/semantic-release/actions/verify-release.js +4 -2
  70. package/src/semantic-release/get-semantic-config.js +2 -2
  71. package/src/semantic-release/utils/bump-packages-version.test.js +4 -1
  72. package/src/semantic-release/utils/calculate-snapshot-version.js +1 -1
  73. package/src/semantic-release/utils/calculate-snapshot-version.test.js +10 -3
  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 +12 -3
  78. package/src/semantic-release/utils/docker-publish.js +5 -2
  79. package/src/semantic-release/utils/docker-publish.test.js +33 -17
  80. package/src/semantic-release/utils/ghpages-publish.js +1 -1
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const commander = require('commander')
4
- const { commands, runCommand } = require('../src')
3
+ import commander from 'commander'
4
+
5
+ import { commands, runCommand } from '../src/index.js'
5
6
 
6
7
  commander
7
8
  .usage('cmchangelog [options]')
package/bin/cm-clean.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import commander from 'commander'
3
+
4
+ import { commands, runCommand } from '../src/index.js'
4
5
 
5
6
  commander
6
7
  .usage('cmclean <action> options]')
package/bin/cm-config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import { commands, release, runCommand } from '../src/index.js'
3
+
4
+ import commander from 'commander'
4
5
 
5
6
  commander
6
7
  .usage('cmconfig')
@@ -11,4 +12,4 @@ commander
11
12
  runCommand(commands.Config, {
12
13
  verbose: commander.verbose
13
14
  })
14
- require('../src').release()
15
+ release()
package/bin/cm-deploy.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import commander from 'commander'
3
+
4
+ import { commands, runCommand } from '../src/index.js'
4
5
 
5
6
  commander
6
7
  .usage('cmdeploy [options]')
package/bin/cm-fetch.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import commander from 'commander'
3
+
4
+ import { commands, runCommand } from '../src/index.js'
4
5
 
5
6
  commander
6
7
  .usage('cmfetch [options]')
package/bin/cm-finish.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import commander from 'commander'
3
+
4
+ import { commands, runCommand } from '../src/index.js'
4
5
 
5
6
  commander
6
7
  .usage('cmfinish [options]')
package/bin/cm-merge.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import commander from 'commander'
3
+
4
+ import { commands, runCommand } from '../src/index.js'
4
5
 
5
6
  commander
6
7
  .usage('cmmerge')
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import commander from 'commander'
3
+
4
+ import { commands, runCommand } from '../src/index.js'
4
5
 
5
6
  commander
6
7
  .usage('cmpublishpages [options]')
package/bin/cm-publish.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import { commands, runCommand } from '../src/index.js'
3
+
4
+ import commander from 'commander'
4
5
 
5
6
  commander
6
7
  .usage('cmpublish [options]')
package/bin/cm-push.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import commander from 'commander'
3
+
4
+ import { commands, runCommand } from '../src/index.js'
4
5
 
5
6
  commander
6
7
  .usage('cmpush [options]')
package/bin/cm-rebase.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import commander from 'commander'
3
+
4
+ import { commands, runCommand } from '../src/index.js'
4
5
 
5
6
  commander
6
7
  .usage('cmrebase [options]')
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import { commands, runCommand } from '../src/index.js'
3
+
4
+ import commander from 'commander'
4
5
 
5
6
  commander
6
7
  .usage('cmrepublish [options]')
package/bin/cm-start.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const commander = require('commander')
3
- const { commands, runCommand } = require('../src')
2
+ import commander from 'commander'
3
+
4
+ import { commands, runCommand } from '../src/index.js'
4
5
 
5
6
  const options = {}
6
7
 
package/bin/cm.js CHANGED
@@ -1,7 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const commander = require('commander')
4
- const cliPkg = require('../package.json')
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'))
5
10
 
6
11
  commander
7
12
  .version(cliPkg.version)
package/bin/cmrelease.js CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('../src').release()
3
+ import { release } from '../src/index.js'
4
+
5
+ release()
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@cmflow/cli",
3
- "version": "0.73.7",
3
+ "version": "0.76.0",
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",
10
11
  "private": false,
11
12
  "bin": {
12
13
  "cm": "./bin/cm.js",
@@ -32,7 +33,6 @@
32
33
  "commander": "5.1.0",
33
34
  "conventional-changelog": "3.1.25",
34
35
  "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",
@@ -41,23 +41,21 @@
41
41
  "inquirer": "7.3.3",
42
42
  "listr": "0.14.3",
43
43
  "lodash": "4.17.20",
44
- "rxjs": "6.6.3",
45
- "semantic-release": "19.0.5",
44
+ "rxjs": "7.8.1",
45
+ "semantic-release": "22.0.7",
46
46
  "semver": "7.3.7",
47
47
  "split": "1.0.1"
48
48
  },
49
49
  "devDependencies": {
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",
50
+ "eslint": "8.53.0",
51
+ "eslint-config-standard": "17.1.0",
52
+ "eslint-plugin-import": "2.29.0",
56
53
  "eslint-plugin-node": "11.1.0",
57
- "eslint-plugin-promise": "4.2.1",
58
- "eslint-plugin-standard": "4.0.2",
54
+ "eslint-plugin-promise": "6.1.1",
55
+ "eslint-plugin-standard": "5.0.0",
56
+ "eslint-plugin-n": "16.3.0",
59
57
  "husky": "4.3.6",
60
- "jest": "^24.9.0",
58
+ "jest": "^29.7.0",
61
59
  "jest-junit": "^11.0.1",
62
60
  "lint-staged": "10.5.3"
63
61
  },
@@ -79,10 +77,10 @@
79
77
  },
80
78
  "scripts": {
81
79
  "test": "yarn lint && yarn test_unit",
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",
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",
86
84
  "release": "node bin/cmrelease.js",
87
85
  "release_dry_run": "node bin/cmrelease.js --dry-run",
88
86
  "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
- module.exports = {
5
+ export default {
6
6
  branch: 'master',
7
7
  plugins: [
8
8
  './semantic'
package/semantic.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./src/semantic-release/actions')
1
+ export * from './src/semantic-release/actions/index.js'
@@ -1,7 +1,6 @@
1
-
2
1
  import chalk from 'chalk'
3
2
  import figures from 'figures'
4
- import { dockerCleanTags } from '../semantic-release/utils/docker-clean-tags'
3
+ import { dockerCleanTags } from '../semantic-release/utils/docker-clean-tags.js'
5
4
 
6
5
  export class Clean {
7
6
  mapContext (commander, context) {
@@ -1,4 +1,4 @@
1
- import { configureGitWorkspace, getConfig } from '../common'
1
+ import { configureGitWorkspace, getConfig } from '../common/index.js'
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'
4
- import { getConfig } from '../common'
3
+ import { deployOnDockerHub, deployOnHeroku } from '../semantic-release/utils/docker-publish.js'
4
+ import { getConfig } from '../common/index.js'
5
5
 
6
6
  export class Deploy {
7
7
  mapContext (commander, context) {
@@ -1,4 +1,4 @@
1
- import { refreshRepository } from './tasks/refresh-repository'
1
+ import { refreshRepository } from './tasks/refresh-repository.js'
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'
4
- import { git } from '../common/cli/git'
5
- import { pushBranch } from './tasks/push-branch'
3
+ import { Rebase } from './rebase.js'
4
+ import { git } from '../common/cli/git.js'
5
+ import { pushBranch } from './tasks/push-branch.js'
6
6
 
7
7
  export class Finish extends Rebase {
8
8
  mapContext (commander, context) {
@@ -1,11 +1,11 @@
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
+ 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,7 +1,7 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { mergeBranch } from './tasks/merge-branch'
4
- import { git } from '../common'
3
+ import { mergeBranch } from './tasks/merge-branch.js'
4
+ import { git } from '../common/cli/git.js'
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'
2
+ import { git } from '../../common/index.js'
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'
3
+ import { ghPagesPublish } from '../semantic-release/utils/ghpages-publish.js'
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'
4
- import { pushBranch } from './tasks/push-branch'
3
+ import { Rebase } from './rebase.js'
4
+ import { pushBranch } from './tasks/push-branch.js'
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'
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'
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'
8
8
 
9
9
  export class Rebase extends Fetch {
10
10
  mapContext (commander, context) {
@@ -1,27 +1,11 @@
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
- }
1
+ import semantic_release from 'semantic-release'
18
2
 
19
3
  delete process.env.CIRCLE_PR_NUMBER
20
4
  delete process.env.CIRCLE_PULL_REQUEST
21
5
  delete process.env.CI_PULL_REQUEST
22
6
 
23
7
  export function release (options = {}) {
24
- require('semantic-release')({
8
+ semantic_release({
25
9
  dryRun: process.argv.includes('--dry-run'),
26
10
  ci: false,
27
11
  noCi: true,
@@ -1,7 +1,7 @@
1
1
  import chalk from 'chalk'
2
2
  import figures from 'figures'
3
- import { Fetch } from './fetch'
4
- import { rebaseAllBranches } from './tasks/rebase-all-branches'
3
+ import { Fetch } from './fetch.js'
4
+ import { rebaseAllBranches } from './tasks/rebase-all-branches.js'
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'
4
- import { branches } from './prompts/branches'
5
- import { Fetch } from './fetch'
3
+ import { git } from '../common/cli/git.js'
4
+ import { branches } from './prompts/branches.js'
5
+ import { Fetch } from './fetch.js'
6
6
 
7
- import { updateDependencies } from './tasks/update-dependencies'
8
- import { WORKFLOW_CONFIGURATION } from '../workflow'
7
+ import { updateDependencies } from './tasks/update-dependencies.js'
8
+ import { WORKFLOW_CONFIGURATION } from '../workflow/index.js'
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'
1
+ import { git } from '../../common/index.js'
2
2
 
3
3
  function setGHToken (context) {
4
4
  const {
@@ -1,4 +1,4 @@
1
- import { git } from '../../common/cli/git'
1
+ import { git } from '../../common/cli/git.js'
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'
1
+ import { git } from '../../common/cli/git.js'
2
2
 
3
3
  export function rebaseAllBranches (context) {
4
4
  const { origin = 'origin', upstream = true, noVerify = true } = context
@@ -1,7 +1,6 @@
1
- import { EMPTY } from 'rxjs'
2
- import { catchError } from 'rxjs/operators'
1
+ import { EMPTY, catchError } from 'rxjs'
3
2
  import Listr from 'listr'
4
- import { git } from '../../common'
3
+ import { git } from '../../common/index.js'
5
4
 
6
5
  function pipe (observable, output) {
7
6
  observable.pipe(catchError((err) => {
@@ -1,4 +1,4 @@
1
- import { git, npm, yarn } from '../../common'
1
+ import { git, npm, yarn } from '../../common/index.js'
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'
3
+ import { git } from '../../common/cli/git.js'
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'
2
- import { refreshMetadata, shouldReinstall } from '../utils/check-install'
1
+ import { npm, yarn } from '../../common/index.js'
2
+ import { refreshMetadata, shouldReinstall } from '../utils/check-install.js'
3
3
  import Listr from 'listr'
4
- import { catchError } from 'rxjs/operators'
4
+ import { catchError } from 'rxjs'
5
5
 
6
6
  export const updateDependencies = ({ useYarn }) => {
7
7
  const manager = useYarn ? yarn : npm
@@ -1,6 +1,5 @@
1
- import isEqual from 'lodash/isEqual'
2
- import { getPackageJson } from '../../common/get-package-json'
3
- import { git } from '../../common'
1
+ import isEqual from 'lodash/isEqual.js'
2
+ import { getPackageJson, git } from '../../common/index.js'
4
3
 
5
4
  function getDeps () {
6
5
  const pkg = getPackageJson()
@@ -1,10 +1,9 @@
1
- import 'any-observable/register/rxjs-all' // eslint-disable-line import/no-unassigned-import
1
+ import 'any-observable/register/rxjs-all.js' // 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'
4
+ import { filter, merge } from 'rxjs'
5
5
  import split from 'split'
6
6
  import { spawnSync } from 'child_process'
7
-
8
7
  export class Cli {
9
8
  constructor (cmd) {
10
9
  this.cmd = cmd
@@ -74,7 +73,6 @@ export class Cli {
74
73
 
75
74
  promise.sync = (opt) => {
76
75
  isPromise = false
77
-
78
76
  return execa.sync(cmd, args, {
79
77
  cwd: process.cwd(),
80
78
  stdio: 'inherit',
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios'
2
- import { Cli } from './cli'
2
+ import { Cli } from './cli.js'
3
3
 
4
4
  class DockerCli extends Cli {
5
5
  constructor () {
@@ -1,10 +1,17 @@
1
- import axios from 'axios'
2
- import execa from 'execa'
3
- import { docker } from './docker'
4
- import { Cli } from './cli'
1
+ import { beforeEach, describe, expect, it, jest } from '@jest/globals'
5
2
 
6
- jest.mock('axios')
7
- jest.mock('execa')
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')
8
15
 
9
16
  execa.mockReturnValue({})
10
17
 
@@ -1,4 +1,4 @@
1
- import { Cli } from './cli'
1
+ import { Cli } from './cli.js'
2
2
 
3
3
  class GitCli extends Cli {
4
4
  constructor () {
@@ -1,9 +1,13 @@
1
- import execa from 'execa'
2
- import { git } from './git'
3
- import { Cli } from './cli'
4
-
5
- jest.mock('execa')
1
+ import { beforeEach, describe, expect, it, jest } from '@jest/globals'
6
2
 
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')
7
11
  execa.sync.mockImplementation((...args) => {
8
12
  return {
9
13
  stdout: `CMD: ${[].concat(...args.filter(arg => typeof arg === 'string' || Array.isArray(arg))).join(' ')}`
@@ -1,4 +1,4 @@
1
- import { Cli } from './cli'
1
+ import { Cli } from './cli.js'
2
2
 
3
3
  export class HerokuCli extends Cli {
4
4
  constructor () {
@@ -1,8 +1,14 @@
1
- import execa from 'execa'
2
- import { Cli } from './cli'
3
- import { heroku } from './heroku'
1
+ import { beforeEach, describe, expect, it, jest } from '@jest/globals'
4
2
 
5
- jest.mock('execa')
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')
6
12
 
7
13
  execa.sync.mockImplementation((...args) => {
8
14
  return {