-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: a base for a new web3.storage upload-client (#141)
Co-authored-by: Hugo Dias <[email protected]>
- Loading branch information
1 parent
4ee0813
commit 9d4b5be
Showing
9 changed files
with
181 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Client | ||
env: | ||
CI: true | ||
FORCE_COLOR: 1 | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'packages/upload-client/**' | ||
- '.github/workflows/client.yml' | ||
- 'pnpm-lock.yaml' | ||
pull_request: | ||
paths: | ||
- 'packages/upload-client/**' | ||
- '.github/workflows/client.yml' | ||
- 'pnpm-lock.yaml' | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 7 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'pnpm' | ||
- run: pnpm install | ||
- run: pnpm -r --filter @web3-storage/upload-client run lint | ||
- run: pnpm -r --filter @web3-storage/upload-client run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ on: | |
options: | ||
- access-api | ||
- access | ||
- upload-client | ||
- wallet | ||
environment: | ||
description: 'Environment to deploy' | ||
|
@@ -73,3 +74,25 @@ jobs: | |
- run: pnpm -r --filter @web3-storage/access publish --tag next --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
deploy-upload-client: | ||
runs-on: ubuntu-latest | ||
if: github.event.inputs.package == 'upload-client' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 7 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: 'https://registry.npmjs.org' | ||
cache: 'pnpm' | ||
- run: pnpm install | ||
- run: pnpm -r --filter @web3-storage/upload-client build | ||
- run: pnpm -r --filter @web3-storage/upload-client run rc || true # this fails because npm does not support workspace protocol so we force it to exit 0 | ||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: 'chore(client): Bump client pre release version' | ||
- run: pnpm -r --filter @web3-storage/upload-client publish --tag next --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ jobs: | |
manifest-file: .github/release-please-manifest.json | ||
default-branch: main | ||
release-type: node | ||
publish: | ||
publish-access: | ||
needs: release | ||
if: contains(fromJson(needs.release.outputs.paths_released), 'packages/access') | ||
runs-on: ubuntu-latest | ||
|
@@ -40,6 +40,25 @@ jobs: | |
- run: pnpm -r publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
publish-upload-client: | ||
needs: release | ||
if: contains(fromJson(needs.release.outputs.paths_released), 'packages/upload-client') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 7 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: 'https://registry.npmjs.org' | ||
cache: 'pnpm' | ||
- run: pnpm install | ||
- run: pnpm -r --filter @web3-storage/upload-client build | ||
- run: pnpm -r publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
pages: | ||
needs: release | ||
if: contains(fromJson(needs.release.outputs.paths_released), 'packages/wallet') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"name": "@web3-storage/upload-client", | ||
"version": "0.0.0", | ||
"description": "The web3.storage client", | ||
"homepage": "https://github.com/web3-storage/w3protocol/tree/main/packages/upload-client", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/web3-storage/w3protocol.git", | ||
"directory": "packages/upload-client" | ||
}, | ||
"author": "Alan Shaw", | ||
"license": "Apache-2.0 OR MIT", | ||
"type": "module", | ||
"types": "dist/src/index.d.ts", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"lint": "tsc && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore", | ||
"build": "tsc --build", | ||
"test": "npm run test:node && npm run test:browser", | ||
"test:node": "mocha 'test/**/!(*.browser).test.js' -n experimental-vm-modules -n no-warnings", | ||
"test:browser": "playwright-test 'test/**/!(*.node).test.js'", | ||
"rc": "npm version prerelease --preid rc" | ||
}, | ||
"exports": { | ||
".": "./src/index.js" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"dist/*" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"src", | ||
"dist/src/**/*.d.ts", | ||
"dist/src/**/*.d.ts.map" | ||
], | ||
"devDependencies": { | ||
"@types/assert": "^1.5.6", | ||
"@types/mocha": "^10.0.0", | ||
"assert": "^2.0.0", | ||
"hd-scripts": "^3.0.2", | ||
"mocha": "^10.1.0", | ||
"playwright-test": "^8.1.1", | ||
"typescript": "^4.8.4" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"./node_modules/hd-scripts/eslint/index.js" | ||
], | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"rules": { | ||
"unicorn/prefer-number-properties": "off" | ||
}, | ||
"env": { | ||
"mocha": true | ||
}, | ||
"ignorePatterns": [ | ||
"dist" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class Client {} | ||
|
||
export default Client | ||
export { Client } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import assert from 'assert' | ||
import Client from '../src/index.js' | ||
|
||
describe('index', function () { | ||
it('should export a client object', () => { | ||
assert(Client) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"lib": ["ESNext", "DOM"], | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": ["src", "scripts", "test", "package.json"], | ||
"exclude": ["**/node_modules/**"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.