UNPKG

@alsew_/strapi-plugin-migration

Version:
21 lines (20 loc) 856 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createMigrationsFolderAndSubFolders = createMigrationsFolderAndSubFolders; const fse = require('fs-extra'); const path = require('path'); async function createMigrationsFolderAndSubFolders() { const dirnames = [ path.join('./migrations', 'scripts'), path.join('./migrations', 'deprecated-fields'), ]; await Promise.all(dirnames.map(dirname => fse.mkdirs(`${dirname}`).catch(console.error))); fse.pathExists(path.join('./migrations', 'deprecated-fields', 'deprecated-fields.json'), (err, exists) => { if (!exists) { fse.outputFile(path.join('./migrations', 'deprecated-fields', 'deprecated-fields.json'), `[]`, function (err) { if (err) throw err; }); } }); }