adapt-cli 3.1.3 → 3.1.5
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.
@@ -79,7 +79,7 @@ export default class Plugin {
|
|
79
79
|
* @returns {boolean|null}
|
80
80
|
*/
|
81
81
|
get isUpToDate () {
|
82
|
-
if (!this.hasFrameworkCompatibleVersion) return true
|
82
|
+
if (!this.hasFrameworkCompatibleVersion) return true
|
83
83
|
const canCheckSourceAgainstProject = (this.latestSourceVersion && this.projectVersion)
|
84
84
|
if (!canCheckSourceAgainstProject) return null
|
85
85
|
const isLatestVersion = (this.projectVersion === this.latestSourceVersion)
|
@@ -104,6 +104,14 @@ export default class Plugin {
|
|
104
104
|
return (this._projectInfo?.version || null)
|
105
105
|
}
|
106
106
|
|
107
|
+
/**
|
108
|
+
* the required framework version from the source package json
|
109
|
+
* @returns {string|null}
|
110
|
+
*/
|
111
|
+
get frameworkVersion () {
|
112
|
+
return (this._sourceInfo?.framework || null)
|
113
|
+
}
|
114
|
+
|
107
115
|
/**
|
108
116
|
* a list of tags denoting the source versions of the plugin
|
109
117
|
* @returns {[string]}
|
@@ -293,7 +301,7 @@ export default class Plugin {
|
|
293
301
|
|
294
302
|
// check if the latest version is compatible
|
295
303
|
const satisfiesConstraint = !this.hasValidRequestVersion || semver.satisfies(this._sourceInfo.version, this.requestedVersion, semverOptions)
|
296
|
-
const satisfiesFramework = semver.satisfies(framework, this.
|
304
|
+
const satisfiesFramework = semver.satisfies(framework, this.frameworkVersion, semverOptions)
|
297
305
|
if (!this.latestCompatibleSourceVersion && satisfiesFramework) this.latestCompatibleSourceVersion = this.latestSourceVersion
|
298
306
|
if (satisfiesConstraint && satisfiesFramework) {
|
299
307
|
return this.latestSourceVersion
|
@@ -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
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
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
|
}
|
@@ -165,7 +165,7 @@ async function conflictResolution ({ logger, targets, isInteractive }) {
|
|
165
165
|
}
|
166
166
|
const preFilteredPlugins = targets.filter(target => !target.isLocalSource)
|
167
167
|
const allQuestions = [
|
168
|
-
add(preFilteredPlugins.filter(target => !target.hasFrameworkCompatibleVersion), 'There is no compatible version of the following plugins:', checkVersion),
|
168
|
+
add(preFilteredPlugins.filter(target => !target.hasFrameworkCompatibleVersion && target.latestSourceVersion), 'There is no compatible version of the following plugins:', checkVersion),
|
169
169
|
add(preFilteredPlugins.filter(target => target.hasFrameworkCompatibleVersion && !target.hasValidRequestVersion), 'The version requested is invalid, there are newer compatible versions of the following plugins:', checkVersion),
|
170
170
|
add(preFilteredPlugins.filter(target => target.hasFrameworkCompatibleVersion && target.hasValidRequestVersion && !target.isApplyLatestCompatibleVersion), 'There are newer compatible versions of the following plugins:', checkVersion)
|
171
171
|
].filter(Boolean)
|