best-react-pagination 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.eslintignore +1 -1
  2. package/LICENCE +12 -12
  3. package/demo/public/index.html +17 -17
  4. package/demo/src/App.tsx +10 -1
  5. package/demo/src/Pagination/components/Item/Item.tsx +19 -0
  6. package/demo/src/Pagination/components/Item/index.ts +1 -0
  7. package/demo/src/Pagination/components/ItemList/ItemList.tsx +17 -0
  8. package/demo/src/Pagination/components/ItemList/index.ts +1 -0
  9. package/demo/src/Pagination/components/Wrapper/Wrapper.tsx +17 -0
  10. package/demo/src/Pagination/components/Wrapper/index.ts +1 -0
  11. package/demo/src/Pagination/components/constants.ts +49 -0
  12. package/demo/src/Pagination/components/index.ts +3 -0
  13. package/demo/src/Pagination/components/utils.ts +3 -0
  14. package/demo/src/Pagination/index.tsx +259 -237
  15. package/demo/tsconfig.json +17 -17
  16. package/dist/components/Item/Item.d.ts +10 -0
  17. package/dist/components/Item/index.d.ts +1 -0
  18. package/dist/components/ItemList/ItemList.d.ts +7 -0
  19. package/dist/components/ItemList/index.d.ts +1 -0
  20. package/dist/components/Wrapper/Wrapper.d.ts +7 -0
  21. package/dist/components/Wrapper/index.d.ts +1 -0
  22. package/dist/components/constants.d.ts +9 -0
  23. package/dist/components/index.d.ts +3 -0
  24. package/dist/components/utils.d.ts +1 -0
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +1 -1
  27. package/husky.config.js +4 -4
  28. package/lib/components/Item/Item.tsx +19 -0
  29. package/lib/components/Item/index.ts +1 -0
  30. package/lib/components/ItemList/ItemList.tsx +17 -0
  31. package/lib/components/ItemList/index.ts +1 -0
  32. package/lib/components/Wrapper/Wrapper.tsx +17 -0
  33. package/lib/components/Wrapper/index.ts +1 -0
  34. package/lib/components/constants.ts +49 -0
  35. package/lib/components/index.ts +3 -0
  36. package/lib/components/utils.ts +3 -0
  37. package/lib/index.tsx +259 -237
  38. package/package.json +5 -3
  39. package/tsconfig.json +24 -23
  40. package/webpack.config.ts +53 -45
package/webpack.config.ts CHANGED
@@ -1,45 +1,53 @@
1
- const path = require("path");
2
- import { Configuration } from "webpack";
3
- const nodeExternals = require("webpack-node-externals");
4
- const fs = require("fs");
5
-
6
- const libPath = path.resolve(__dirname, "lib");
7
- const distPath = path.resolve(__dirname, "dist");
8
- const demoPath = path.resolve(__dirname, "demo");
9
-
10
- const config: Configuration = {
11
- entry: path.resolve(libPath, "index.tsx"),
12
- output: {
13
- path: distPath,
14
- filename: "index.js",
15
- library: "best-react-pagination",
16
- libraryTarget: "umd",
17
- },
18
- resolve: {
19
- extensions: [".tsx", ".ts", ".js"],
20
- },
21
- externals: [nodeExternals()],
22
- plugins: [
23
- {
24
- apply: (compiler) => {
25
- compiler.hooks.compile.tap("Copy file", () => {
26
- fs.copyFile(demoPath + "/src/pagination/index.tsx", libPath + "/index.tsx", (err: any) => {
27
- if (err) throw err;
28
- console.log("Pagination was copied to ", libPath);
29
- });
30
- });
31
- },
32
- },
33
- ],
34
- module: {
35
- rules: [
36
- {
37
- test: /\.tsx?$/,
38
- exclude: /(node_modules|bower_components)/,
39
- use: ["babel-loader", "ts-loader"],
40
- },
41
- ],
42
- },
43
- };
44
-
45
- export default config;
1
+ const path = require("path");
2
+ import { Configuration } from "webpack";
3
+ const nodeExternals = require("webpack-node-externals");
4
+ const ncp = require("ncp").ncp;
5
+ const fs = require("fs-extra");
6
+
7
+ const libPath = path.resolve(__dirname, "lib");
8
+ const distPath = path.resolve(__dirname, "dist");
9
+ const demoPath = path.resolve(__dirname, "demo");
10
+
11
+ const config: Configuration = {
12
+ entry: path.resolve(libPath, "index.tsx"),
13
+ output: {
14
+ path: distPath,
15
+ filename: "index.js",
16
+ library: "best-react-pagination",
17
+ libraryTarget: "umd",
18
+ clean: true,
19
+ },
20
+ resolve: {
21
+ extensions: [".tsx", ".ts", ".js"],
22
+ },
23
+ externals: [nodeExternals()],
24
+ plugins: [
25
+ {
26
+ apply: (compiler) => {
27
+ compiler.hooks.beforeCompile.tapPromise("Copy file", () => {
28
+ return new Promise<void>((resolve, reject) => {
29
+ fs.emptyDirSync(libPath);
30
+ ncp(demoPath + "/src/Pagination/", libPath, (err: any) => {
31
+ if (err) {
32
+ reject(err);
33
+ }
34
+ console.log("Pagination was copied to ", libPath);
35
+ resolve();
36
+ });
37
+ });
38
+ });
39
+ },
40
+ },
41
+ ],
42
+ module: {
43
+ rules: [
44
+ {
45
+ test: /\.tsx?$/,
46
+ exclude: /(node_modules|bower_components)/,
47
+ use: ["babel-loader", "ts-loader"],
48
+ },
49
+ ],
50
+ },
51
+ };
52
+
53
+ export default config;