humus-old/server/create-fixtures.js
2019-05-30 09:12:17 -05:00

47 lines
1.9 KiB
JavaScript

import fs from 'fs';
import path from 'path';
import {globalRegistry, Resource} from '@avocado/resource';
const RESOURCE_PATH = path.resolve(process.cwd(), 'resource');
function writeFixture(uri, json) {
// const uuid = Resource.uuid();
// json.uuid = uuid;
// globalRegistry.register(uri, uuid);
fs.writeFileSync(path.join(RESOURCE_PATH, uri), JSON.stringify(json));
}
// Write all our dudes.
import {blueFireJSON} from './fixtures/blue-fire.entity';
writeFixture('blue-fire.entity.json', blueFireJSON());
import {fireJSON} from './fixtures/fire.entity';
writeFixture('fire.entity.json', fireJSON());
import {flowerBarrelJSON} from './fixtures/flower-barrel.entity';
writeFixture('flower-barrel.entity.json', flowerBarrelJSON());
import {kittyJSON} from './fixtures/kitty.entity';
writeFixture('kitty.entity.json', kittyJSON());
import {mamaKittySpawnerJSON} from './fixtures/mama-kitty-spawner.entity';
writeFixture('mama-kitty-spawner.entity.json', mamaKittySpawnerJSON());
import {mamaKittyJSON} from './fixtures/mama-kitty.entity';
writeFixture('mama-kitty.entity.json', mamaKittyJSON());
import {tomatoPlantJSON} from './fixtures/tomato-plant.entity';
writeFixture('tomato-plant.entity.json', tomatoPlantJSON());
// Write items.
import {potionJSON} from './fixtures/potion.entity';
writeFixture('potion.entity.json', potionJSON());
import {rockJSON} from './fixtures/rock.entity';
writeFixture('rock.entity.json', rockJSON());
import {hoeJSON} from './fixtures/hoe.entity';
writeFixture('hoe.entity.json', hoeJSON());
import {wateringCanJSON} from './fixtures/watering-can.entity';
writeFixture('watering-can.entity.json', wateringCanJSON());
import {tomatoSeedsJSON} from './fixtures/tomato-seeds.entity';
writeFixture('tomato-seeds.entity.json', tomatoSeedsJSON());
// Write rooms.
import {kittyFireJSON} from './fixtures/kitty-fire.room';
writeFixture('kitty-fire.room.json', kittyFireJSON());
// Flush registry.
// globalRegistry.flush();