zarro 1.165.2 → 1.165.6
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/gulp-tasks/modules/fetch-github-release/dist-copy/constants.d.ts +2 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/constants.js +10 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/fetchRelease.d.ts +22 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/fetchRelease.js +123 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/getAssetDefault.d.ts +2 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/getAssetDefault.js +34 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/index.d.ts +2 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/index.js +18 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/isUpdateAvailable.d.ts +99 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/isUpdateAvailable.js +50 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/types.d.ts +14 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/types.js +2 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/util.d.ts +3 -0
- package/gulp-tasks/modules/fetch-github-release/dist-copy/util.js +39 -0
- package/gulp-tasks/modules/fetch-github-release.js +15 -5
- package/package.json +9 -2
- package/gulp-tasks/modules/fetch-github-release/.editorconfig +0 -10
- package/gulp-tasks/modules/fetch-github-release/.gitattributes +0 -1
- package/gulp-tasks/modules/fetch-github-release/.github/.kodiak.toml +0 -1
- package/gulp-tasks/modules/fetch-github-release/.github/workflows/release-please.yml +0 -26
- package/gulp-tasks/modules/fetch-github-release/.github/workflows/test.yml +0 -26
- package/gulp-tasks/modules/fetch-github-release/.prettierrc.json +0 -7
- package/gulp-tasks/modules/fetch-github-release/CHANGELOG.md +0 -8
- package/gulp-tasks/modules/fetch-github-release/package-lock.json +0 -12412
- package/gulp-tasks/modules/fetch-github-release/package.json +0 -78
- package/gulp-tasks/modules/fetch-github-release/renovate.json5 +0 -19
- package/gulp-tasks/modules/fetch-github-release/src/__tests__/index.ts +0 -51
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PACKAGE_DATA_DIR = exports.PACKAGE_NAME = void 0;
|
|
7
|
+
const os_1 = __importDefault(require("os"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
exports.PACKAGE_NAME = 'fetch-github-release';
|
|
10
|
+
exports.PACKAGE_DATA_DIR = path_1.default.join(os_1.default.homedir(), `.${exports.PACKAGE_NAME}`);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OctokitRelease, OctokitReleaseAssets, RepoInfo } from './types';
|
|
2
|
+
export interface FetchReleaseOptions extends RepoInfo {
|
|
3
|
+
getRelease: (owner: string, repo: string) => Promise<OctokitRelease>;
|
|
4
|
+
getAsset?: (version: string, assets: OctokitReleaseAssets) => OctokitReleaseAssets[number] | undefined;
|
|
5
|
+
accessToken?: string;
|
|
6
|
+
destination?: string;
|
|
7
|
+
shouldExtract?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Downloads and extract release for the specified tag from Github to the destination.
|
|
11
|
+
*
|
|
12
|
+
* await fetchLatestRelease({ owner: 'smallstep', repo: 'cli', tag: '1.0.0' })
|
|
13
|
+
*/
|
|
14
|
+
export declare function fetchReleaseByTag(options: Omit<FetchReleaseOptions, 'getRelease'> & {
|
|
15
|
+
tag: string;
|
|
16
|
+
}): Promise<string[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Downloads and extract latest release from Github to the destination.
|
|
19
|
+
*
|
|
20
|
+
* await fetchLatestRelease({ owner: 'smallstep', repo: 'cli' })
|
|
21
|
+
*/
|
|
22
|
+
export declare function fetchLatestRelease(options: Omit<FetchReleaseOptions, 'getRelease'>): Promise<string[]>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.fetchLatestRelease = exports.fetchReleaseByTag = void 0;
|
|
16
|
+
const yafs_1 = require("yafs");
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const rest_1 = require("@octokit/rest");
|
|
19
|
+
const decompress_1 = __importDefault(require("decompress"));
|
|
20
|
+
const bent = require("bent");
|
|
21
|
+
const constants_1 = require("./constants");
|
|
22
|
+
const util_1 = require("./util");
|
|
23
|
+
const getAssetDefault_1 = require("./getAssetDefault");
|
|
24
|
+
function determineFilenameFrom(response) {
|
|
25
|
+
const contentDisposition = response.headers["content-disposition"];
|
|
26
|
+
if (!contentDisposition) {
|
|
27
|
+
// guess? shouldn't get here from GH queries...
|
|
28
|
+
return fallback();
|
|
29
|
+
}
|
|
30
|
+
const parts = contentDisposition.split(";").map(s => s.trim());
|
|
31
|
+
for (const part of parts) {
|
|
32
|
+
let match = part.match(/^filename=(?<filename>.+)/i);
|
|
33
|
+
if (match && match.groups) {
|
|
34
|
+
const filename = match.groups["filename"];
|
|
35
|
+
if (filename) {
|
|
36
|
+
return filename;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return fallback();
|
|
41
|
+
function fallback() {
|
|
42
|
+
console.warn(`Unable to determine filename from request, falling back on release.zip`);
|
|
43
|
+
return "release.zip";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function download(url, destination) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const fetch = bent(url);
|
|
49
|
+
try {
|
|
50
|
+
const response = yield fetch();
|
|
51
|
+
const data = yield response.arrayBuffer();
|
|
52
|
+
const filename = determineFilenameFrom(response);
|
|
53
|
+
yield (0, yafs_1.writeFile)(path_1.default.join(destination, filename), data);
|
|
54
|
+
return determineFilenameFrom(response);
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
const err = e;
|
|
58
|
+
if (err.statusCode === undefined) {
|
|
59
|
+
throw err;
|
|
60
|
+
}
|
|
61
|
+
if (err.statusCode === 301 || err.statusCode === 302) {
|
|
62
|
+
const next = err.headers["location"];
|
|
63
|
+
if (!next) {
|
|
64
|
+
throw new Error(`No location provided for http response ${err.statusCode}`);
|
|
65
|
+
}
|
|
66
|
+
return download(next, destination);
|
|
67
|
+
}
|
|
68
|
+
throw err;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function fetchRelease(options) {
|
|
73
|
+
var _a;
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const { owner, repo, getRelease, getAsset = getAssetDefault_1.getAssetDefault, destination = constants_1.PACKAGE_DATA_DIR, shouldExtract = true, } = options;
|
|
76
|
+
if (!owner) {
|
|
77
|
+
throw new Error('Required "owner" option is missing');
|
|
78
|
+
}
|
|
79
|
+
if (!repo) {
|
|
80
|
+
throw new Error('Required "repo" option is missing');
|
|
81
|
+
}
|
|
82
|
+
const { data: { assets, tag_name: version }, } = yield getRelease(owner, repo);
|
|
83
|
+
const downloadUrl = (_a = getAsset(version, assets)) === null || _a === void 0 ? void 0 : _a.browser_download_url;
|
|
84
|
+
if (!downloadUrl) {
|
|
85
|
+
throw new Error('Unable to find download URL');
|
|
86
|
+
}
|
|
87
|
+
yield (0, util_1.ensureDirExist)(destination);
|
|
88
|
+
const filename = yield download(downloadUrl, destination);
|
|
89
|
+
const downloadPath = path_1.default.join(destination, filename);
|
|
90
|
+
if (shouldExtract) {
|
|
91
|
+
const files = yield (0, decompress_1.default)(downloadPath, destination);
|
|
92
|
+
yield (0, yafs_1.rm)(downloadPath);
|
|
93
|
+
return files.map((file) => path_1.default.join(destination, file.path));
|
|
94
|
+
}
|
|
95
|
+
return [downloadPath];
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Downloads and extract release for the specified tag from Github to the destination.
|
|
100
|
+
*
|
|
101
|
+
* await fetchLatestRelease({ owner: 'smallstep', repo: 'cli', tag: '1.0.0' })
|
|
102
|
+
*/
|
|
103
|
+
function fetchReleaseByTag(options) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
return fetchRelease(Object.assign(Object.assign({}, options), { getRelease: (owner, repo) => new rest_1.Octokit({ auth: options.accessToken }).repos.getReleaseByTag({
|
|
106
|
+
owner,
|
|
107
|
+
repo,
|
|
108
|
+
tag: options.tag,
|
|
109
|
+
}) }));
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
exports.fetchReleaseByTag = fetchReleaseByTag;
|
|
113
|
+
/**
|
|
114
|
+
* Downloads and extract latest release from Github to the destination.
|
|
115
|
+
*
|
|
116
|
+
* await fetchLatestRelease({ owner: 'smallstep', repo: 'cli' })
|
|
117
|
+
*/
|
|
118
|
+
function fetchLatestRelease(options) {
|
|
119
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
return fetchRelease(Object.assign(Object.assign({}, options), { getRelease: (owner, repo) => new rest_1.Octokit({ auth: options.accessToken }).repos.getLatestRelease({ owner, repo }) }));
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
exports.fetchLatestRelease = fetchLatestRelease;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAssetDefault = void 0;
|
|
4
|
+
function getPlatformIdentifier() {
|
|
5
|
+
switch (process.platform) {
|
|
6
|
+
case 'win32':
|
|
7
|
+
return { platform: 'windows', arch: 'amd64' };
|
|
8
|
+
case 'linux':
|
|
9
|
+
if (process.arch === 'arm64') {
|
|
10
|
+
return { platform: 'linux', arch: 'arm64' };
|
|
11
|
+
}
|
|
12
|
+
if (process.arch === 'arm') {
|
|
13
|
+
return { platform: 'linux', arch: 'arm' };
|
|
14
|
+
}
|
|
15
|
+
return { platform: 'linux', arch: 'amd64' };
|
|
16
|
+
case 'darwin':
|
|
17
|
+
return { platform: 'darwin', arch: 'amd64' };
|
|
18
|
+
default:
|
|
19
|
+
throw new Error('Unsupported platform');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function getAssetDefault(version, assets) {
|
|
23
|
+
const { platform, arch } = getPlatformIdentifier();
|
|
24
|
+
const platformAssets = assets.filter((asset) => asset.name.includes(platform));
|
|
25
|
+
if (platformAssets.length === 1) {
|
|
26
|
+
return platformAssets[0];
|
|
27
|
+
}
|
|
28
|
+
const archAsset = platformAssets.find((asset) => asset.name.includes(arch));
|
|
29
|
+
if (!archAsset) {
|
|
30
|
+
throw new Error(`Unable to find release for platform: ${platform} and arch: ${arch}`);
|
|
31
|
+
}
|
|
32
|
+
return archAsset;
|
|
33
|
+
}
|
|
34
|
+
exports.getAssetDefault = getAssetDefault;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./fetchRelease"), exports);
|
|
18
|
+
__exportStar(require("./isUpdateAvailable"), exports);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { RepoInfo } from "./types";
|
|
2
|
+
interface IsUpdateAvailableOptions extends RepoInfo {
|
|
3
|
+
currentVersion: string;
|
|
4
|
+
accessToken?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function isUpdateAvailable(options: IsUpdateAvailableOptions): Promise<boolean>;
|
|
7
|
+
export interface FetchLatestReleaseOptions extends RepoInfo {
|
|
8
|
+
accessToken?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FetchLatestReleaseResult {
|
|
11
|
+
url: string;
|
|
12
|
+
id: number;
|
|
13
|
+
assets: any[];
|
|
14
|
+
name: string | null;
|
|
15
|
+
body?: string | null;
|
|
16
|
+
assets_url: string;
|
|
17
|
+
author: string;
|
|
18
|
+
body_html: string;
|
|
19
|
+
body_text: string;
|
|
20
|
+
created_at: string;
|
|
21
|
+
discussion_url: string;
|
|
22
|
+
draft: boolean;
|
|
23
|
+
html_url: string;
|
|
24
|
+
mentions_count: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function fetchLatestReleaseInfo(opts: ListReleasesOptions): Promise<ReleaseInfo>;
|
|
27
|
+
export interface ListReleasesOptions extends RepoInfo {
|
|
28
|
+
accessToken?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface AuthorInfo {
|
|
31
|
+
login: string;
|
|
32
|
+
id: number;
|
|
33
|
+
node_id: string;
|
|
34
|
+
avatar_url: string;
|
|
35
|
+
gravatar_id: string;
|
|
36
|
+
url: string;
|
|
37
|
+
html_url: string;
|
|
38
|
+
followers_url: string;
|
|
39
|
+
following_url: string;
|
|
40
|
+
gists_url: string;
|
|
41
|
+
starred_url: string;
|
|
42
|
+
subscriptions_url: string;
|
|
43
|
+
organizations_url: string;
|
|
44
|
+
repos_url: string;
|
|
45
|
+
events_url: string;
|
|
46
|
+
received_events_url: string;
|
|
47
|
+
type: string;
|
|
48
|
+
site_admin: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface ReleaseAsset {
|
|
51
|
+
url: string;
|
|
52
|
+
id: number;
|
|
53
|
+
node_id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
label: string;
|
|
56
|
+
uploader: AuthorInfo;
|
|
57
|
+
content_type: string;
|
|
58
|
+
state: string;
|
|
59
|
+
size: number;
|
|
60
|
+
download_count: number;
|
|
61
|
+
created_at: string;
|
|
62
|
+
updated_at: string;
|
|
63
|
+
browser_download_url: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ReleaseReactions {
|
|
66
|
+
url: string;
|
|
67
|
+
total_count: number;
|
|
68
|
+
"+1": number;
|
|
69
|
+
"-1": number;
|
|
70
|
+
laugh: number;
|
|
71
|
+
hooray: number;
|
|
72
|
+
confused: number;
|
|
73
|
+
heart: number;
|
|
74
|
+
rocket: number;
|
|
75
|
+
eyes: number;
|
|
76
|
+
}
|
|
77
|
+
export interface ReleaseInfo {
|
|
78
|
+
url: string;
|
|
79
|
+
assets_url: string;
|
|
80
|
+
upload_url: string;
|
|
81
|
+
html_url: string;
|
|
82
|
+
author: AuthorInfo;
|
|
83
|
+
node_id: string;
|
|
84
|
+
tag_name: string;
|
|
85
|
+
tag_commitish?: string;
|
|
86
|
+
name: string;
|
|
87
|
+
draft: boolean;
|
|
88
|
+
prerelease: boolean;
|
|
89
|
+
created_at: string;
|
|
90
|
+
published_at: string;
|
|
91
|
+
assets: ReleaseAsset[];
|
|
92
|
+
tarball_url: string;
|
|
93
|
+
zipball_url: string;
|
|
94
|
+
body: string;
|
|
95
|
+
reactions: ReleaseReactions;
|
|
96
|
+
}
|
|
97
|
+
export declare function listReleases(opts: ListReleasesOptions): Promise<ReleaseInfo[]>;
|
|
98
|
+
export declare function newerVersion(latestVersion: string, currentVersion: string): boolean;
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.newerVersion = exports.listReleases = exports.fetchLatestReleaseInfo = exports.isUpdateAvailable = void 0;
|
|
13
|
+
const rest_1 = require("@octokit/rest");
|
|
14
|
+
const semver_1 = require("semver");
|
|
15
|
+
function isUpdateAvailable(options) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const { repo, owner, currentVersion, accessToken } = options;
|
|
18
|
+
const { data: { tag_name: latestVersion }, } = yield new rest_1.Octokit({ auth: accessToken }).repos.getLatestRelease({ owner, repo });
|
|
19
|
+
return newerVersion(latestVersion, currentVersion);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
exports.isUpdateAvailable = isUpdateAvailable;
|
|
23
|
+
function fetchLatestReleaseInfo(opts) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const { repo, owner, accessToken } = opts;
|
|
26
|
+
const result = yield new rest_1.Octokit({ auth: accessToken }).repos.getLatestRelease({ owner, repo });
|
|
27
|
+
return result.data;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.fetchLatestReleaseInfo = fetchLatestReleaseInfo;
|
|
31
|
+
function listReleases(opts) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const { repo, owner, accessToken } = opts;
|
|
34
|
+
const result = yield new rest_1.Octokit({ auth: accessToken }).repos.listReleases({ owner, repo });
|
|
35
|
+
return result.data;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
exports.listReleases = listReleases;
|
|
39
|
+
function newerVersion(latestVersion, currentVersion) {
|
|
40
|
+
if (!latestVersion) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (!currentVersion) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
const normalizedLatestVersion = latestVersion.replace(/^v/, "");
|
|
47
|
+
const normalizedCurrentVersion = currentVersion.replace(/^v/, "");
|
|
48
|
+
return (0, semver_1.gt)(normalizedLatestVersion, normalizedCurrentVersion);
|
|
49
|
+
}
|
|
50
|
+
exports.newerVersion = newerVersion;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RestEndpointMethodTypes } from '@octokit/rest';
|
|
2
|
+
export type OctokitRelease = RestEndpointMethodTypes['repos']['getLatestRelease']['response'];
|
|
3
|
+
export type OctokitReleaseAssets = OctokitRelease['data']['assets'];
|
|
4
|
+
export interface Release {
|
|
5
|
+
repository: string;
|
|
6
|
+
package: string;
|
|
7
|
+
destination: string;
|
|
8
|
+
version: string;
|
|
9
|
+
extract: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface RepoInfo {
|
|
12
|
+
owner: string;
|
|
13
|
+
repo: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ensureDirExist = exports.mkdir = exports.exists = void 0;
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const exists = (filePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
try {
|
|
20
|
+
yield fs_1.default.promises.access(filePath);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
catch (_a) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
exports.exists = exists;
|
|
28
|
+
const mkdir = (dirname) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
const isExist = yield (0, exports.exists)(dirname);
|
|
30
|
+
if (!isExist) {
|
|
31
|
+
yield fs_1.default.promises.mkdir(dirname, { recursive: true });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
exports.mkdir = mkdir;
|
|
35
|
+
const ensureDirExist = (filePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
const dirname = path_1.default.dirname(filePath);
|
|
37
|
+
yield (0, exports.mkdir)(dirname);
|
|
38
|
+
});
|
|
39
|
+
exports.ensureDirExist = ensureDirExist;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(async function () {
|
|
3
3
|
requireModule("fetch");
|
|
4
|
-
const path = require("path"), { folderExistsSync } = require("yafs")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const path = require("path"), { folderExistsSync } = require("yafs"),
|
|
5
|
+
// ideally, during dev, we want fresh src files
|
|
6
|
+
// but the build produces a dist folder with
|
|
7
|
+
// js artifacts, which also work - but npm
|
|
8
|
+
// refuses to pack them, and I haven't figured out
|
|
9
|
+
// why; so another process should create dist-copy
|
|
10
|
+
// specifically for packing purposes
|
|
11
|
+
search = ["src", "dist", "dist-copy"];
|
|
12
|
+
for (const item of search) {
|
|
13
|
+
const seek = path.join(__dirname, "fetch-github-release", item);
|
|
14
|
+
if (folderExistsSync(seek)) {
|
|
15
|
+
module.exports = require(seek);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
9
19
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zarro",
|
|
3
|
-
"version": "1.165.
|
|
3
|
+
"version": "1.165.6",
|
|
4
4
|
"description": "Some glue to make gulp easier, perhaps even zero- or close-to-zero-conf",
|
|
5
5
|
"bin": {
|
|
6
6
|
"zarro": "./index.js"
|
|
@@ -39,6 +39,9 @@
|
|
|
39
39
|
"build-zarro": "tsc",
|
|
40
40
|
"prebuild-fetch-github-release": "rimraf gulp-tasks/modules/fetch-github-release/dist",
|
|
41
41
|
"build-fetch-github-release": "tsc -p gulp-tasks/modules/fetch-github-release/tsconfig.json",
|
|
42
|
+
"postbuild-fetch-github-release": "run-s delete-fetch-github-release-dist-shadow shadow-fetch-github-release-dist",
|
|
43
|
+
"delete-fetch-github-release-dist-shadow": "rimraf gulp-tasks/modules/fetch-github-release/dist-copy",
|
|
44
|
+
"shadow-fetch-github-release-dist": "cpy gulp-tasks/modules/fetch-github-release/dist/*.* gulp-tasks/modules/fetch-github-release/dist-copy/",
|
|
42
45
|
"gulp": "gulp",
|
|
43
46
|
"test-npm-gulp-task": "echo \"this is a test\"",
|
|
44
47
|
"verify-up-to-date": "run-s \"zarro -- verify-up-to-date\"",
|
|
@@ -91,7 +94,10 @@
|
|
|
91
94
|
},
|
|
92
95
|
"files": [
|
|
93
96
|
"gulp-tasks/**/*.js",
|
|
94
|
-
"gulp-tasks/modules/fetch-github-release
|
|
97
|
+
"gulp-tasks/modules/fetch-github-release/dist-copy/*.js",
|
|
98
|
+
"gulp-tasks/modules/fetch-github-release/dist-copy/*.d.ts",
|
|
99
|
+
"gulp-tasks/modules/fetch-github-release/src/*.ts",
|
|
100
|
+
"gulp-tasks/modules/fetch-github-release/src/*.js",
|
|
95
101
|
"index-modules/**/*.js",
|
|
96
102
|
"types.d.ts",
|
|
97
103
|
"tsconfig.json"
|
|
@@ -118,6 +124,7 @@
|
|
|
118
124
|
"@types/xml2js": "^0.4.8",
|
|
119
125
|
"@types/yargs": "^15.0.13",
|
|
120
126
|
"console-cls": "^1.2.2",
|
|
127
|
+
"cpy-cli": "^5.0.0",
|
|
121
128
|
"debugger-is-attached": "^1.2.0",
|
|
122
129
|
"expect-even-more-jest": "^1.15.0",
|
|
123
130
|
"filesystem-sandbox": "^1.20.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
* text=auto eol=lf
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = 1
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: release-please
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- main
|
|
6
|
-
jobs:
|
|
7
|
-
release-please:
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
steps:
|
|
10
|
-
- uses: GoogleCloudPlatform/release-please-action@v2
|
|
11
|
-
id: release
|
|
12
|
-
with:
|
|
13
|
-
release-type: node
|
|
14
|
-
package-name: 'fetch-github-release'
|
|
15
|
-
- uses: actions/checkout@v2
|
|
16
|
-
if: ${{ steps.release.outputs.release_created }}
|
|
17
|
-
- uses: actions/setup-node@v2
|
|
18
|
-
with:
|
|
19
|
-
node-version: '*'
|
|
20
|
-
check-latest: true
|
|
21
|
-
registry-url: 'https://registry.npmjs.org'
|
|
22
|
-
if: ${{ steps.release.outputs.release_created }}
|
|
23
|
-
- run: npm publish
|
|
24
|
-
if: ${{ steps.release.outputs.release_created }}
|
|
25
|
-
env:
|
|
26
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: Test
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches: [main]
|
|
5
|
-
pull_request:
|
|
6
|
-
branches: [main]
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
timeout-minutes: 15
|
|
11
|
-
steps:
|
|
12
|
-
- name: Git checkout
|
|
13
|
-
uses: actions/checkout@v2
|
|
14
|
-
- name: Setup Node.js
|
|
15
|
-
uses: actions/setup-node@v2
|
|
16
|
-
with:
|
|
17
|
-
node-version: 16
|
|
18
|
-
check-latest: true
|
|
19
|
-
- name: Install dependencies
|
|
20
|
-
run: npm ci
|
|
21
|
-
- name: Linting
|
|
22
|
-
run: npm run format:ci
|
|
23
|
-
- name: Building
|
|
24
|
-
run: npm run build
|
|
25
|
-
- name: Tests
|
|
26
|
-
run: npm run test
|