humus-old/server/create-fixtures.js
2019-05-26 12:01:16 -05:00

39 lines
1.5 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());
// Write items.
import {potionJSON} from './fixtures/potion.entity';
writeFixture('potion.entity.json', potionJSON());
import {rockJSON} from './fixtures/rock.entity';
writeFixture('rock.entity.json', rockJSON());
// Write rooms.
import {kittyFireJSON} from './fixtures/kitty-fire.room';
writeFixture('kitty-fire.room.json', kittyFireJSON());
// Flush registry.
// globalRegistry.flush();