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

fis3-deploy-wantu

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fis3-deploy-wantu - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

64

index.js
"use strict";
var rocketz = require("rocketz");
var fs = require("fs");
var path = require("path");
var cacheDir = ".wantu-cache";
var cachePath = path.join(__dirname, cacheDir);
var Wantu = require("wantu");
module.exports = function( options, modified, total, next ) {
if ( !options ) {
fis.log.error("Invalid RocketZ's setting!");
if ( !(options.accessKey && options.secretKey) ) {
fis.log.error("ACCESS_KEY and SECRET_KEY are required!");
}
else if ( !options.namespace ) {
fis.log.error("Namespace is required!");
}
options.assets = options.from;
options.remote = options.to;
if ( !fs.existsSync(cachePath) ) {
fs.mkdirSync(cachePath);
}
rocketz.init(options);
var wantu = new Wantu(options.accessKey, options.secretKey);
if ( rocketz.preview() ) {
rocketz.run();
}
modified.forEach(function( file ) {
var releasePath = file.getHashRelease();
var releaseFileName = path.basename(releasePath);
var cacheFilePath = path.join(cachePath, releaseFileName);
next();
if ( !fs.existsSync(cacheFilePath) ) {
fs.writeFileSync(cacheFilePath, file.getContent());
}
wantu.singleUpload({
namespace: options.namespace,
expiration: -1
}, cacheFilePath, releasePath.replace("/" + releaseFileName, ""), "", "", function( err, res ) {
if ( !err ) {
if ( res.statusCode === 200 ) {
var time = "[" + fis.log.now(true) + "]";
process.stdout.write(
"\nWantu uploader - ".green.bold +
time.grey + " " +
file.subpath.replace(/^\//, "") +
" >> ".yellow.bold +
JSON.parse(res.data).url
);
fs.unlinkSync(cacheFilePath);
next();
}
else {
console.log(res);
fis.log.error("Something is wrong when uploading to Wantu!");
}
}
else {
fis.log.error(err);
}
});
});
};

4

package.json
{
"name": "fis3-deploy-wantu",
"version": "0.2.0",
"description": "A RocketZ plug-in for FIS3",
"version": "0.2.1",
"description": "Upload assets to Wantu via FIS3",
"main": "index.js",

@@ -6,0 +6,0 @@ "scripts": {

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