diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9907c36..e1ad601f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,12 +48,19 @@ jobs: package: artifacts/algo-ts/package.json access: 'public' - - name: Update puya-ts' peer dependency on algo-ts - run: npx tsx ../../scripts/update-algo-ts-peer-dep.ts ${{ steps.publish-algo-ts.outputs.version }} + - name: Install @algorandfoundation/puya-ts dependencies and patch for bundling + run: npm i --include=prod && npx patch-package --patch-dir ../../patches working-directory: artifacts/puya-ts - - name: Publish @algorandfoundation/puya-ts + - name: Generate semantic version for @algorandfoundation/puya-ts run: npx semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish @algorandfoundation/puya-ts + uses: JS-DevTools/npm-publish@v3 + id: publish-puya-ts + with: + token: ${{ secrets.NPM_TOKEN }} + package: artifacts/puya-ts/package.json + access: 'public' diff --git a/.releaserc.json b/.releaserc.json index b873a2f5..89287d75 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -55,6 +55,7 @@ [ "@semantic-release/npm", { + "npmPublish": false, "pkgRoot": "artifacts/puya-ts" } ], diff --git a/.tstoolkitrc.ts b/.tstoolkitrc.ts index b12bbb35..e005bd74 100644 --- a/.tstoolkitrc.ts +++ b/.tstoolkitrc.ts @@ -14,6 +14,7 @@ const config: TsToolkitConfig = { 'puya-ts': 'bin/run-cli.ts', puyats: 'bin/run-cli.ts', }, + customSections: ['bundledDependencies'], }, } export default config diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..432ed88d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Algorand Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/package-lock.json b/package-lock.json index 3ffe700e..2ec722db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,9 @@ "": { "name": "@algorandfoundation/puya-ts", "version": "1.0.0", + "bundleDependencies": [ + "typescript" + ], "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -16,6 +19,8 @@ "cross-spawn": "^7.0.3", "glob": "^11.0.0", "polytype": "^0.17.0", + "typescript": "^5.6.2", + "upath": "^2.0.1", "zod": "^3.23.8" }, "devDependencies": { @@ -47,11 +52,7 @@ "rollup": "^4.22.4", "semantic-release": "^24.1.1", "tsx": "4.19.1", - "typescript": "^5.6.2", "vitest": "2.1.1" - }, - "peerDependencies": { - "@algorandfoundation/algorand-typescript": "0.0.1-alpha.1" } }, "../algorand-typescript-testing/dist": { @@ -11913,7 +11914,7 @@ "version": "5.6.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", - "dev": true, + "inBundle": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -12026,6 +12027,16 @@ "node": ">=8" } }, + "node_modules/upath": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/upath/-/upath-2.0.1.tgz", + "integrity": "sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w==", + "license": "MIT", + "engines": { + "node": ">=4", + "yarn": "*" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index 7182f45d..31398df8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@algorandfoundation/puya-ts", "version": "1.0.0", - "description": "", + "description": "Compiles Algorand TypeScript into byte code which runs on the Algorand Virtual Machine (AVM)", "private": false, "types": "src/index.ts", "scripts": { @@ -10,7 +10,7 @@ "dev:auction": "tsx src/cli.ts build examples/auction --dry-run", "dev:voting": "tsx src/cli.ts build examples/voting/contract.algo.ts --output-awst --output-awst-json", "dev:hello": "tsx src/cli.ts build examples/hello-world/contract.algo.ts --output-awst --output-awst-json", - "dev:hello-abi": "tsx src/cli.ts build examples/hello-world-abi/contract.algo.ts", + "dev:hello-abi": "tsx src/cli.ts build examples/hello-world-abi", "dev:calculator": "tsx src/cli.ts build examples/calculator/contract.algo.ts", "dev:tealscript": "tsx src/cli.ts build examples/tealscript/example.algo.ts", "dev:approvals": "tsx src/cli.ts build tests/approvals --output-awst --output-awst-json --dry-run", @@ -44,7 +44,7 @@ "script:op-metadata": "tsx ./scripts/generate-op-metadata.ts src/awst_build/op-metadata.ts && eslint src/awst_build/op-metadata.ts --fix", "script:op-ptypes": "tsx ./scripts/generate-op-ptypes.ts src/awst_build/ptypes/op-ptypes.ts && eslint src/awst_build/ptypes/op-ptypes.ts --fix" }, - "author": "", + "author": "Algorand foundation", "license": "MIT", "devDependencies": { "@algorandfoundation/algorand-typescript": "file:packages/algo-ts/dist", @@ -75,7 +75,6 @@ "rollup": "^4.22.4", "semantic-release": "^24.1.1", "tsx": "4.19.1", - "typescript": "^5.6.2", "vitest": "2.1.1" }, "dependencies": { @@ -85,9 +84,10 @@ "cross-spawn": "^7.0.3", "glob": "^11.0.0", "polytype": "^0.17.0", + "typescript": "^5.6.2", "zod": "^3.23.8" }, - "peerDependencies": { - "@algorandfoundation/algorand-typescript": "0.0.1-alpha.1" - } + "bundledDependencies": [ + "typescript" + ] } diff --git a/packages/algo-ts/package.json b/packages/algo-ts/package.json index e0c6cb21..e96f73fe 100644 --- a/packages/algo-ts/package.json +++ b/packages/algo-ts/package.json @@ -1,7 +1,7 @@ { "name": "@algorandfoundation/algorand-typescript", - "version": "0.0.1-alpha.1", - "description": "", + "version": "0.0.1-alpha.2", + "description": "This package contains definitions for the types which comprise Algorand TypeScript which can be compiled to run on the Algorand Virtual Machine using the Puya compiler.", "private": false, "main": "index.js", "types": "src/index.ts", diff --git a/scripts/update-algo-ts-peer-dep.ts b/scripts/update-algo-ts-peer-dep.ts deleted file mode 100644 index 129042e8..00000000 --- a/scripts/update-algo-ts-peer-dep.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* eslint-disable no-console */ -import fs from 'fs' - -const AlgoTsPackageName = '@algorandfoundation/algorand-typescript' -const newVersion = process.argv[2] - -const SemVersionReg = /^\d+\.\d+\.\d+(-((beta)|(alpha))(\.\d+)?)?$/ - -if (!SemVersionReg.test(newVersion)) { - console.error(`Arg 2 of '${newVersion}' should be an npm compatible semantic version number`) - process.exit(1) -} - -if (!fs.existsSync('package.json')) { - console.error('No package.json file could be found in the current working directory') - process.exit(2) -} - -console.info('Loading package.json file') -const pkgJsonText = fs.readFileSync('package.json', 'utf-8') -const pkgJsonObj = JSON.parse(pkgJsonText) - -if (!pkgJsonObj['peerDependencies']) { - pkgJsonObj['peerDependencies'] = {} -} -console.info(`Setting peer dependency on ${AlgoTsPackageName} to ${newVersion}`) -pkgJsonObj['peerDependencies'][AlgoTsPackageName] = newVersion - -fs.writeFileSync('package.json', JSON.stringify(pkgJsonObj, undefined, 2)) -console.info('Writing updated package.json')