nappup 1.3.1 → 1.4.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/README.md +3 -2
- package/bin/nappup/helpers.js +5 -0
- package/bin/nappup/index.js +2 -2
- package/package.json +2 -2
- package/src/index.js +2 -2
package/README.md
CHANGED
|
@@ -27,7 +27,8 @@ nappup [directory] [options]
|
|
|
27
27
|
| Flag | Description |
|
|
28
28
|
|------|-------------|
|
|
29
29
|
| `-s <secret_key>` | Your Nostr secret key (hex or nsec format) used to sign the application event. See [Authentication](#authentication) for alternatives. |
|
|
30
|
-
| `-
|
|
30
|
+
| `-D <name>` | **Recommended**: A string to derive the identifier (`d` tag) from. This is the preferred way to set your app's identifier since you don't need to worry about the format - we'll handle the conversion for you. Just provide the application name and we'll ensure it's safely converted to a valid `d` tag. |
|
|
31
|
+
| `-d <d_tag>` | The exact identifier (`d` tag) for your application. Only use this if you know the exact `d` tag you want. Otherwise, use `-D`. If both are omitted, defaults to deriving the identifier from the directory name. Avoid generic names like `dist` or `build` - use something unique among your other apps like `mycoolapp`. |
|
|
31
32
|
| `-y` | Skip confirmation prompt. Useful for CI/CD pipelines or automated scripts. |
|
|
32
33
|
| `-r` | Force re-upload. By default, Napp Up! might skip files that haven't changed. Use this flag to ensure everything is pushed fresh. |
|
|
33
34
|
| `--main` | Publish to the **main** release channel. This is the default behavior. |
|
|
@@ -65,7 +66,7 @@ NOSTR_SECRET_KEY=nsec1... nappup
|
|
|
65
66
|
|
|
66
67
|
Upload a specific `dist` folder with a custom identifier to the `next` channel:
|
|
67
68
|
```bash
|
|
68
|
-
nappup ./dist -s nsec1... -
|
|
69
|
+
nappup ./dist -s nsec1... -D "My App #1" --next
|
|
69
70
|
```
|
|
70
71
|
|
|
71
72
|
Force re-upload a draft:
|
package/bin/nappup/helpers.js
CHANGED
|
@@ -9,6 +9,7 @@ export function parseArgs (args) {
|
|
|
9
9
|
let dir = null
|
|
10
10
|
let sk = null
|
|
11
11
|
let dTag = null
|
|
12
|
+
let dTagRaw = null
|
|
12
13
|
let channel = null
|
|
13
14
|
let shouldReupload = false
|
|
14
15
|
let yes = false
|
|
@@ -20,6 +21,9 @@ export function parseArgs (args) {
|
|
|
20
21
|
} else if (args[i] === '-d' && args[i + 1]) {
|
|
21
22
|
dTag = args[i + 1]
|
|
22
23
|
i++
|
|
24
|
+
} else if (args[i] === '-D' && args[i + 1]) {
|
|
25
|
+
dTagRaw = args[i + 1]
|
|
26
|
+
i++
|
|
23
27
|
} else if (args[i] === '--main' && channel === null) {
|
|
24
28
|
channel = 'main'
|
|
25
29
|
} else if (args[i] === '--next' && channel === null) {
|
|
@@ -39,6 +43,7 @@ export function parseArgs (args) {
|
|
|
39
43
|
dir: path.resolve(dir ?? '.'),
|
|
40
44
|
sk,
|
|
41
45
|
dTag,
|
|
46
|
+
dTagRaw,
|
|
42
47
|
channel: channel || 'main',
|
|
43
48
|
shouldReupload,
|
|
44
49
|
yes
|
package/bin/nappup/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import toApp from '#index.js'
|
|
|
11
11
|
const args = parseArgs(process.argv.slice(2))
|
|
12
12
|
await confirmArgs(args)
|
|
13
13
|
|
|
14
|
-
const { dir, sk, dTag, channel, shouldReupload } = args
|
|
14
|
+
const { dir, sk, dTag, dTagRaw, channel, shouldReupload } = args
|
|
15
15
|
const fileList = await toFileList(getFiles(dir), dir)
|
|
16
16
|
|
|
17
|
-
await toApp(fileList, await NostrSigner.create(sk), { log: console.log.bind(console), dTag, channel, shouldReupload })
|
|
17
|
+
await toApp(fileList, await NostrSigner.create(sk), { log: console.log.bind(console), dTag, dTagRaw, channel, shouldReupload })
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export default async function (...args) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export async function toApp (fileList, nostrSigner, { log = () => {}, dTag, channel = 'main', shouldReupload = false } = {}) {
|
|
19
|
+
export async function toApp (fileList, nostrSigner, { log = () => {}, dTag, dTagRaw, channel = 'main', shouldReupload = false } = {}) {
|
|
20
20
|
if (!nostrSigner && typeof window !== 'undefined') nostrSigner = window.nostr
|
|
21
21
|
if (!nostrSigner) throw new Error('No Nostr signer found')
|
|
22
22
|
if (typeof window !== 'undefined' && nostrSigner === window.nostr) {
|
|
@@ -29,7 +29,7 @@ export async function toApp (fileList, nostrSigner, { log = () => {}, dTag, chan
|
|
|
29
29
|
if (typeof dTag === 'string') {
|
|
30
30
|
if (!isNostrAppDTagSafe(dTag)) throw new Error('dTag should be [A-Za-z0-9] with length ranging from 1 to 19')
|
|
31
31
|
} else {
|
|
32
|
-
dTag = fileList[0].webkitRelativePath.split('/')[0].trim()
|
|
32
|
+
dTag = dTagRaw || fileList[0].webkitRelativePath.split('/')[0].trim()
|
|
33
33
|
if (!isNostrAppDTagSafe(dTag)) dTag = await deriveNostrAppDTag(dTag || Math.random().toString(36))
|
|
34
34
|
}
|
|
35
35
|
let nmmr
|