adapt-cli 3.1.2 → 3.1.4

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.
@@ -3,6 +3,7 @@ import getBowerRegistryConfig from '../getBowerRegistryConfig.js'
3
3
  import fs from 'fs-extra'
4
4
  import path from 'path'
5
5
  import bower from 'bower'
6
+ import fetch from 'node-fetch'
6
7
  import chalk from 'chalk'
7
8
  import inquirer from 'inquirer'
8
9
  import { readValidateJSON } from '../../util/JSONReadValidate.js'
@@ -120,11 +121,18 @@ async function exists (BOWER_REGISTRY_CONFIG, plugin) {
120
121
  }
121
122
 
122
123
  async function registerWithBowerRepo (BOWER_REGISTRY_CONFIG, plugin, repository) {
123
- return new Promise((resolve, reject) => {
124
- bower.commands.register(plugin.toString(), repository.url || repository, {
125
- registry: BOWER_REGISTRY_CONFIG
126
- })
127
- .on('end', resolve)
128
- .on('error', reject)
124
+ const data = {
125
+ name: plugin.toString(),
126
+ url: repository.url || repository
127
+ }
128
+ const response = await fetch(`${BOWER_REGISTRY_CONFIG.register}packages`, {
129
+ headers: {
130
+ 'User-Agent': 'adapt-cli',
131
+ 'Content-Type': 'application/json'
132
+ },
133
+ followRedirect: false,
134
+ method: 'POST',
135
+ body: JSON.stringify(data)
129
136
  })
137
+ return (response?.status === 201)
130
138
  }
package/lib/logger.js CHANGED
@@ -9,10 +9,10 @@ export default {
9
9
  this.write(args.join(' '))
10
10
  },
11
11
  warn (...args) {
12
- chalk.yellow(...args)
12
+ this.log(chalk.yellow(...args))
13
13
  },
14
14
  error (...args) {
15
- chalk.red(...args)
15
+ this.log(chalk.red(...args))
16
16
  },
17
17
  log (...args) {
18
18
  if (this.isLoggingProgress) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-cli",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "Command line tools for Adapt",
5
5
  "main": "./lib/api.js",
6
6
  "type": "module",