Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Oct 22, 2021
0 parents commit 4db2122
Show file tree
Hide file tree
Showing 67 changed files with 3,014 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node_version: [16]
include:
- os: macos-latest
node_version: 16
- os: windows-latest
node_version: 16
fail-fast: false
name: 'Test on node-${{ matrix.node_version }}, ${{ matrix.os }}'
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}

- name: Install & Build
run: yarn test:setup

- name: Run tests
run: yarn test
36 changes: 36 additions & 0 deletions .github/workflows/docs-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy Docs Website
on:
push:
# We only run this GitHub action upon new commits to `master`
branches:
- master
# We only run this GitHub action if there are changes in the `docs/` directory
paths:
- docs/**
- libframe
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install
# `yarn install` will checkout the git submodule `libframe/`
run: |
yarn install
- name: Build
run: |
yarn docs:build
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: docs/dist/client
# Remove previous build files
clean: true
# Do not remove the `.nojekyll` file: we have manually added an empty `.nojekyll` file at the root of the `gh-pages` branch and we don't want having to re-create it after each build.
clean-exclude: |
.nojekyll
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libframe"]
path = libframe
url = [email protected]:brillout/libframe
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Telefunc (new 2021 version) `0.1.0-beta.1`

Initial beta release.

# Telefunc (old 2020 version) `0.0.26`

See [github.com/brillout/telefunc-old](https://github.com/brillout/telefunc-old).

# Wildcard API `v0.5.3`

See [github.com/brillout/wildcard-api](https://github.com/brillout/wildcard-api).
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2020-present Romuald Brillout

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*Remote Functions. Instead of API.*

Intro & docs: [telefunc.com](https://telefunc.com)
<br/>
Examples (official): [examples/](examples)
<br/>
Examples (community): [examples/README.md](examples#community-examples)

Version history & breaking changes: [CHANGELOG.md](CHANGELOG.md)

Follow: [twitter.com/brillout](https://twitter.com/brillout)
<br/>
Chat: [Discord - Vike Land - #telefunc](https://discord.gg/3DYWwk4xRQ)

Have a question? Want a feature? A tool integration is not working? Chat on
<a href="https://discord.gg/3DYWwk4xRQ">Discord</a> or open a
<a href="https://github.com/brillout/telefunc/issues/new">GitHub ticket</a>.

12 changes: 12 additions & 0 deletions docs/_default/_default.page.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'libframe-docs/_default.page.client'

import '../icons/vue.svg'
import '../icons/react.svg'
import '../icons/chevron.svg'
import '../icons/vite-plugin-ssr.svg'

/*
import { setClientFrame } from 'libframe-docs/_default.page.server'
setClientFrame({assets: [
]})
*/
13 changes: 13 additions & 0 deletions docs/_default/_default.page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export * from 'libframe-docs/_default.page.server'
import logoUrl from '../icons/telefunc.svg'
import { setFrame } from 'libframe-docs/_default.page.server'
import { headings } from '../headings'
import { projectInfo } from '../utils'

setFrame({
projectVersion: projectInfo.version,
projectName: projectInfo.name,
repo: projectInfo.githubRepository,
headings,
logoUrl
})
54 changes: 54 additions & 0 deletions docs/headings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Heading } from 'libframe-docs/types'

export const headings: Heading[] = [
{
level: 1,
title: 'Overview',
titleEmoji: 'compass'
},
{
level: 2,
title: 'Introduction',
titleDocument: 'vite-plugin-ssr',
url: '/'
},
{
level: 2,
title: 'Tour',
url: '/tour'
},
{
level: 1,
title: 'Get Started',
titleEmoji: 'seedling'
},
{
level: 2,
title: 'Scaffold new app',
url: '/scaffold'
},
{
level: 2,
title: 'Add to existing app',
url: '/add'
},
{
level: 1,
title: 'Guides',
titleEmoji: 'books'
},
{
level: 4,
title: 'Basics'
},
{
level: 2,
title: 'Permissions',
url: '/permissions'
},
{
level: 2,
title: 'Error Handling',
url: '/error-handling'
},
]
6 changes: 6 additions & 0 deletions docs/mdx.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '*.mdx' {
import { FunctionComponent } from 'react'
const value: FunctionComponent
export default value
export const headings: { level: number; title: string; id: string; titleAddendum?: string }[]
}
19 changes: 19 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"scripts": {
"dev": "cd ../libframe/docs/ && yarn dev",
"prod": "cd ../libframe/docs/ && yarn prod",
"build": "cd ../libframe/docs/ && yarn build"
},
"dependencies": {
"libframe-docs": "*",
"@types/node": "^15.12.1",
"@types/react": "^17.0.9",
"@types/react-dom": "^17.0.6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typescript": "^4.3.2"
},
"// Needed for Yarn workspaces": "",
"name": "docs",
"version": "0.0.1"
}
13 changes: 13 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"jsx": "react",
"module": "ES2020",
"moduleResolution": "Node",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["vite/client"],
"esModuleInterop": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"strict": true
}
}
1 change: 1 addition & 0 deletions docs/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './projectInfo'
7 changes: 7 additions & 0 deletions docs/utils/projectInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const PROJECT_VERSION = '0.2.7'

export const projectInfo = {
name: 'Telefunc',
version: PROJECT_VERSION,
githubRepository: 'https://github.com/brillout/telefunc'
}
3 changes: 3 additions & 0 deletions examples/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Community Examples

Make a PR to add your example.
2 changes: 2 additions & 0 deletions examples/vite/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules/
/dist/
5 changes: 5 additions & 0 deletions examples/vite/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
semi: true
singleQuote: false
trailingComma: es5
tabWidth: 2
printWidth: 80
9 changes: 9 additions & 0 deletions examples/vite/.test.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { page, run, urlBase } from "../../libframe/test/setup";

run("npm run start");

test("page content is rendered to DOM", async () => {
page.goto(`${urlBase}/`);
await page.click("button");
expect(await page.textContent("body")).toContain("42");
});
12 changes: 12 additions & 0 deletions examples/vite/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<body>
<button>Message Server</button>
<p>
Messages:
</p>
<p id="messages">None</p>
<script type="module" src="/main.js"></script>
</body>
</html>

9 changes: 9 additions & 0 deletions examples/vite/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { msg } from './msg.telefunc'

const buttonEl = document.querySelector("button")
const messagesEl = document.querySelector('#messages')

buttonEl.onclick = () => {
const m = await msg()
messagesEl.textContent = m
}
11 changes: 11 additions & 0 deletions examples/vite/msg.telefunc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { getContext } from 'telefunc'

export { msg }

async function msg() {
const context = getContext()
console.log(context.headers)
return {
he: 42,
}
}
Loading

0 comments on commit 4db2122

Please sign in to comment.