diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 3a96a21..0c201e5 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -5,7 +5,6 @@ on: branches: - main pull_request: - permissions: actions: read contents: read @@ -22,21 +21,16 @@ jobs: with: version: 9 - # This enables task distribution via Nx Cloud - # Run this command as early as possible, before dependencies are installed - # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun - - run: pnpm dlx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build" - # Cache node_modules - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - - run: pnpm install --frozen-lockfile + - run: pnpm install --no-frozen-lockfile - uses: nrwl/nx-set-shas@v4 # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud # - run: pnpm exec nx-cloud record -- echo Hello World # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected - - run: pnpm exec nx affected -t build && pnpm build + - run: pnpx nx affected -t build && pnpm build diff --git a/eslint.config.mjs b/eslint.config.mjs index 00e4284..2a7fd5d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -20,7 +20,8 @@ export default [ '**/.nx', '**/pnpm-*.yaml', '**/node_modules', - '**/dist' + '**/dist', + '**/*.html' ] }, { diff --git a/nx.json b/nx.json index ec1cfd3..d45d4f7 100644 --- a/nx.json +++ b/nx.json @@ -29,6 +29,5 @@ "sharedGlobals" ] }, - "nxCloudId": "681f1bf43845db51336764b6", - "nxCloudAccessToken": "OWM0ZThhYWItODQwYS00ZjgzLWJhMWMtODYyOTgzMDVjMmZhfHJlYWQtd3JpdGU=" + "nxCloudId": "681f1bf43845db51336764b6" } \ No newline at end of file diff --git a/package.json b/package.json index 28699c8..b98ff7b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "type": "git", "url": "https://github.com/ArcStackLab/webapis.git" }, - "packageManager": "pnpm@9.2.0", + "packageManager": "pnpm@9", "description": "A Comprehensive Integration of All Web Standard APIs", "scripts": { "build": "tsup", @@ -52,8 +52,11 @@ "esbuild": "^0.23.1", "eslint": "^9.9.1", "globals": "^15.9.0", + "gulp": "^5.0.0", + "gulp-cli": "^3.0.0", "husky": "^9.1.5", "lint-staged": "^15.2.10", + "netlify-cli": "^21.4.2", "nx": "19.8.0", "prettier": "^3.3.3", "tslib": "^2.7.0", diff --git a/packages/permissions/demo/index.js b/packages/permissions/demo/index.js index 447a4e9..1ca14a8 100644 --- a/packages/permissions/demo/index.js +++ b/packages/permissions/demo/index.js @@ -19,7 +19,7 @@ function createOptionTag(value) { } /** - * @type {ReturnType} + * @type {ReturnType} */ let permissionHandler const closeButton = document.querySelector('#close') @@ -49,7 +49,7 @@ const stateColor = { } function handlePermission(option) { - permissionHandler = PermissionsAPI.getPermissionHandler(option, { + permissionHandler = getPermissionHandler(option, { granted: (permission) => { console.log('Permission Granted:', permission) state.replaceChildren( diff --git a/packages/permissions/src/PermissionsAPI.ts b/packages/permissions/src/PermissionsAPI.ts index e1c1e46..c80e787 100644 --- a/packages/permissions/src/PermissionsAPI.ts +++ b/packages/permissions/src/PermissionsAPI.ts @@ -202,6 +202,8 @@ export class PermissionsAPI { getPermission: () => { const _events = PermissionsAPI.#events.get(_handler) + if (!_events || _handler === null) throw new Error('Cannot get permission: handler has been closed') + PermissionsAPI.getPermission(permissionOption).then( ({ error, permission }) => { if (error) { diff --git a/packages/permissions/src/types.ts b/packages/permissions/src/types.ts index 5e4803d..1ae0b8f 100644 --- a/packages/permissions/src/types.ts +++ b/packages/permissions/src/types.ts @@ -150,6 +150,7 @@ export type PermissionHandler = { /** * Executes the permission request. * @returns {T} - The result of the permission request. + * @throws {Error} - Throws if handler is already closed */ getPermission: () => T