Skip to content

Commit 181e447

Browse files
committed
feat: typings
1 parent c35dcd7 commit 181e447

29 files changed

+442
-307
lines changed

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ yarn-debug.log*
55
yarn-error.log*
66

77
# production
8-
lib
8+
dist
99
docs
10+
*.tgz
1011

1112
# typescript
1213
tsconfig.tsbuildinfo
1314
src/***/*.d.ts
14-
!src/declaration.d.ts
15+
!src/declaration.d.ts

.npmignore

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
src
1+
-lib/
2+
/index.*
3+
bin/
4+
config/
5+
src/
6+
assets/
27
node_modules/
8+
.npmrc
39
.eslintrc
410
*config.*
511
yarn-error.log
612
*.sublime-*
13+
.vscode/
14+
*.tgz

README.md

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
1-
[![npm](https://img.shields.io/npm/dm/@truerenton/uilib?style=flat-square)](https://www.npmjs.com/package/@truerenton/uilib)
2-
1+
[![npm](https://img.shields.io/npm/dm/@foreverido/uilib?style=flat-square)](https://www.npmjs.com/package/@foreverido/uilib)
32

43
# UILIB
54

65
React/Preact UI components library
76

8-
## Installation
9-
10-
`npm i @truerenton/uilib`
11-
12-
or
13-
14-
`yarn add @truerenton/uilib`
15-
167
## Roadmap
178

18-
* build and publish typings
19-
* uncomment rest components and fix typings
20-
* documentation for every component
9+
- build and publish typings
10+
- uncomment rest components and fix typings
11+
- documentation for every component / sandpack

config/paths.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
src: resolvePath('src'),
1313
server: resolvePath('server'),
1414
docs: resolvePath('docs'),
15-
lib: resolvePath('lib'),
15+
dist: resolvePath('dist'),
1616
assets: resolvePath('assets'),
1717
modules: resolvePath('node_modules'),
1818
};

config/webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const config = {
88
extensions: ['.js', '.jsx', '.ts', '.tsx', '.css', '.styl'],
99
alias: {
1010
src: paths.src,
11-
'@foreverido/uilib': paths.src,
1211
theme: `${paths.src}/theme.styl`,
1312
react: 'preact/compat',
1413
'react-dom': 'preact/compat',
1514
'justorm/react': 'justorm/preact',
15+
hooks: 'preact/hooks',
1616
},
1717
},
1818
module: {

index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './src';

index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export * from './src/components';
2-
// export * from './src/tools';
1+
export * from './src';

package.json

+39-35
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"name": "@truerenton/uilib",
3-
"version": "0.0.2",
2+
"name": "@foreverido/uilib",
3+
"version": "0.0.11",
44
"description": "React UI components library",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",
77
"ts": "tsc --noUnusedLocals",
88
"dev": "webpack-dev-server --mode=development --config ./config/docs.webpack.config.js --progress",
9-
"docs:build": "NODE_ENV=production webpack --mode=production --config ./config/docs.webpack.config.js --progress",
10-
"docs:deploy": "./bin/deploy-docs.sh",
11-
"build:lib": "rollup -c rollup.config.ts",
9+
"build": "rollup -c rollup.config.ts",
1210
"release": "standard-version",
1311
"release:patch": "yarn release -- --release-as patch",
1412
"release:minor": "yarn release -- --release-as minor",
15-
"release:major": "yarn release -- --release-as major"
13+
"release:major": "yarn release -- --release-as major",
14+
"docs:build": "NODE_ENV=production webpack --mode=production --config ./config/docs.webpack.config.js --progress",
15+
"docs:deploy": "./bin/deploy-docs.sh"
1616
},
1717
"standard-version": {
1818
"scripts": {
@@ -28,30 +28,28 @@
2828
"components",
2929
"library"
3030
],
31-
"homepage": "https://github.com/apostololeg/uilib#readme",
31+
"homepage": "https://github.com/foreverido/uilib#readme",
3232
"repository": {
3333
"type": "git",
34-
"url": "git+https://github.com/apostololeg/uilib.git"
34+
"url": "git+https://github.com/foreverido/uilib.git"
3535
},
36-
"main": "lib/index.cjs.js",
37-
"module": "lib/esm",
38-
"types": "lib/types",
36+
"main": "dist/cjs",
37+
"module": "dist/esm",
38+
"types": "dist/index.d.ts",
3939
"sideEffects": false,
4040
"dependencies": {
41-
"@guanghechen/postcss-modules-dts": "^1.8.4",
42-
"@rollup/plugin-babel": "^5.3.0",
43-
"@rollup/plugin-json": "^4.1.0",
41+
"classnames": "^2.2.6",
42+
"compareq": "^1.2.2",
43+
"decko": "^1.2.0",
4444
"fastest-validator": "^1.4.1",
45-
"path-parser": "^6.1.0",
46-
"rollup-plugin-cleaner": "^1.0.0",
47-
"rollup-plugin-delete": "^2.0.0",
48-
"rollup-plugin-node-externals": "^2.2.0",
49-
"rollup-plugin-postcss": "^4.0.1",
50-
"rollup-plugin-styles": "^3.14.1",
51-
"rollup-plugin-stylus-css-modules": "^1.5.0",
52-
"rollup-plugin-svg": "^2.0.0",
53-
"rollup-plugin-uglify": "^6.0.4",
54-
"typescript-plugin-css-modules": "^3.4.0"
45+
"justorm": "^2.1.1",
46+
"lodash.omit": "^4.5.0",
47+
"lodash.pick": "^4.4.0",
48+
"nanoid": "^3.1.6",
49+
"preact": "^10.4.4",
50+
"react": "^17.0.2",
51+
"react-dom": "^17.0.2",
52+
"timen": "^0.0.9"
5553
},
5654
"devDependencies": {
5755
"@babel/core": "^7.9.6",
@@ -72,47 +70,53 @@
7270
"@babel/preset-env": "^7.12.1",
7371
"@babel/preset-typescript": "^7.16.0",
7472
"@babel/runtime-corejs2": "^7.9.6",
73+
"@codesandbox/sandpack-react": "^0.12.0",
74+
"@guanghechen/postcss-modules-dts": "^1.8.4",
75+
"@rollup/plugin-babel": "^5.3.0",
7576
"@rollup/plugin-commonjs": "^21.0.1",
77+
"@rollup/plugin-json": "^4.1.0",
7678
"@rollup/plugin-node-resolve": "^13.0.6",
7779
"@svgr/rollup": "^5.5.0",
7880
"@types/react": "^17.0.34",
7981
"@webpack-cli/serve": "^1.6.0",
8082
"babel-loader": "^8.2.3",
8183
"babel-minify-webpack-plugin": "^0.3.1",
8284
"babel-plugin-object-to-json-parse": "^0.2.0",
83-
"classnames": "^2.2.6",
8485
"clean-webpack-plugin": "^4.0.0",
85-
"compareq": "^1.2.2",
8686
"component-directory-webpack-plugin": "^1.0.5",
8787
"copy-webpack-plugin": "^9.0.1",
8888
"css-loader": "^6.5.0",
8989
"css-modules-typescript-loader": "^4.0.1",
9090
"cssnano": "^4.1.10",
91-
"decko": "^1.2.0",
9291
"favicons-webpack-plugin": "^5.0.2",
9392
"file-loader": "^6.2.0",
9493
"html-webpack-plugin": "^5.5.0",
95-
"justorm": "^2.1.1",
96-
"lodash.omit": "^4.5.0",
97-
"lodash.pick": "^4.4.0",
9894
"mini-css-extract-plugin": "^2.4.3",
99-
"nanoid": "^3.1.6",
95+
"path-parser": "^6.1.0",
10096
"postcss-cssnext": "^3.1.0",
10197
"postcss-loader": "^6.2.0",
10298
"postcss-preset-env": "^6.7.0",
103-
"preact": "^10.4.4",
10499
"preact-svg-loader": "^0.2.1",
105-
"react-dom": "^17.0.2",
100+
"raw-loader": "^4.0.2",
106101
"replace": "^1.2.1",
102+
"rollup-plugin-cleaner": "^1.0.0",
103+
"rollup-plugin-delete": "^2.0.0",
104+
"rollup-plugin-dts": "^4.1.0",
105+
"rollup-plugin-node-externals": "^2.2.0",
106+
"rollup-plugin-postcss": "^4.0.1",
107+
"rollup-plugin-styles": "^3.14.1",
108+
"rollup-plugin-stylus-css-modules": "^1.5.0",
109+
"rollup-plugin-svg": "^2.0.0",
107110
"rollup-plugin-typescript-paths": "^1.3.0",
108111
"rollup-plugin-typescript2": "^0.30.0",
112+
"rollup-plugin-uglify": "^6.0.4",
109113
"standard-version": "^9.3.2",
110114
"style-loader": "^3.3.1",
111115
"stylus": "^0.54.7",
112116
"stylus-loader": "^6.2.0",
113117
"terser-webpack-plugin": "^5.2.4",
114-
"timen": "^0.0.9",
115118
"typescript": "^4.4.4",
119+
"typescript-plugin-css-modules": "^3.4.0",
116120
"webpack": "5",
117121
"webpack-bundle-analyzer": "^3.8.0",
118122
"webpack-cli": "^4.9.1",
@@ -123,6 +127,6 @@
123127
"url": "https://github.com/apostololeg/uilib/issues"
124128
},
125129
"directories": {
126-
"lib": "lib"
130+
"dist": "./dist"
127131
}
128132
}

rollup.config.ts

+74-59
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import styles from 'rollup-plugin-styles';
1717
import svgr from '@svgr/rollup';
1818
import json from '@rollup/plugin-json';
1919

20+
// import dts from '@guanghechen/postcss-modules-dts';
21+
import dts from 'rollup-plugin-dts';
22+
2023
// import { babel } from '@rollup/plugin-babel';
2124
import typescript from 'rollup-plugin-typescript2';
2225

@@ -34,66 +37,78 @@ glob.sync('src/**/*.styl').forEach(css => {
3437
);
3538
});
3639

37-
export default {
38-
// preserveModules: true,
39-
input: 'index.ts',
40-
output: [
41-
// {
42-
// dir: pkg.main,
43-
// format: 'cjs',
44-
// // exports: 'named',
45-
// },
46-
{
47-
dir: pkg.module,
48-
format: 'es',
49-
// format: 'iife',
50-
// exports: 'named',
51-
preserveModules: true,
52-
},
53-
],
54-
external: [
55-
'react',
56-
'react',
57-
'timen',
58-
'justorm',
59-
'compareq',
60-
'classnames',
61-
'nanoid',
62-
'lodash.omit',
63-
'lodash.pick',
64-
],
65-
plugins: [
66-
del({ targets: './lib/*' }),
40+
export default [
41+
{
42+
// preserveModules: true,
43+
input: 'index.ts',
44+
output: [
45+
// {
46+
// dir: pkg.main,
47+
// format: 'cjs',
48+
// name: 'uilib',
49+
// sourcemap: true,
50+
// // exports: 'named',
51+
// },
52+
{
53+
dir: pkg.module,
54+
format: 'esm',
55+
// format: 'iife',
56+
// exports: 'named',
57+
sourcemap: true,
58+
preserveModules: true,
59+
},
60+
],
61+
external: [
62+
'react',
63+
'react/jsx-runtime',
64+
'preact',
65+
'timen',
66+
'justorm',
67+
'compareq',
68+
'classnames',
69+
'nanoid',
70+
'lodash.omit',
71+
'lodash.pick',
72+
],
73+
plugins: [
74+
del({ targets: './dist/*' }),
6775

68-
externals({ deps: true }),
69-
resolve(),
70-
commonjs(),
76+
externals({ deps: true }),
77+
resolve(),
78+
commonjs(),
7179

72-
json(),
80+
json(),
7381

74-
svgr(),
75-
styles({ modules: true }),
76-
// stylusCssModules({ output: 'index.css' }),
77-
// postcss({
78-
// // minimize: true,
79-
// modules: true,
80-
// // use: {
81-
// // sass: null,
82-
// // stylus: null,
83-
// // less: null,
84-
// // },
85-
// // extract: true,
86-
// }),
82+
svgr(),
83+
styles({ modules: true }),
84+
// stylusCssModules({ output: 'index.css' }),
8785

88-
typescript({
89-
useTsconfigDeclarationDir: true,
90-
tsconfig: 'tsconfig.json',
91-
}),
92-
// babel({
93-
// babelHelpers: 'bundled',
94-
// include: path.resolve('src/components'),
95-
// extensions: ['.js', '.ts', '.jsx', '.tsx'],
96-
// }),
97-
uglify(),
98-
],
99-
};
86+
typescript({
87+
useTsconfigDeclarationDir: true,
88+
tsconfig: 'tsconfig.json',
89+
}),
90+
// postcss({
91+
// // minimize: true,
92+
// modules: true,
93+
// // use: {
94+
// // sass: null,
95+
// // stylus: null,
96+
// // less: null,
97+
// // },
98+
// // extract: true,
99+
// }),
100+
// babel({
101+
// babelHelpers: 'bundled',
102+
// include: path.resolve('src/components'),
103+
// extensions: ['.js', '.ts', '.jsx', '.tsx'],
104+
// }),
105+
uglify(),
106+
],
107+
},
108+
// {
109+
// input: 'dist/esm/types/index.d.ts',
110+
// output: [{ file: 'dist/index.d.ts', format: 'esm' }],
111+
// plugins: [dts()],
112+
// // external: [/\.css$/],
113+
// },
114+
];

src/components/Button/Button.example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Title } from '../../helpers';
1+
import Title from 'helpers/Title';
22

33
import { Form } from '../Form/Form';
44
// import { AssistiveText } from '../AssistiveText/AssistiveText';

src/components/Button/Button.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { ReactNode, ButtonHTMLAttributes } from 'react';
2-
import { useEffect, useRef } from 'preact/hooks';
1+
import { ReactNode, ButtonHTMLAttributes, useEffect, useRef } from 'react';
32
import cn from 'classnames';
43

54
import { Spinner } from '../Spinner/Spinner';

src/components/Checkbox/Checkbox.example.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createStore } from 'justorm/preact';
22

3-
import { State } from 'src/helpers';
3+
import State from 'helpers/State';
44
import { Container } from '../Container/Container';
55
import { Checkbox } from './Checkbox';
66

0 commit comments

Comments
 (0)