mylibrary-edison 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 +117 -0
  2. package/index.js +15 -0
  3. package/package.json +34 -0
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # 💡 mylibrary-edison
2
+
3
+ A clean, minimalist, and beginner-friendly JavaScript utility library built using modern Node.js and ES Modules.
4
+
5
+ ---
6
+
7
+ ## 📖 Description
8
+
9
+ **mylibrary-edison** is an educational, boilerplate-ready NPM package designed to demonstrate how to create, structure, and publish a modern ES Module (ESM) library. Out of the box, it exports a single, ready-to-implement utility function called `ask()`.
10
+
11
+ It is designed for beginners who want to learn how modern ES module exports work, how to organize a clean package structure, and how to distribute their code via the NPM registry.
12
+
13
+ ---
14
+
15
+ ## 🛠️ Project Structure
16
+
17
+ The project has a clean and beginner-friendly layout with absolute minimal noise:
18
+
19
+ ```text
20
+ edison/
21
+ ├── package.json # Package configuration, metadata, and module entrypoints
22
+ ├── index.js # Main library file exporting the public API (ask function)
23
+ └── README.md # Comprehensive documentation and publishing guide
24
+ ```
25
+
26
+ ### File Breakdown:
27
+ 1. **`package.json`**: Configures the project metadata (name, version, author, license) and explicitly declares `"type": "module"` so Node.js loads files as ES Modules, enabling the use of `import` and `export` statements.
28
+ 2. **`index.js`**: Contains the source code of the library, exporting the single placeholder function `ask()`.
29
+ 3. **`README.md`**: This guide! It describes the library, usage, and publishing instructions.
30
+
31
+ ---
32
+
33
+ ## 🚀 Installation
34
+
35
+ Once published to NPM, developers can install **mylibrary-edison** using their favorite package manager:
36
+
37
+ ```bash
38
+ # Using npm
39
+ npm install mylibrary-edison
40
+
41
+ # Using yarn
42
+ yarn add mylibrary-edison
43
+
44
+ # Using pnpm
45
+ pnpm add mylibrary-edison
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 💻 Usage Example
51
+
52
+ Since **mylibrary-edison** uses modern **ES Modules (ESM)**, you can import it into your JavaScript projects using the standard `import` syntax:
53
+
54
+ ```javascript
55
+ // Import the ask function from the mylibrary-edison library
56
+ import { ask } from 'mylibrary-edison';
57
+
58
+ // Call the function
59
+ ask();
60
+ ```
61
+
62
+ > [!NOTE]
63
+ > Ensure your consuming application's `package.json` includes `"type": "module"`, or that you run your script with an `.mjs` extension so Node.js recognizes ES modules.
64
+
65
+ ---
66
+
67
+ ## 📦 How to Publish to NPM
68
+
69
+ Ready to share your library with the world? Follow these simple steps:
70
+
71
+ ### 1. Create an NPM Account
72
+ If you haven't already, sign up for a free account at [npmjs.com](https://www.npmjs.com/).
73
+
74
+ ### 2. Log In to NPM via CLI
75
+ Run the following command in your terminal to authenticate your machine:
76
+ ```bash
77
+ npm login
78
+ ```
79
+ *You will be prompted for your username, password, email, and a one-time password (OTP) sent to your email.*
80
+
81
+ ### 3. Check for Package Name Availability
82
+ Before publishing, make sure the name `mylibrary-edison` isn't already taken on NPM. If it is, update the `"name"` field in your `package.json` to something unique (e.g., `@your-username/mylibrary-edison` or `mylibrary-edison-utility`).
83
+
84
+ ### 4. Publish Your Package
85
+ Run the following command to make the package public on the registry:
86
+ ```bash
87
+ npm publish --access public
88
+ ```
89
+ 🎉 **Congratulations! Your library is now live on NPM!**
90
+
91
+ ---
92
+
93
+ ## 🔢 Semantic Versioning (SemVer) Explanation
94
+
95
+ NPM packages follow **Semantic Versioning** rules, represented as `MAJOR.MINOR.PATCH` (e.g., `1.0.0`):
96
+
97
+ - **`PATCH` (e.g., `1.0.1`)**: Incremented for backwards-compatible bug fixes.
98
+ - **`MINOR` (e.g., `1.1.0`)**: Incremented for new backwards-compatible functionality or features.
99
+ - **`MAJOR` (e.g., `2.0.0`)**: Incremented for API-breaking changes that require consumers to update their code.
100
+
101
+ To update your version before publishing a new release, you can use the npm utility:
102
+ ```bash
103
+ # Increments patch version (1.0.0 -> 1.0.1)
104
+ npm version patch
105
+
106
+ # Increments minor version (1.0.0 -> 1.1.0)
107
+ npm version minor
108
+
109
+ # Increments major version (1.0.0 -> 2.0.0)
110
+ npm version major
111
+ ```
112
+
113
+ ---
114
+
115
+ ## 📄 License
116
+
117
+ This project is licensed under the **MIT License**. Feel free to use, modify, and distribute it as you see fit.
package/index.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @file index.js
3
+ * @description The main entry point for the "mylibrary-edison" library.
4
+ * This file uses ES Modules syntax to export functions.
5
+ */
6
+
7
+ /**
8
+ * Ask a question or trigger a query.
9
+ * Currently, the logic is not implemented and left as a placeholder for customization.
10
+ *
11
+ * @returns {void}
12
+ */
13
+ export function ask() {
14
+ // TODO: Add logic here
15
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "mylibrary-edison",
3
+ "version": "1.0.0",
4
+ "description": "A lightweight, beginner-friendly JavaScript utility library exporting the ask function.",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "exports": {
8
+ ".": "./index.js"
9
+ },
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1"
12
+ },
13
+ "keywords": [
14
+ "edison",
15
+ "mylibrary-edison",
16
+ "ask",
17
+ "helper",
18
+ "utility",
19
+ "esm"
20
+ ],
21
+ "author": "Open Source Developer",
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/your-username/mylibrary-edison.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/your-username/mylibrary-edison/issues"
29
+ },
30
+ "homepage": "https://github.com/your-username/mylibrary-edison#readme",
31
+ "engines": {
32
+ "node": ">=14.0.0"
33
+ }
34
+ }