<commit_before>import 'colors';
import * as fs from 'fs-extra';
import Command from 'cmd-line/lib/Command';
import utils from '../utils';
import inflector from '../support/inflector';

export default (new Command(__filename, 'Creates or run seed in your project.'))
.Args('model')
	.Options(['-g', '--generate', 'Generete a seed file for the specified model.'])
	.Action(async function (model, options) {
		process.env.NODE_ENV = 'development';
		const Koa = require(ProyPath('/node_modules/koa'));
		let app = new Koa();
		app.inflector = inflector;
		fs.ensureDirSync(ProyPath('seeds'));
		if (model && options.generate && scfg.database.models[model] && !utils.canAccess(ProyPath('seeds', `${model}.js`))) {
			console.log('file need creation');
			let [skey, ...keys] = Object.keys(scfg.database[model]);
			skey = {
				[skey]: 'unic'
			};
			let seed = {};
			keys.forEach((key) => {
				seed[key] = '';
			});
			utils.render(TemplatePath('seeds', 'model.handlebars'), ProyPath('seeds', `${model}.js`), {
				model: `${JSON.stringify(skey)},${JSON.stringify(seed)}`
			});
		} else if (!options.generate) {
			await require(ProyPath('node_modules', 'koaton', 'lib', 'orm')).initialize(app, true);<commit_msg>fix: make seed compatible with koaton 2.0.5<commit_after>import 'colors';
import * as fs from 'fs-extra';
import Command from 'cmd-line/lib/Command';
import utils from '../utils';

export default (new Command(__filename, 'Creates or run seed in your project.'))
	.Args('model')
	.Options(['-g', '--generate', 'Generete a seed file for the specified model.'])
	.Action(async function (model, options) {
		process.env.NODE_ENV = 'development';
		fs.ensureDirSync(ProyPath('seeds'));
		if (model && options.generate && scfg.database.models[model] && !utils.canAccess(ProyPath('seeds', `${model}.js`))) {
			console.log('file need creation');
			let [skey, ...keys] = Object.keys(scfg.database[model]);
			skey = {
				[skey]: 'unic'
			};
			let seed = {};
			keys.forEach((key) => {
				seed[key] = '';
			});
			utils.render(TemplatePath('seeds', 'model.handlebars'), ProyPath('seeds', `${model}.js`), {
				model: `${JSON.stringify(skey)},${JSON.stringify(seed)}`
			});
		} else if (!options.generate) {
			await require(ProyPath('node_modules', 'koaton', 'middleware', 'orm')).initializeORM(true);
{'fraction_non_alphanumeric': 0.20138288677614521, 'fraction_numerical': 0.0012964563526361278, 'mean_word_length': 4.538277511961723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2057118', 'n_tokens_mistral': 829, 'n_tokens_neox': 779, 'n_words': 175}