Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tpm

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tpm - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

package.json
{
"name": "tpm",
"version": "1.0.3",
"version": "1.0.4",
"description": "Static Package Manager",

@@ -5,0 +5,0 @@ "author": "Longhao Luo <lhluo@tudou.com>",

@@ -110,2 +110,42 @@

// 是否可发布的文件
function canDeploy(path) {
if (!Util.indir(path, Path.resolve(config.root + '/dist'))) {
return false;
}
return /\.(js|css|jpg|png|gif|ico|swf|htm|html)$/.test(path);
}
// 返回一个目录里所有要构建的文件
function grepPaths(rootDirPath) {
var paths = [];
function walk(dirPath) {
var files = Fs.readdirSync(dirPath);
for (var i = 0, len = files.length; i < len; i++) {
var file = files[i];
if (file.charAt(0) === '.') {
continue;
}
var path = Path.resolve(dirPath + '/' + file);
var stat = Fs.statSync(path);
if (stat.isDirectory()) {
walk(path);
} else if (canDeploy(path)) {
paths.push(path);
}
}
}
walk(rootDirPath);
return paths;
}
if (args.length < 2) {

@@ -119,2 +159,4 @@ console.log(DEPLOY_USAGE);

path = Path.resolve(path);
var pathList = [];

@@ -126,8 +168,11 @@

var stat = Fs.statSync(path);
if (!Util.indir(path, config.root + '/dist') || stat.isDirectory(path)) {
Util.error('Cannot deploy: ' + path);
return;
if (stat.isDirectory(path)) {
pathList = grepPaths(path);
} else {
if (!canDeploy(path)) {
Util.error('Cannot deploy: ' + path);
return;
}
pathList.push(path);
}
path = Path.resolve(path);
pathList.push(path);
}

@@ -134,0 +179,0 @@

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