Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function saveContentToEntitlementsFile(content) {
var plistContent = plist.build(content);
var filePath = pathToEntitlementsFile();
// ensure that file exists
mkpath.sync(path.dirname(filePath));
// save it's content
fs.writeFileSync(filePath, plistContent, 'utf8');
}
function saveContentToEntitlementsFile(content) {
var plistContent = plist.build(content);
var filePath = pathToEntitlementsFile();
// ensure that file exists
mkpath.sync(path.dirname(filePath));
// save it's content
fs.writeFileSync(filePath, plistContent, 'utf8');
}
function saveContentToEntitlementsFile(content) {
var plistContent = plist.build(content),
filePath = pathToEntitlementsFile();
// ensure that file exists
mkpath.sync(path.dirname(filePath));
// save it's content
fs.writeFileSync(filePath, plistContent, 'utf8');
}
gulp.task('css', function() {
var file = path.resolve(PATHS.src.css.main);
var source = path.relative(__dirname, file);
mkpath.sync('dist');
var output = fs.createWriteStream('dist/build.css');
var contents = fs.readFileSync(file, {encoding: 'utf8'});
// Initialize and pluginize `rework`
var css = rework(contents);
css.use(npmRework());
// write result
output.write(css.toString())
output.end();
});
recorder.rec = function rec (opts) {
const proxy = httpProxy.createProxyServer({
changeOrigin: true
}) // be default we changeOrigin, because
// ssl enabled APIs like github throw Hostname/IP doesn't match certificate's altnames when this is not enabled
const defaultPath = 'test/fixtures/' + utils.urlToFilename(opts.target)
const mockPath = opts.mockPath || defaultPath
mkpath.sync(mockPath)
const bodies = {}
proxy.on('proxyRes', function (proxyRes, req, res) {
const body = bodies[req._header]
if (body) {
req.body = body
}
record(req, proxyRes, mockPath)
})
const app = connect()
.use(morgan)
.use(function (req, res) {
let body = ''
req.on('data', function (data) {
body += data
kms.generateDataKey(params, function(err, data){
if (err) return callback(err); // an error occurred
else{
mkpath.sync(path.join(project.getRootPath(), '_meta', 'secrets', 'kmsfile'));
let aesCtr = new aesjs.ModeOfOperation.ctr(data.Plaintext);
let encryptedBytes = aesCtr.encrypt(plaintext);
fs.writeFileAsync(path.join(project.getRootPath(), '_meta', 'secrets', 'kmsfile', path.basename(evt.options.file)), encryptedBytes);
return callback(null, `kmsfile::${kmskey}::${data.CiphertextBlob.toString('base64')}::${path.basename(evt.options.file)}`);
}
});
}
function getComponentPath(componentName, directory, fileName) {
const cwd = process.cwd()
const root = path.join(cwd, 'src')
mkdir.sync(root)
const dir = path.join(root, directory)
mkdir.sync(dir)
const componentPath = path.join(dir, fileName)
const exists = fs.existsSync(componentPath)
if (exists) {
console.error(chalk.red(`Component ${chalk.bold(componentName)} already exists at ${relativePath(componentPath)}`))
return process.exit(1)
}
mkdir.sync(componentPath)
return componentPath
}
function getComponentPath(componentName, directory, fileName) {
const cwd = process.cwd()
const root = path.join(cwd, 'src')
mkdir.sync(root)
const dir = path.join(root, directory)
mkdir.sync(dir)
const componentPath = path.join(dir, fileName)
const exists = fs.existsSync(componentPath)
if (exists) {
console.error(chalk.red(`Component ${chalk.bold(componentName)} already exists at ${relativePath(componentPath)}`))
return process.exit(1)
}
mkdir.sync(componentPath)
return componentPath
}
function getComponentPath(componentName, directory, fileName) {
const cwd = process.cwd()
const root = path.join(cwd, 'src')
mkdir.sync(root)
const dir = path.join(root, directory)
mkdir.sync(dir)
const componentPath = path.join(dir, fileName)
const exists = fs.existsSync(componentPath)
if (exists) {
console.error(chalk.red(`Component ${chalk.bold(componentName)} already exists at ${relativePath(componentPath)}`))
return process.exit(1)
}
mkdir.sync(componentPath)
return componentPath
}
function createDirectoriesIfNeeded(dirPath) {
try {
mkpath.sync(dirPath);
} catch (err) {
console.log(err);
}
}