diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d47069d --- /dev/null +++ b/.github/workflows/release.yml @@ -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 \ No newline at end of file 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 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..7ef4cec 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" + } } 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