update : convly request applied

This commit is contained in:
dogusdeniz 2023-01-11 13:00:21 +03:00 committed by GitHub
parent 11923a820f
commit 83ca415e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -14,6 +14,13 @@ const validateInput = (input) => {
return regex.test(input) || "Please use only letters and number, '-' or '_' and no spaces";
};
const getFormattedDate = (date = new Date()) => {
return new Date(date.getTime() - date.getTimezoneOffset() * 60000)
.toISOString()
.split(".")[0]
.replace(/[-T:]/g, "_");
};
module.exports = (plop) => {
// Migration generator
plop.setGenerator('migration', {
@ -29,7 +36,7 @@ module.exports = (plop) => {
actions(answers) {
const currentDir = process.cwd();
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
const timestamp = moment().format('YYYY_MM_DD_HH_mm_ss');
const timestamp = getFormattedDate();
return [
{

View File

@ -1,4 +1,4 @@
import { Knex } from 'knex';
import type { Knex } from 'knex';
/**
* Migration `{{ id }}`

View File

@ -36,8 +36,7 @@
"fs-extra": "10.0.0",
"node-plop": "0.26.3",
"plop": "2.7.6",
"pluralize": "8.0.0",
"moment": "^2.29.4"
"pluralize": "8.0.0"
},
"engines": {
"node": ">=14.19.1 <=18.x.x",