Skip to content

Commit

Permalink
Merge pull request #1523 from johnlindquist/next
Browse files Browse the repository at this point in the history
v3
  • Loading branch information
johnlindquist authored Sep 28, 2024
2 parents 0de31f2 + 70c1998 commit 4188b56
Show file tree
Hide file tree
Showing 309 changed files with 39,704 additions and 39,719 deletions.
164 changes: 139 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,109 @@ on:
- main
- beta
- alpha
- next
tags:
- "*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
runs-on: ${{ matrix.os }}
test-windows:
runs-on: windows-latest
steps:
- name: Checkout kit
uses: actions/checkout@master

- uses: pnpm/action-setup@v4
name: Install pnpm

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: 'pnpm'

- name: Check node $PATH version
shell: bash
run: |
node --version
pnpm --version
- name: pnpm i
shell: bash
run: |
cd "${{ env.wd_path }}"
pnpm i
- name: pnpm run ava
shell: bash
run: |
pnpm run ava
- name: pnpm run build-kit
shell: bash
env:
KIT: ${{ env.kit_path }}
run: |
pnpm run build-kit
- name: pnpm run test
uses: nick-invision/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: |
pnpm run test
env:
KIT: ${{ env.kit_path }}


test-mac-and-ubuntu:
strategy:
matrix:
os: [macos-latest]

os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4

- name: Get Time
id: time
uses: nanzm/get-time-action@v1.1
uses: nanzm/get-time-action@v2.0
with:
timeZone: 8
format: "YYYY-MM-DD-HH-mm-ss"

- name: Checkout kit
uses: actions/checkout@master

- name: Install Node
run: |
mkdir -p ./.knode
./build/install-node.sh v18.18.2 --prefix ./.knode
- uses: pnpm/action-setup@v4
name: Install pnpm

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: 'pnpm'

- name: Build Kit
run: |
PATH="./.knode/bin:$PATH" npm i && PATH="./.knode/bin:$PATH" npm dedupe
PATH="./.knode/bin:$PATH" KIT=./.kit node ./build/build-ci.js
pnpm i
export NODE_PATH=$(pnpm node -e )
KIT=./.kit pnpm node ./build/build-ci.js
env:
KIT: ${{ env.kit_path }}

- name: Set env vars
run: |
echo "wd_path=$PWD" >> $GITHUB_ENV
echo "kit_path=$PWD/.kit" >> $GITHUB_ENV
echo "knode_path=$PWD/.knode" >> $GITHUB_ENV
echo "release_channel=${{ env.GITHUB_REF_SLUG_URL }}" >> $GITHUB_ENV
- name: Add node and kit to PATH
run: |
echo "${{ env.knode_path }}/bin" >> $GITHUB_PATH
echo "${{ env.kit_path }}/bin" >> $GITHUB_PATH
echo "---"
echo "$GITHUB_PATH"
Expand All @@ -63,21 +121,75 @@ jobs:
- name: Log ./.kit
run: |
ls ./.kit/*/*
ls ./.kit/*/*
- name: npm i
- name: pnpm i
run: |
cd "${{ env.wd_path }}"
npm i
pnpm i
- name: pnpm run ava
run: |
pnpm run ava
- name: npm run test
run: |
npm run test
env:
KIT: ${{ env.kit_path }}
KNODE: ${{ env.knode_path }}

- name: Semantic Release
release:
runs-on: macos-latest
needs: [test-windows, test-mac-and-ubuntu]
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4

- name: Get Time
id: time
uses: nanzm/[email protected]
with:
timeZone: 8
format: "YYYY-MM-DD-HH-mm-ss"

- name: Checkout kit
uses: actions/checkout@master

- uses: pnpm/action-setup@v4
name: Install pnpm

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.17.0
cache: 'pnpm'


- name: Build Kit
run: |
pnpm install
KIT=./.kit pnpm node ./build/build-ci.js
- name: Set env vars
run: |
echo "wd_path=$PWD" >> $GITHUB_ENV
echo "kit_path=$PWD/.kit" >> $GITHUB_ENV
echo "release_channel=${{ env.GITHUB_REF_SLUG_URL }}" >> $GITHUB_ENV
- name: Add node and kit to PATH
run: |
echo "${{ env.kit_path }}/bin" >> $GITHUB_PATH
echo "---"
echo "$GITHUB_PATH"
echo "$PATH"
- name: Check node $PATH version
run: |
node --version
pnpm --version
- name: Semantic Release
run: |
cd "${{ env.wd_path }}"
npx semantic-release
Expand All @@ -102,17 +214,19 @@ jobs:
draft: true
prerelease: false

- uses: actions/[email protected]
- name: Create and Upload Release
uses: softprops/action-gh-release@v2
with:
files: ./kit.zip
tag_name: ${{ steps.time.outputs.time }}
name: ${{ env.release_channel }}
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./kit.zip
asset_name: kit.zip
asset_content_type: application/zip

- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
release_id: ${{ steps.create_release.outputs.id }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ kit.sock
.kitignore
TODO.md
.idea
.tsimp
.aider*
6 changes: 5 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
node
node_modules
node_modules
**/*.test.js
**/*.test.ts
test
test-sdk
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
registry=https://registry.npmjs.org
install-links=false
install-links=false
save-exact=true
use-node-version=20.17.0
6 changes: 3 additions & 3 deletions GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ my-sites --open
The `db` helpers reads/writes to json files in the `~/.kenv/db` directory. It's meant as a simple wrapper around common json operations.
```js
// Menu: Database Read/Write Example
// Name: Database Read/Write Example
// Description: Add/remove items from a list of fruit

let fruitDb = await db(["apple", "banana", "orange"])
Expand Down Expand Up @@ -397,7 +397,7 @@ while (true) {
This db helper can also be used as a simple Key/value Store like this:
```js
// Menu: Database Read/Write Example 2
// Name: Database Read/Write Example 2
// Description: Use 'db' helper as Key/Value Store

// Open the json file with the same name as the script file, the data in the param is the default,
Expand Down Expand Up @@ -1179,7 +1179,7 @@ await degit(`https://github.com/sveltejs/template`).clone(
targetDir
)

edit(targetDir)
await edit(targetDir)
```
## View Logs
Expand Down
77 changes: 17 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Script Kit v2
# Script Kit v3

[https://scriptkit.com/](https://scriptkit.com/)

Expand Down Expand Up @@ -27,76 +27,33 @@
| | Measure Tool |
| | Debug from IDE |

## Script Kit Dev Setup
## Prerequisites

> Note: This ain't pretty 😅
Install pnpm:

Requirements: yarn 1

### Why both npm and yarn?

The App was created with https://github.com/electron-react-boilerplate/electron-react-boilerplate a long time ago. They require yarn and webpack.

I have been unable to prioritize the time to switch over to another build system or keeping up with the boilerplate, especially with so many moving pieces.

Thus, we use yarn to build the App and npm to build the SDK 🤦‍♂️

> Note: A huge focus of v3 will be to clean up this mess and make it much, much easier to contribute.
### Using node 18.18.2 from ~/.knode

Installing `Kit.app` already installed node 18.18.2 to ~/.knode. You'll want to use this node version for all build/run steps:

`PATH=~/.knode/bin:$PATH`

This will use 18.18.2's node/npm when working with Kit. (Alternatively, you can use nvm/n/whatever, but I don't)

- Use `volta` to manage node versions.
1. Install [volta](https://volta.sh/)
2. Volta will automatically switch node version to 18.18.2 when working with kit.
[https://pnpm.io/installation](https://pnpm.io/installation)

### Clone Kit SDK

Clone:
`git clone https://github.com/johnlindquist/kit.git`

Install:
`npm install`

### Clone Kit App

Clone:
`git clone https://github.com/johnlindquist/kitapp.git`

Install:
`yarn`

### (Skip if you already have a kenv from production) Clone the base kenv
Clone and install:
```
git clone https://github.com/johnlindquist/kit.git
cd kit
pnpm install
```

Clone:
`git clone https://github.com/johnlindquist/kenv.git ~/.kenv`

### Building Kit SDK

`npm run build-kit`
`pnpm build`

The build command builds the SDK to ~/.kit

#### yarn link (First run only)
#### npm link to app (First run only)

1. cd to ~/.kit
2. yarn link
3. cd to ~/wherever you cloned kitapp
4. yarn link @johnlindquist/kit
(The app requires `npm` instead of `pnpm` due to build/native reasons)

This will force the App to use the SDK so you can work on both simultaneously

### Building the App

```bash
yarn webpack-dev
yarn install-electron-deps
yarn start
```

Assuming everything went well, the app should start up.
1. cd to ~/.kit
2. npm link
3. cd to wherever you cloned kitapp
4. npm link @johnlindquist/kit
Loading

0 comments on commit 4188b56

Please sign in to comment.