@dhis2/cli-utils 4.1.0-alpha.9 → 4.2.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.
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "engines": {
7
7
  "node": ">=12"
8
8
  },
9
- "version": "4.1.0-alpha.9",
9
+ "version": "4.2.2",
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.2.1",
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"
@@ -26,36 +26,6 @@ function publisher(target = '', packages) {
26
26
  })
27
27
  }
28
28
 
29
- case 'app-hub': {
30
- return packages
31
- .map(pkgJsonPath => {
32
- return [
33
- [
34
- '@semantic-release/npm',
35
- {
36
- pkgRoot: path.dirname(pkgJsonPath),
37
- npmPublish: false,
38
- },
39
- ],
40
- [
41
- '@semantic-release/exec',
42
- {
43
- prepareCmd:
44
- 'yarn install --frozen-lockfile && yarn d2-app-scripts build --cwd ' +
45
- path.dirname(pkgJsonPath),
46
- },
47
- ],
48
- [
49
- require('../support/semantic-release-app-hub.js'),
50
- {
51
- pkgRoot: path.dirname(pkgJsonPath),
52
- },
53
- ],
54
- ]
55
- })
56
- .reduce((a, b) => a.concat(b))
57
- }
58
-
59
29
  default: {
60
30
  return packages.map(pkgJsonPath => {
61
31
  return [
@@ -133,9 +103,6 @@ const handler = async ({ publish }) => {
133
103
  '@semantic-release/github',
134
104
  ]
135
105
 
136
- reporter.debug('Order of plugins')
137
- reporter.debug(plugins)
138
-
139
106
  /* rely on defaults for configuration, except for plugins as they
140
107
  * need to be custom.
141
108
  *
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,95 +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 { pkgRoot } = config
62
- const { env, logger } = context
63
-
64
- const d2Config = require(path.join(pkgRoot, 'd2.config.js'))
65
- const pkg = require(path.join(pkgRoot, 'package.json'))
66
-
67
- logger.log(d2Config)
68
- logger.log(pkg)
69
-
70
- const fileVersion = pkg.version
71
- const file = `dhis2-${d2Config.name}-${fileVersion}.zip`
72
-
73
- await publishAppHub({
74
- cwd: pkgRoot,
75
- apikey: env.APP_HUB_TOKEN,
76
- id: d2Config.id,
77
- minDHIS2Version: d2Config.minDHIS2Version,
78
- baseUrl: 'https://apps.dhis2.org',
79
- channel: 'stable',
80
- file,
81
- fileVersion,
82
- })
83
- }
84
-
85
- exports.success = (config, context) => {
86
- const { logger } = context
87
-
88
- logger.log('Published successfully to the App Hub')
89
- }
90
-
91
- exports.fail = (config, context) => {
92
- const { logger } = context
93
-
94
- logger.log('Published to the App Hub failed')
95
- }