File tree Expand file tree Collapse file tree
lib/integration/PluginManagement Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import getBowerRegistryConfig from '../getBowerRegistryConfig.js'
33import fs from 'fs-extra'
44import path from 'path'
55import bower from 'bower'
6+ import fetch from 'node-fetch'
67import chalk from 'chalk'
78import inquirer from 'inquirer'
89import { readValidateJSON } from '../../util/JSONReadValidate.js'
@@ -120,11 +121,18 @@ async function exists (BOWER_REGISTRY_CONFIG, plugin) {
120121}
121122
122123async 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 )
129136 } )
137+ return ( response ?. status === 201 )
130138}
You can’t perform that action at this time.
0 commit comments