bigbrother-webpack-plugin
Advanced tools
Comparing version 1.0.5 to 1.1.0
1.1.0 / 2018-11-16 | ||
================== | ||
* feat: add linke env info | ||
* fix: commment | ||
* fix: NO_BIGBROTHER | ||
* feat: ALI_MONITOR | ||
* upd: readme | ||
* docs: history | ||
1.0.5 / 2018-11-13 | ||
@@ -3,0 +13,0 @@ ================== |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var BigBrother_1 = require("./BigBrother"); | ||
module.exports = BigBrother_1.default; | ||
var BigBrotherWebpackPlugin_1 = require("./BigBrotherWebpackPlugin"); | ||
module.exports = BigBrotherWebpackPlugin_1.default; |
@@ -8,4 +8,2 @@ import { ISatoriCreateBuild } from './typings'; | ||
} | ||
declare function postBuild(args: ISatoriCreateBuild): Promise<void>; | ||
declare function postDev(args: ISatoriCreateBuild): Promise<void>; | ||
export { MonitorClient as default, postBuild, postDev, }; | ||
export default MonitorClient; |
@@ -5,2 +5,3 @@ "use strict"; | ||
var satori_1 = require("./adapter/satori"); | ||
var enum_1 = require("./enum"); | ||
var MonitorClient = /** @class */ (function () { | ||
@@ -43,3 +44,19 @@ function MonitorClient() { | ||
MonitorClient.prototype.ifSkipReport = function (data) { | ||
return data.git && !data.git.repoProjectId && !data.git.repository; | ||
// 环境变量跳过上报: 设置环境变量 NO_BIGBROTHER=true 可以关闭内网环境验证和数据上报 | ||
if (process.env.NO_BIGBROTHER === 'true') { | ||
return true; | ||
} | ||
var platform = data.platform, git = data.git; | ||
// LinkE 平台,无 appName 跳过上报 | ||
if (platform.type === enum_1.PLATFORM_TYPE.LINKE) { | ||
if (!platform.appName) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
// Basement 或者本地,未收集到 git 信息,跳过上报 | ||
if (!git.repoProjectId && !git.repository) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
@@ -49,33 +66,1 @@ return MonitorClient; | ||
exports.default = MonitorClient; | ||
function postBuild(args) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var client; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
client = new MonitorClient(); | ||
return [4 /*yield*/, client.postBuild(args)]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.postBuild = postBuild; | ||
function postDev(args) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var client; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
client = new MonitorClient(); | ||
return [4 /*yield*/, client.postDev(args)]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.postDev = postDev; |
@@ -1,9 +0,8 @@ | ||
export declare enum PLATFORM_TYPE { | ||
LINKE = "LINKE", | ||
BASEMENT = "BASEMENT" | ||
} | ||
import * as webpack from 'webpack'; | ||
import { PLATFORM_TYPE } from '../enum'; | ||
export interface IPlatformInfo { | ||
type: PLATFORM_TYPE; | ||
cloudBuildId: string; | ||
cloudBuildLog: string; | ||
cloudBuildId?: string; | ||
cloudBuildLog?: string; | ||
appName?: string; | ||
} | ||
@@ -59,4 +58,4 @@ export interface IBuildGitInfo { | ||
export interface ISatoriCreateBuild extends ICommonArgs { | ||
git?: IBuildGitInfo; | ||
platform?: IPlatformInfo; | ||
git: IBuildGitInfo; | ||
platform: IPlatformInfo; | ||
envs: object; | ||
@@ -72,2 +71,21 @@ hardware: IHardware; | ||
} | ||
export interface ITYPETOOL { | ||
name: string; | ||
version: string; | ||
[key: string]: any; | ||
} | ||
export interface IOptions { | ||
stagesPath: string; | ||
cwd: string; | ||
tool: ITYPETOOL; | ||
buildConfig?: object; | ||
apply: (compiler: webpack.Compiler) => void; | ||
report: (compiler: webpack.Compiler) => void; | ||
} | ||
export interface IStages { | ||
stage: string; | ||
startTime: number; | ||
endTime: number; | ||
elapse: number; | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var PLATFORM_TYPE; | ||
(function (PLATFORM_TYPE) { | ||
PLATFORM_TYPE["LINKE"] = "LINKE"; | ||
PLATFORM_TYPE["BASEMENT"] = "BASEMENT"; | ||
})(PLATFORM_TYPE = exports.PLATFORM_TYPE || (exports.PLATFORM_TYPE = {})); |
import getHardware from './getHardware'; | ||
import GitInfo from './GitInfo'; | ||
export { getHardware, GitInfo, }; | ||
import { IPkg, IBuildGitInfo, IPlatformInfo } from '../typings'; | ||
declare function getPkg(cwd: any): IPkg; | ||
declare function getArtifactInfo(stats: any): { | ||
hash: any; | ||
size: number; | ||
manifest: any; | ||
}; | ||
declare function getGitInfo(cwd: any): IBuildGitInfo; | ||
declare function getPlatformInfo(): IPlatformInfo; | ||
export { GitInfo, getHardware, getPkg, getArtifactInfo, getGitInfo, getPlatformInfo, }; |
@@ -7,1 +7,60 @@ "use strict"; | ||
exports.GitInfo = GitInfo_1.default; | ||
var enum_1 = require("../enum"); | ||
var path_1 = require("path"); | ||
var fs_1 = require("fs"); | ||
function getPkg(cwd) { | ||
var pkg = {}; | ||
try { | ||
pkg = require(path_1.join(cwd, 'package.json')); | ||
} | ||
catch (_) { } // eslint-disable-line | ||
return pkg; | ||
} | ||
exports.getPkg = getPkg; | ||
function getArtifactInfo(stats) { | ||
var json = stats.toJson(); | ||
var totalSize = 0; | ||
var manifest = json.assets.map(function (_a) { | ||
var name = _a.name, size = _a.size; | ||
totalSize += size; | ||
return { name: name, size: size }; | ||
}); | ||
return { | ||
hash: stats.hash, | ||
size: totalSize, | ||
manifest: manifest, | ||
}; | ||
} | ||
exports.getArtifactInfo = getArtifactInfo; | ||
function getGitInfo(cwd) { | ||
var gitPath = path_1.join(cwd, (!process.env.TEST ? '.' : '') + "git"); | ||
if (fs_1.existsSync(gitPath)) { | ||
var gitInfo = new GitInfo_1.default({ gitPath: gitPath }); | ||
return gitInfo.gitInfo; | ||
} | ||
var _a = process.env, REPO_PROJECT_ID = _a.REPO_PROJECT_ID, COMMIT_ID = _a.COMMIT_ID; | ||
return { | ||
repoProjectId: REPO_PROJECT_ID, | ||
commitId: COMMIT_ID, | ||
}; | ||
} | ||
exports.getGitInfo = getGitInfo; | ||
function getPlatformInfo() { | ||
var _a = process.env, PLATFORM_TYPE = _a.PLATFORM_TYPE, | ||
// basement | ||
CLOUD_BUILD_ID = _a.CLOUD_BUILD_ID, CLOUD_BUILD_LOG = _a.CLOUD_BUILD_LOG, | ||
// linke | ||
APP_NAME = _a.APP_NAME; | ||
var type = [enum_1.PLATFORM_TYPE.BASEMENT, enum_1.PLATFORM_TYPE.LINKE].indexOf(PLATFORM_TYPE) > -1 | ||
? PLATFORM_TYPE | ||
: ''; | ||
return { | ||
type: type, | ||
// basement | ||
cloudBuildId: (CLOUD_BUILD_ID || ''), | ||
cloudBuildLog: CLOUD_BUILD_LOG || '', | ||
// appname | ||
appName: APP_NAME, | ||
}; | ||
} | ||
exports.getPlatformInfo = getPlatformInfo; |
{ | ||
"name": "bigbrother-webpack-plugin", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "bigbrother client", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
21498
22
565
1
11