New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

build-plugin-teamix

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

build-plugin-teamix - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

58

assetsInfoPlugin.js

@@ -13,25 +13,35 @@ const fs = require('fs');

compiler.hooks.afterEmit.tap('AssetsInfoPlugin', async () => {
const { assetsPath = '' } = this.options;
const gitDir = path.join(process.cwd(), '.git');
if (!fs.existsSync(gitDir)) {
return;
}
const url = await gitRemoteOriginUrl() || '';
let repo = '';
if (url) {
const repoInfo = url.split(':');
if (repoInfo && repoInfo[1]) {
repo = repoInfo[1].replace('.git', '');
const { BUILD_GIT_GROUP, BUILD_GIT_PROJECT, BUILD_GIT_COMMITID, BUILD_GIT_BRANCH, BUILD_ENV } = process.env;
let repoInfo;
let repo;
if (BUILD_ENV === 'cloud') {
repoInfo = {
branch: BUILD_GIT_BRANCH,
commitId: BUILD_GIT_COMMITID,
};
repo = `${BUILD_GIT_GROUP}/${BUILD_GIT_PROJECT}`;
} else {
const { assetsPath = '' } = this.options;
const gitDir = path.join(process.cwd(), '.git');
if (!fs.existsSync(gitDir)) {
return;
}
const url = await gitRemoteOriginUrl() || '';
if (url) {
const repoInfo = url.split(':');
if (repoInfo && repoInfo[1]) {
repo = repoInfo[1].replace('.git', '');
}
}
if (!repo) {
return;
}
const HEAD = fs.readFileSync(path.join(gitDir, 'HEAD'), { encoding: 'utf-8' });
const currentBranch = HEAD.replace('ref: refs/heads/', '').replace(os.EOL, '');
const commitId = fs.readFileSync(path.join(gitDir, HEAD.replace('ref: ', '').replace(os.EOL, '')), { encoding: 'utf-8' }).replace(os.EOL, '');
repoInfo = {
branch: currentBranch,
commitId,
};
}
if (!repo) {
return;
}
const HEAD = fs.readFileSync(path.join(gitDir, 'HEAD'), { encoding: 'utf-8' });
const currentBranch = HEAD.replace('ref: refs/heads/', '').replace(os.EOL, '');
const commitId = fs.readFileSync(path.join(gitDir, HEAD.replace('ref: ', '').replace(os.EOL, '')), { encoding: 'utf-8' }).replace(os.EOL, '');
const repoInfo = {
branch: currentBranch,
commitId,
};
const snippet = `;if(!window.__assets_info__){window.__assets_info__={};}window.__assets_info__['${repo}']=${JSON.stringify(repoInfo)};`;

@@ -50,3 +60,7 @@ const appendConent = dir => {

}
appendConent(assetsPath);
if (process.env.BUILD_ENV === 'cloud') {
appendConent(process.evn.BUILD_DEST_ABSOLUTE);
} else {
appendConent(assetsPath);
}
});

@@ -53,0 +67,0 @@ }

{
"name": "build-plugin-teamix",
"version": "1.0.1",
"version": "1.0.2",
"description": "build-scripts 插件, 适配teamix基础工程",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc