Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Baseline tools #10

Merged
merged 16 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "jxnl/instructor-js" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"ignore": [],
"privatePackages": {
"version": true,
"tag": false
}
}
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
$schema: "https://json.schemastore.org/eslintrc",
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
extends: ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
rules: {
"prettier/prettier": "error",
"linebreak-style": "off",
"semi": "off",
"indent": "off",
"@typescript-eslint/semi": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
]
}
}
56 changes: 56 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish changesets

on:
pull_request:
types:
- closed

concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions: {} #reset
jobs:
publish:
if: github.repository == 'jxnl/instructor-js' && github.event.pull_request.merged == true && (startsWith(github.head_ref, 'changeset-release/main') || startsWith(github.head_ref, '_publish-trigger'))
permissions:
contents: write
pull-requests: write

name: Publish packages
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.9.0

- name: Install Dependencies
run: bun i

- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish packages & create release
id: changesets
uses: changesets/action@v1
with:
publish: bun publish-packages
createGithubReleases: true

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
53 changes: 53 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Create changeset release PR

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions: {} #reset
env:
CI: true

jobs:
release:
if: github.repository == 'jxnl/instructor-js'
permissions:
contents: write
pull-requests: write

name: Changeset Release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.9.0

- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Setup npmrc
run: echo "//npm.pkg.github.com/:_authToken=$NPM_TOKEN" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install Dependencies
run: bun i

- name: Create version PR
uses: changesets/action@v1
with:
version: bun run version-packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: test-wf
on: [push]

jobs:

test:
name: run-tests
runs-on: ubuntu-latest
environment: OPENAI
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.9.0

- name: Install Dependencies
run: bun i

- run: bun run type-check
- run: bun run lint

- run: bun test
92 changes: 90 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,91 @@
node_modules/
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
.next/
out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env
dist/
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
.turbo

node_modules
.pnp
.pnp.js

# testing
coverage

# next.js
.next/
out/
build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# turbo
.turbo

# vercel
.vercel

dist

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# vim
*.sw*

# env
.env*.local
.envrc


tsconfig.tsbuildinfo

29 changes: 26 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
/node_modules
node_modules
.next
build
dist
*.tsbuildinfo
*.gitignore
*.svg
*.lock
*.npmignore
*.sql
*.png
*.jpg
*.jpeg
*.gif
*.ico
*.sh
Dockerfile
Dockerfile.*
.env
.env.*
LICENSE
*.log
.DS_Store
.dockerignore
*.patch
*.toml

# don't format tsc output, will break source maps
/dist
28 changes: 28 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"endOfLine": "lf",
"semi": false,
"trailingComma": "none",
"arrowParens": "avoid",
"singleQuote": false,
"tabWidth": 2,
"importOrder": [
"^(react/(.*)$)|^(react$)",
"^(next/(.*)$)|^(next$)",
"<THIRD_PARTY_MODULES>",
"",
"^types$",
"^@/types/(.*)$",
"^@/config/(.*)$",
"^@/constants/(.*)$",
"^@/lib/(.*)$",
"",
"^[./]"
],
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"],
"plugins": [
"@ianvs/prettier-plugin-sort-imports"
],
"printWidth": 100,
"proseWrap": "never",
"quoteProps": "consistent"
}
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodejs 20.9.0
bun 1.0.15
Loading