Skip to content

Instantly share code, notes, and snippets.

@ericlewis
Created March 7, 2019 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericlewis/17c2dbe013e6863efdcaee91966a2e9c to your computer and use it in GitHub Desktop.
Save ericlewis/17c2dbe013e6863efdcaee91966a2e9c to your computer and use it in GitHub Desktop.
Generates the files needed for React Native Fabric components.
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
require('flow-remove-types/register');
const RNCodegen = require('./generators/RNCodegen.js');
const mkdirp = require('mkdirp');
function _generate(schema, outputDirectory) {
mkdirp.sync(outputDirectory);
RNCodegen.generate({
libraryName: 'rncore',
schema,
outputDirectory,
});
}
function generateCombined() {
const activityIndicatorSchema = require('../../../Libraries/Components/ActivityIndicator/ActivityIndicatorSchema.js');
const switchSchema = require('../../../Libraries/Components/Switch/SwitchSchema.js');
const sliderSchema = require('../../../Libraries/Components/Slider/SliderSchema.js');
const schema = {
modules: {
...activityIndicatorSchema.modules,
...switchSchema.modules,
...sliderSchema.modules,
},
};
const outputDirectory = '../../ReactCommon/fabric/components/rncore';
_generate(schema, outputDirectory);
}
generateCombined();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment