@ptolemy2002/react-mount-effects 1.0.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 (3) hide show
  1. package/README.md +12 -0
  2. package/index.js +32 -0
  3. package/package.json +33 -0
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # React Library CRA Template
2
+ This is a React Library Created by Ptolemy2002's [cra-template-react-library](https://www.npmjs.com/package/@ptolemy2002/cra-template-react-library) template in combination with [create-react-app](https://www.npmjs.com/package/create-react-app). It contains methods of building and publishing your library to npm.
3
+ For now, the library makes use of React 18 and does not use TypeScript.
4
+
5
+ ## Commands
6
+ The following commands exist in the project:
7
+
8
+ - `npm run build` - Builds the library
9
+ - `npm run release` - Publishes the library to npm without changing the version
10
+ - `npm run release-patch` - Publishes the library to npm with a patch version bump
11
+ - `npm run release-minor` - Publishes the library to npm with a minor version bump
12
+ - `npm run release-major` - Publishes the library to npm with a major version bump
package/index.js ADDED
@@ -0,0 +1,32 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/index.js
20
+ var src_exports = {};
21
+ __export(src_exports, {
22
+ useMountEffect: () => useMountEffect,
23
+ useUnmountEffect: () => useUnmountEffect
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+ var import_react = require("react");
27
+ function useMountEffect(callback) {
28
+ (0, import_react.useEffect)(callback, []);
29
+ }
30
+ function useUnmountEffect(callback) {
31
+ (0, import_react.useEffect)(() => callback, []);
32
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@ptolemy2002/react-mount-effects",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "files": [
6
+ "index.js"
7
+ ],
8
+ "scripts": {
9
+ "build": "esbuild src/index.js --bundle --format=cjs --outfile=index.js --external:react --external:react-dom --external:@types/react --external:@types/react-dom",
10
+ "postinstall": "npx typesync",
11
+ "uninstall": "bash ./scripts/uninstall.sh",
12
+ "reinstall": "bash ./scripts/reinstall.sh",
13
+ "example-uninstall": "bash ./scripts/example-uninstall.sh",
14
+ "example-install": "bash ./scripts/example-install.sh",
15
+ "example-reinstall": "bash ./scripts/example-reinstall.sh",
16
+ "example-start": "bash ./scripts/example-start.sh",
17
+ "release": "bash ./scripts/release.sh",
18
+ "release-patch": "bash ./scripts/release.sh patch",
19
+ "release-minor": "bash ./scripts/release.sh minor",
20
+ "release-major": "bash ./scripts/release.sh major"
21
+ },
22
+ "description": "Example of a React library",
23
+ "license": "ISC",
24
+ "peerDependencies": {
25
+ "@types/react": "^18.3.3",
26
+ "@types/react-dom": "^18.3.0",
27
+ "react": "^18.3.1",
28
+ "react-dom": "^18.3.1"
29
+ },
30
+ "devDependencies": {
31
+ "esbuild": "^0.23.0"
32
+ }
33
+ }