@haandrikman/test-package-bramtest 0.0.1
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/.github/workflows/publish.yml +67 -0
- package/README.md +3 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +41 -0
- package/dist/index.mjs +14 -0
- package/package.json +25 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: Publish NPM package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v2
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
|
|
16
|
+
- name: Setup Node.js
|
|
17
|
+
uses: actions/setup-node@v2
|
|
18
|
+
with:
|
|
19
|
+
node-version: '20'
|
|
20
|
+
registry-url: 'https://registry.npmjs.org'
|
|
21
|
+
|
|
22
|
+
- name: Setup pnpm
|
|
23
|
+
run: npm install -g pnpm
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: pnpm install
|
|
27
|
+
|
|
28
|
+
- name: Test
|
|
29
|
+
run: pnpm test
|
|
30
|
+
|
|
31
|
+
- name: Check the version
|
|
32
|
+
id: check
|
|
33
|
+
run: |
|
|
34
|
+
CURRENT_VERSION=$(jq -r .version package.json)
|
|
35
|
+
echo "Current version: $CURRENT_VERSION"
|
|
36
|
+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
|
37
|
+
echo "Latest tag: $LATEST_TAG"
|
|
38
|
+
|
|
39
|
+
LATEST_VERSION=${LATEST_TAG#v}
|
|
40
|
+
|
|
41
|
+
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ];
|
|
42
|
+
then
|
|
43
|
+
echo "Version changed"
|
|
44
|
+
echo "version_changed=true" >> $GITHUB_OUTPUT
|
|
45
|
+
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
46
|
+
else
|
|
47
|
+
echo "Version not changed"
|
|
48
|
+
echo "version_changed=false" >> $GITHUB_OUTPUT
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
- name: Build
|
|
52
|
+
run: pnpm build
|
|
53
|
+
if: steps.check.outputs.version_changed == 'true'
|
|
54
|
+
|
|
55
|
+
- name: Publish
|
|
56
|
+
if: steps.check.outputs.version_changed == 'true'
|
|
57
|
+
run: npm publish --access public --no-git-checks
|
|
58
|
+
env:
|
|
59
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
60
|
+
|
|
61
|
+
- name: Tag release
|
|
62
|
+
if: steps.check.outputs.version_changed == 'true'
|
|
63
|
+
run: |
|
|
64
|
+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
65
|
+
git config --local user.name "github-actions[bot]"
|
|
66
|
+
git tag -a "v${{ steps.check.outputs.new_version }}" -m "v${{ steps.check.outputs.new_version }}"
|
|
67
|
+
git push origin "v${{ steps.check.outputs.new_version }}"
|
package/README.md
ADDED
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
sayHello: () => sayHello
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/functions.ts
|
|
28
|
+
function sayHello({ firstName, lastName, age }) {
|
|
29
|
+
console.log("Hello!");
|
|
30
|
+
console.log("Your first name is ${firstName}");
|
|
31
|
+
if (lastName) {
|
|
32
|
+
console.log("Your last name is $(lastName)");
|
|
33
|
+
}
|
|
34
|
+
if (age) {
|
|
35
|
+
console.log("Your age is ${age}");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
sayHello
|
|
41
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/functions.ts
|
|
2
|
+
function sayHello({ firstName, lastName, age }) {
|
|
3
|
+
console.log("Hello!");
|
|
4
|
+
console.log("Your first name is ${firstName}");
|
|
5
|
+
if (lastName) {
|
|
6
|
+
console.log("Your last name is $(lastName)");
|
|
7
|
+
}
|
|
8
|
+
if (age) {
|
|
9
|
+
console.log("Your age is ${age}");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
sayHello
|
|
14
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@haandrikman/test-package-bramtest",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "test package",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.mjs",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"homepage": "https://google.com",
|
|
12
|
+
"repository":{
|
|
13
|
+
"url":"https://github.com/Bram-Haandrikman/test"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsup"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [],
|
|
19
|
+
"author": "haandb",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"tsup": "^8.5.1",
|
|
23
|
+
"typescript": "^5.9.3"
|
|
24
|
+
}
|
|
25
|
+
}
|