fintech-component-library 1.0.0 → 1.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.
@@ -0,0 +1,23 @@
1
+ name: Publish NPM Package
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ release:
7
+ types: [created]
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+
14
+ - name: Setup Node.js
15
+ uses: actions/setup-node@v2
16
+ with:
17
+ node-version: '14'
18
+ registry-url: 'https://registry.npmjs.org/'
19
+ - run: npm install
20
+ - run: npm test
21
+ - run: npm publish
22
+ env:
23
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_FINTECH }}
package/index.js CHANGED
@@ -1,4 +1,9 @@
1
1
  function greet(name) {
2
2
  return `Hello, ${name}! Welcome to my first NPM package.`;
3
3
  }
4
- module.exports = greet;
4
+
5
+ function button(label, onClick) {
6
+ return `<button onclick="${onClick}">${label}</button>`;
7
+ }
8
+
9
+ module.exports = { greet, button };
package/index.test.js ADDED
@@ -0,0 +1,9 @@
1
+ const { greet, button } = require("./index");
2
+
3
+ test("greets a user", () => {
4
+ expect(greet("World")).toBe("Hello, World! Welcome to my first NPM package.");
5
+ });
6
+
7
+ test("creates a button", () => {
8
+ expect(button("Click me", "alert('Hello')")).toBe('<button onclick="alert(\'Hello\')">Click me</button>');
9
+ });
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "fintech-component-library",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
6
+ "test": "jest"
7
7
  },
8
8
  "keywords": [],
9
9
  "author": "",
10
10
  "license": "ISC",
11
- "description": ""
11
+ "description": "",
12
+ "devDependencies": {
13
+ "jest": "^29.7.0",
14
+ "jest-circus": "^29.7.0"
15
+ }
12
16
  }