Skip to content

Commit 0393ac4

Browse files
committed
feat: init replicate-fetch
1 parent 53392cd commit 0393ac4

20 files changed

+3475
-0
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.eslintrc.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
3+
"root": true,
4+
"env": {
5+
"commonjs": true,
6+
"es2021": true,
7+
"node": true
8+
},
9+
"extends": [
10+
"eslint:recommended",
11+
"airbnb-base",
12+
"plugin:@typescript-eslint/eslint-recommended",
13+
"plugin:@typescript-eslint/recommended",
14+
"prettier"
15+
],
16+
"plugins": ["@typescript-eslint", "import", "prettier"],
17+
"parser": "@typescript-eslint/parser",
18+
"parserOptions": {
19+
"sourceType": "module",
20+
"ecmaVersion": 2021
21+
},
22+
"rules": {
23+
"prettier/prettier": "error",
24+
"import/no-unresolved": 0,
25+
"import/extensions": 0,
26+
"import/prefer-default-export": 0,
27+
"import/no-extraneous-dependencies": 0,
28+
"no-await-in-loop": 0,
29+
"no-promise-executor-return": 0,
30+
"no-continue": 0
31+
}
32+
}

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set node v16
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '16'
21+
22+
- name: Install
23+
run: npm install
24+
25+
- name: Lint
26+
run: npm run lint
27+
28+
typecheck:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- name: Set node v16
34+
uses: actions/setup-node@v3
35+
with:
36+
node-version: '16'
37+
38+
- name: Install
39+
run: npm install
40+
41+
- name: Typecheck
42+
run: npm run typecheck
43+
44+
test:
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- uses: actions/checkout@v3
49+
50+
- name: Set node v16
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: '16'
54+
55+
- name: Install
56+
run: npm install
57+
58+
- name: Build
59+
run: npm run test

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Logs
2+
*.log
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Coverage
8+
coverage
9+
10+
# Compiled
11+
build
12+
dist
13+
14+
# Dependency directories
15+
node_modules
16+
17+
# OS X temporary files
18+
.DS_Store
19+
20+
# VSCode settings
21+
.vscode

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
test

.prettierrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true
6+
}

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
# replicate-fetch
2+
3+
[![npm version](https://img.shields.io/npm/v/replicate-fetch.svg)](https://www.npmjs.com/package/replicate-fetch) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/GPTGenius/replicate-fetch/ci.yml?branch=main) ![GitHub](https://img.shields.io/github/license/lvqq/cap)
4+
25
Fetch api for Midjourney/Openjourney on Replicate
6+
7+
## Usage
8+
### createOpenjourney
9+
```typescript
10+
import { createOpenjourney } from 'replicate-fetch'
11+
12+
createOpenjourney({ prompt: "a cat" })
13+
```
14+
15+
### Example
16+
17+
> mdjrny-v4 style a highly detailed matte painting of a man on a hill watching a rocket launch in the distance by studio ghibli, makoto shinkai, by artgerm, by wlop, by greg rutkowski, volumetric lighting, octane render, 4 k resolution, trending on artstation, masterpiece
18+
19+
![](./assets/example-0.png)
20+
21+
### createStableDiffusion
22+
```typescript
23+
import { createStableDiffusion } from 'replicate-fetch'
24+
25+
createStableDiffusion({ prompt: "a cat" })
26+
```
27+
28+
### Example
29+
> an astronaut riding a horse on mars, hd, dramatic lighting
30+
31+
![](./assets/example-1.png)
32+
33+
### Other api
34+
35+
```typescript
36+
import { createMidjourney } from 'replicate-fetch'
37+
38+
createMidjourney({ prompt: "a cat" })
39+
```

assets/example-0.png

321 KB
Loading

assets/example-1.png

382 KB
Loading

0 commit comments

Comments
 (0)