Skip to content

Commit

Permalink
testing bun + fix for plexus react
Browse files Browse the repository at this point in the history
  • Loading branch information
Pckool committed Sep 9, 2023
1 parent b765010 commit 9548897
Show file tree
Hide file tree
Showing 42 changed files with 147 additions and 80 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Cache node modules
- name: 💾 Fetch Cache
id: cache-yarn
uses: actions/cache@v3
env:
cache-name: cache-node-module
cache-name: cache-node-modules
with:
path: |
~/.cache/yarn
Expand All @@ -28,4 +31,4 @@ jobs:
name: 📦 Install Dependencies
env:
NO_YARN_POSTINSTALL: 1
run: yarn install --frozen-lockfile
run: bun install --frozen-lockfile
5 changes: 4 additions & 1 deletion .github/workflows/npm-publish-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/setup-node@v3
with:
node-version: 16
Expand All @@ -27,7 +30,7 @@ jobs:
id: cache-yarn
uses: actions/cache@v3
env:
cache-name: cache-node-module
cache-name: cache-node-modules
with:
path: |
~/.cache/yarn
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/npm-publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -35,7 +38,7 @@ jobs:
id: cache-yarn
uses: actions/cache@v3
env:
cache-name: cache-node-module
cache-name: cache-node-modules
with:
path: |
~/.cache/yarn
Expand All @@ -55,11 +58,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: 💾 Fetch Cache
id: cache-yarn
uses: actions/cache@v3
env:
cache-name: cache-node-module
cache-name: cache-node-modules
with:
path: |
~/.cache/yarn
Expand All @@ -83,11 +89,14 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: 💾 Fetch Cache
id: cache-yarn
uses: actions/cache@v3
env:
cache-name: cache-node-module
cache-name: cache-node-modules
with:
path: |
~/.cache/yarn
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache node modules
id: cache-yarn
uses: actions/cache@v2
env:
cache-name: cache-node-module
cache-name: cache-node-modules
with:
path: |
~/.cache/yarn
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/trunk-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Cache node modules
id: cache-yarn
uses: actions/cache@v3
env:
cache-name: cache-node-module
cache-name: cache-node-modules
with:
path: |
~/.cache/yarn
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/trunk-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Cache node modules
id: cache-yarn
uses: actions/cache@v3
env:
cache-name: cache-node-module
cache-name: cache-node-modules
with:
path: |
~/.cache/yarn
Expand Down
Binary file added bun.lockb
Binary file not shown.
10 changes: 5 additions & 5 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"scripts": {
"precli:build": "rm -rf ./out/bin.js",
"build": "rollup --config ./rollup.config.js",
"postbuild": "node ./lib/postbuild.js",
"preexecute": "yarn build",
"execute": "npx .",
"prepublish": "yarn build",
"postbuild": "bun ./lib/postbuild.js",
"preexecute": "bun build",
"execute": "bunx .",
"prepublish": "bun build",
"publish-stable": "yarn publish",
"local-install": "yarn build && npm link"
"local-install": "bun build && npm link"
},
"repository": {
"type": "git",
Expand Down
7 changes: 4 additions & 3 deletions cli/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ const helpString = `
Options:
--yarn Use Yarn as the package manager
--bun Use Bun as the package manager
--canary Use the canary version of plexus
--dev Use the dev version of plexus
--skip-install Skip the install of the PlexusJS packages
--typescript Create TypeScript files
--dev Use the dev version of plexus
--skip-install Skip the install of the PlexusJS packages
--typescript Create TypeScript files
--react Install the React package
--next Install the Next package
--template=<template> Choose the template to use to generate a PlexusJS core
Expand Down
4 changes: 4 additions & 0 deletions cli/src/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export const installPlexus = (tag = '') => {
if (existsSync(`${__dirname}/yarn.lock`) || yargs.argv.yarn) {
console.log(chalk.cyan.bgWhite(`Using Yarn Package Manager`))
installCommand = 'yarn install'
}
if (existsSync(`${__dirname}/bun.lockb`) || yargs.argv.bun) {
console.log(chalk.black.bgWhite(`Using Bun Package Manager`))
installCommand = 'bun install'
} else {
console.log(chalk.cyan.bgWhite('Using NPM Package Manager'))
}
Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ This website is built using [Docusaurus 2](https://docusaurus.io/), a modern sta
### Installation

```
$ yarn
$ bun install
```

### Local Development

```
$ yarn start
$ bun start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
$ bun build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
Expand Down
10 changes: 2 additions & 8 deletions docs/docs/style-guides/scalable.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@ sidebar_position: 2

## Quick Setup

<small>With Yarn</small>
<small>CLI</small>

```bash prefix="$"
yarn create plexus-core --typescript --template=scalable
```

<small>With NPX</small>

```bash
npx create-plexus-core --typescript --template=scalable
plexus-cli create --typescript --template=scalable
```

## Ideology
Expand Down
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
"private": true,
"scripts": {
"postinstall": "test -n \"$NO_YARN_POSTINSTALL\" || yarn run build",
"core": "yarn workspace @plexusjs/core",
"react": "yarn workspace @plexusjs/react",
"next": "yarn workspace @plexusjs/next",
"plexus-cli": "yarn workspace plexus-cli",
"docs": "yarn workspace plexus-docs",
"docs:generate:ref": "ts-node write-documentation.ts",
"postdocs:generate:ref": "yarn format --all",
"core": "bun workspace @plexusjs/core",
"react": "bun workspace @plexusjs/react",
"next": "bun workspace @plexusjs/next",
"plexus-cli": "bun workspace plexus-cli",
"docs": "bun workspace plexus-docs",
"docs:generate:ref": "bun write-documentation.ts",
"postdocs:generate:ref": "bun format --all",
"bootstrap": "lerna bootstrap --use-workspaces",
"build": "lerna run build",
"postbuild": "yarn docs:generate:ref",
"dev": "lerna run build && lerna watch -- lerna run build --scope=$LERNA_PACKAGE_NAME",
"build": "bunx --bun lerna run build",
"postbuild": "bun docs:generate:ref",
"dev": "bunx --bun lerna run build && bunx --bun lerna watch -- lerna run build --scope=$LERNA_PACKAGE_NAME",
"prereleaseOnly": "pinst --disable && echo '🚀 Publishing...'",
"release-canary": "lerna run build && lerna publish --preid canary --no-private --yes --force-publish --canary",
"release-stable": "lerna run build && lerna publish --preid canary --no-private --yes --force-publish",
"postrelease": "pinst --enable && echo '🎉 Published!'",
"test": "vitest",
"test": "bun test",
"test-ui": "vitest --ui",
"format": "trunk fmt"
},
Expand Down Expand Up @@ -69,13 +69,14 @@
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vitest": "^0.34.2",
"yargs": "^17.4.1"
"yargs": "^17.4.1",
"bun-types": "latest"
},
"workspaces": {
"packages": [
"packages/*",
"docs/",
"plexus-cli"
"cli"
]
},
"publishConfig": {
Expand Down
8 changes: 4 additions & 4 deletions packages/plexus-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@plexusjs/core",
"version": "1.10.6",
"description": "A library for building modular interconnected applications",
"main": "./dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/src/index.js",
"types": "dist/src/index.d.ts",
"publishConfig": {
"access": "public"
},
Expand All @@ -20,8 +20,8 @@
"license": "MIT",
"scripts": {
"prebuild": "rimraf ./dist ./tsconfig.tsbuildinfo",
"build": "tsc --build --force && echo \"Build complete.\"",
"dev": "tsc --watch"
"build": "bun build ./src/* --outdir ./dist/ --splitting --sourcemap=external --target=browser && tsc && echo \"Build complete.\"",
"build:legacy": "tsc --build --force && tsc && echo \"Build complete.\""
},
"gitHead": "192584965efcda8142c23e6f53df2e9f97bfd0df",
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions packages/plexus-core/src/collection/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './collection'
export * from './data'
export * from './group'
export * from './selector'
3 changes: 3 additions & 0 deletions packages/plexus-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/// <reference lib="dom" />
/// <reference lib="dom.iterable" />

import { instance, PlexusInstance, batch } from './instance/instance'
import { PlexusPlugin, Plugin, createPlexusPlugin } from './plugin'
import { PlexusScopeConfig } from './scope'
Expand Down
4 changes: 4 additions & 0 deletions packages/plexus-core/src/instance/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './instance'
export * from './controller'
export * from './instance'
export * from './runtime'
2 changes: 2 additions & 0 deletions packages/plexus-core/src/scheduler/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './scheduler'
export * from './task'
2 changes: 1 addition & 1 deletion packages/plexus-core/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type PlexusState = <Value = any>(
export interface StateStore {
_name: string
_persist: boolean
_interval: NodeJS.Timer | null
_interval: Timer | null
_ready: boolean
_isSetting: boolean
}
Expand Down
5 changes: 4 additions & 1 deletion packages/plexus-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"extends": "../tsconfig.shared.json",
"compilerOptions": {
"lib": ["dom"],
"types": ["bun-types"],
"rootDir": "./src",
"outDir": "./dist"
"outDir": "./dist/src",
"emitDeclarationOnly": true
},
"include": ["./src/**/*"]
}
Loading

0 comments on commit 9548897

Please sign in to comment.