@dhis2/cli-utils 4.1.0-alpha.7 → 4.2.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.
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "engines": {
7
7
  "node": ">=12"
8
8
  },
9
- "version": "4.1.0-alpha.7",
9
+ "version": "4.2.0",
10
10
  "main": "src/index.js",
11
11
  "author": "Viktor Varland <viktor@dhis2.org>",
12
12
  "contributors": [
@@ -15,23 +15,22 @@
15
15
  "license": "BSD-3-Clause",
16
16
  "private": false,
17
17
  "dependencies": {
18
- "@dhis2/cli-app-scripts": "^7.1.0-alpha.2",
19
- "@dhis2/cli-helpers-engine": "^3.0.0",
18
+ "@dhis2/cli-helpers-engine": "^3.1.0",
20
19
  "@dhis2/cli-utils-codemods": "^3.0.0",
21
- "@dhis2/cli-utils-cypress": "^8.0.0",
22
- "@dhis2/cli-utils-docsite": "^3.0.0",
20
+ "@dhis2/cli-utils-cypress": "^9.0.1",
21
+ "@dhis2/cli-utils-docsite": "^3.1.2",
23
22
  "@semantic-release/changelog": "^5.0.1",
24
23
  "@semantic-release/commit-analyzer": "^8.0.1",
25
- "@semantic-release/exec": "^5.0.0",
26
24
  "@semantic-release/git": "^9.0.0",
27
- "@semantic-release/github": "^7.0.5",
28
- "@semantic-release/npm": "^7.0.5",
29
- "@semantic-release/release-notes-generator": "^9.0.1",
25
+ "@semantic-release/github": "^7.2.3",
26
+ "@semantic-release/npm": "^7.1.3",
27
+ "@semantic-release/release-notes-generator": "^9.0.3",
30
28
  "dhis2-uid": "^0.1.2",
31
29
  "ejs": "^3.0.1",
32
30
  "inquirer": "^7.1.0",
33
31
  "jsondiffpatch": "^0.4.1",
34
- "semantic-release": "^16.0.4"
32
+ "semantic-release": "^17.4.4",
33
+ "tape": "^4.13.2"
35
34
  },
36
35
  "publishConfig": {
37
36
  "access": "public"
@@ -14,8 +14,6 @@ const packageIsPublishable = pkgJsonPath => {
14
14
  }
15
15
 
16
16
  function publisher(target = '', packages) {
17
- const appHubPlugin = require('../support/semantic-release-app-hub.js')
18
-
19
17
  switch (target.toLowerCase()) {
20
18
  case 'npm': {
21
19
  return packages.filter(packageIsPublishable).map(pkgJsonPath => {
@@ -28,35 +26,6 @@ function publisher(target = '', packages) {
28
26
  })
29
27
  }
30
28
 
31
- case 'app-hub': {
32
- return packages
33
- .map(pkgJsonPath => {
34
- return [
35
- [
36
- '@semantic-release/npm',
37
- {
38
- pkgRoot: path.dirname(pkgJsonPath),
39
- npmPublish: false,
40
- },
41
- ],
42
- [
43
- '@semantic-release/exec',
44
- {
45
- prepareCmd:
46
- 'yarn install --frozen-lockfile && yarn d2-app-scripts build',
47
- },
48
- ],
49
- [
50
- appHubPlugin,
51
- {
52
- pkgRoot: path.dirname(pkgJsonPath),
53
- },
54
- ],
55
- ]
56
- })
57
- .reduce((a, b) => a.concat(b))
58
- }
59
-
60
29
  default: {
61
30
  return packages.map(pkgJsonPath => {
62
31
  return [
package/src/index.js CHANGED
@@ -1,11 +1,15 @@
1
- const { namespace } = require('@dhis2/cli-helpers-engine')
1
+ const { namespace, createModuleLoader } = require('@dhis2/cli-helpers-engine')
2
2
 
3
3
  const command = namespace('utils', {
4
4
  desc: 'Utils for miscellaneous operations',
5
5
  builder: yargs => {
6
- yargs.command(require('@dhis2/cli-utils-cypress'))
7
- yargs.command(require('@dhis2/cli-utils-codemods'))
8
- yargs.command(require('@dhis2/cli-utils-docsite'))
6
+ const loader = createModuleLoader({
7
+ parentModule: __filename,
8
+ })
9
+
10
+ yargs.command(loader('@dhis2/cli-utils-cypress'))
11
+ yargs.command(loader('@dhis2/cli-utils-codemods'))
12
+ yargs.command(loader('@dhis2/cli-utils-docsite'))
9
13
  yargs.commandDir('cmds')
10
14
  },
11
15
  })
@@ -2,7 +2,7 @@ const analyzeCommits = (config, context) => {
2
2
  const { logger, commits } = context
3
3
 
4
4
  const { message, commit } = commits[0]
5
- const defer = /\[(defer|skip)[ -]release\]/gi
5
+ const defer = /\[defer[ -]release\]/gi
6
6
 
7
7
  if (message.match(defer)) {
8
8
  logger.warn(`This release has been deferred by commit ${commit.short}`)
@@ -1,85 +0,0 @@
1
- const fs = require('fs')
2
- const path = require('path')
3
- const { publishCommand } = require('@dhis2/cli-app-scripts')
4
- const SemanticReleaseError = require('@semantic-release/error')
5
-
6
- const { handler: publishAppHub } = publishCommand
7
-
8
- exports.verifyConditions = (config, context) => {
9
- const { env } = context
10
- const { pkgRoot } = config
11
-
12
- const configPath = path.join(pkgRoot, 'd2.config.js')
13
-
14
- if (!fs.existsSync(configPath)) {
15
- throw new SemanticReleaseError(
16
- `Failed to locate d2.config.js file, does it exist in ${pkgRoot}?`,
17
- 'EMISSINGD2CONFIG',
18
- 'd2.config.js is necessary to automatically publish to the App Hub'
19
- )
20
- }
21
-
22
- const d2Config = require(configPath)
23
-
24
- if (d2Config.type === 'lib') {
25
- throw new SemanticReleaseError(
26
- 'App Hub does not support publishing libraries.',
27
- 'EAPPHUBSUPPORT',
28
- "The type in d2.config.js must not be 'lib'"
29
- )
30
- }
31
-
32
- if (!d2Config.id) {
33
- throw new SemanticReleaseError(
34
- "'id' field missing from d2.config.js",
35
- 'EMISSINGAPPHUBID',
36
- 'The App Hub application id must be defined in d2.config.js'
37
- )
38
- }
39
-
40
- if (!d2Config.minDHIS2Version) {
41
- throw new SemanticReleaseError(
42
- "'minDHIS2Version' field missing from d2.config.js",
43
- 'EMISSINGMINDHIS2VERSION',
44
- 'The minimum supported DHIS2 version must be defined in d2.config.js'
45
- )
46
- }
47
-
48
- if (!env.APP_HUB_TOKEN) {
49
- throw new SemanticReleaseError(
50
- 'APP_HUB_TOKEN is missing from the environment',
51
- 'EMISSINGAPPHUBTOKEN',
52
- 'You need to supply the API token to the APP_HUB_TOKEN env var.'
53
- )
54
- }
55
- }
56
-
57
- // maybe we can use this step for release channels
58
- // exports.addChannel = (config, context) => {}
59
-
60
- exports.publish = async (config, context) => {
61
- const d2Config = require(path.join(config.pkgRoot, 'd2.config.js'))
62
- const { pkgRoot } = config
63
- const { env } = context
64
-
65
- await publishAppHub({
66
- cwd: pkgRoot,
67
- apikey: env.APP_HUB_TOKEN,
68
- id: d2Config.id,
69
- minDHIS2Version: d2Config.minDHIS2Version,
70
- baseUrl: 'https://apps.dhis2.org',
71
- channel: 'stable',
72
- })
73
- }
74
-
75
- exports.success = (config, context) => {
76
- const { logger } = context
77
-
78
- logger.log('Published successfully to the App Hub')
79
- }
80
-
81
- exports.fail = (config, context) => {
82
- const { logger } = context
83
-
84
- logger.log('Published to the App Hub failed')
85
- }