Files
react-native/scripts/codegen/__test_fixtures__/fixtures.js
T
Riccardo Cipolleschi 0465c3fd10 Refactor generate-specs-cli and add tests
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
2022-05-04 04:04:10 -07:00

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,
};