cordova-fetch 4.0.1-nightly.20240415021844963.sha.4d5820de → 4.0.1-nightly.20240416000714364.sha.63476a4e
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +16 -10
- package/package.json +6 -8
package/index.js
CHANGED
@@ -16,19 +16,25 @@
|
|
16
16
|
*/
|
17
17
|
|
18
18
|
const execa = require('execa');
|
19
|
-
const pify = require('pify');
|
20
19
|
const which = require('which');
|
21
|
-
const path = require('path');
|
22
|
-
const fs = require('fs
|
20
|
+
const path = require('node:path');
|
21
|
+
const fs = require('node:fs/promises');
|
23
22
|
const { CordovaError, events } = require('cordova-common');
|
24
23
|
const npa = require('npm-package-arg');
|
25
24
|
const pacote = require('pacote');
|
26
25
|
const semver = require('semver');
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
function resolvePackage (...args) {
|
28
|
+
return new Promise((resolve, reject) => {
|
29
|
+
require('resolve')(...args, (err, ...result) => {
|
30
|
+
if (err) {
|
31
|
+
reject(err);
|
32
|
+
} else {
|
33
|
+
resolve(result);
|
34
|
+
}
|
35
|
+
});
|
36
|
+
});
|
37
|
+
}
|
32
38
|
|
33
39
|
/**
|
34
40
|
* Installs a module from npm, a git url or the local file system.
|
@@ -47,7 +53,7 @@ module.exports = async function (target, dest, opts = {}) {
|
|
47
53
|
}
|
48
54
|
|
49
55
|
// Create dest if it doesn't exist yet
|
50
|
-
fs.
|
56
|
+
await fs.mkdir(dest, { recursive: true });
|
51
57
|
|
52
58
|
// First try to determine the name from the spec using npa. This is very cheap.
|
53
59
|
let { name, rawSpec } = npa(target, dest);
|
@@ -83,7 +89,7 @@ async function installPackage (target, dest, opts) {
|
|
83
89
|
await isNpmInstalled();
|
84
90
|
|
85
91
|
// Ensure that `npm` installs to `dest` and not any of its ancestors
|
86
|
-
await fs.
|
92
|
+
await fs.mkdir(path.join(dest, 'node_modules'), { recursive: true });
|
87
93
|
|
88
94
|
// Run `npm` to install requested package
|
89
95
|
const args = npmArgs(target, opts);
|
@@ -114,7 +120,7 @@ async function resolvePathToPackage (name, basedir) {
|
|
114
120
|
|
115
121
|
// We resolve the path to the module's package.json to avoid getting the
|
116
122
|
// path to `main` which could be located anywhere in the package
|
117
|
-
const [pkgJsonPath, pkgJson] = await
|
123
|
+
const [pkgJsonPath, pkgJson] = await resolvePackage(`${name}/package.json`, { paths, basedir });
|
118
124
|
|
119
125
|
return [path.dirname(pkgJsonPath), pkgJson];
|
120
126
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cordova-fetch",
|
3
|
-
"version": "4.0.1-nightly.
|
3
|
+
"version": "4.0.1-nightly.20240416000714364.sha.63476a4e",
|
4
4
|
"description": "Apache Cordova fetch module. Fetches from git and npm.",
|
5
5
|
"main": "index.js",
|
6
6
|
"repository": "github:apache/cordova-fetch",
|
@@ -15,16 +15,14 @@
|
|
15
15
|
"author": "Apache Software Foundation",
|
16
16
|
"license": "Apache-2.0",
|
17
17
|
"dependencies": {
|
18
|
-
"@npmcli/arborist": "^
|
19
|
-
"cordova-common": "5.0.1-nightly.
|
18
|
+
"@npmcli/arborist": "^7.4.0",
|
19
|
+
"cordova-common": "5.0.1-nightly.20240416000714364.sha.0901c1dc",
|
20
20
|
"execa": "^5.1.1",
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"pacote": "^15.1.1",
|
24
|
-
"pify": "^5.0.0",
|
21
|
+
"npm-package-arg": "^11.0.1",
|
22
|
+
"pacote": "^17.0.6",
|
25
23
|
"resolve": "^1.22.1",
|
26
24
|
"semver": "^7.3.8",
|
27
|
-
"which": "^
|
25
|
+
"which": "^4.0.0"
|
28
26
|
},
|
29
27
|
"devDependencies": {
|
30
28
|
"@cordova/eslint-config": "^5.0.0",
|