Skip to content

Commit

Permalink
fix: output in ts with babel
Browse files Browse the repository at this point in the history
  • Loading branch information
omariosouto committed Dec 14, 2021
1 parent 2db9164 commit 4e5585d
Show file tree
Hide file tree
Showing 17 changed files with 2,129 additions and 1,538 deletions.
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN || secrets.GH_MASTER_TOKEN }}
run: |
yarn build
yarn export:docs
yarn release
- name: Release GitHub Registry
env:
Expand Down
3 changes: 2 additions & 1 deletion lib/components/box/box.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { Ref } from 'react';
import { renderCSS } from '@lib/utils/renderCSS';
import { theme } from '@lib/core/theme/theme';
import { StyleSheet } from '@lib/core/stylesheet/stylesheet';

interface BoxProps {
as?: any;
children?: any;
className?: string;
styleSheet?: any;
styleSheet?: StyleSheet;
ref?: Ref<any>;
}
export const Box = React.forwardRef(({
Expand Down
9 changes: 6 additions & 3 deletions lib/core/stylesheet/stylesheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { Breakpoints } from '@lib/core/breakpoints/breakpoints';
type ResponsiveProperty<Type> = Partial<Record<Breakpoints, Type>>;

export interface StyleSheet {
backgroundColor: ResponsiveProperty<string>;
padding: ResponsiveProperty<number>;
margin: ResponsiveProperty<number>;
srOnly?: boolean;
backgroundColor?: ResponsiveProperty<string>;
padding?: ResponsiveProperty<number>;
margin?: ResponsiveProperty<number>;
focus?: any;
hover?: any;
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
"url": "/~https://github.com/skynexui/core.git"
},
"scripts": {
"build": "rollup -c",
"prebuild": "rimraf dist && rimraf types",
"build": "yarn export:types && rollup -c && yarn export:docs",
"release": "semantic-release",
"release:github_registry": "npm publish --@skynexui:registry=https://npm.pkg.github.com",
"dev": "start-storybook -p 6006",
"build:storybook": "build-storybook -o dist-storybook",
"export:types": "tsc",
"export:docs": "find ./lib -name '*.mdx' -exec cp -prv '{}' './dist' ';' && node ./scripts/parseDocs.js && cp ./docs.json ./dist/docs.json && ls -la ./dist"
},
"dependencies": {
Expand Down
5 changes: 3 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,22 @@ export default [
}),
commonjs(),
babel({
babelHelpers: 'bundled',
exclude: "node_modules/**",
extensions
}),
],
},
{
input: 'dist/esm/types/components.d.ts',
input: 'types/components.d.ts',
output: [{ file: packageJson.types, format: "esm" }],
external: [/\.css$/],
plugins: [
alias({
entries: [{
find: '@lib',
replacement: (...args) => {
return path.resolve(__dirname, 'dist/esm/types/');
return path.resolve(__dirname, 'types/');
},
}]
}),
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"declarationDir": "types",
"sourceMap": true,
"emitDeclarationOnly": true,
"skipLibCheck": true,
"typeRoots": [
"./node_modules/@types",
"./@types"
Expand Down
1 change: 1 addition & 0 deletions types/_old/GlobalStyle.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function GlobalStyle(): JSX.Element;
31 changes: 31 additions & 0 deletions types/_old/components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { Ref } from 'react';
interface BoxProps {
as?: any;
children?: any;
className?: string;
styleSheet?: any;
ref?: Ref<any>;
}
export declare const Box: React.ForwardRefExoticComponent<Pick<BoxProps, "as" | "styleSheet" | "children" | "className"> & React.RefAttributes<unknown>>;
export declare function Icon({ as, styleSheet: initialStyleSheet, ...props }: any): JSX.Element;
export declare const Text: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
export declare function Image({ as, ...props }: any): JSX.Element;
export declare namespace Image {
var defaultProps: {
styleSheet: {};
};
}
export declare function Input({ as, styleSheet, ...props }: any): JSX.Element;
export declare namespace Input {
var defaultProps: {
styleSheet: {};
};
}
export declare function Button({ as, styleSheet, ...props }: any): JSX.Element;
export declare namespace Button {
var defaultProps: {
styleSheet: {};
};
}
export declare function Link({ children, href, styleSheet, as, ...props }: any): JSX.Element;
export {};
3 changes: 3 additions & 0 deletions types/components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { theme } from '@lib/core/theme/theme';
export { Box } from '@lib/components/box/box';
export { Text } from '@lib/components/text/text';
11 changes: 11 additions & 0 deletions types/components/box/box.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { Ref } from 'react';
import { StyleSheet } from '@lib/core/stylesheet/stylesheet';
interface BoxProps {
as?: any;
children?: any;
className?: string;
styleSheet?: StyleSheet;
ref?: Ref<any>;
}
export declare const Box: React.ForwardRefExoticComponent<Pick<BoxProps, "as" | "styleSheet" | "children" | "className"> & React.RefAttributes<unknown>>;
export {};
13 changes: 13 additions & 0 deletions types/components/text/text.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { StyleSheet } from '@lib/core/stylesheet/stylesheet';
interface TextProps {
styleSheet: StyleSheet;
children: React.ReactNode;
}
export declare function Text({ children, styleSheet }: TextProps): JSX.Element;
export declare namespace Text {
var defaultProps: {
styleSheet: {};
};
}
export {};
7 changes: 7 additions & 0 deletions types/core/breakpoints/breakpoints.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export declare enum Breakpoints {
xs = "Breakpoints.xs",
sm = "Breakpoints.sm",
md = "Breakpoints.md",
lg = "Breakpoints.lg",
xl = "Breakpoints.xl"
}
11 changes: 11 additions & 0 deletions types/core/stylesheet/stylesheet.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Breakpoints } from '@lib/core/breakpoints/breakpoints';
declare type ResponsiveProperty<Type> = Partial<Record<Breakpoints, Type>>;
export interface StyleSheet {
srOnly?: boolean;
backgroundColor?: ResponsiveProperty<string>;
padding?: ResponsiveProperty<number>;
margin?: ResponsiveProperty<number>;
focus?: any;
hover?: any;
}
export {};
Loading

1 comment on commit 4e5585d

@vercel
Copy link

@vercel vercel bot commented on 4e5585d Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.