Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
formatCode = memoize(2)((language, code) => {
let formattedCode = code;
if (language === 'jsx') {
try {
formattedCode = beautify(code, {
indent_size: 2,
brace_style: 'collapse,preserve-inline',
end_with_newline: true,
wrap_line_length: 80,
e4x: true,
});
} catch (error) {
console.warn("Couldn't format code", formattedCode); // eslint-disable-line no-console
}
}
return formattedCode;
});' if (/^\\.view\\.view-main/.test(myApp.views[v].selector)) {\n' +
' mainView = myApp.views[v]\n' +
' } else if (/^#right-panel-view/.test(myApp.views[v].selector)) {\n' +
' rightView = myApp.views[v]\n' +
' }\n' +
' }\n' +
' if (mainView === null) {\n' +
' myApp.alert("Main view not found.")\n' +
' }\n' +
' if (rightView === null) {\n' +
' myApp.alert("Right panel view not found.")\n' +
' }\n' +
' var $$ = window.Dom7;\n' +
jsFile + '\n' +
'}\n'
jsFile = beautify.js(jsFile, {indent_size: 2, end_with_newline: true})
fs.writeFileSync(path.resolve(env.app, 'kitchen-sink-' + theme + '.js'), jsFile)
htmlCode = beautify.html(htmlCode, {indent_size: 2})
fs.writeFileSync(path.resolve(env.app, 'kitchen-sink-' + theme + '-html.js'), 'module.exports = \'\' +\n\'' + htmlCode.replace(/\'/g, '\\\'').replace(/\n/g, '\' +\n\'') + '\'\n') // eslint-disable-line
callback()
} catch (err) {
alert('Failed to copy kitchen sink js file.', 'issue')
}
} catch (err) {
alert('Failed to copy kitchen sink css file.', 'issue')
}
} catch (err) {
alert('Failed to clean routes.json file.', 'issue')
}
}
})
}module.exports = ({ destination }) => {
const modelFolder = `${destination}/models`;
const indexFile = `${destination}/models/index.js`;
// if (logging) console.log('updating models/index.js ');
let items = fs.readdirSync(modelFolder);
items = items.map((item) => item.replace('.js', ''));
items = items.filter(item => item !== 'index');
const code = modelIndex(items);
const pretty = beautify(code, { indent_size: 2, space_in_empty_paren: true });
fs.writeFileSync(indexFile, pretty);
};let content = fs.readFileSync(tplPath, 'utf-8');
if (packageJson.requirejs && packageJson.requirejs.paths) {
var strPaths = JSON.stringify(packageJson.requirejs.paths)
content = content.replace('', strPaths.substr(1, strPaths.length - 2))
}
else {
content = content.replace('', '')
}
var configJson = fs.readFileSync(path.resolve(outputPath, 'config.json'), 'utf-8')
content = content.replace('window.MAKA = maka;', `
window.MAKA = maka;
window.MAKA.version = '${version}';
maka.init({
baseUrl: "",
appUrls: ${beautify.js(configJson)}
});
`)
fs.writeFileSync(path.resolve(coreDirectory, isDev ? 'main.js' : 'main.min.js'), content);
fs.writeFileSync(path.resolve(coreDirectory, isDev ? 'maka-main.js' : 'maka-main.min.js'), content);
if (fs.existsSync(path.resolve(outputPath, 'config.json'))) {
fs.unlinkSync(path.resolve(outputPath, 'config.json'))
}
}"dependencies": {
"@material-ui/core": "^4.0.2",
"@material-ui/icons": "^4.0.1",
"@material-ui/styles": "^4.0.2",
"clsx": "^1.0.4",
"isomorphic-unfetch": "^3.0.0",
"material-table": "^1.39.0",
"next": "^8.1.0",
"prop-types": "^15.7.2",
"query-string": "^6.7.0",
"react": "^16.8.6",
"react-dom": "^16.8.6"
}
}
`;
const pretty = beautify(code, { indent_size: 2, space_in_empty_paren: true });
fs.writeFileSync(fileName, pretty);
};
/node_modules
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Next.js
/.next`;
const pretty = beautify(code, { indent_size: 2, space_in_empty_paren: true });
fs.writeFileSync(fileName, pretty);
};export function beautifyMessages(messages) {
return beautify.js(JSON.stringify(messages), {
indent_size: "4",
indent_char: " ",
max_preserve_newlines: "5",
preserve_newlines: true,
keep_array_indentation: false,
break_chained_methods: false,
indent_scripts: "normal",
brace_style: "collapse",
space_before_conditional: true,
unescape_strings: false,
jslint_happy: false,
end_with_newline: false,
wrap_line_length: "0",
indent_inner_html: false,
comma_first: false,
e4x: falsetap(function(file, t) {
var contents = file.contents.toString();
contents = beautify_js(contents, config);
file.contents = new Buffer(contents);
}),
extensionFilter.restorefunction formatJavaScript(text: string) {
return jsBeautify.js(text, JS_BEAUTIFY_OPTIONS);
}return compile(tpls).then(() => {
if (opts.footer) {
res += opts.footer;
}
if (mod !== 'native') {
res += '});';
}
if (prettyPrint) {
res = beautify.js(res);
}
return res.replace(nRgxp, eol) + eol;
});
};