nostr-tools 1.0.0-alpha → 1.0.0-alpha2

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.
@@ -1,7 +1,8 @@
1
1
  name: publish npm package
2
2
 
3
3
  on:
4
- - tag
4
+ push:
5
+ tags: [v*]
5
6
 
6
7
  jobs:
7
8
  publish-npm:
@@ -10,8 +11,9 @@ jobs:
10
11
  - uses: actions/checkout@v3
11
12
  - uses: actions/setup-node@v3
12
13
  with:
13
- node-version: 16
14
- registry-url: https://registry.npmjs.org/
14
+ node-version: 18
15
+ - run: yarn --ignore-engines
16
+ - run: node build.js
15
17
  - run: npm publish
16
18
  env:
17
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}
19
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
@@ -1,6 +1,8 @@
1
1
  name: test every commit
2
2
  on:
3
- - push
3
+ push:
4
+ branches:
5
+ - master
4
6
 
5
7
  jobs:
6
8
  test:
@@ -11,5 +13,5 @@ jobs:
11
13
  with:
12
14
  node-version: 18
13
15
  - run: yarn --ignore-engines
14
- - run: node build.cjs
16
+ - run: node build.js
15
17
  - run: yarn test
package/README.md CHANGED
@@ -153,7 +153,7 @@ Please consult the tests or [the source code](https://github.com/fiatjaf/nostr-t
153
153
  ### Using from the browser (if you don't want to use a bundler)
154
154
 
155
155
  ```html
156
- <script src="https://unpkg.com/nostr-tools/standalone/index.js"></script>
156
+ <script src="https://unpkg.com/nostr-tools/nostr.bundle.js"></script>
157
157
  <script>
158
158
  window.NostrTools.generatePrivateKey('...') // and so on
159
159
  </script>
@@ -15,17 +15,27 @@ let common = {
15
15
  }
16
16
 
17
17
  esbuild
18
- .build({...common, outdir: 'esm/', format: 'esm', packages: 'external'})
18
+ .build({
19
+ ...common,
20
+ outfile: 'lib/nostr.esm.js',
21
+ format: 'esm',
22
+ packages: 'external'
23
+ })
19
24
  .then(() => console.log('esm build success.'))
20
25
 
21
26
  esbuild
22
- .build({...common, outdir: 'cjs/', format: 'cjs', packages: 'external'})
27
+ .build({
28
+ ...common,
29
+ outfile: 'lib/nostr.cjs.js',
30
+ format: 'cjs',
31
+ packages: 'external'
32
+ })
23
33
  .then(() => console.log('cjs build success.'))
24
34
 
25
35
  esbuild
26
36
  .build({
27
37
  ...common,
28
- outdir: 'standalone/',
38
+ outfile: 'lib/nostr.bundle.js',
29
39
  format: 'iife',
30
40
  globalName: 'NostrTools',
31
41
  define: {
package/event.test.js CHANGED
@@ -6,7 +6,7 @@ const {
6
6
  signEvent,
7
7
  getEventHash,
8
8
  getPublicKey
9
- } = require('./cjs')
9
+ } = require('./lib/nostr.cjs')
10
10
 
11
11
  const event = {
12
12
  id: 'd7dd5eb3ab747e16f8d0212d53032ea2a7cadef53837e5a6c66d42849fcb9027',
package/filter.test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* eslint-env jest */
2
2
 
3
- const {matchFilters} = require('./cjs')
3
+ const {matchFilters} = require('./lib/nostr.cjs')
4
4
 
5
5
  test('test if filters match', () => {
6
6
  ;[
package/keys.test.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* eslint-env jest */
2
2
 
3
- const {generatePrivateKey, getPublicKey} = require('./cjs')
3
+ const {generatePrivateKey, getPublicKey} = require('./lib/nostr.cjs')
4
4
 
5
5
  test('test private key generation', () => {
6
6
  expect(generatePrivateKey()).toMatch(/[a-f0-9]{64}/)