@fencyai/js 0.1.2

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.
package/README.md ADDED
@@ -0,0 +1,143 @@
1
+ # @fencyai/js
2
+
3
+ A TypeScript ESM module designed for browser use, published as an npm package.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @fencyai/js
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### ES Modules (Recommended)
14
+
15
+ ```javascript
16
+ import { greet, FencyUtils } from '@fencyai/js';
17
+
18
+ // Use the utility function
19
+ console.log(greet('World')); // "Hello from fency-js: World"
20
+
21
+ // Use the utility class
22
+ const utils = new FencyUtils('2.0.0');
23
+ console.log(utils.getVersion()); // "2.0.0"
24
+ console.log(utils.formatDate(new Date())); // Current date formatted
25
+ ```
26
+
27
+ ### Default Import
28
+
29
+ ```javascript
30
+ import fency from '@fencyai/js';
31
+
32
+ console.log(fency.greet('Browser')); // "Hello from fency-js: Browser"
33
+ const utils = new fency.FencyUtils();
34
+ ```
35
+
36
+ ### Browser Usage
37
+
38
+ ```html
39
+ <!DOCTYPE html>
40
+ <html>
41
+ <head>
42
+ <title>Fency JS Demo</title>
43
+ </head>
44
+ <body>
45
+ <script type="module">
46
+ import { greet, FencyUtils } from 'https://unpkg.com/@fencyai/js@latest/dist/index.js';
47
+
48
+ console.log(greet('Browser User'));
49
+ const utils = new FencyUtils();
50
+ document.body.innerHTML = `<p>Version: ${utils.getVersion()}</p>`;
51
+ </script>
52
+ </body>
53
+ </html>
54
+ ```
55
+
56
+ ## Development
57
+
58
+ ### Prerequisites
59
+
60
+ - Node.js 16.0.0 or higher
61
+ - npm
62
+
63
+ ### Versioning
64
+
65
+ This project follows [Semantic Versioning](https://semver.org/). See [VERSIONING.md](./VERSIONING.md) for detailed guidelines.
66
+
67
+ **Quick version commands:**
68
+ ```bash
69
+ npm run version:patch # Bug fixes (0.1.0 → 0.1.1)
70
+ npm run version:minor # New features (0.1.0 → 0.2.0)
71
+ npm run version:major # Breaking changes (0.1.0 → 1.0.0)
72
+ ```
73
+
74
+ ### Setup
75
+
76
+ 1. Clone the repository:
77
+ ```bash
78
+ git clone https://github.com/fencyai/fency-js.git
79
+ cd fency-js
80
+ ```
81
+
82
+ 2. Install dependencies:
83
+ ```bash
84
+ npm install
85
+ ```
86
+
87
+ 3. Start development mode:
88
+ ```bash
89
+ npm run dev
90
+ ```
91
+
92
+ ### Build
93
+
94
+ Build the project for production:
95
+ ```bash
96
+ npm run build
97
+ ```
98
+
99
+ This will:
100
+ - Compile TypeScript to JavaScript
101
+ - Generate type definitions
102
+ - Bundle and minify the code for browser use
103
+
104
+ ### Publishing
105
+
106
+ Before publishing, make sure to:
107
+
108
+ 1. Update the version: `npm run version:patch|minor|major`
109
+ 2. Update the CHANGELOG.md with your changes
110
+ 3. Build the project: `npm run build`
111
+ 4. Publish to npm: `npm publish`
112
+
113
+ **Quick publish commands:**
114
+ ```bash
115
+ npm run publish:patch # Bump patch + publish
116
+ npm run publish:minor # Bump minor + publish
117
+ npm run publish:major # Bump major + publish
118
+ ```
119
+
120
+ ## Project Structure
121
+
122
+ ```
123
+ fency-js/
124
+ ├── src/
125
+ │ └── index.ts # Main entry point
126
+ ├── dist/ # Built files (generated)
127
+ ├── package.json # Package configuration
128
+ ├── tsconfig.json # TypeScript configuration
129
+ └── README.md # This file
130
+ ```
131
+
132
+ ## Features
133
+
134
+ - ✅ TypeScript support with full type definitions
135
+ - ✅ ESM module format for modern browsers
136
+ - ✅ Tree-shakable exports
137
+ - ✅ Minified production builds
138
+ - ✅ Browser-compatible
139
+ - ✅ npm package ready
140
+
141
+ ## License
142
+
143
+ MIT
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A sample utility function that demonstrates the module structure
3
+ * @param message - The message to log
4
+ * @returns A formatted greeting
5
+ */
6
+ export declare function greet(message: string): string;
7
+ /**
8
+ * A sample class that can be used in browser environments
9
+ */
10
+ export declare class FencyUtils {
11
+ private version;
12
+ constructor(version?: string);
13
+ /**
14
+ * Get the current version
15
+ */
16
+ getVersion(): string;
17
+ /**
18
+ * Format a date for display
19
+ */
20
+ formatDate(date: Date): string;
21
+ }
22
+ declare const _default: {
23
+ greet: typeof greet;
24
+ FencyUtils: typeof FencyUtils;
25
+ };
26
+ export default _default;
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,GAAE,MAAgB;IAIrC;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;CAG/B;;;;;AAGD,wBAGE"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ function n(e){return`Hello from @fencyai/js: ${e}`}var t=class{constructor(r="1.0.0"){this.version=r}getVersion(){return this.version}formatDate(r){return r.toLocaleDateString()}},i={greet:n,FencyUtils:t};export{t as FencyUtils,i as default,n as greet};
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@fencyai/js",
3
+ "version": "0.1.2",
4
+ "description": "A TypeScript ESM module for browser use",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc && esbuild src/index.ts --bundle --format=esm --outfile=dist/index.js --minify",
20
+ "dev": "tsc --watch",
21
+ "clean": "rm -rf dist",
22
+ "prepublishOnly": "npm run clean && npm run build",
23
+ "test": "echo \"Error: no test specified\" && exit 1",
24
+ "version:patch": "npm version patch",
25
+ "version:minor": "npm version minor",
26
+ "version:major": "npm version major",
27
+ "version:prepatch": "npm version prepatch",
28
+ "version:preminor": "npm version preminor",
29
+ "version:premajor": "npm version premajor",
30
+ "version:prerelease": "npm version prerelease",
31
+ "publish:patch": "npm run version:patch && npm publish --access public",
32
+ "publish:minor": "npm run version:minor && npm publish --access public",
33
+ "publish:major": "npm run version:major && npm publish --access public"
34
+ },
35
+ "keywords": [
36
+ "typescript",
37
+ "esm",
38
+ "browser",
39
+ "module"
40
+ ],
41
+ "author": "",
42
+ "license": "MIT",
43
+ "devDependencies": {
44
+ "@types/node": "^20.10.0",
45
+ "esbuild": "^0.19.0",
46
+ "typescript": "^5.3.0"
47
+ },
48
+ "engines": {
49
+ "node": ">=16.0.0"
50
+ },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/fencyai/fency-js.git"
54
+ },
55
+ "bugs": {
56
+ "url": "https://github.com/fencyai/fency-js/issues"
57
+ },
58
+ "homepage": "https://github.com/fencyai/fency-js#readme"
59
+ }