Ensure build output has the generated view configs (#3572)
* Ensure build output has the generated view configs * Change files * Build fixes
This commit is contained in:
Родитель
7747498a60
Коммит
b2f0ae646a
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/callout",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/experimental-avatar",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/experimental-checkbox",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/experimental-expander",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/experimental-shimmer",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/focus-trap-zone",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/focus-zone",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/menu-button",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/radio-group",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/spinner",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/tooltip",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "Ensure build output has the generated view configs",
|
||||
"packageName": "@fluentui-react-native/vibrancy-view",
|
||||
"email": "30809111+acoates-ms@users.noreply.github.com",
|
||||
"dependentChangeType": "patch"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('@fluentui-react-native/scripts/babel.config');
|
|
@ -6,17 +6,17 @@
|
|||
|
||||
import type { ColorValue, HostComponent, ViewProps } from 'react-native';
|
||||
|
||||
import type { DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';
|
||||
import type { DirectEventHandler, Double, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
||||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
export interface NativeProps extends ViewProps {
|
||||
expandDirection?: 'up' | 'down';
|
||||
expandDirection?: WithDefault<'up' | 'down', 'down'>;
|
||||
expanded?: boolean;
|
||||
enabled?: boolean;
|
||||
width?: Double;
|
||||
height?: Double;
|
||||
contentHorizontalAlignment?: 'center' | 'left' | 'right' | 'stretch';
|
||||
contentVerticalAlignment?: 'bottom' | 'center' | 'stretch' | 'top';
|
||||
contentHorizontalAlignment?: WithDefault<'center' | 'left' | 'right' | 'stretch', 'stretch'>;
|
||||
contentVerticalAlignment?: WithDefault<'bottom' | 'center' | 'stretch' | 'top', 'top'>;
|
||||
headerBackground?: ColorValue;
|
||||
headerForeground?: ColorValue;
|
||||
headerForegroundPointerOver?: ColorValue;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
module.exports = require('@fluentui-react-native/scripts/babel.config');
|
|
@ -9,6 +9,7 @@ const { clean } = require('./tasks/clean');
|
|||
const { copy } = require('./tasks/copy');
|
||||
const { jest } = require('./tasks/jest');
|
||||
const { ts } = require('./tasks/ts');
|
||||
const { codegenNativeComponents } = require('./tasks/codegenNativeComponents')
|
||||
const { eslint } = require('./tasks/eslint');
|
||||
const { depcheckTask } = require('./tasks/depcheck');
|
||||
const { checkForModifiedFiles } = require('./tasks/checkForModifiedFilesTask');
|
||||
|
@ -32,6 +33,7 @@ export function preset() {
|
|||
task('clean', clean);
|
||||
task('copy', copy);
|
||||
task('jest', jest);
|
||||
task('codegenNativeComponents', codegenNativeComponents);
|
||||
task('ts:commonjs', ts.commonjs);
|
||||
task('ts:esm', ts.esm);
|
||||
task('eslint', eslint);
|
||||
|
@ -71,7 +73,7 @@ export function preset() {
|
|||
),
|
||||
);
|
||||
|
||||
task('build', series('clean', 'copy', 'ts'));
|
||||
task('build', series('clean', 'copy', 'ts', 'codegenNativeComponents'));
|
||||
|
||||
task('depcheck', depcheckTask);
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
// @ts-check
|
||||
import * as glob from 'glob';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
exports.codegenNativeComponents = () => {
|
||||
const babel = require("@babel/core");
|
||||
const matches = glob.sync("src/**/*NativeComponent.ts");
|
||||
|
||||
matches.forEach(matchedPath => {
|
||||
const relativePath = path.relative(path.resolve(process.cwd(), 'src'), matchedPath);
|
||||
const code = fs.readFileSync(matchedPath).toString();
|
||||
const filename = path.resolve(process.cwd(), matchedPath);
|
||||
|
||||
const res = babel.transformSync(code,
|
||||
{
|
||||
ast: false,
|
||||
filename,
|
||||
cwd: process.cwd(),
|
||||
sourceRoot: process.cwd(),
|
||||
root: process.cwd(),
|
||||
babelrc: true
|
||||
});
|
||||
|
||||
const relativeOutputPath = relativePath.replace(/\.ts$/, '.js');
|
||||
|
||||
fs.writeFileSync(path.resolve(process.cwd(), 'lib', relativeOutputPath), res?.code);
|
||||
});
|
||||
|
||||
|
||||
|
||||
};
|
Загрузка…
Ссылка в новой задаче