Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'fs-jetpack' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
var argv = require('yargs').argv;
let destination = path.join(conf.paths.dist, '..', 'depend');
let dependencies = ['openstudio', 'energyplus', 'ruby', 'mongo', 'openstudioServer'];
if (argv.prefix) {
destination = argv.prefix;
}
if (argv.exclude) {
const without = argv.exclude.split(',');
dependencies = _.difference(dependencies, without);
}
const manifest = jetpack.read('manifest.json', 'json');
const platform = os.platform();
const arch = os.arch();
gulp.task('download-deps', function () {
// List the dependencies to download here
// These should correspond to keys in the manifest
console.log('Dependencies: ' + dependencies.sort().join(', '));
var tasks = dependencies.map(depend => {
const fileInfo = _.find(manifest[depend], {platform: platform});
const fileName = fileInfo.name;
return progress(request({uri: manifest.endpoint + fileName, timeout: 5000}))
.on('progress', state => {
export async function listBuiltinFavicons ({filter, offset, limit} = {}) {
if (filter) {
filter = new RegExp(filter, 'i')
}
// list files in assets/favicons and filter on the name
var dir = jetpack.cwd(__dirname).cwd('assets/favicons')
var items = (await dir.listAsync())
.filter(filename => {
if (filter && !filter.test(filename)) {
return false
}
return filename.endsWith('.ico')
})
return items.slice(offset || 0, limit || Number.POSITIVE_INFINITY)
}
function getBowerLicenses() {
// first - check that this is even a bower project
var baseDir;
if (Array.isArray(options.baseDir)) {
baseDir = options.baseDir[0];
if (options.baseDir.length > 1) {
console.warn("Checking multiple directories is not yet supported for Bower projects.\n" +
"Checking only the first directory: " + baseDir);
}
}
if (!jetpack.exists(path.join(baseDir, 'bower.json'))) {
console.log('this does not look like a Bower project, skipping Bower checks.');
return [];
}
bower.config.cwd = baseDir;
var bowerComponentsDir = path.join(bower.config.cwd, bower.config.directory);
return jetpack.inspectTreeAsync(bowerComponentsDir, { relativePath: true })
.then((result) => {
/**
* for each component, try to calculate the license from the NPM package info
* if it is a available because license-checker more closely aligns with our
* objective.
*/
return bluebird.map(result.children, (component) => {
var absPath = path.join(bowerComponentsDir, component.relativePath);
// npm license check didn't work
module.exports = context => {
// grab ~/.irapp/overrides
const overrideDir = jetpack.path(`${homeDir}`, '.irapp', 'overrides');
// grab the environment var
const envDir = process.env.IR_APP_PLUGIN_PATH || '';
// sanitize & verify they exist
return pipe(
split(';'),
map(trim),
prepend(overrideDir),
without(['', null]),
uniq,
filter(jetpack.exists)
)(envDir);
};
return tap(function(file) {
var filename = path.basename(file.relative);
if (filename === 'index.html') {
var adScriptLib = file.contents.toString().replace('', getAdScript('lib'));
file.contents = new Buffer(adScriptLib);
}
if (filename === 'script.js') {
var adScriptInit = file.contents.toString().replace('timeline.init();', getAdScript('init'));
file.contents = new Buffer(adScriptInit);
if (platform === 'sizmek') { // move init file into folder
fs.copy(supportFiles.cwd() + '/EBLoader.js', path.parse(file.path).dir + '/EBLoader.js', { overwrite: true });
}
}
});
};
// console.log(`Saving file ${filePath}`)
// await fs.mkdir(path.dirname(filePath), {recursive:true})
if (data) {
try {
await jetpack.writeAsync(filePath, data)
return
} catch (error) {
console.error(error)
}
}
if (srcFilePath) {
try {
await jetpack.copyAsync(srcFilePath, filePath, {overwrite : true})
return
} catch (error) {
console.error(error)
}
}
}
url: `${process.env.DOMAIN}/`
};
for (const chunk of req.body.files) {
const { uuid, count } = chunk;
// console.log('Chunk', chunk);
const chunkOutput = path.join(__dirname,
'..',
'..',
'..',
'..',
process.env.UPLOAD_FOLDER,
'chunks',
uuid);
const chunkDir = await jetpack.list(chunkOutput);
const ext = path.extname(chunkDir[0]);
const output = path.join(__dirname,
'..',
'..',
'..',
'..',
process.env.UPLOAD_FOLDER,
`${filename}${ext || ''}`);
chunkDir.sort();
// Save some data
info.name = `${filename}${ext || ''}`;
info.url += `${filename}${ext || ''}`;
for (let i = 0; i < chunkDir.length; i++) {
const dir = path.join(__dirname,
var baseDir;
if (Array.isArray(options.baseDir)) {
baseDir = options.baseDir[0];
if (options.baseDir.length > 1) {
console.warn("Checking multiple directories is not yet supported for Bower projects.\n" +
"Checking only the first directory: " + baseDir);
}
}
if (!jetpack.exists(path.join(baseDir, 'bower.json'))) {
console.log('this does not look like a Bower project, skipping Bower checks.');
return [];
}
bower.config.cwd = baseDir;
var bowerComponentsDir = path.join(bower.config.cwd, bower.config.directory);
return jetpack.inspectTreeAsync(bowerComponentsDir, { relativePath: true })
.then((result) => {
/**
* for each component, try to calculate the license from the NPM package info
* if it is a available because license-checker more closely aligns with our
* objective.
*/
return bluebird.map(result.children, (component) => {
var absPath = path.join(bowerComponentsDir, component.relativePath);
// npm license check didn't work
// try to get the license and package info from .bower.json first
// because it has more metadata than the plain bower.json
var package = '';
try {
package = jetpack.read(path.join(absPath, '.bower.json'), 'json');
'use strict';
var gulp = require('gulp');
var watch = require('gulp-watch');
var batch = require('gulp-batch');
var ts = require('gulp-typescript');
var plumber = require('gulp-plumber');
var jetpack = require('fs-jetpack');
var bundle = require('./bundle');
var utils = require('./utils');
// var ts = require('typescript');
var projectDir = jetpack;
var srcDir = jetpack.cwd('./src');
var distDir = jetpack.cwd('./dist');
var destDir = jetpack.cwd('./app');
gulp.task('bundle', function() {
return Promise.all([
bundle(distDir.path('background', 'parser.js'), destDir.path('parser.js')),
bundle(distDir.path('background', 'app.js'), destDir.path('background.js')),
bundle(distDir.path('ui', 'app.js'), destDir.path('app.js'))
]);
});
var tsProject = ts.createProject('tsconfig.json');
gulp.task('ts', function() {
var tsResult = gulp.src('src/**/*.ts').pipe(tsProject());
return tsResult.js.pipe(gulp.dest('dist'));
});
* the electron project directory LICENSE file.
*
* @fileoverview Electron entry point continues here. Creates windows and
* handles system events.
*/
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const appMenu = require('./appmenu.js');
const server = require('./servermgr.js');
const projectLocator = require('./projectlocator.js');
const createWindow = require('./helpers/window');
const winston = require('winston');
const packageData = require('fs-jetpack').cwd(app.getAppPath()).read('package.json', 'json');
const tag = '[ArdublocklyElec] ';
// Global reference of the window object must be maintain, or the window will
// be closed automatically when the JavaScript object is garbage collected.
var mainWindow = null;
var splashWindow = null;
// Set up the app data directory within the Ardublockly root directory
(function setAppData() {
var appDataPath = projectLocator.getExecDirJetpack().cwd('appdata');
app.setPath('appData', appDataPath.path());
app.setPath('userData', appDataPath.path());
app.setPath('cache', appDataPath.path('GenCache'));
app.setPath('userCache', appDataPath.path('AppCache'));
app.setPath('temp', appDataPath.path('temp'));