yank-note-registry 1.0.2 → 1.0.4

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/.editorconfig ADDED
@@ -0,0 +1,11 @@
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 = */
@@ -6,26 +6,23 @@ name: Node.js Package
6
6
  on: workflow_dispatch
7
7
 
8
8
  jobs:
9
- bump-version:
9
+ build:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
+ - uses: actions/setup-node@v3
13
+ with:
14
+ node-version: 16
15
+ registry-url: https://registry.npmjs.org/
12
16
  - uses: actions/checkout@v3
13
17
  with:
14
18
  token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
19
+ - run: yarn
20
+ - run: yarn run build
15
21
  - run: git config --global user.name 'action'
16
22
  - run: git config --global user.email 'noreply@github.com'
23
+ - run: git add -u && git commit -m 'update index.json'
17
24
  - run: npm version patch -m "[RELEASE] %s"
18
25
  - run: git push
19
-
20
- publish-npm:
21
- needs: bump-version
22
- runs-on: ubuntu-latest
23
- steps:
24
- - uses: actions/checkout@v3
25
- - uses: actions/setup-node@v3
26
- with:
27
- node-version: 16
28
- registry-url: https://registry.npmjs.org/
29
26
  - run: npm publish
30
27
  env:
31
28
  NODE_AUTH_TOKEN: ${{secrets.npm_token}}
package/build.js ADDED
@@ -0,0 +1,65 @@
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();
@@ -0,0 +1,8 @@
1
+ {
2
+ "official": [
3
+ { "id": "yank-note-extension-git-push", "version": "1.0.0-alpha.1" }
4
+ ],
5
+ "unofficial": [
6
+ { "id": "yank-note-extension-example", "version": "0.0.3" }
7
+ ]
8
+ }
package/index.json CHANGED
@@ -1 +1,103 @@
1
- {}
1
+ [
2
+ {
3
+ "name": "yank-note-extension-git-push",
4
+ "version": "1.0.0-alpha.1",
5
+ "displayName": "Git Push",
6
+ "displayName_ZH-CN": "Git 推送",
7
+ "description": "Run Git commit and push to remote repository",
8
+ "description_ZH-CN": "运行 Git 提交并推送到远程仓库",
9
+ "keywords": [],
10
+ "author": {
11
+ "name": "purocean",
12
+ "email": "purocean@gmail.com"
13
+ },
14
+ "license": "AGPL-3.0",
15
+ "homepage": "https://github.com/purocean/yank-note-extension/packages/git-push",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/purocean/yank-note-extension.git"
19
+ },
20
+ "main": "./lib/index.js",
21
+ "icon": "https://unpkg.com/yank-note-extension-git-push@1.0.0-alpha.1/./icon.png",
22
+ "compatibility": [
23
+ {
24
+ "extension": "*",
25
+ "engine": ">=3.29.0"
26
+ }
27
+ ],
28
+ "bugs": {
29
+ "url": "https://github.com/purocean/yank-note-extension/issues"
30
+ },
31
+ "dist": {
32
+ "integrity": "sha512-Dbc4fwv23aCYp9/rVcJ8YixslLao8A/1SJSH3wNuRTg6MAlnuscTxSV044mmObFUiFpmjQ4XgzRSTPkFhlVHJg==",
33
+ "shasum": "d91a15020d6b5eed77560d21814d839c79a17f46",
34
+ "tarball": "https://registry.npmjs.org/yank-note-extension-git-push/-/yank-note-extension-git-push-1.0.0-alpha.1.tgz",
35
+ "fileCount": 6,
36
+ "unpackedSize": 41253
37
+ },
38
+ "directories": {},
39
+ "maintainers": [
40
+ {
41
+ "name": "purocean",
42
+ "email": "purocean@outlook.com"
43
+ }
44
+ ],
45
+ "origin": "official"
46
+ },
47
+ {
48
+ "name": "yank-note-extension-example",
49
+ "version": "0.0.3",
50
+ "displayName": "Example Extension",
51
+ "description": "HelloWorld example extension",
52
+ "displayName_ZH-CN": "示例拓展",
53
+ "description_ZH-CN": "HelloWorld 示例拓展",
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+ssh://git@github.com/purocean/yank-note-extension-example.git"
57
+ },
58
+ "author": {
59
+ "name": "purocean",
60
+ "email": "purocean@gmail.com"
61
+ },
62
+ "license": "MIT",
63
+ "keywords": [],
64
+ "homepage": "https://github.com/purocean/yank-note-extension-example",
65
+ "main": "./lib/index.js",
66
+ "icon": "https://unpkg.com/yank-note-extension-example@0.0.3/./icon.png",
67
+ "compatibility": [
68
+ {
69
+ "extension": "*",
70
+ "engine": ">=3.29.0"
71
+ }
72
+ ],
73
+ "themes": [
74
+ {
75
+ "name": "Red",
76
+ "css": "./themes/demo1.css"
77
+ },
78
+ {
79
+ "name": "Green",
80
+ "css": "./themes/demo2.css"
81
+ }
82
+ ],
83
+ "gitHead": "14921e3d272fcc04666491efb9f8a81d02ef36cd",
84
+ "bugs": {
85
+ "url": "https://github.com/purocean/yank-note-extension-example/issues"
86
+ },
87
+ "dist": {
88
+ "integrity": "sha512-xMYUVhNV3aGts1Y29P3/ScWejKliT//tVucgyCLUipt6LXzopZWANMevyn0oZGAo/UqikDURMUtiygg69lcZlw==",
89
+ "shasum": "fe3d5d9fb15e7b0eb3710e676fe5666169de4003",
90
+ "tarball": "https://registry.npmjs.org/yank-note-extension-example/-/yank-note-extension-example-0.0.3.tgz",
91
+ "fileCount": 10,
92
+ "unpackedSize": 27068
93
+ },
94
+ "directories": {},
95
+ "maintainers": [
96
+ {
97
+ "name": "purocean",
98
+ "email": "purocean@outlook.com"
99
+ }
100
+ ],
101
+ "origin": "unofficial"
102
+ }
103
+ ]
package/package.json CHANGED
@@ -1,26 +1,16 @@
1
1
  {
2
2
  "name": "yank-note-registry",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Yank Note Extension Registry",
5
5
  "main": "index.json",
6
6
  "repository": "git@github.com:purocean/yank-note-registry.git",
7
7
  "author": "purocean <purocean@gmail.com>",
8
8
  "license": "MIT",
9
9
  "private": false,
10
- "extensions": [
11
- {
12
- "id": "yank-note-extension-example",
13
- "name": "Yank Note Extension Example",
14
- "description": "This is an example of an extension for Yank Note",
15
- "version": "0.0.1",
16
- "homepage": "https://github.com/purocean/yank-note-extension-example"
17
- },
18
- {
19
- "id": "yank-note-extension-git-push",
20
- "name": "Git Push",
21
- "description": "Run Git commit and push to remote repository",
22
- "version": "1.0.0",
23
- "homepage": "https://github.com/purocean/yank-note-extension/packages/git-push"
24
- }
25
- ]
10
+ "scripts": {
11
+ "build": "node build.js"
12
+ },
13
+ "devDependencies": {
14
+ "node-fetch": "2"
15
+ }
26
16
  }