Skip to content

Commit

Permalink
Merge branch 'main' into feat/srcbookdev#218-Add-AI-generation-to-mar…
Browse files Browse the repository at this point in the history
…kdown-cells
  • Loading branch information
Aswanth-c committed Sep 16, 2024
1 parent e37bdf9 commit ae2cf40
Show file tree
Hide file tree
Showing 97 changed files with 7,465 additions and 3,247 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@srcbook/configs"]
}
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
permissions:
contents: write
packages: write
pull-requests: write
name: Releasing
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install PNPM
uses: pnpm/action-setup@v4
with:
version: 9.8.0
run_install: false

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install Dependencies
run: pnpm i --frozen-lockfile

- name: Build
run: pnpm build

- name: Create Release Pull Request or Publish to Github Registry
uses: changesets/action@v1
with:
publish: pnpm ci:publish
version: pnpm ci:version
commit: 'chore: release package(s)'
title: 'chore: release package(s)'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ srcbook/lib/**/*

# turbo
**/.turbo

# Aide
*.code-workspace
70 changes: 42 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
## Setup
You can contribute to Srcbook in three primary ways:

- Node 22+
- pnpm 9+
1. Using Srcbook! Usage leads to filing issues for bugs or feature requests.
2. Contributing code for fixes or features.
3. Being a Srcbook advocate.

## Development
Being an advocate is highly underrated. It helps the project grow and receive more investment. The best way to do this is use Srcbook, share your Srcbooks with others, write about or present using Srcbook, etc.

If you write interesting Srcbooks, share them with us and we will happily feature them on [the hub](https://hub.srcbook.com)!

## Code contributions

> [!TIP]
> Before spending time writing code, consider opening an issue and clarifying desired behavior with the maintainers to ensure a smooth process. We are quick to respond!
If you're ready to file a PR, remember to [add a changeset](#making-a-changeset).

### Setup

- Node 18+
- pnpm 9.5+

> [!NOTE]
> If you switch node versions during development, you may need to rebuild with `pnpm rebuild -r` due to the `better-sqlite3` native bindings.
First, make sure to install dependencies:

```
```shell
pnpm install
```

Expand All @@ -24,9 +42,7 @@ pnpm run dev

Then visit http://localhost:5173

_Note: make sure to run the database migrations with `pnpm run migrate` if you get a drizzle DB error._

## Running pnpm scripts
### Running pnpm scripts

Similar to NPM, check top-level package.json for scripts.

Expand All @@ -40,7 +56,22 @@ To run a script defined in one of the packages:
pnpm run check-types --filter=@srcbook/api
```

## Adding a dependency
### Making a changeset

When you create a PR, we ask that you also create a changeset. This is part of our release process automation.

```shell
pnpm changeset
```

This will prompt you about what has changed and whether it should be considered major/minor/patch.

> [!IMPORTANT]
> Given the project is young, we are keeping all changes as minor or patch. Using patch is the safest bet for now.
Please write good changeset messages because these will appear in our changelogs.

### Adding a dependency

To add a dependency from npm registry:

Expand All @@ -64,7 +95,7 @@ pnpm add -D @srcbook/shared --workspace --filter api

To remove a package, use `remove` instead of `add` in the commands above.

## Database
### Database

The application is powered by a local sqlite3 database, that lives at `~/.srcbook/srcbook.db`. We use [drizzle](https://orm.drizzle.team/) as an orm and for migrations.

Expand All @@ -75,25 +106,8 @@ To create a new migration, first modify [schema.ts](./packages/api/db/schema.mts
pnpm run generate -- --name <migration_name>
```

To apply migrations:
Migrations should be executed when the application starts. You can manually apply them using:

```shell
pnpm run migrate
```

## Releasing

The package that gets published to npm is under [srcbook/](./srcbook/). Publishing `srcbook` currently assumes that you've published the latest relevant versions for `@srcbook/shared` and `@srcbook/api`. Currently, you should do all of these manually, following this checklist:

From the root level:

- run `pnpm run build`

From the relevant package directory:

- update the CHANELOG.md in the root directory
- bump the version in the package.json, commit and push the changes. Example: `git commit -m "Release srcbook version 0.0.1-alpha.10`
- `pnpm publish`
- push git tags & add release notes to GitHub

TODO: automate this further with semantic commits, auto-changelogs and git tag pushing.
64 changes: 30 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/aa3fa190-bffb-413d-6919-0adfeaae1800/public">
<source media="(prefers-color-scheme: light)" srcset="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/733eaa72-3f6a-47f4-2560-9b9441d5ce00/public">
<img alt="Srcbook banner" src="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/733eaa72-3f6a-47f4-2560-9b9441d5ce00/public">
<source media="(prefers-color-scheme: dark)" srcset="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/2d5c9dda-044b-49e2-5255-4a0be1085d00/public">
<source media="(prefers-color-scheme: light)" srcset="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/064ebb1f-5153-4581-badd-42b42272fc00/public">
<img alt="Srcbook banner" src="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/064ebb1f-5153-4581-badd-42b42272fc00/public">
</picture>

[![npm version](https://badge.fury.io/js/srcbook.svg)](https://badge.fury.io/js/srcbook)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
<p align="center">
<a href="https://badge.fury.io/js/srcbook"><img src="https://badge.fury.io/js/srcbook.svg" alt="npm version" /></a>
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="Apache 2.0 license" /></a>
</p>

<p align="center">
<a href="https://hub.srcbook.com">Examples</a> ·
<a href="https://discord.gg/shDEGBSe2d">Discord</a> ·
<a href="https://www.youtube.com/@srcbook">Youtube</a>
</p>

## Features

- Create, run, and share reproducible programs and ideas
- Export to valid markdown format (.src.md)
- AI features for exploring and iterating on ideas
- Diagraming with [mermaid](https://mermaid.js.org) for rich annotations
- Local execution with a web interface
- Powered by Node.js
- Open-source under the Apache2 license

<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/7c2f1fdf-8c9a-4e5c-46eb-64a35a5c4400/public">
<source media="(prefers-color-scheme: light)" srcset="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/08f1a7b9-2fc1-404c-6621-9f0280010600/public">
<img alt="Srcbook banner" src="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/08f1a7b9-2fc1-404c-6621-9f0280010600/public">
<source media="(prefers-color-scheme: dark)" srcset="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/2a4fa0f6-ef1b-4606-c9fa-b31d61b7c300/public">
<source media="(prefers-color-scheme: light)" srcset="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/ebfa2bfe-f805-4398-a348-0f48d4f93400/public">
<img alt="Example Srcbook" src="https://imagedelivery.net/oEu9i3VEvGGhcGGAYXSBLQ/ebfa2bfe-f805-4398-a348-0f48d4f93400/public">
</picture>

## FAQ
Expand All @@ -37,29 +46,20 @@ Srcbook runs locally on your machine as a CLI application with a web interface.

### Installing

You can install the `srcbook` application from `npm`:
We recommend using npx to always run the latest version from npm

```bash
npm install -g srcbook
```

### Running
# Using npm
npx srcbook@latest start

```
srcbook start
# Using your pm equivalent
pnpm dlx srcbook@latest start
```

You can also run it directly using `npx`:
> You can instead use a global install with `<pkg manager> i -g srcbook`
> and then directly call srcbook with `srcbook start`
```bash
# Using npx
npx srcbook start

# Using pnpm
pnpm dlx srcbook start
```

Here is the current list of commands:
### Current Commands

```bash
$ srcbook -h
Expand All @@ -77,23 +77,19 @@ Commands:
help [command] display help for command
```

### Updating

You can update `srcbook` using `npm`:

```bash
npm update -g srcbook
```

### Uninstalling

You can remove srcbook by first removing the package, and then cleaning it's local directory on disk:

```bash
npm uninstall -g srcbook
rm -rf ~/.srcbook

# if you configured a global install
npm uninstall -g srcbook
```

> if you used another pm you will need to use it's specific uninstall command
## Analytics and tracking

In order to improve Srcbook, we collect some behavioral analytics. We don't collect any Personal Identifiable Information (PII), our goals are simply to improve the application. The code is open source so you don't have to trust us, you can verify! You can find more information in our [privacy policy](https://github.com/srcbookdev/srcbook/blob/main/PRIVACY-POLICY.md).
Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@
"format": "prettier --write .",
"generate": "pnpm --filter api generate",
"migrate": "pnpm --filter api migrate",
"start": "turbo start"
"start": "turbo start",
"ci:publish": "pnpm publish -r",
"ci:version": "pnpm changeset version"
},
"devDependencies": {
"@types/node": "catalog:",
"prettier": "catalog:",
"typescript": "catalog:",
"@srcbook/configs": "workspace:*"
"@changesets/cli": "^2.27.8",
"@srcbook/configs": "workspace:^",
"@types/node": "^20.14.2",
"prettier": "^3.3.3",
"typescript": "5.6.2",
"eslint": "^8.57.0"
},
"dependencies": {
"turbo": "^2.0.14"
"turbo": "^2.1.1"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
44 changes: 44 additions & 0 deletions packages/api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# @srcbook/api

## 0.0.5

### Patch Changes

- 8c99a0d: Fix broken NPM package
- Updated dependencies [8c99a0d]
- @srcbook/shared@0.0.5

## 0.0.4

### Patch Changes

- 9f0a632: Secrets must now be enabled per Srcbook
- Updated dependencies [9f0a632]
- @srcbook/shared@0.0.4

## 0.0.3

### Patch Changes

- b5ab034: Added an upsell to subscribe to our mailing list + ability to update in settings
- a920be0: Windows support with resolve DB path off home dir
- 545699e: Add Prettier Support to Code Notebook
- 833264c: Underlying dependency bumps for maintenence
- Updated dependencies [545699e]
- Updated dependencies [833264c]
- @srcbook/shared@0.0.3

## 0.0.2

### Patch Changes

- Updated dependencies [735deb8]
- @srcbook/shared@0.0.2

## 0.0.1

### Patch Changes

- 4e04909: hover tooltips, tooling improvements, new contributors effyzhang 1egoman!
- Updated dependencies [4e04909]
- @srcbook/shared@0.0.1
Loading

0 comments on commit ae2cf40

Please sign in to comment.