@ezhang6811/npm-publish-test 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.
@@ -0,0 +1,22 @@
1
+ name: Test NPM Publish
2
+ on:
3
+ workflow_dispatch:
4
+
5
+ jobs:
6
+ publish:
7
+ runs-on: ubuntu-latest
8
+ permissions:
9
+ id-token: write
10
+ contents: read
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-node@v4
14
+ with:
15
+ node-version: '18'
16
+ registry-url: 'https://registry.npmjs.org'
17
+
18
+ - name: Test publish
19
+ env:
20
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
21
+ NPM_CONFIG_PROVENANCE: true
22
+ run: npm publish
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # npm-publish-test
2
+ test publishing to npm with OIDC auth
3
+
4
+ ## Installation
5
+
6
+ ```bash
7
+ npm install npm-publish-test
8
+ ```
9
+
10
+ ## Usage
11
+
12
+ ```javascript
13
+ const { hello, add } = require('npm-publish-test');
14
+
15
+ // Use the hello function
16
+ console.log(hello()); // Output: Hello, World!
17
+ console.log(hello('Alice')); // Output: Hello, Alice!
18
+
19
+ // Use the add function
20
+ console.log(add(2, 3)); // Output: 5
21
+ ```
22
+
23
+ ## API
24
+
25
+ ### `hello(name)`
26
+
27
+ Returns a greeting message.
28
+
29
+ - **name** (string, optional): The name to greet. Defaults to 'World'.
30
+ - **Returns**: (string) A greeting message
31
+
32
+ ### `add(a, b)`
33
+
34
+ Adds two numbers together.
35
+
36
+ - **a** (number): The first number to add
37
+ - **b** (number): The second number to add
38
+ - **Returns**: (number) Sum of a and b
package/index.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A simple hello world function
3
+ * @param {string} name - The name to greet
4
+ * @returns {string} A greeting message
5
+ */
6
+ function hello(name = 'World') {
7
+ return `Hello, ${name}!`;
8
+ }
9
+
10
+ /**
11
+ * A simple addition function
12
+ * @param {number} a - First number
13
+ * @param {number} b - Second number
14
+ * @returns {number} Sum of a and b
15
+ */
16
+ function add(a, b) {
17
+ return a + b;
18
+ }
19
+
20
+ // Export the functions
21
+ module.exports = {
22
+ hello,
23
+ add
24
+ };
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@ezhang6811/npm-publish-test",
3
+ "version": "1.0.0",
4
+ "description": "test publishing to npm with OIDC auth",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/ezhang6811/npm-publish-test.git"
9
+ },
10
+ "scripts": {
11
+ "test": "node index.js"
12
+ },
13
+ "keywords": [
14
+ "test",
15
+ "npm",
16
+ "publish"
17
+ ],
18
+ "author": "ezhang6811",
19
+ "license": "ISC",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ }
23
+ }