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

Move to new scaffold #27

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"image": "mcr.microsoft.com/devcontainers/typescript-node",
"remoteUser": "node",
"updateContentCommand": "npm clean-install && npm run build"
}
10 changes: 10 additions & 0 deletions .eslintrc.jest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
env:
commonjs: true
es2021: true
es2022: true
jest: true
rules:
# Disable for convenience
react/display-name: off
# Disable for convenience
react/prop-types: off
10 changes: 10 additions & 0 deletions .eslintrc.react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends:
- plugin:react/recommended
- plugin:react/jsx-runtime
plugins:
- react
# rules:
# react/react-in-jsx-scope: off
settings:
react:
version: 18.3.1
12 changes: 12 additions & 0 deletions .eslintrc.typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends:
- plugin:@typescript-eslint/recommended
parser: '@typescript-eslint/parser'
plugins:
- '@typescript-eslint'
rules:
'@typescript-eslint/no-unused-vars':
- error
- argsIgnorePattern: ^_
caughtErrorsIgnorePattern: ^_
destructuredArrayIgnorePattern: ^_
varsIgnorePattern: ^_
44 changes: 44 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
env:
browser: true
extends:
- eslint:recommended
overrides:
- extends: .eslintrc.react.yml
files:
- '**/*.jsx'
- '**/*.tsx'
- extends: .eslintrc.typescript.yml
files:
- '**/*.mts'
- '**/*.ts'
- '**/*.tsx'
- extends: .eslintrc.jest.yml
files:
- '**/__tests__/**'
- '**/*.spec.cjs'
- '**/*.spec.mjs'
- '**/*.spec.js'
- '**/*.spec.jsx'
- '**/*.spec.cts'
- '**/*.spec.mts'
- '**/*.spec.ts'
- '**/*.spec.tsx'
- '**/*.test.cjs'
- '**/*.test.mjs'
- '**/*.test.js'
- '**/*.test.jsx'
- '**/*.test.cts'
- '**/*.test.mts'
- '**/*.test.ts'
- '**/*.test.tsx'
parserOptions:
ecmaVersion: latest
sourceType: module
plugins:
- prettier
root: true
rules:
prettier/prettier: error
no-empty:
- error
- allowEmptyCatch: true
113 changes: 113 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Bug report
description: Use this template to report a bug.
labels:
- bug
body:
- type: markdown
attributes:
value: |
We run this project out of our spare time and may not monitor this repository every day. Our support capacity is very limited.

Developers in professional capacity will receive prioritized support.
- type: dropdown
attributes:
label: Version
description: |
Please verify the issue on latest versions. Support on non-latest version is minimal and on a per case basis.

If you are using latest production, please verify against our latest development version as the issue could have been resolved recently. To install latest development version, run `npm install event-as-promise@main`.

multiple: true
options:
- Latest production (@latest)
- Latest development (@main)
- Not latest
validations:
required: true
- type: dropdown
attributes:
label: Module resolution
description: Please describe how you import our package.
multiple: true
options:
- 'ESM: import { EventAsPromise } from "event-as-promise"'
- 'CommonJS: require("event-as-promise")'
- Others or unrelated
validations:
required: true
- type: dropdown
attributes:
label: Bundler
description: For apps, please tell us what bundler is used to create your app bundle.
multiple: true
options:
- 'Webpack: Plain'
- 'Webpack: Complex'
- ESBuild
- 'create-react-app'
- Not an app
- Others or unrelated
validations:
required: true
- type: dropdown
attributes:
label: Environment
description: |
We support [Browserslist "defaults"](https://github.com/browserslist/browserslist#full-list) and [Internet Explorer mode](https://aka.ms/iemode). Support of other environments is minimal.

When using in a sandboxed environment (e.g. SharePoint, Salesforce, etc.), please verify the issue outside of the sandbox. If the issue is related to the sandbox, please file it to your sandbox vendor.
multiple: true
options:
- '> 0.5%, last 2 versions, Firefox ESR, not dead'
- Internet Explorer mode
- Server-side rendering
- Others or unrelated
validations:
required: true
- type: textarea
attributes:
label: Test case
description: |
Please write a minimal test case which fail the scenario with comments in [BDD format (given/when/then)](https://www.thoughtworks.com/insights/blog/applying-bdd-acceptance-criteria-user-stories).

To protect from regressions, once the issue is resolved, your test case will be added to [our test suite](../tree/main/packages/integration-test/).

For your convenience, a basic test case is provided below. For advanced scenarios, please look at [our test suite](../tree/main/packages/integration-test/).

*Support will be slow or denied if a test case is not provided.*
render: js
value: |
import { expect, test } from '@jest/globals';

test('simple scenario', async () => {
const target = new EventTarget();
const eventAsPromise = new EventAsPromise();

target.addEventListener('count', eventAsPromise.eventListener);

const promise = eventAsPromise.one();

target.dispatchEvent(new CustomEvent('count', { detail: 'one' }));

await expect(promise).resolves.toEqual(expect.objectContaining({ detail: 'one' }));
});

- type: input
attributes:
label: Coding sandbox URL
description: |
If you have a minimal repro in a coding sandbox, please provide a URL here. Please prepare it from scratch. We cannot work directly on your app source code.
placeholder: 'https://'
- type: textarea
attributes:
label: Console errors
description: Please copy any related errors printed to the console here.
render: js
- type: textarea
attributes:
label: Screenshots
description: Please remove or obscure any personally identifiable information from your screenshots or recordings.
- type: textarea
attributes:
label: Additional context
description: If any of the answers is "others or unrelated", please explain it here.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Changelog

> Please copy and paste new entries from `CHANGELOG.md` here.

## Specific changes

> Please list each individual specific change in this pull request.

-
14 changes: 14 additions & 0 deletions .github/workflows/bump-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Bump dependencies

on:
workflow_dispatch: {}

jobs:
call-workflow:
permissions:
contents: write
id-token: write
secrets: inherit
uses: compulim/workflows/.github/workflows/bump-dependencies.yml@main
with:
package-name: event-as-promise
29 changes: 29 additions & 0 deletions .github/workflows/bump-scaffold.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Bump scaffold

on:
workflow_dispatch:
inputs:
package-name:
default: event-as-promise
description: Name of the package
required: true
type: string
use-react:
default: false
description: Use React
required: true
type: boolean
skip-integration-test:
default: false
description: Skip integration test
required: true
type: boolean

jobs:
call-workflow:
secrets: inherit
uses: compulim/workflows/.github/workflows/bump-scaffold.yml@main
with:
package-name: ${{ inputs.package-name }}
skip-integration-test: ${{ inputs.skip-integration-test }}
use-react: ${{ inputs.use-react }}
21 changes: 21 additions & 0 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Continuous deployment

on:
push:
branches: [main]
paths-ignore:
- '.devcontainer/**'
- '.github/**'
workflow_dispatch: {}

jobs:
call-workflow:
permissions:
attestations: write
contents: write
id-token: write
pages: write
secrets: inherit
uses: compulim/workflows/.github/workflows/continuous-deployment.yml@main
with:
package-name: event-as-promise
10 changes: 10 additions & 0 deletions .github/workflows/list-outdated-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: List outdated dependencies

on:
schedule:
- cron: '0 4 * * 1'
workflow_dispatch: {}

jobs:
call-workflow:
uses: compulim/workflows/.github/workflows/list-outdated-dependencies.yml@main
95 changes: 0 additions & 95 deletions .github/workflows/node.js.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Prepare release

on:
workflow_dispatch: {}

jobs:
call-workflow:
permissions:
contents: write
id-token: write
secrets: inherit
uses: compulim/workflows/.github/workflows/prepare-release.yml@main
Loading