all-the-public-replicate-models 1.0.1 → 1.1.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "all-the-public-replicate-models",
3
3
  "description": "Metadata for all the public models on Replicate, bundled up into an npm package",
4
- "version": "1.0.1",
4
+ "version": "1.1.1",
5
5
  "devDependencies": {
6
6
  "chai": "^4.3.10",
7
7
  "lodash-es": "^4.17.21",
@@ -10,8 +10,15 @@
10
10
  },
11
11
  "type": "module",
12
12
  "main": "index.mjs",
13
+ "exports": {
14
+ ".": "./index.mjs",
15
+ "./lite": "./lite.mjs"
16
+ },
13
17
  "scripts": {
14
- "build": "node script/build.js > models.json",
18
+ "build": "node script/build.js",
15
19
  "test": "mocha test.js"
20
+ },
21
+ "engines": {
22
+ "node": ">=18"
16
23
  }
17
24
  }
package/script/build.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import Replicate from "replicate";
2
2
  const replicate = new Replicate();
3
3
  import {unset} from "lodash-es";
4
+ import fs from "fs";
4
5
 
5
6
  async function main () {
6
7
  console.error("Fetching all public models from Replicate...")
@@ -17,8 +18,20 @@ async function main () {
17
18
  unset(models[i], 'default_example.webhook_completed')
18
19
  unset(models[i], 'latest_version.openapi_schema.paths')
19
20
  }
21
+
22
+ const lite = models.map(model => {
23
+ return {
24
+ url: model.url,
25
+ owner: model.owner,
26
+ name: model.name,
27
+ description: model.description,
28
+ run_count: model.run_count,
29
+ cover_image_url: model.cover_image_url
30
+ }
31
+ });
20
32
 
21
- process.stdout.write(JSON.stringify(models, null, 2))
33
+ fs.writeFileSync('models.json', JSON.stringify(models, null, 2))
34
+ fs.writeFileSync('models-lite.json', JSON.stringify(lite, null, 2))
22
35
  }
23
36
 
24
37
  main()
package/test.js CHANGED
@@ -6,8 +6,8 @@ describe('models module', () => {
6
6
  expect(models).to.be.an('array');
7
7
  });
8
8
 
9
- it('should have at least 500 objects', () => {
10
- expect(models).to.have.lengthOf.at.least(500);
9
+ it('should have at least 1000 models', () => {
10
+ expect(models).to.have.lengthOf.at.least(1000);
11
11
  });
12
12
 
13
13
  describe('first object in the array', () => {