yank-note-registry 1.0.4 → 1.0.5

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/extensions.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "official": [
3
3
  { "id": "yank-note-extension-git-push", "version": "1.0.0-alpha.1" }
4
4
  ],
5
- "unofficial": [
5
+ "registry": [
6
6
  { "id": "yank-note-extension-example", "version": "0.0.3" }
7
7
  ]
8
8
  }
package/index.json CHANGED
@@ -98,6 +98,6 @@
98
98
  "email": "purocean@outlook.com"
99
99
  }
100
100
  ],
101
- "origin": "unofficial"
101
+ "origin": "registry"
102
102
  }
103
103
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yank-note-registry",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Yank Note Extension Registry",
5
5
  "main": "index.json",
6
6
  "repository": "git@github.com:purocean/yank-note-registry.git",
package/.editorconfig DELETED
@@ -1,11 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- end_of_line = lf
6
- indent_style = space
7
- indent_size = 2
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
10
- block_comment_start = /*
11
- block_comment_end = */
@@ -1,28 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
-
4
- name: Node.js Package
5
-
6
- on: workflow_dispatch
7
-
8
- jobs:
9
- build:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: actions/setup-node@v3
13
- with:
14
- node-version: 16
15
- registry-url: https://registry.npmjs.org/
16
- - uses: actions/checkout@v3
17
- with:
18
- token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
19
- - run: yarn
20
- - run: yarn run build
21
- - run: git config --global user.name 'action'
22
- - run: git config --global user.email 'noreply@github.com'
23
- - run: git add -u && git commit -m 'update index.json'
24
- - run: npm version patch -m "[RELEASE] %s"
25
- - run: git push
26
- - run: npm publish
27
- env:
28
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}
package/build.js DELETED
@@ -1,65 +0,0 @@
1
- const fs = require('fs');
2
- const fetch = require('node-fetch');
3
- const index = require('./index.json');
4
- const { official, unofficial } = require('./extensions.json');
5
-
6
- async function fetchInfo (id, version) {
7
- console.log(` Fetching ${id}@${version}`);
8
-
9
- const { versions } = await fetch(`https://registry.npmjs.org/${id}`).then(r => r.json());
10
-
11
- const packageJson = versions[version]
12
- if (!packageJson) {
13
- throw new Error(`${id}@${version} not found`);
14
- }
15
-
16
- Object.keys(packageJson).forEach(key => {
17
- if (key.startsWith('_') || [
18
- 'devDependencies',
19
- 'dependencies',
20
- 'peerDependencies',
21
- 'optionalDependencies',
22
- 'bundledDependencies',
23
- 'scripts',
24
- ].includes(key)) {
25
- delete packageJson[key];
26
- };
27
-
28
- delete packageJson.dist.signatures;
29
- delete packageJson.dist['npm-signature'];
30
- });
31
-
32
- if (packageJson.icon && !/^https?:\/\//.test(packageJson.icon)) {
33
- packageJson.icon = `https://unpkg.com/${id}@${version}/${packageJson.icon}`;
34
- }
35
-
36
- return packageJson;
37
- }
38
-
39
- async function transform (list, official = false) {
40
- const data = [];
41
-
42
- for (const item of list) {
43
- const old = index.find(i => i.name === item.id);
44
- const origin = official ? 'official' : 'unofficial';
45
- console.log(`Transform ${origin} ${item.id}@${item.version}`);
46
- if (!old || old.version !== item.version) {
47
- data.push({ ...await fetchInfo(item.id, item.version), origin });
48
- } else {
49
- data.push({ ...old, origin });
50
- }
51
- }
52
-
53
- return data;
54
- }
55
-
56
- async function build () {
57
- const data = [
58
- ...await transform(official, true),
59
- ...await transform(unofficial, false)
60
- ];
61
-
62
- fs.writeFileSync('./index.json', JSON.stringify(data, null, 2));
63
- }
64
-
65
- build();