Merge branch 'master' of github.com:ethers-io/ethers.js
This commit is contained in:
commit
6e36447aa0
@ -28,6 +28,7 @@ const npm = __importStar(require("../npm"));
|
||||
const utils_1 = require("../utils");
|
||||
(function () {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const common = utils_1.loadJson(path_1.resolve("package.json")).common;
|
||||
const progress = log_1.getProgressBar(log_1.colorify.bold("Bumping package.json versions"));
|
||||
const latestVersions = {};
|
||||
let updated = false;
|
||||
@ -36,6 +37,9 @@ const utils_1 = require("../utils");
|
||||
for (let i = 0; i < path_1.dirnames.length; i++) {
|
||||
progress(i / path_1.dirnames.length);
|
||||
const dirname = path_1.dirnames[i];
|
||||
const packageJsonPath = path_1.getPackageJsonPath(dirname);
|
||||
// Set the common elements to the package.json
|
||||
local.updateJson(packageJsonPath, common, true);
|
||||
const pLocal = local.getPackage(dirname);
|
||||
const pNpm = yield npm.getPackage(dirname);
|
||||
const tarballHash = local.computeTarballHash(dirname);
|
||||
@ -50,7 +54,7 @@ const utils_1 = require("../utils");
|
||||
log_1.colorify.bold(" => "),
|
||||
log_1.colorify.green(version)
|
||||
].join(""));
|
||||
local.updateJson(path_1.getPackageJsonPath(dirname), { gitHead: undefined, tarballHash, version }, true);
|
||||
local.updateJson(packageJsonPath, { gitHead: undefined, tarballHash, version }, true);
|
||||
updated = true;
|
||||
}
|
||||
latestVersions[pLocal.name] = version;
|
||||
|
1
misc/admin/lib/cmds/get-config.d.ts
vendored
Normal file
1
misc/admin/lib/cmds/get-config.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
26
misc/admin/lib/cmds/get-config.js
Normal file
26
misc/admin/lib/cmds/get-config.js
Normal file
@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const config_1 = require("../config");
|
||||
if (process.argv.length !== 3) {
|
||||
console.log("Usage: get-config KEY");
|
||||
process.exit(1);
|
||||
}
|
||||
const key = process.argv[2];
|
||||
(function () {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const value = yield config_1.config.get(key);
|
||||
console.log(value);
|
||||
});
|
||||
})().catch((error) => {
|
||||
console.log(`Error running ${process.argv[0]}: ${error.message}`);
|
||||
process.exit(1);
|
||||
});
|
@ -19,8 +19,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const aws_sdk_1 = __importDefault(require("aws-sdk"));
|
||||
const { createHash } = require("crypto");
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const aws_sdk_1 = __importDefault(require("aws-sdk"));
|
||||
const changelog_1 = require("../changelog");
|
||||
const config_1 = require("../config");
|
||||
const depgraph_1 = require("../depgraph");
|
||||
@ -153,16 +154,29 @@ exports.invalidate = invalidate;
|
||||
// The password above already succeeded
|
||||
const username = yield config_1.config.get("github-user");
|
||||
const password = yield config_1.config.get("github-release");
|
||||
const hash = createHash("sha384").update(fs_1.default.readFileSync(path_1.resolve("packages/ethers/dist/ethers.umd.min.js"))).digest("base64");
|
||||
const gitCommit = yield git_1.getGitTag(path_1.resolve("CHANGELOG.md"));
|
||||
let content = change.content.trim();
|
||||
content += '\n\n----\n\n';
|
||||
content += '**Embedding UMD with [SRI](https:/\/developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity):**\n';
|
||||
content += '```html\n';
|
||||
content += '<script type="text/javascript"\n';
|
||||
content += ` integrity="sha384-${hash}"\n`;
|
||||
content += ' crossorigin="anonymous"\n';
|
||||
content += ` src="https:/\/cdn-cors.ethers.io/lib/ethers-${change.version.substring(1)}.umd.min.js">\n`;
|
||||
content += '</script>\n';
|
||||
content += '```';
|
||||
// Publish the release
|
||||
const beta = false;
|
||||
const link = yield github_1.createRelease(username, password, change.version, change.title, change.content, beta, gitCommit);
|
||||
const link = yield github_1.createRelease(username, password, change.version, change.title, content, beta, gitCommit);
|
||||
console.log(`${log_1.colorify.bold("Published release:")} ${link}`);
|
||||
}
|
||||
// Upload libs to the CDN (as ethers-v5.0 and ethers-5.0.x)
|
||||
{
|
||||
const bucketName = yield config_1.config.get("aws-upload-scripts-bucket");
|
||||
const originRoot = yield config_1.config.get("aws-upload-scripts-root");
|
||||
const bucketNameLib = yield config_1.config.get("aws-upload-scripts-bucket");
|
||||
const originRootLib = yield config_1.config.get("aws-upload-scripts-root");
|
||||
const bucketNameCors = yield config_1.config.get("aws-upload-scripts-bucket-cors");
|
||||
const originRootCors = yield config_1.config.get("aws-upload-scripts-root-cors");
|
||||
const s3 = new aws_sdk_1.default.S3({
|
||||
apiVersion: '2006-03-01',
|
||||
accessKeyId: awsAccessId,
|
||||
@ -170,13 +184,49 @@ exports.invalidate = invalidate;
|
||||
});
|
||||
// Upload the libs to ethers-v5.0 and ethers-5.0.x
|
||||
const fileInfos = [
|
||||
{ filename: "packages/ethers/dist/ethers.esm.min.js", key: `ethers-${change.version.substring(1)}.esm.min.js` },
|
||||
{ filename: "packages/ethers/dist/ethers.umd.min.js", key: `ethers-${change.version.substring(1)}.umd.min.js` },
|
||||
{ filename: "packages/ethers/dist/ethers.esm.min.js", key: "ethers-5.0.esm.min.js" },
|
||||
{ filename: "packages/ethers/dist/ethers.umd.min.js", key: "ethers-5.0.umd.min.js" },
|
||||
// The CORS-enabled versions on cdn-cors.ethers.io
|
||||
{
|
||||
bucketName: bucketNameCors,
|
||||
originRoot: originRootCors,
|
||||
suffix: "-cors",
|
||||
filename: "packages/ethers/dist/ethers.esm.min.js",
|
||||
key: `ethers-${change.version.substring(1)}.esm.min.js`
|
||||
},
|
||||
{
|
||||
bucketName: bucketNameCors,
|
||||
originRoot: originRootCors,
|
||||
suffix: "-cors",
|
||||
filename: "packages/ethers/dist/ethers.umd.min.js",
|
||||
key: `ethers-${change.version.substring(1)}.umd.min.js`
|
||||
},
|
||||
// The non-CORS-enabled versions on cdn.ethers.io
|
||||
{
|
||||
bucketName: bucketNameLib,
|
||||
originRoot: originRootLib,
|
||||
filename: "packages/ethers/dist/ethers.esm.min.js",
|
||||
key: `ethers-${change.version.substring(1)}.esm.min.js`
|
||||
},
|
||||
{
|
||||
bucketName: bucketNameLib,
|
||||
originRoot: originRootLib,
|
||||
filename: "packages/ethers/dist/ethers.umd.min.js",
|
||||
key: `ethers-${change.version.substring(1)}.umd.min.js`
|
||||
},
|
||||
{
|
||||
bucketName: bucketNameLib,
|
||||
originRoot: originRootLib,
|
||||
filename: "packages/ethers/dist/ethers.esm.min.js",
|
||||
key: "ethers-5.0.esm.min.js"
|
||||
},
|
||||
{
|
||||
bucketName: bucketNameLib,
|
||||
originRoot: originRootLib,
|
||||
filename: "packages/ethers/dist/ethers.umd.min.js",
|
||||
key: "ethers-5.0.umd.min.js"
|
||||
},
|
||||
];
|
||||
for (let i = 0; i < fileInfos.length; i++) {
|
||||
const { filename, key } = fileInfos[i];
|
||||
const { bucketName, originRoot, filename, key, suffix } = fileInfos[i];
|
||||
yield putObject(s3, {
|
||||
ACL: "public-read",
|
||||
Body: fs_1.default.readFileSync(path_1.resolve(filename)),
|
||||
@ -184,7 +234,7 @@ exports.invalidate = invalidate;
|
||||
ContentType: "application/javascript; charset=utf-8",
|
||||
Key: (originRoot + key)
|
||||
});
|
||||
console.log(`${log_1.colorify.bold("Uploaded:")} https://cdn.ethers.io/lib/${key}`);
|
||||
console.log(`${log_1.colorify.bold("Uploaded:")} https://cdn${suffix || ""}.ethers.io/lib/${key}`);
|
||||
}
|
||||
}
|
||||
// Flush the edge caches
|
||||
|
@ -32,7 +32,7 @@ hardened has highly ignoring implemented implementer imported including instanti
|
||||
joined keyword labelled larger lookup matches mined modified modifies multi
|
||||
named needed nested neutered numeric offline optimizer overriding owned packed
|
||||
padded parsed parsing passed placeholder processing properties prototyping reached
|
||||
recommended recovered redacted remaining replaced required
|
||||
recommended recovered redacted remaining replaced required reverted
|
||||
serializes shared signed signing skipped stored supported tagging targetted
|
||||
throttled transactions typed uninstall unstake unsubscribe using verifies verifying website
|
||||
|
||||
|
@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//import { getGitTag } from "../git";
|
||||
const local_1 = require("../local");
|
||||
const log_1 = require("../log");
|
||||
const path_1 = require("../path");
|
||||
|
@ -9,6 +9,8 @@ import * as npm from "../npm";
|
||||
import { loadJson, repeat, saveJson } from "../utils";
|
||||
|
||||
(async function() {
|
||||
const common = loadJson(resolve("package.json")).common;
|
||||
|
||||
const progress = getProgressBar(colorify.bold("Bumping package.json versions"));
|
||||
|
||||
const latestVersions: Record<string, string> = { };
|
||||
@ -21,6 +23,10 @@ import { loadJson, repeat, saveJson } from "../utils";
|
||||
progress(i / dirnames.length);
|
||||
|
||||
const dirname = dirnames[i];
|
||||
const packageJsonPath = getPackageJsonPath(dirname);
|
||||
|
||||
// Set the common elements to the package.json
|
||||
local.updateJson(packageJsonPath, common, true);
|
||||
|
||||
const pLocal = local.getPackage(dirname);
|
||||
const pNpm = await npm.getPackage(dirname);
|
||||
@ -41,7 +47,7 @@ import { loadJson, repeat, saveJson } from "../utils";
|
||||
colorify.green(version)
|
||||
].join(""));
|
||||
|
||||
local.updateJson(getPackageJsonPath(dirname), { gitHead: undefined, tarballHash, version }, true);
|
||||
local.updateJson(packageJsonPath, { gitHead: undefined, tarballHash, version }, true);
|
||||
|
||||
updated = true;
|
||||
}
|
||||
|
16
misc/admin/src.ts/cmds/get-config.ts
Normal file
16
misc/admin/src.ts/cmds/get-config.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { config } from "../config";
|
||||
|
||||
if (process.argv.length !== 3) {
|
||||
console.log("Usage: get-config KEY");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const key = process.argv[2];
|
||||
|
||||
(async function() {
|
||||
const value = await config.get(key);
|
||||
console.log(value);
|
||||
})().catch((error) => {
|
||||
console.log(`Error running ${ process.argv[0] }: ${ error.message }`);
|
||||
process.exit(1);
|
||||
});
|
@ -1,6 +1,8 @@
|
||||
import AWS from 'aws-sdk';
|
||||
const { createHash } = require("crypto");
|
||||
import fs from "fs";
|
||||
|
||||
import AWS from 'aws-sdk';
|
||||
|
||||
import { getLatestChange } from "../changelog";
|
||||
import { config } from "../config";
|
||||
import { getOrdered } from "../depgraph";
|
||||
@ -157,18 +159,34 @@ export function invalidate(cloudfront: AWS.CloudFront, distributionId: string):
|
||||
const username = await config.get("github-user");
|
||||
const password = await config.get("github-release");
|
||||
|
||||
const hash = createHash("sha384").update(fs.readFileSync(resolve("packages/ethers/dist/ethers.umd.min.js"))).digest("base64");
|
||||
|
||||
const gitCommit = await getGitTag(resolve("CHANGELOG.md"));
|
||||
|
||||
let content = change.content.trim();
|
||||
content += '\n\n----\n\n';
|
||||
content += '**Embedding UMD with [SRI](https:/\/developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity):**\n';
|
||||
content += '```html\n';
|
||||
content += '<script type="text/javascript"\n';
|
||||
content += ` integrity="sha384-${ hash }"\n`;
|
||||
content += ' crossorigin="anonymous"\n';
|
||||
content += ` src="https:/\/cdn-cors.ethers.io/lib/ethers-${ change.version.substring(1) }.umd.min.js">\n`;
|
||||
content += '</script>\n';
|
||||
content += '```';
|
||||
|
||||
// Publish the release
|
||||
const beta = false;
|
||||
const link = await createRelease(username, password, change.version, change.title, change.content, beta, gitCommit);
|
||||
const link = await createRelease(username, password, change.version, change.title, content, beta, gitCommit);
|
||||
console.log(`${ colorify.bold("Published release:") } ${ link }`);
|
||||
}
|
||||
|
||||
// Upload libs to the CDN (as ethers-v5.0 and ethers-5.0.x)
|
||||
{
|
||||
const bucketName = await config.get("aws-upload-scripts-bucket");
|
||||
const originRoot = await config.get("aws-upload-scripts-root");
|
||||
const bucketNameLib = await config.get("aws-upload-scripts-bucket");
|
||||
const originRootLib = await config.get("aws-upload-scripts-root");
|
||||
|
||||
const bucketNameCors = await config.get("aws-upload-scripts-bucket-cors");
|
||||
const originRootCors = await config.get("aws-upload-scripts-root-cors");
|
||||
|
||||
const s3 = new AWS.S3({
|
||||
apiVersion: '2006-03-01',
|
||||
@ -177,15 +195,52 @@ export function invalidate(cloudfront: AWS.CloudFront, distributionId: string):
|
||||
});
|
||||
|
||||
// Upload the libs to ethers-v5.0 and ethers-5.0.x
|
||||
const fileInfos: Array<{ filename: string, key: string }> = [
|
||||
{ filename: "packages/ethers/dist/ethers.esm.min.js", key: `ethers-${ change.version.substring(1) }.esm.min.js` },
|
||||
{ filename: "packages/ethers/dist/ethers.umd.min.js", key: `ethers-${ change.version.substring(1) }.umd.min.js` },
|
||||
{ filename: "packages/ethers/dist/ethers.esm.min.js", key: "ethers-5.0.esm.min.js" },
|
||||
{ filename: "packages/ethers/dist/ethers.umd.min.js", key: "ethers-5.0.umd.min.js" },
|
||||
const fileInfos: Array<{ bucketName: string, originRoot: string, filename: string, key: string, suffix?: string }> = [
|
||||
// The CORS-enabled versions on cdn-cors.ethers.io
|
||||
{
|
||||
bucketName: bucketNameCors,
|
||||
originRoot: originRootCors,
|
||||
suffix: "-cors",
|
||||
filename: "packages/ethers/dist/ethers.esm.min.js",
|
||||
key: `ethers-${ change.version.substring(1) }.esm.min.js`
|
||||
},
|
||||
{
|
||||
bucketName: bucketNameCors,
|
||||
originRoot: originRootCors,
|
||||
suffix: "-cors",
|
||||
filename: "packages/ethers/dist/ethers.umd.min.js",
|
||||
key: `ethers-${ change.version.substring(1) }.umd.min.js`
|
||||
},
|
||||
|
||||
// The non-CORS-enabled versions on cdn.ethers.io
|
||||
{
|
||||
bucketName: bucketNameLib,
|
||||
originRoot: originRootLib,
|
||||
filename: "packages/ethers/dist/ethers.esm.min.js",
|
||||
key: `ethers-${ change.version.substring(1) }.esm.min.js`
|
||||
},
|
||||
{
|
||||
bucketName: bucketNameLib,
|
||||
originRoot: originRootLib,
|
||||
filename: "packages/ethers/dist/ethers.umd.min.js",
|
||||
key: `ethers-${ change.version.substring(1) }.umd.min.js`
|
||||
},
|
||||
{
|
||||
bucketName: bucketNameLib,
|
||||
originRoot: originRootLib,
|
||||
filename: "packages/ethers/dist/ethers.esm.min.js",
|
||||
key: "ethers-5.0.esm.min.js"
|
||||
},
|
||||
{
|
||||
bucketName: bucketNameLib,
|
||||
originRoot: originRootLib,
|
||||
filename: "packages/ethers/dist/ethers.umd.min.js",
|
||||
key: "ethers-5.0.umd.min.js"
|
||||
},
|
||||
];
|
||||
|
||||
for (let i = 0; i < fileInfos.length; i++) {
|
||||
const { filename, key } = fileInfos[i];
|
||||
const { bucketName, originRoot, filename, key, suffix } = fileInfos[i];
|
||||
await putObject(s3, {
|
||||
ACL: "public-read",
|
||||
Body: fs.readFileSync(resolve(filename)),
|
||||
@ -193,7 +248,7 @@ export function invalidate(cloudfront: AWS.CloudFront, distributionId: string):
|
||||
ContentType: "application/javascript; charset=utf-8",
|
||||
Key: (originRoot + key)
|
||||
});
|
||||
console.log(`${ colorify.bold("Uploaded:") } https://cdn.ethers.io/lib/${ key }`);
|
||||
console.log(`${ colorify.bold("Uploaded:") } https://cdn${ suffix || "" }.ethers.io/lib/${ key }`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ hardened has highly ignoring implemented implementer imported including instanti
|
||||
joined keyword labelled larger lookup matches mined modified modifies multi
|
||||
named needed nested neutered numeric offline optimizer overriding owned packed
|
||||
padded parsed parsing passed placeholder processing properties prototyping reached
|
||||
recommended recovered redacted remaining replaced required
|
||||
recommended recovered redacted remaining replaced required reverted
|
||||
serializes shared signed signing skipped stored supported tagging targetted
|
||||
throttled transactions typed uninstall unstake unsubscribe using verifies verifying website
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//import { getGitTag } from "../git";
|
||||
|
||||
import { computeTarballHash, updateJson } from "../local";
|
||||
import { colorify, getProgressBar } from "../log";
|
||||
import { dirnames, getPackageJsonPath } from "../path";
|
||||
|
@ -21,7 +21,6 @@ export async function createRelease(user: string, password: string, tagName: str
|
||||
password: password
|
||||
});
|
||||
|
||||
|
||||
return JSON.parse(Buffer.from(result.body).toString("utf8")).html_url;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user