humus-old/server/create-fixtures.js

47 lines
1.9 KiB
JavaScript
Raw Normal View History

2019-05-21 03:10:07 -05:00
import fs from 'fs';
import path from 'path';
2019-05-21 21:10:32 -05:00
import {globalRegistry, Resource} from '@avocado/resource';
2019-05-21 03:10:07 -05:00
const RESOURCE_PATH = path.resolve(process.cwd(), 'resource');
function writeFixture(uri, json) {
2019-05-21 21:10:32 -05:00
// const uuid = Resource.uuid();
// json.uuid = uuid;
// globalRegistry.register(uri, uuid);
2019-05-21 03:10:07 -05:00
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());
2019-05-30 09:12:17 -05:00
import {tomatoPlantJSON} from './fixtures/tomato-plant.entity';
writeFixture('tomato-plant.entity.json', tomatoPlantJSON());
2019-05-26 08:07:45 -05:00
// Write items.
import {potionJSON} from './fixtures/potion.entity';
writeFixture('potion.entity.json', potionJSON());
2019-05-26 12:01:16 -05:00
import {rockJSON} from './fixtures/rock.entity';
writeFixture('rock.entity.json', rockJSON());
2019-05-27 17:30:40 -05:00
import {hoeJSON} from './fixtures/hoe.entity';
writeFixture('hoe.entity.json', hoeJSON());
2019-05-28 20:35:24 -05:00
import {wateringCanJSON} from './fixtures/watering-can.entity';
writeFixture('watering-can.entity.json', wateringCanJSON());
2019-05-30 09:12:17 -05:00
import {tomatoSeedsJSON} from './fixtures/tomato-seeds.entity';
writeFixture('tomato-seeds.entity.json', tomatoSeedsJSON());
2019-05-21 03:10:07 -05:00
// Write rooms.
import {kittyFireJSON} from './fixtures/kitty-fire.room';
writeFixture('kitty-fire.room.json', kittyFireJSON());
2019-05-21 21:10:32 -05:00
// Flush registry.
// globalRegistry.flush();