Skip to content

Commit ca49fdf

Browse files
chore: build .d.ts files using npm script (#696)
1 parent 1fad1cd commit ca49fdf

File tree

8 files changed

+17
-44
lines changed

8 files changed

+17
-44
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
"license": "Apache-2.0",
77
"scripts": {
88
"start": "lerna run build:i18n && start-storybook -p 6006 -c .storybook",
9-
"build": "npm-run-all -s build:clean build:bundle",
10-
"build:clean": "yarn clean",
9+
"build": "npm-run-all -s clean build:bundle build:types",
1110
"build:bundle": "lerna run build --stream",
12-
"build:storybook": "lerna run build:i18n && build-storybook -c .storybook -o .out",
11+
"build:types": "lerna run build:types --stream",
1312
"pretest": "rimraf coverage && lerna run build:i18n",
1413
"test": "jest --config=config/jest.config.js --coverage",
1514
"clean": "lerna run clean --stream && rimraf coverage",

packages/base/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"clean": "rimraf cjs Device hooks lib polyfill styling types utils index.esm.js index.d.ts",
2424
"build:rollup": "rollup -c rollup.config.js",
2525
"build:polyfills": "tsc ./src/polyfill/*.ts --outDir ./polyfill --skipLibCheck",
26-
"build": "npm-run-all -s build:rollup build:polyfills"
26+
"build": "npm-run-all -s build:rollup build:polyfills",
27+
"build:types": "tsc --declaration --emitDeclarationOnly --declarationDir . --removeComments false"
2728
},
2829
"dependencies": {
2930
"@babel/runtime": "7.11.0",

packages/charts/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"sideEffects": false,
1717
"scripts": {
1818
"clean": "rimraf cjs components interfaces internal lib util index.esm.js index.d.ts config.d.ts hooks",
19-
"build": "rollup -c rollup.config.js"
19+
"build": "rollup -c rollup.config.js",
20+
"build:types": "tsc --declaration --emitDeclarationOnly --declarationDir . --removeComments false || exit 0"
2021
},
2122
"dependencies": {
2223
"@babel/runtime": "7.11.0",

packages/main/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"build:i18n-bundles": "mkdirp dist/assets/i18n && node ../../node_modules/@ui5/webcomponents-tools/lib/i18n/toJSON.js src/i18n dist/assets/i18n",
2929
"build:i18n-default": "node ../../node_modules/@ui5/webcomponents-tools/lib/i18n/defaults.js src/i18n dist/assets/i18n && tsc dist/assets/i18n/i18n-defaults.js --allowJs --declaration --emitDeclarationOnly --declarationDir dist/assets/i18n",
3030
"build:i18n-imports": "mkdirp dist/json-imports && node ../../node_modules/@ui5/webcomponents-tools/lib/generate-json-imports/i18n.js dist/assets/i18n dist/json-imports/",
31-
"build:assets": "node ../../scripts/generate-assets/index.js"
31+
"build:assets": "node ../../scripts/generate-assets/index.js",
32+
"build:types": "tsc --declaration --emitDeclarationOnly --declarationDir . --removeComments false"
3233
},
3334
"dependencies": {
3435
"@babel/runtime": "7.11.0",

packages/main/src/components/FormItem/index.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createComponentStyles } from '@ui5/webcomponents-react-base/lib/createC
22
import { FlexBox } from '@ui5/webcomponents-react/lib/FlexBox';
33
import { FlexBoxAlignItems } from '@ui5/webcomponents-react/lib/FlexBoxAlignItems';
44
import { FlexBoxDirection } from '@ui5/webcomponents-react/lib/FlexBoxDirection';
5-
import { Label } from '@ui5/webcomponents-react/lib/Label';
5+
import { Label, LabelPropTypes } from '@ui5/webcomponents-react/lib/Label';
66
import React, { cloneElement, CSSProperties, FC, isValidElement, ReactElement, ReactNode, ReactNodeArray } from 'react';
77

88
export interface FormItemProps {
@@ -50,18 +50,21 @@ const renderLabel = (
5050
}
5151

5252
if (isValidElement(label)) {
53-
return cloneElement(
53+
return cloneElement<LabelPropTypes>(
5454
label,
5555
{
56-
wrap: label.props.wrap ?? true,
57-
className: `${classes.label} ${label.props.className ?? ''}`,
56+
wrap: (label as ReactElement<LabelPropTypes>).props.wrap ?? true,
57+
className: `${classes.label} ${(label as ReactElement<LabelPropTypes>).props.className ?? ''}`,
5858
style: {
5959
gridColumnStart: styles.gridColumnStart,
6060
gridRowStart: styles.gridRowStart,
61-
...(label.props.style || {})
61+
...((label as ReactElement<LabelPropTypes>).props.style || {})
6262
}
6363
},
64-
label.props.children ? `${label.props.children}:` : ''
64+
(label as ReactElement<LabelPropTypes>).props.children
65+
? // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
66+
`${(label as ReactElement<LabelPropTypes>).props.children}:`
67+
: ''
6568
);
6669
}
6770

packages/main/src/exceptions/UnknownFlavourException.test.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/main/src/exceptions/UnknownFlavourException.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

scripts/rollup/configFactory.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,6 @@ const rollupConfigFactory = (pkgName, externals = []) => {
6565
console.info('Copy index file');
6666
asyncCopyTo(path.resolve(PKG_BASE_PATH, 'src', 'index.ts'), path.resolve(PKG_BASE_PATH, `index.esm.js`));
6767

68-
console.info('Create TS Types');
69-
const tsConfigPath = path.resolve(PKG_BASE_PATH, 'tsconfig.json');
70-
if (fs.existsSync(tsConfigPath)) {
71-
spawnSync(
72-
path.resolve(PATHS.nodeModules, '.bin', 'tsc'),
73-
[
74-
'--project',
75-
tsConfigPath,
76-
'--declaration',
77-
'--emitDeclarationOnly',
78-
'--declarationDir',
79-
PKG_BASE_PATH,
80-
'--removeComments',
81-
'false'
82-
],
83-
{ stdio: 'inherit' }
84-
);
85-
}
86-
8768
const external = (id) => {
8869
const containsThisModule = (pkg) => id === pkg || id.startsWith(pkg + '/');
8970
return externalModules.some(containsThisModule);

0 commit comments

Comments
 (0)