Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//------------------------------------------------------------------------------
const
path = require("path"),
{ Linter } = require("eslint"),
shelljs = require("shelljs"),
parser = require("../../"),
testUtils = require("../../tools/test-utils");
//------------------------------------------------------------------------------
// Setup
//------------------------------------------------------------------------------
const TSX_FIXTURES_DIR = "./tests/fixtures/tsx";
const testFiles = shelljs.find(TSX_FIXTURES_DIR)
.filter(filename => filename.indexOf(".src.tsx") > -1)
// strip off ".src.tsx"
.map(filename => filename.substring(TSX_FIXTURES_DIR.length - 1, filename.length - 8));
//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------
describe("TSX", () => {
testFiles.forEach(filename => {
const code = shelljs.cat(`${path.resolve(TSX_FIXTURES_DIR, filename)}.src.tsx`);
const config = {
useJSXTextNode: true,
jsx: true
};
test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config));
const leche = require("leche"),
path = require("path"),
shelljs = require("shelljs"),
tester = require("./tester"),
espree = require("../../espree"),
assert = require("assert");
// var espree = require("esprima-fb");
//------------------------------------------------------------------------------
// Setup
//------------------------------------------------------------------------------
const FIXTURES_DIR = "./tests/fixtures/ecma-version/";
const allTestFiles = shelljs.find(FIXTURES_DIR)
.filter(filename => filename.indexOf(".src.js") > -1)
.map(filename => filename.slice(FIXTURES_DIR.length - 2, filename.length - 7)); // strip off ".src.js"
const scriptOnlyTestFiles = allTestFiles.filter(filename => filename.indexOf("modules") === -1);
const moduleTestFiles = allTestFiles.filter(filename => filename.indexOf("not-strict") === -1 && filename.indexOf("edge-cases") === -1);
//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------
describe("ecmaVersion", () => {
let config;
try {
if (fs.statSync(directory).isDirectory()) {
paraview.push(directory);
}
} catch (err) {
// skip
}
});
}
if (!process.argv.slice(2).length || !program.help || paraview.length === 0) {
program.outputHelp();
process.exit(0);
}
const pvPythonExecs = shell.find(paraview).filter(function(file) {
return file.match(/pvpython$/) || file.match(/pvpython.exe$/);
});
if (pvPythonExecs.length < 1) {
console.log(
'Could not find pvpython in your ParaView HOME directory ($PARAVIEW_HOME)'
);
program.outputHelp();
} else {
const cmdLine = [
quotePath(pvPythonExecs[0]),
'-dr',
quotePath(
path.normalize(path.join(__dirname, '../server/pvw-visualizer.py'))
),
'--content',
quotePath(path.normalize(path.join(__dirname, '../dist'))),
express = require('express'),
app = express(),
http = require('http'),
bodyParser = require('body-parser'),
favicon = require('serve-favicon'),
shell = require('shelljs');
app.use(bodyParser.json());
app.use(express.static(__dirname + '/static'));
app.use(favicon(__dirname + '/static/favicon.ico'));
app.set('port', process.env.PORT || 8888);
app.set('views', __dirname + '/express/views');
// load endpoints
var routes = shell.find('express/routes').filter(function(file) {
return file.match(/\.js$/);
});
routes.forEach(function(route) {
require('./' + route)(app);
});
// create and run the server
http.createServer(app).listen(app.get('port'), function() {
"use strict";
console.log('Express server listening on port ' + app.get('port'));
});
const readLine = require('readline')
const sh = require('shelljs')
const Stream = require('stream')
const stylelintLineRegex = /\s*?\/\/\s?stylelint.*/
let mixinName
let mixin
let mixinDocumentation = ''
let inMixin = false
let output = ''
sh.config.fatal = true
// Find all files in mixins folder; returns Array
const scss = sh.find('./scss/mixins/**/*.scss')
scss.forEach((file) => {
const inStream = fs.createReadStream(file)
const OutStream = new Stream()
const rl = readLine.createInterface(inStream, OutStream)
// Loop through all lines
rl.on('line', (line) => {
if (!inMixin) {
// Add documentation
if (line.startsWith('//')) {
// Ignore stylelint comments
if (!stylelintLineRegex.test(line)) {
mixinDocumentation += `${line.slice(2).trim()}\n`
}
} else if (line === '') {
this.notification({
type: 'info',
message: TAPi18n.__('build-started', this.name)
});
// async sleep statements
Meteor.sleep(50);
// GO TO APPLICATION DIR
cd(`${this.dir()}/programs/server`);
// GO NPM PACKAGES
cd('npm');
// BINARY NPM MODULES
const bindingFiles = find('.').filter((file) => {
return file.match(/\.gyp$/);
});
bindingFiles.forEach((file) => {
const dir = file.replace('/binding.gyp', '');
// async sleep statements
Meteor.sleep(100);
// GO TO BINDING FILE DIR
cd(dir);
// REMOVE BEFORE MODULES
rm('-rf', 'node_modules');
// INSTALL MODULES
it('should use react with addons everywhere', () => {
shell.find(['app/scripts', 'test'])
.filter((file) => file.match(/\.jsx$/))
.forEach((file) => assert.noFileContent(file, "'react'"));
});
`${packageJson.name}@${packageJson.version}`
)}`
);
}
function copyReadmeToDist(){
const modulePath = path.resolve('./');
const readmePath = path.join(modulePath, 'README.md');
if (fs.existsSync(readmePath)) {
shell.cp(readmePath, path.join(modulePath, 'dist'));
}
}
const packageJson = getPackageJson();
const tsFiles = shell.find('src').filter(tsFile => tsFile.match(/\.ts$/));
if (tsFiles.length !== 0) {
tscfy({ errorCallback: () => logError('ts', packageJson) });
} else {
babelify({ errorCallback: () => logError('js', packageJson) });
}
copyLicence();
copyReadmeToDist();
console.log(
chalk.gray(
`Built: ${chalk.bold(`${packageJson.name}@${packageJson.version}`)}`
)
);
_listAvailableBoilerPlates() {
const excludeBoilerplates = [...this.navigationBoilerplates];
const boilerplatesPath = this.templatePath('./boilerplates');
const boilerplates = _.uniq(
shell.find(boilerplatesPath).filter(file => file.match(/\.js.hbs$/i))
.map(file => (/\/([a-zA-Z0-9\/]+)(\.ios|\.android)?\.js\.hbs$/ig).exec(
file.split(boilerplatesPath)[1])[1]
)
);
return boilerplates.filter(b => excludeBoilerplates.indexOf(b) === -1);
},
function() {
var dirs = shell.find('.').filter(function(file) {
return file.match(/node_modules$/);
}).forEach(function(path) {
shell.rm('-rf', path);
});
}
);