mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
0465c3fd10
Summary: This Diff splits the `generate-specs-cli.js` script into: * `generate-specs-cli-executor.js`: which contains the logic to generate the code for iOS. * `generate-specs-cli.js`: which contains the argument parsing logic and invokes the executor. Finally it introduces some tests. ## Changelog [iOS][Changed] - Refactor part of the codegen scripts and add tests. Reviewed By: cortinico, dmitryrykun Differential Revision: D35892576 fbshipit-source-id: 6a3205af049bf55aa4ecaf64544ebc4eb7b13f73
88 lines
1.9 KiB
JavaScript
88 lines
1.9 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @emails oncall+react_native
|
|
* @format
|
|
*/
|
|
|
|
'use-strict';
|
|
|
|
const SCHEMA_TEXT = `
|
|
{
|
|
"modules": {
|
|
"ColoredView": {
|
|
"type": "Component",
|
|
"components": {
|
|
"ColoredView": {
|
|
"extendsProps": [
|
|
{
|
|
"type": "ReactNativeBuiltInType",
|
|
"knownTypeName": "ReactNativeCoreViewProps"
|
|
}
|
|
],
|
|
"events": [],
|
|
"props": [
|
|
{
|
|
"name": "color",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "StringTypeAnnotation",
|
|
"default": null
|
|
}
|
|
}
|
|
],
|
|
"commands": []
|
|
}
|
|
}
|
|
},
|
|
"NativeCalculator": {
|
|
"type": "NativeModule",
|
|
"aliases": {},
|
|
"spec": {
|
|
"properties": [
|
|
{
|
|
"name": "add",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "FunctionTypeAnnotation",
|
|
"returnTypeAnnotation": {
|
|
"type": "PromiseTypeAnnotation"
|
|
},
|
|
"params": [
|
|
{
|
|
"name": "a",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "NumberTypeAnnotation"
|
|
}
|
|
},
|
|
{
|
|
"name": "b",
|
|
"optional": false,
|
|
"typeAnnotation": {
|
|
"type": "NumberTypeAnnotation"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"moduleNames": [
|
|
"Calculator"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
const SCHEMA = JSON.parse(SCHEMA_TEXT);
|
|
|
|
module.exports = {
|
|
schemaText: SCHEMA_TEXT,
|
|
schema: SCHEMA,
|
|
};
|