Skip to content

Commit 6eac6d2

Browse files
committed
build: update packaging files
1 parent 220b119 commit 6eac6d2

File tree

6 files changed

+100
-17
lines changed

6 files changed

+100
-17
lines changed

.all-contributorsrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"projectName": "node-toasted",
2+
"projectName": "toasted-notifier",
33
"projectOwner": "Aetherinox",
44
"repoType": "github",
55
"repoHost": "https://github.com",

.github/workflows/npm-publish.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ on:
1414

1515
# ---------------------------------------------------------------------------------------
1616
# Name of the plugin to use when creating the release zip filename
17-
# e.g: node-toasted-v1.0.0.zip
17+
# e.g: toasted-notifier-v1.0.0.zip
1818
# ---------------------------------------------------------------------------------------
1919

2020
PLUGIN_NAME:
2121
description: "📦 Name of Plugin"
2222
required: true
23-
default: 'node-toasted'
23+
default: 'toasted-notifier'
2424
type: string
2525

2626
# ---------------------------------------------------------------------------------------
@@ -61,11 +61,11 @@ on:
6161
# ---------------------------------------------------------------------------------------
6262
# Release Candidate version number
6363
# this will be added to the end of your released app in the releases page.
64-
# e.g: node-toasted-v1.0.0-rc.1
64+
# e.g: toasted-notifier-v1.0.0-rc.1
6565
# ---------------------------------------------------------------------------------------
6666

6767
VERSION_RC:
68-
description: "🧪 RC (Pre-release) Ver (node-toasted-rc.v1)"
68+
description: "🧪 RC (Pre-release) Ver (toasted-notifier-rc.v1)"
6969
required: false
7070
type: string
7171
default: "1"
@@ -248,8 +248,8 @@ jobs:
248248
- name: "🔎 Find and Replace (Start)"
249249
uses: jacobtomlinson/gha-find-replace@v3
250250
with:
251-
find: '"name": "node-toasted"'
252-
replace: '"name": "@aetherinox/node-toasted"'
251+
find: '"name": "toasted-notifier"'
252+
replace: '"name": "@aetherinox/toasted-notifier"'
253253
include: "package.json"
254254
regex: true
255255

@@ -303,8 +303,8 @@ jobs:
303303
- name: "🔎 Find and Replace (Finish)"
304304
uses: jacobtomlinson/gha-find-replace@v3
305305
with:
306-
find: '"name": "@aetherinox/node-toasted"'
307-
replace: '"name": "node-toasted"'
306+
find: '"name": "@aetherinox/toasted-notifier"'
307+
replace: '"name": "toasted-notifier"'
308308
include: "package.json"
309309
regex: true
310310

@@ -372,7 +372,7 @@ jobs:
372372
- name: "🪪 Generate IDs"
373373
id: task_release_npm_env_generate
374374
run: |
375-
npm run node-toasted:generate
375+
npm run ntfy:generate
376376
377377
# ---------------------------------------------------------------------------------------
378378
# Get guid and uuid from env variable

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
!*.npmignore
8282
!*.all-contributorsrc
8383
!*.editorconfig
84-
!*node-toasted.js
84+
!*ntfy.js
8585
!*index.js
8686
!*manifest.json
8787
!*package.json

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,11 @@ This library is packaged with [ntfy-desktop](https://github.com/Aetherinox/ntfy-
7171
- [Help](#help)
7272
- [How to change text `NtfyToast` at the top of notifications](#how-to-change-text-ntfytoast-at-the-top-of-notifications)
7373
- [Can't use Windows Toast notifications in WSL2](#cant-use-windows-toast-notifications-in-wsl2)
74-
- [Distributing Toasted-Notifer with Electron](#distributing-toasted-notifer-with-electron)
74+
- [Distributing with Electron](#distributing-with-electron)
7575
- [Using Webpack](#using-webpack)
7676
- [Windows: Where are shortcut / .lnk files placed](#windows-where-are-shortcut--lnk-files-placed)
7777
- [Usage in tmux session](#usage-in-tmux-session)
7878

79-
8079
<br />
8180

8281
---
@@ -102,7 +101,7 @@ The correct notification package will be used by Toasted Node depending on the e
102101
<br />
103102

104103
## What is ntfy-toast
105-
[ntfy-toast](https://github.com/Aetherinox/ntfy-toast) is a notification system for Windows 8 - 11. It is one of the libraries used by Toasted Notifier to display notifications for users.
104+
[ntfy-toast](https://github.com/Aetherinox/ntfy-toast) is a package included in this repo, which services notifications for users running Windows 8 - 11.
106105

107106
It is based on [SnoreToast](https://github.com/KDE/snoretoast), but has been updated with numerous features.
108107

@@ -724,7 +723,7 @@ You can add a `postinstall` action in the `package.json`:
724723
725724
<br />
726725
727-
### Distributing Toasted-Notifer with Electron
726+
### Distributing with Electron
728727
If you package your Electron based app as an asar; toasted-notifier will fail to load. This is because of how a asar package works. You cannot execute a binary from within an asar package.
729728
730729
Is solution is that when packaging the app into an asar, make sure you `--unpack` the `vendor/` folder of toasted-notifier so that the module still has access to the notification vendor binaries.

ntfy.js

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env node
2+
3+
/*
4+
build toasted-notifier by running
5+
npm run build
6+
7+
guid and uuid will be automatically generated and placed
8+
inside .env file which will then be read by the github workflow
9+
build script.
10+
*/
11+
12+
/*
13+
This script handles the following:
14+
- read package.json
15+
- create .env file
16+
- return uuid, guid, version
17+
18+
can be called with the following external commands:
19+
- node ntfy.js returns version of toasted-notifier
20+
- node ntfy.js generate generates uuid / guid and shows all env vars in console
21+
- node ntfy.js uuid returns toasted-notifier uuid
22+
- node ntfy.js guid returns toasted-notifier guid
23+
- node ntfy.js versiom returns version of toasted-notifier
24+
25+
can be called with the following toasted-notifier commands:
26+
- npm run ntfy
27+
- npm run ntfy:generate
28+
- npm run env-ntfy
29+
- npm run env-uuid
30+
- npm run env-guid
31+
- npm run env-version
32+
*/
33+
34+
const fs = require('fs');
35+
const { v5: uuid } = require('uuid');
36+
37+
/*
38+
* declrations > package.json
39+
*/
40+
41+
const { version, repository } = JSON.parse(fs.readFileSync('package.json'));
42+
const args = process.argv.slice(2, process.argv.length);
43+
const action = args[0];
44+
// const a = args[ 1 ];
45+
// const b = args[ 2 ];
46+
47+
if (action === 'guid') {
48+
console.log(`${process.env.GUID}`);
49+
} else if (action === 'setup') {
50+
fs.writeFileSync('.env', '', (err) => {
51+
if (err) {
52+
console.error(err);
53+
} else {
54+
console.log('Wrote to .env successfully');
55+
}
56+
});
57+
} else if (action === 'generate') {
58+
const buildGuid = uuid(`${repository.url}`, uuid.URL);
59+
const buildUuid = uuid(version, buildGuid);
60+
61+
const ids = `
62+
VERSION=${version}
63+
GUID=${buildGuid}
64+
UUID=${buildUuid}
65+
`;
66+
67+
console.log(version);
68+
console.log(buildGuid);
69+
console.log(buildUuid);
70+
71+
fs.writeFileSync('.env', ids, (err) => {
72+
if (err) {
73+
console.error(`Could not write env vars: ${err}`);
74+
} else {
75+
console.log('Wrote env vars to .env');
76+
}
77+
});
78+
} else if (action === 'uuid') {
79+
console.log(`${process.env.UUID}`);
80+
} else {
81+
console.log(version);
82+
}
83+
84+
process.exit(0);

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
"prepare": "husky install",
5757
"contrib:add": "all-contributors add",
5858
"contrib:generate": "all-contributors generate",
59-
"ntfy-toast-node": "node ntfy.js",
60-
"ntfy-toast-node:generate": "node ntfy.js generate",
59+
"ntfy": "node ntfy.js",
60+
"ntfy:generate": "node ntfy.js generate",
6161
"env-base": "npx --quiet env-cmd --no-override node ntfy.js",
6262
"env-uuid": "npx --quiet env-cmd --no-override node ntfy.js uuid",
6363
"env-guid": "npx --quiet env-cmd --no-override node ntfy.js guid",

0 commit comments

Comments
 (0)