all-the-package-types 1.0.0

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.
@@ -0,0 +1,4 @@
1
+ # These are supported funding model platforms
2
+ github: jsdelivr
3
+ open_collective: jsdelivr
4
+ custom: ['https://www.jsdelivr.com/sponsors']
@@ -0,0 +1,35 @@
1
+ name: Release
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 */24 * * *"
6
+
7
+ jobs:
8
+ release:
9
+ name: release
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-node@v3
14
+ with:
15
+ node-version: '18'
16
+ - name: Update and Publish
17
+ run: |
18
+ git config --global user.name "github-actions"
19
+ git config --global user.email "github-actions@users.noreply.github.com"
20
+
21
+ npm update all-the-package-repos
22
+ npm run build
23
+ npm test
24
+
25
+ # bail if no changes are present
26
+ [[ `git status --porcelain` ]] || exit 0
27
+
28
+ echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
29
+
30
+ git add .
31
+ # bump the version, commit, and create a tag
32
+ npm version patch -f -m "Update all-the-package-types to %s"
33
+
34
+ git push origin master --follow-tags
35
+ npm publish
package/cli.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ process.stdout.write(require('.').map(p => JSON.stringify(p)).join('\n'))
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "all-the-package-types",
3
+ "version": "1.0.0",
4
+ "description": "A list of all the `@types` packages on npm with metadata. Updated daily.",
5
+ "main": "types.json",
6
+ "bin": "cli.js",
7
+ "scripts": {
8
+ "build": "node script/build.js",
9
+ "test": "node test/index.js | tap-spec"
10
+ },
11
+ "repository": "https://github.com/jsdelivr/all-the-package-types",
12
+ "keywords": [
13
+ "npm",
14
+ "registry",
15
+ "packages",
16
+ "types",
17
+ "names",
18
+ "list",
19
+ "words",
20
+ "filter",
21
+ "search",
22
+ "offline"
23
+ ],
24
+ "author": "Martin Kolárik",
25
+ "license": "MIT",
26
+ "devDependencies": {
27
+ "all-the-package-repos": "^2",
28
+ "tap-spec": "^5.0.0",
29
+ "tape": "^5.6.6"
30
+ }
31
+ }
package/readme.md ADDED
@@ -0,0 +1,60 @@
1
+ # all-the-package-types
2
+
3
+ *Maintained by [jsDelivr](https://github.com/jsdelivr). Please consider [becoming a sponsor](https://github.com/sponsors/jsdelivr) to support us.*
4
+
5
+ A list of all the `@types` packages on npm with metadata. Updated daily.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ npm install all-the-package-types
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ The module exports an array of package names:
16
+
17
+ ```js
18
+ const types = require("all-the-package-types")
19
+
20
+ // [
21
+ // {
22
+ // "p": "https://github.com/11ty/eleventy-img", <= the matching library repository, if detected
23
+ // "l": "@11ty/eleventy-img", <= the matching library name, if detected
24
+ // "t": "11ty__eleventy-img" <= the "@types" package name
25
+ // },
26
+ // ...
27
+ // ]
28
+
29
+ ```
30
+
31
+ ## CLI Usage
32
+
33
+ You can also use it on the command line. Newline-delimited packages are piped to
34
+ STDOUT:
35
+
36
+ ```sh
37
+ npm i -g all-the-package-types
38
+ all-the-package-types | grep spell
39
+ ```
40
+
41
+ ## Tests
42
+
43
+ ```sh
44
+ npm install
45
+ npm test
46
+ ```
47
+
48
+ ## Dependencies
49
+
50
+ None
51
+
52
+ ## Dev Dependencies
53
+
54
+ - [all-the-package-repos](https://github.com/nice-registry/all-the-package-repos): Normalized repository URLs for every package in the npm registry.
55
+ - [tap-spec](https://github.com/scottcorgan/tap-spec): Formatted TAP output like Mocha&#39;s spec reporter
56
+ - [tape](https://github.com/substack/tape): tap-producing test harness for node and browsers
57
+
58
+ ## License
59
+
60
+ MIT
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs')
4
+ const path = require('path')
5
+ const repos = require('all-the-package-repos');
6
+
7
+ const filename = path.join(__dirname, '../types.json')
8
+ const names = Object.keys(repos)
9
+ .filter(name => name.startsWith('@types/'))
10
+ .map((name) => {
11
+ let typesName = name.substring(7);
12
+ let packageName = typesName;
13
+
14
+ if (packageName.includes('__')) {
15
+ packageName = `@${packageName.replace('__', '/')}`;
16
+ }
17
+
18
+ return {
19
+ p: repos[packageName] || null,
20
+ l: Object.hasOwn(repos, packageName) ? packageName : null,
21
+ t: typesName,
22
+ };
23
+ })
24
+
25
+ fs.writeFileSync(filename, JSON.stringify(names, null, 2))
package/test/index.js ADDED
@@ -0,0 +1,8 @@
1
+ const test = require('tape')
2
+ const names = require('..')
3
+
4
+ test('names', function (t) {
5
+ t.ok(Array.isArray(names), 'is an array')
6
+ t.ok(names.length > 10 * 1000, 'has hella names')
7
+ t.end()
8
+ })