2021-02-17 06:14:07 +01:00
|
|
|
import 'reflect-metadata';
|
|
|
|
import { container } from 'tsyringe';
|
|
|
|
import { Configuration } from './common/config/Configuration';
|
2021-02-22 06:39:02 +01:00
|
|
|
import { IConverter } from './common/converters/IConverter';
|
2021-08-19 10:02:25 +02:00
|
|
|
import { EffectConverter } from './converters/EffectConverter';
|
|
|
|
import { EffectMapConverter } from './converters/EffectMapConverter';
|
|
|
|
import { ExternalTextsConverter } from './converters/ExternalTextsConverter';
|
|
|
|
import { FigureConverter } from './converters/FigureConverter';
|
|
|
|
import { FigureDataConverter } from './converters/FigureDataConverter';
|
|
|
|
import { FigureMapConverter } from './converters/FigureMapConverter';
|
|
|
|
import { FurnitureConverter } from './converters/FurnitureConverter';
|
|
|
|
import { FurnitureDataConverter } from './converters/FurnitureDataConverter';
|
|
|
|
import { OldAssetConverter } from './converters/OldAssetConverter';
|
|
|
|
import { PetConverter } from './converters/PetConverter';
|
|
|
|
import { ProductDataConverter } from './converters/ProductDataConverter';
|
2021-02-17 06:14:07 +01:00
|
|
|
|
|
|
|
(async () =>
|
|
|
|
{
|
2021-02-25 00:24:09 +01:00
|
|
|
checkNodeVersion();
|
2021-08-03 20:17:03 +02:00
|
|
|
|
2021-02-15 17:13:43 +01:00
|
|
|
const config = container.resolve(Configuration);
|
2021-01-28 09:12:04 +01:00
|
|
|
await config.init();
|
|
|
|
|
2021-02-22 06:39:02 +01:00
|
|
|
const converters = [
|
2021-08-19 10:02:25 +02:00
|
|
|
FurnitureDataConverter,
|
|
|
|
FigureDataConverter,
|
2021-02-22 06:39:02 +01:00
|
|
|
ProductDataConverter,
|
|
|
|
ExternalTextsConverter,
|
2021-08-19 10:02:25 +02:00
|
|
|
EffectMapConverter,
|
|
|
|
FigureMapConverter,
|
|
|
|
FurnitureConverter,
|
2021-02-22 06:39:02 +01:00
|
|
|
FigureConverter,
|
|
|
|
EffectConverter,
|
2021-08-03 09:15:05 +02:00
|
|
|
PetConverter,
|
2021-08-19 10:02:25 +02:00
|
|
|
OldAssetConverter
|
2021-02-22 06:39:02 +01:00
|
|
|
];
|
2021-02-21 06:27:46 +01:00
|
|
|
|
2021-08-12 05:07:23 +02:00
|
|
|
const [ arg1, arg2, ...rest ] = process.argv;
|
|
|
|
|
2021-02-22 06:39:02 +01:00
|
|
|
for(const converterClass of converters)
|
2021-02-21 06:27:46 +01:00
|
|
|
{
|
2021-02-22 06:39:02 +01:00
|
|
|
const converter = (container.resolve<any>(converterClass) as IConverter);
|
2021-02-21 06:27:46 +01:00
|
|
|
|
2021-08-12 05:07:23 +02:00
|
|
|
await converter.convertAsync(rest);
|
2021-02-15 17:13:43 +01:00
|
|
|
}
|
2021-02-17 06:14:07 +01:00
|
|
|
})();
|
2021-02-25 00:24:09 +01:00
|
|
|
|
|
|
|
function checkNodeVersion()
|
|
|
|
{
|
|
|
|
const version = process.version.replace('v', '');
|
|
|
|
const major = version.split('.')[0];
|
|
|
|
if(parseInt(major) < 14)
|
|
|
|
{
|
|
|
|
throw new Error('Invalid node version: ' + version + ' please use >= 14');
|
|
|
|
}
|
|
|
|
}
|