node-semvers 1.1.0 → 1.2.0
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/assets/postinstall.cjs +45 -0
- package/package.json +2 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('exit'), require('fetch-json-cache'), require('path'), require('url')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exit', 'fetch-json-cache', 'path', 'url'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tsdsBuild = factory(global.exit, global.Cache, global.path, global.url));
|
|
5
|
+
})(this, (function (exit, Cache, path, url) { 'use strict';
|
|
6
|
+
|
|
7
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
|
+
function packageRoot(dir, packageName) {
|
|
9
|
+
if (path.basename(dir) === packageName) return dir;
|
|
10
|
+
var nextDir = path.dirname(dir);
|
|
11
|
+
if (nextDir === dir) throw new Error("".concat(packageName, " not found"));
|
|
12
|
+
return packageRoot(nextDir, packageName);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var __dirname = path.dirname(typeof __filename !== 'undefined' ? __filename : url.fileURLToPath((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('postinstall.cjs', document.baseURI).href))));
|
|
16
|
+
var root = packageRoot(__dirname, 'node-semvers');
|
|
17
|
+
var constants = {
|
|
18
|
+
CACHE_DIRECTORY: path.resolve(path.join(root, '.cache')),
|
|
19
|
+
DISTS_URL: 'https://nodejs.org/dist/index.json',
|
|
20
|
+
SCHEDULES_URL: 'https://raw.githubusercontent.com/nodejs/Release/master/schedule.json'
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function postinstall() {
|
|
24
|
+
var cacheJSON = function cacheJSON(callback) {
|
|
25
|
+
cache.get(constants.DISTS_URL, {
|
|
26
|
+
force: true
|
|
27
|
+
}, function(err) {
|
|
28
|
+
err ? callback(err) : cache.get(constants.SCHEDULES_URL, {
|
|
29
|
+
force: true
|
|
30
|
+
}, callback);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
var cache = new Cache(constants.CACHE_DIRECTORY);
|
|
34
|
+
cacheJSON(function(err) {
|
|
35
|
+
if (err) {
|
|
36
|
+
console.log("Failed to cache dists and schedules. Error: ".concat(err.message));
|
|
37
|
+
return exit(err.code || -1);
|
|
38
|
+
}
|
|
39
|
+
exit(0);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return postinstall;
|
|
44
|
+
|
|
45
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-semvers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Utilities for managing versions of node including looking up codenames",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|
|
37
37
|
"bin",
|
|
38
|
+
"assets",
|
|
38
39
|
"scripts"
|
|
39
40
|
],
|
|
40
41
|
"scripts": {
|