Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use yarn #1

Merged
merged 5 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
name: 'Build - Test - [Publish]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
node-version: '16.13'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- run: yarn --frozen-lockfile
- run: yarn build
- run: yarn test
version: 8.x
run_install: false

- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- run: pnpm run setup

- run: pnpm build

- run: pnpm test

- run: cp README.md packages/vanilla-hcaptcha

- name: 'Publish'
if: contains('refs/heads/master', github.ref)
run: lerna publish -y from-package
run: pnpm --filter=@hcaptcha/vanilla-hcaptcha publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20.9
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
MIT License

Copyright (c) 2024 hCaptcha

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
Expand Down
43 changes: 33 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,51 @@
A Vanilla Web Component wrapper for [hCaptcha](https://docs.hcaptcha.com/).
It allows for easy integration with hCaptcha in many modern web frameworks.

<img width="300px" src="https://assets-global.website-files.com/5c73e7ea3f8bb2a85d2781db/5c73e7ea3f8bb23b4c278261_hcaptcha-logo-landscape.svg" alt="hCaptcha logo" title="hCaptcha logo" />
<img width="300px" src="https://www.hcaptcha.com/hosted-assets/3u1Osx9BvMjYSHbCn6ECWNM27toZY1eqxXveJVL4mMNGUtMZu2Yc6GAid43jA_TmZApJ6djyh0iqvu-YNhOB9hGmvfdy4M_Fr1Y61EZQ-j1oIjD1MF0k1dN99xXVRKV0EpBi03o3AMgo_p4Lk3A49jwtvuitT9AAAAAAAAAAAAAAAAA/64da82f6bf67de1b12789030/64da82f6bf67de1b1278903b_Asset%208.svg" alt="hCaptcha logo" title="hCaptcha logo" />

**0** dependencies. **<1kb** gzipped. Integrates well with Vue.JS, React, Preact, Angular, etc.

[Install](#install) | [Usage](#usage) | [Attributes](#attributes) | [Events](#events) | [Methods](#methods)
[Install](#install)
| [Browser Compatibility](#browser-compatibility)
| [Usage](#usage)
| [Attributes](#attributes)
| [Events](#events)
| [Methods](#methods)

## Install

Use your favorite package manager:
```bash
yarn add vanilla-hcaptcha
yarn add @hcaptcha/vanilla-hcaptcha
```

```bash
npm install vanilla-hcaptcha
pnpm add @hcaptcha/vanilla-hcaptcha
```

```bash
npm install @hcaptcha/vanilla-hcaptcha
```

Or via cdn:
```html
<script src="https://cdn.jsdelivr.net/npm/vanilla-hcaptcha"></script>
<script src="https://cdn.jsdelivr.net/npm/@hcaptcha/vanilla-hcaptcha"></script>
```

## Browser Compatibility

hCaptcha web component is using es6 syntax and window property [customElements](https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements).

| Browser | Min Version |
|-----------------|-------------|
| Chrome | 54 |
| Edge | 79 |
| Firefox | 63 |
| Opera | 41 |
| Safari | 10.1 |
| Chrome Android | 54 |
| Firefox Android | 63 |

## Usage

Being a vanilla web component, it is relatively [easy](https://custom-elements-everywhere.com) to integrate in
Expand Down Expand Up @@ -126,7 +149,7 @@ mainstream web frameworks such as: React, Preact, Vue.js, Angular, Stencil.js, e
<html ng-app="angularjsApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanilla-hcaptcha"></script>
<script src="https://cdn.jsdelivr.net/npm/@hcaptcha/vanilla-hcaptcha"></script>

<script>
angular.module('angularjsApp', [])
Expand Down Expand Up @@ -160,7 +183,7 @@ mainstream web frameworks such as: React, Preact, Vue.js, Angular, Stencil.js, e

```html

<script src="https://cdn.jsdelivr.net/npm/vanilla-hcaptcha"></script>
<script src="https://cdn.jsdelivr.net/npm/@hcaptcha/vanilla-hcaptcha"></script>

<h-captcha id="signupCaptcha"
site-key="781559eb-513a-4bae-8d29-d4af340e3624"
Expand Down Expand Up @@ -241,11 +264,11 @@ The following methods allow for programmatic control, necessary only in case of

## Commands

* `yarn build`
* `pnpm build`
> Build a production version of the component.

* `yarn dev`
* `pnpm dev`
> Build dev version with hot reload.

* `yarn test`
* `pnpm test`
> Runs unit tests.
2 changes: 1 addition & 1 deletion examples/cdn/angularjs.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Demo hCaptcha Web Component - Angular</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>

<!-- <script src="https://cdn.jsdelivr.net/npm/vanilla-hcaptcha" async defer></script>-->
<!-- <script src="https://cdn.jsdelivr.net/npm/@hcaptcha/vanilla-hcaptcha" async defer></script>-->
<script src="/node_modules/vanilla-hcaptcha/dist/index.min.js"></script>

<script>
Expand Down
2 changes: 1 addition & 1 deletion examples/cdn/vanilla.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<div>Open the console!</div>

<!-- <script src="https://cdn.jsdelivr.net/npm/vanilla-hcaptcha" async defer></script>-->
<!-- <script src="https://cdn.jsdelivr.net/npm/@hcaptcha/vanilla-hcaptcha" async defer></script>-->
<script src="/node_modules/vanilla-hcaptcha/dist/index.min.js"></script>

<h-captcha id="signupCaptcha"
Expand Down
2 changes: 1 addition & 1 deletion examples/cdn/vue.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Demo hCaptcha Web Component - Vue 2</title>
<script src="https://unpkg.com/[email protected]"></script>

<!-- <script src="https://cdn.jsdelivr.net/npm/vanilla-hcaptcha"></script>-->
<!-- <script src="https://cdn.jsdelivr.net/npm/@hcaptcha/vanilla-hcaptcha"></script>-->
<script src="/node_modules/vanilla-hcaptcha/dist/index.min.js"></script>
</head>
<body>
Expand Down
10 changes: 0 additions & 10 deletions lerna.json

This file was deleted.

20 changes: 7 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,20 @@
"name": "vanilla-hcaptcha",
"description": "Vanilla Web Component for hCaptcha. 0 dependencies. <1kb gzipped.",
"version": "1.0.2",
"workspaces": {
"packages": [
"packages/*",
"examples/*"
],
"nohoist": [ "**/vanilla-hcaptcha" ]
},
"author": {
"name": "Sergiu Danalachi <danalachi.sergiu@gmail.com>",
"url": "https://github.com/DSergiu"
"name": "hCaptcha <support@hcaptcha.com>",
"url": "https://www.hcaptcha.com"
},
"packageManager": "[email protected]",
"private": true,
"license": "MIT",
"scripts": {
"dev": "lerna run dev --stream",
"build": "lerna run build --stream",
"test": "lerna run test --stream"
"setup": "pnpm install --frozen-lockfile --prefer-offline",
"dev": "pnpm -r --stream run dev",
"build": "pnpm -r --stream run build",
"test": "pnpm --r -stream run test"
},
"devDependencies": {
"lerna": "^4.0.0",
"serve": "^13.0.2"
}
}
21 changes: 14 additions & 7 deletions packages/vanilla-hcaptcha/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
{
"name": "vanilla-hcaptcha",
"name": "@hcaptcha/vanilla-hcaptcha",
"description": "Vanilla Web Component for hCaptcha. 0 dependencies. <1kb gzipped.",
"version": "1.0.2",
"main": "dist/index.min.js",
"types": "dist/hcaptcha.d.ts",
"author": {
"name": "Sergiu Danalachi <[email protected]>",
"url": "https://github.com/DSergiu"
"author": "hCaptcha team and contributors",
"homepage": "https://github.com/hCaptcha/vanilla-hcaptcha",
"organization": "hCaptcha",
"license": "MIT",
"private": false,
"publishConfig": {
"registry":"https://registry.npmjs.org",
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/hCaptcha/vanilla-hcaptcha.git",
"web": "https://github.com/hCaptcha/vanilla-hcaptcha"
},
"files": [
"dist",
"src",
"demo.html"
],
"homepage": "https://github.com/DSergiu/vanilla-hcaptcha",
"private": false,
"license": "MIT",
"scripts": {
"dev": "rollup -c -w",
"build": "rollup -c",
Expand Down
Loading