Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2afe22f
Checkpoint:
matheus23 Jun 10, 2021
b6d5813
Switch to cborg
matheus23 Jun 10, 2021
457fded
Fix cborg imports
matheus23 Jun 11, 2021
8e50ee0
Only use tsc & esbuild for building & remove rollup
matheus23 Jun 11, 2021
25031f8
Clarify node version requirement
matheus23 Jun 11, 2021
927a84d
Fix README
matheus23 Jun 11, 2021
96c9c06
Remove prettier & unused npm dependencies
matheus23 Jun 11, 2021
2a0e237
Actually remove rollup file lol
matheus23 Jun 11, 2021
357ac15
Fix build by using typedoc@beta (supports ts 4.3)
matheus23 Jun 11, 2021
b0c8810
Use the npm prepare script
matheus23 Jun 11, 2021
c84d461
Target es2020, build output to "modules/"
matheus23 Jun 14, 2021
c5396bb
Try to put config files into config/
matheus23 Jun 14, 2021
37bb7eb
Revert "Try to put config files into config/"
matheus23 Jun 14, 2021
11e9623
Add exports map & move built stuff to lib/
matheus23 Jun 14, 2021
872a156
Setup github actions, remove travis
matheus23 Jun 14, 2021
51dd228
Try using setup-node instead of nix
matheus23 Jun 14, 2021
b8c1a60
Fix typo
matheus23 Jun 14, 2021
e78d919
Goddamnit I need type checking
matheus23 Jun 14, 2021
8b038f5
Try the network-concurrency flag
matheus23 Jun 14, 2021
7e9118e
Debug
matheus23 Jun 14, 2021
1d8803c
Try running tests with nix instead
matheus23 Jun 14, 2021
c0c5829
Better error for loadWebnativePage
matheus23 Jun 14, 2021
a27e013
Try something
matheus23 Jun 15, 2021
5bf0d2c
Let's try something weird
matheus23 Jun 15, 2021
edf3f47
Try waiting for domcontentloaded
matheus23 Jun 15, 2021
19be18c
Try writing webnative to the window object
matheus23 Jun 15, 2021
c60a2d7
Try setup-node again
matheus23 Jun 15, 2021
5b9c3e8
Try waiting for networkidle2
matheus23 Jun 15, 2021
1be0f36
Output errors happening in puppeteer to console
matheus23 Jun 15, 2021
ab3e2d6
Bump fission-bloom-filters version
matheus23 Jun 15, 2021
66635fc
Also export dist directory
matheus23 Jun 17, 2021
fa30fb8
Add file extension to imports/exports
matheus23 Jun 18, 2021
6c774dc
Try using ts-node for tests
matheus23 Jun 18, 2021
b38286f
Revert "Try using ts-node for tests"
matheus23 Jun 18, 2021
787786f
Revert "Add file extension to imports/exports"
matheus23 Jun 18, 2021
518f6a0
Use transform typescript to add .js to generated imports
matheus23 Jun 18, 2021
cbb2fec
Add more missing /index imports
matheus23 Jun 21, 2021
48bb593
Update noble-ed25519 with better browser support
matheus23 Jun 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Test

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]

pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-and-test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v2

- name: Setup Node Environment
uses: actions/setup-node@v2
with:
node-version: '16'

# https://github.com/actions/cache/blob/main/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# ---

- name: Install Dependencies
run: yarn install --network-concurrency 1

- name: Build & Test
run: yarn test:prod
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/coverage
/dist
/lib
/docs
/node_modules
/yarn-error.log
Expand Down
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The Fission webnative SDK offers tools for:
// ES6
import * as wn from 'webnative'

// Browser/UMD build
// Browser/IIFE build
const wn = globalThis.webnative
```

Expand Down Expand Up @@ -150,7 +150,7 @@ The `publish` function synchronises your file system with the Fission API and IP
Each file and directory has a `history` property, which you can use to get an earlier version of that item. We use the `delta` variable as the order index. Primarily because the timestamps can be slightly out of sequence, due to device inconsistencies.

```ts
const file = await fs.get("private/Blog Posts/article.md")
const file = await fs.get(wn.path.file("private", "Blog Posts", "article.md"))

file.history.list()
// { delta: -1, timestamp: 1606236743 }
Expand Down Expand Up @@ -183,7 +183,7 @@ yarn start
yarn build

# test
yarn test
yarn test:prod
yarn test:watch

# generate docs
Expand Down
81 changes: 36 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,33 @@
"IPFS",
"files"
],
"main": "dist/index.cjs.js",
"module": "dist/index.es5.js",
"browser": "dist/index.umd.min.js",
"main": "lib/index.js",
"exports": {
".": "./lib/index.js",
"./*": "./lib/*.js",
"./package.json": "./package.json"
},
"types": "lib/index.d.ts",
"typesVersions": {
"*": {
"lib/index.d.ts": [
"lib/index.d.ts"
],
"*": [
"lib/*"
]
}
},
"files": [
"lib",
"dist",
"README.md",
"CHANGELOG.md",
"LICENSE",
"package.json",
"!*.test.ts",
"docs"
],
"types": "dist/index.d.ts",
"author": "Daniel Holmgren <daniel@fission.codes>",
"repository": {
"type": "git",
Expand All @@ -28,53 +43,39 @@
"homepage": "https://guide.fission.codes",
"license": "Apache-2.0",
"engines": {
"node": ">=10.21.0"
"node": ">=15"
},
"scripts": {
"docs": "rimraf docs && typedoc && typedoc --entryPoints ./src/fs --out docs/fs",
"lint": "yarn eslint src/**/*.ts",
"prebuild": "rimraf dist && node scripts/gen-version.js",
"build": "tsc && rollup -c rollup.config.ts",
"start": "tsc -w",
"prebuild": "rimraf lib dist && node scripts/gen-version.js",
"build": "ttsc && yarn run build:minified && cp src/package.json lib/package.json",
"build:minified": "esbuild src/index.ts --outfile=dist/index.min.js --bundle --minify --sourcemap --platform=browser --format=iife --global-name=globalThis.webnative --target=es2020 && gzip -k9 dist/index.min.js",
"start": "ttsc -w",
"test": "jest --forceExit",
Comment on lines +54 to 55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not totally relevant, but do we want to switch stuff around so yarn test works "out of the box"? I would suggest make it the same as test:unit and drop test:unit ... maybe test:prod should be test:integration to be more accurate?

"test:watch": "jest --watch",
"test:prod": "yarn run build && yarn run lint && yarn run test -- --no-cache",
"test:types": "cp -RT tests/types/ dist/ && yarn run tsd",
"test:prod": "yarn run build && yarn run lint && yarn run test --no-cache",
"test:types": "cp -RT tests/types/ lib/ && yarn run tsd",
"test:unit": "jest --watch --testPathPattern=src/",
"precommit": "lint-staged",
"prepublishOnly": "yarn build && yarn docs",
"prepare": "yarn build && yarn docs",
"publish-dry": "npm publish --dry-run",
"publish-alpha": "npm publish --tag alpha",
"publish-latest": "npm publish --tag latest"
},
"lint-staged": {
"{src,test}/**/*.ts": [
"prettier --write",
"git add"
]
},
"prettier": {
"semi": false,
"singleQuote": true
},
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.2",
"@babel/preset-typescript": "^7.13.0",
"@ipld/car": "https://github.com/matheus23/ipld-car-jest-fix#28fa48a8d0e701ddaf6e4785d0d9f08735b67bc8",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-inject": "^4.0.2",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@types/jest": "^26.0.23",
"@types/jest-environment-puppeteer": "^4.4.1",
"@types/node": "^15.6.1",
"@types/throttle-debounce": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^4.25.0",
"@typescript-eslint/parser": "^4.25.0",
"@zoltu/typescript-transformer-append-js-extension": "^1.0.1",
"babel-jest": "^27.0.1",
"braces": "^3.0.2",
"esbuild": "^0.12.8",
"eslint": "^7.27.0",
"fast-check": "^2.14.0",
"interface-datastore": "^4.0.1",
Expand All @@ -84,44 +85,34 @@
"jest": "^27.0.1",
"jest-config": "^27.0.1",
"jest-puppeteer": "^5.0.4",
"lint-staged": "^11.0.0",
"multihashing-async": "^2.1.2",
"prettier": "^2.3.0",
"prompt": "^1.1.0",
"puppeteer": "^9.1.1",
"replace-in-file": "^6.2.0",
"rimraf": "^3.0.2",
"rollup": "^2.50.3",
"rollup-plugin-gzip": "^2.5.0",
"rollup-plugin-node-polyfills": "^0.2.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"tslib": "^2.2.0",
"typedoc": "^0.20.36",
"ttypescript": "^1.5.12",
"typedoc": "^0.21.0-beta.2",
"typescript": "^4.3.2",
"typescript-documentation": "^2.0.0",
"yarn": "^1.22.4"
},
"dependencies": {
"base58-universal": "https://github.com/digitalbazaar/base58-universal#de970560f005de0f7054723c35ef6e0ff4b328b7",
"borc": "^3.0.0",
"buffer": "^6.0.3",
"cborg": "^1.3.4",
"cids": "^1.1.6",
"fission-bloom-filters": "1.7.0",
"fission-bloom-filters": "1.7.1",
"ipfs-message-port-client": "https://ipfs.runfission.com/ipfs/bafybeigx6q4aezve7my76s5vvfuiinbxtepapqvmjf2jbgrozrut6cjape/p/ipfs-message-port-client.tar.gz",
"ipfs-message-port-protocol": "https://ipfs.runfission.com/ipfs/bafybeigx6q4aezve7my76s5vvfuiinbxtepapqvmjf2jbgrozrut6cjape/p/ipfs-message-port-protocol.tar.gz",
"ipld-dag-pb": "^0.22.2",
"keystore-idb": "0.14.1",
"keystore-idb": "0.14.2",
"localforage": "^1.9.0",
"make-error": "^1.3.6",
"noble-ed25519": "^1.2.2",
"noble-ed25519": "^1.2.4",
"throttle-debounce": "^3.0.1"
},
"resolutions": {
"**/ipfs-message-port-protocol": "https://ipfs.runfission.com/ipfs/bafybeigx6q4aezve7my76s5vvfuiinbxtepapqvmjf2jbgrozrut6cjape/p/ipfs-message-port-protocol.tar.gz"
},
"tsd": {
"directory": "dist"
"directory": "lib"
}
}
104 changes: 0 additions & 104 deletions rollup.config.ts

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/gen-version.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require("fs").promises
const fs = require('fs').promises

fs.readFile("package.json", { encoding: "utf-8" }).then(pkg => {
const pkgJson = JSON.parse(pkg)
Expand Down
4 changes: 0 additions & 4 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,4 @@ pkgs.mkShell {
unstable.nodejs-16_x
unstable.niv
];

shellHook = ''
${yarn}/bin/yarn install
'';
}
1 change: 0 additions & 1 deletion src/@types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ declare module 'base58-universal' {
export function encode(input: Uint8Array, maxline?: number): string
export function decode(input: string): Uint8Array
}
declare module 'borc'
8 changes: 4 additions & 4 deletions src/apps/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as did from '../did'
import * as ucan from '../ucan'
import { api, Maybe, isString } from '../common'
import * as did from '../did/index'
import * as ucan from '../ucan/index'
import { api, Maybe, isString } from '../common/index'
import { setup } from '../setup/internal'
import { CID } from '../ipfs'
import { CID } from '../ipfs/index'


export type App = {
Expand Down
Loading