Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const migration = deployDouble(contracts);
// Scaffold
shell.mkdir(temp);
shell.cp('-Rf', templatePath, temp);
// Contracts
contracts.forEach(item => {
shell.cp(`${sourcesPath}${item}.sol`, `${temp}/contracts/${item}.sol`)
});
// Migration
fs.writeFileSync(migrationPath, migration)
// Test
shell.cp(`${testPath}${test}`, `${temp}/test/${test}`);
// Configs
fs.writeFileSync(`${temp}/${truffleConfigName}`, getTruffleConfigJS());
fs.writeFileSync(`${temp}/${buidlerConfigName}`, getBuidlerConfigJS());
fs.writeFileSync(configPath, configjs);
decacheConfigs();
};
function updateConfigFilesFrom(sourceConfig, configMunger, locations) {
// First cleanup current config and merge project's one into own
var defaultConfig = locations.defaultConfigXml;
var ownConfig = locations.configXml;
var sourceCfg = sourceConfig.path;
// If defaults.xml is present, overwrite platform config.xml with it.
// Otherwise save whatever is there as defaults so it can be
// restored or copy project config into platform if none exists.
if (fs.existsSync(defaultConfig)) {
events.emit('verbose', 'Generating config.xml from defaults for platform "windows"');
shell.cp('-f', defaultConfig, ownConfig);
} else if (fs.existsSync(ownConfig)) {
shell.cp('-f', ownConfig, defaultConfig);
} else {
shell.cp('-f', sourceCfg, ownConfig);
}
// Then apply config changes from global munge to all config files
// in project (including project's config)
configMunger.reapply_global_munge().save_all();
// Merge changes from app's config.xml into platform's one
var config = new ConfigParser(ownConfig);
xmlHelpers.mergeXml(sourceConfig.doc.getroot(),
config.doc.getroot(), 'windows', /*clobber=*/true);
// CB-6976 Windows Universal Apps. For smooth transition and to prevent mass api failures
// we allow using windows8 tag for new windows platform
xmlHelpers.mergeXml(sourceConfig.doc.getroot(),
config.doc.getroot(), 'windows8', /*clobber=*/true);
config.write();
function updateConfigFilesFrom(sourceConfig, configMunger, locations) {
events.emit('verbose', 'Generating config.xml from defaults for platform "android"');
// First cleanup current config and merge project's one into own
// Overwrite platform config.xml with defaults.xml.
shell.cp('-f', locations.defaultConfigXml, locations.configXml);
// Then apply config changes from global munge to all config files
// in project (including project's config)
configMunger.reapply_global_munge().save_all();
// Merge changes from app's config.xml into platform's one
var config = new ConfigParser(locations.configXml);
xmlHelpers.mergeXml(sourceConfig.doc.getroot(),
config.doc.getroot(), 'android', /*clobber=*/true);
config.write();
return config;
}
const { cd, cp, exec, mkdir, rm } = require('shelljs');
const path = require('path');
const fs = require('fs');
const dist = path.resolve(__dirname, 'dist');
const esdoc = path.resolve(__dirname, 'esdoc');
const report = path.resolve(__dirname, 'report');
const samples = path.resolve(__dirname, 'samples');
const coverage = path.resolve(__dirname, 'coverage');
const { GH_TOKEN, TRAVIS_REPO_SLUG } = process.env;
// Copy dist
mkdir('-p', path.join(esdoc, 'dist'));
cp('-r', dist, path.resolve(esdoc));
// Copy samples
mkdir('-p', path.join(esdoc, 'samples'));
cp('-r', samples, path.resolve(esdoc));
// Copy test report
mkdir('-p', path.join(esdoc, 'report'));
const files = fs.readdirSync(report);
const htmlFiles = files.filter(file => path.extname(file) === '.html');
const index = fs.createWriteStream(path.join(esdoc, 'report', 'index.html'));
index.write('<ul>');
htmlFiles.forEach((file) => {
cp(path.join(report, file), path.join(esdoc, 'report', file));
index.write(`<li><a href="${file}">${file}</a></li>`);
});
index.write('</ul>');
const real_path = fs.realpathSync(src);
const real_plugin_path = fs.realpathSync(plugin_dir);
if (real_path.indexOf(real_plugin_path) !== 0) { throw new CordovaError('File "' + src + '" is located outside the plugin directory "' + plugin_dir + '"'); }
dest = path.resolve(project_dir, dest);
// check that dest path is located in project directory
if (dest.indexOf(project_dir) !== 0) { throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project'); }
shell.mkdir('-p', path.dirname(dest));
if (link) {
linkFileOrDirTree(src, dest);
} else if (fs.statSync(src).isDirectory()) {
// XXX shelljs decides to create a directory when -R|-r is used which sucks. http://goo.gl/nbsjq
shell.cp('-Rf', path.join(src, '/*'), dest);
} else {
shell.cp('-f', src, dest);
}
}
module.exports = function generateSassBuild(destinationDir) {
const classnameTokens = readJSONSync(`${destinationDir}/polaris.tokens.json`);
const buildSass = resolve(destinationDir, 'sass');
const buildStyles = join(buildSass, 'styles');
const global = join(buildStyles, 'global');
const foundation = join(buildStyles, 'foundation');
const shared = join(buildStyles, 'shared');
const components = join(buildStyles, 'components');
const tokens = join(buildStyles, 'polaris-tokens');
mkdir('-p', components, foundation, global, shared, tokens);
cp(join(srcStyles, 'foundation', '*.scss'), foundation);
cp(join(srcStyles, 'polaris-tokens', '*.scss'), tokens);
cp(join(srcStyles, 'global.scss'), join(buildStyles, 'global.scss'));
cp(join(srcStyles, 'foundation.scss'), join(buildStyles, 'foundation.scss'));
cp(join(srcStyles, 'shared.scss'), join(buildStyles, 'shared.scss'));
cp(resolve(srcStyles, '../styles.scss'), join(buildSass, 'styles.scss'));
const dirWithCssModulesGlobals = ['global', 'shared'];
dirWithCssModulesGlobals.forEach((dir) => {
const srcDir = join(srcStyles, dir);
const destDir = join(buildStyles, dir);
const regex = /:global\s*\(([^)]+)\)|:global\s*{\s*([^}]+)\s*}\s*/;
glob.sync(join(srcDir, '/**/*.scss')).forEach((srcFile) => {
// On Windows `srcFile` contains forwardslashes as path separators (as it
// came from glob) while `srcDir` contains backslashes as path separators
// (as it came from path.join). Replace backslashes with forward-slashes
const componentFile = `./src/components/shared/${upperCamel}.tsx`;
const testFile = `./src/components/shared/__tests__/${upperCamel}.test.tsx`;
exists = yield functions_1.fsExists(componentFile);
if (exists) {
console.log(chalk_1.default.redBright(`${upperCamel} shared already exists. Delete or rename existing component first.`));
process.exit(0);
return;
}
exists = yield functions_1.fsExists('.dooboo/react.js');
let tsx, tsxTest;
if (exists) {
tsx = path.resolve(__dirname, '..', 'templates/react/shared/Shared.tsx');
tsxTest = path.resolve(__dirname, '..', 'templates/react/shared/Shared.test.tsx');
console.log(chalk_1.default.cyanBright(`creating shared component...`));
shell.cp(tsx, componentFile);
shell.cp(tsxTest, testFile);
shell.sed('-i', 'Shared', `${camel}`, testFile);
console.log(chalk_1.default.green(`generated: src/components/shared/${upperCamel}.tsx
testFile: src/components/shared/__tests__/${upperCamel}.test.tsx`));
process.exit(0);
return;
}
exists = yield functions_1.fsExists('.dooboo/react-native.js');
if (exists) {
tsx = path.resolve(__dirname, '..', 'templates/react-native/shared/Shared.tsx');
tsxTest = path.resolve(__dirname, '..', 'templates/react-native/shared/Shared.test.tsx');
console.log(chalk_1.default.cyanBright(`creating shared component...`));
shell.cp(tsx, componentFile);
shell.cp(tsxTest, testFile);
shell.sed('-i', 'Shared', `${camel}`, testFile);
console.log(chalk_1.default.green(`generated: src/components/shared/${upperCamel}.tsx
testFile: src/components/shared/__tests__/${upperCamel}.test.tsx`));
_publishDemos: function() {
var index,
repo = Release._cloneDemosRepo(),
dest = repo + "/" + Release.newVersion,
src = Release.dir.repo + "/dist/demos",
commitMessage = "Added version " + Release.newVersion;
shell.mkdir( "-p", dest );
shell.cp( "-r", src + "/*", dest );
if ( !Release.preRelease ) {
console.log( "Updating demos index..." );
fs.writeFileSync( repo + "/index.php",
"
const path = require('path');
const { cp, sed } = require('shelljs');
const projectDir = path.resolve(__dirname, '..');
cp('-R', `${projectDir}/dist/examples`, projectDir);
sed(
'-i',
'../runcode.js',
'https://unpkg.com/kotlin-runcode@1/dist/runcode.min.js',
`${projectDir}/examples/index.html`
);
/*jshint node:true */
'use strict';
var path = require('path');
var shell = require('shelljs');
shell.cp('-R',
path.resolve(__dirname, '../node_modules')
);
shell.chmod(770, path.resolve(__dirname, '../build.sh'));
shell.chmod(770, path.resolve(__dirname, 'node-install.sh'));