Skip to content

Commit

Permalink
Merge pull request #9 from joeyfigaro/typescript-support
Browse files Browse the repository at this point in the history
#8 – initial TS support + release workflow
  • Loading branch information
acamposuribe authored Dec 13, 2023
2 parents c851a26 + 4d02f15 commit 2cb78de
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'Create Release'

on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build_typings:
name: generate declarations
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@main

- uses: actions/setup-node@v4
name: setup node
id: cache

- name: install dependencies
run: npm install

- name: create declarations
continue-on-error: false
run: npm run build:types

# publish:
# name: publish new release
# runs-on: ubuntu-latest
# needs: typecheck
# steps:
# - uses: actions/checkout@main

# - uses: actions/setup-node@v4
# name: setup node
# id: cache

# - name: install dependencies
# run: npm install

# - name: publish to npm
# run: npm publish
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
50 changes: 50 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@
"description": "Unlock custom brushes, natural fill effects and intuitive hatching in p5.js",
"main": "p5.brush.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build:types": "tsc --project tsconfig.build.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/acamposuribe/p5.brush.git"
},
"typings": "dist/p5.brush.d.ts",
"exports": {
".": {
"import": "./p5.brush.js",
"require": "./p5.brush.js",
"types": "./dist/p5.brush.d.ts"
},
"./minified": "./p5.brush.min.js"
},
"keywords": [
"brush",
"children",
Expand All @@ -26,5 +36,9 @@
"bugs": {
"url": "https://github.com/acamposuribe/p5.brush/issues"
},
"homepage": "https://p5-brush.cargo.site/"
"homepage": "https://p5-brush.cargo.site/",
"devDependencies": {
"@types/p5": "^1.7.3",
"typescript": "^5.3.2"
}
}
11 changes: 11 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"allowJs": true,
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"types": ["p5"]
},
"files": ["p5.brush.js"],
}

0 comments on commit 2cb78de

Please sign in to comment.