From b468ac3c3df0cc1e4e99533747ecc0db22117b5b Mon Sep 17 00:00:00 2001 From: Joey Figaro Date: Tue, 21 Nov 2023 21:12:06 -0500 Subject: [PATCH 1/5] feat: add initial workflow for releases --- .github/workflows/release.yml | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ac4daf2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,72 @@ +name: 'Create Release' + +on: + # workflow_dispatch: + # inputs: + # generate-coverage: + # default: true + # description: Include Coverage Report + # type: boolean + push: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + files_changed: + name: Check changes + runs-on: ubuntu-latest + outputs: + source: ${{ steps.filter.outputs.changes }} + steps: + - uses: actions/checkout@main + with: + fetch-depth: 0 + + - uses: dorny/paths-filter@v2 + id: filter + with: + base: main + token: ${{ github.token }} + filters: | + - 'p5.brush.js' + + typecheck: + name: generate Typescript assets + runs-on: ubuntu-latest + needs: files_changed + if: needs.files_changed.outputs.source == 'true' + + steps: + - uses: actions/checkout@main + + - uses: actions/setup-node@v4 + name: setup node + id: cache + + - name: install dependencies + run: npm install + + - name: create declarations + if: needs.files_changed.outputs.source == 'true' + 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 \ No newline at end of file From 939d04c41005b469579def34f37934f5a05666ec Mon Sep 17 00:00:00 2001 From: Joey Figaro Date: Tue, 21 Nov 2023 21:13:04 -0500 Subject: [PATCH 2/5] feat: add required dependencies --- package-lock.json | 50 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 9 +++++++-- 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..4232995 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,50 @@ +{ + "name": "p5.brush", + "version": "0.0.1-beta", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "p5.brush", + "version": "0.0.1-beta", + "license": "MIT", + "devDependencies": { + "@types/p5": "^1.7.3", + "typescript": "^5.3.2" + } + }, + "node_modules/@types/p5": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@types/p5/-/p5-1.7.3.tgz", + "integrity": "sha512-sYeos5Zbb5dx4jp5uDnZDtW3St6+9RtLCi7n2Rl6Ok2a5ofRIWDbXEigl++ppqgAyB20S8czlrrrmzLS1AwJPA==", + "dev": true + }, + "node_modules/typescript": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", + "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + }, + "dependencies": { + "@types/p5": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@types/p5/-/p5-1.7.3.tgz", + "integrity": "sha512-sYeos5Zbb5dx4jp5uDnZDtW3St6+9RtLCi7n2Rl6Ok2a5ofRIWDbXEigl++ppqgAyB20S8czlrrrmzLS1AwJPA==", + "dev": true + }, + "typescript": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", + "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", + "dev": true + } + } +} diff --git a/package.json b/package.json index c8e7abb..848490f 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "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", @@ -26,5 +27,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" + } } From 765f306451f86e9fc63c3296ca101fb4e2b58502 Mon Sep 17 00:00:00 2001 From: Joey Figaro Date: Tue, 21 Nov 2023 21:30:00 -0500 Subject: [PATCH 3/5] feat: create .gitignore; add dist folder to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7773828 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist/ \ No newline at end of file From 842effb56d880bafa1c95e556e6c72daef77c42d Mon Sep 17 00:00:00 2001 From: Joey Figaro Date: Tue, 21 Nov 2023 21:30:31 -0500 Subject: [PATCH 4/5] chore: add initial exports + typings to manifest; update tsconfig output --- package.json | 9 +++++++++ tsconfig.build.json | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tsconfig.build.json diff --git a/package.json b/package.json index 848490f..7ef4cec 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,15 @@ "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", diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..a51edbc --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "allowJs": true, + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "dist", + "types": ["p5"] + }, + "files": ["p5.brush.js"], +} \ No newline at end of file From 4d02f158c5643cd31a8f1487c7b7e2c39096bedf Mon Sep 17 00:00:00 2001 From: Joey Figaro Date: Tue, 21 Nov 2023 21:34:56 -0500 Subject: [PATCH 5/5] chore: release workflow cleanup --- .github/workflows/release.yml | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ac4daf2..d47069d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,6 @@ name: 'Create Release' on: - # workflow_dispatch: - # inputs: - # generate-coverage: - # default: true - # description: Include Coverage Report - # type: boolean push: branches: [main] @@ -14,30 +8,10 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true -jobs: - files_changed: - name: Check changes +jobs: + build_typings: + name: generate declarations runs-on: ubuntu-latest - outputs: - source: ${{ steps.filter.outputs.changes }} - steps: - - uses: actions/checkout@main - with: - fetch-depth: 0 - - - uses: dorny/paths-filter@v2 - id: filter - with: - base: main - token: ${{ github.token }} - filters: | - - 'p5.brush.js' - - typecheck: - name: generate Typescript assets - runs-on: ubuntu-latest - needs: files_changed - if: needs.files_changed.outputs.source == 'true' steps: - uses: actions/checkout@main @@ -50,7 +24,6 @@ jobs: run: npm install - name: create declarations - if: needs.files_changed.outputs.source == 'true' continue-on-error: false run: npm run build:types