Skip to content

Commit

Permalink
feat(api): convert whole package API to TypeScript
Browse files Browse the repository at this point in the history
    BREAKING CHANGE: All helpers are now written in TypeScript.

    Flow types are no longer available, and TypeScript types are built-in.
  • Loading branch information
thibaudcolas committed Jun 13, 2022
1 parent fd0122d commit 3fca3fa
Show file tree
Hide file tree
Showing 49 changed files with 12,468 additions and 10,594 deletions.
25 changes: 0 additions & 25 deletions .flowconfig

This file was deleted.

5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: "❓ Question"
url: https://github.com/thibaudcolas/draftjs-conductor/discussions
about: Use GitHub Discussions to get help with this project.
22 changes: 0 additions & 22 deletions .github/ISSUE_TEMPLATE/question.md

This file was deleted.

32 changes: 19 additions & 13 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@
extends: ["config:base"],
// https://renovatebot.com/docs/configuration-options/#commitbodytable
commitBodyTable: true,
// https://docs.renovatebot.com/configuration-options/#dependencydashboard
dependencyDashboard: false,
// https://renovatebot.com/docs/configuration-options/#ignoredeps
ignoreDeps: [
"immutable",
"@types/draft-js",
"draft-js",
"draft-js-10",
"normalize.css",
"flow-bin",
"@types/react",
"@types/react-dom",
"react",
"react-dom",
"react-test-renderer",
"jamesives/github-pages-deploy-action",
],
// https://renovatebot.com/docs/configuration-options/#labels
labels: ["enhancement"],
Expand All @@ -23,11 +28,13 @@
// https://docs.renovatebot.com/configuration-options/#commitmessagetopic
commitMessageTopic: "{{depName}}",
// https://renovatebot.com/docs/configuration-options/#prbodycolumns
prBodyColumns: ["Package", "Update", "Type", "Change", "Sourcegraph"],
prBodyColumns: ["Package", "Update", "Type", "Change"],
// https://renovatebot.com/docs/configuration-options/#schedule
schedule: ["every weekend"],
// Limit the number of consecutive PRs
prHourlyLimit: 2,
// Silently merge updates without PRs
automergeType: "branch",
node: {
enabled: true,
major: {
Expand All @@ -39,8 +46,6 @@
vulnerabilityAlerts: {
automerge: true,
},
// Silently merge updates without PRs
automergeType: "branch",
packageRules: [
{
packageNames: ["prettier"],
Expand All @@ -58,10 +63,15 @@
automerge: true,
},
{
packageNames: ["react-scripts"],
packageNames: ["@types/jest", "react-scripts"],
groupName: "react-scripts",
automerge: true,
},
{
packageNames: ["typescript"],
groupName: "typescript",
automerge: true,
},
{
packagePatterns: ["^@commitlint"],
groupName: "commitlint",
Expand All @@ -71,27 +81,23 @@
packagePatterns: ["^enzyme"],
groupName: "enzyme",
automerge: true,
automergeType: "branch",
},
{
packagePatterns: ["^rollup", "^@babel"],
packagePatterns: ["^rollup", "^@rollup"],
groupName: "rollup",
automerge: true,
},
{
packageNames: ["react", "react-dom", "react-test-renderer"],
groupName: "react",
packageNames: ["snapshot-diff"],
groupName: "snapshot-diff",
automerge: true,
},
{
packagePatterns: ["^semantic-release", "^@semantic-release"],
groupName: "semantic-release",
automerge: true,
},
{
packageNames: ["source-map-explorer"],
groupName: "source-map-explorer",
automerge: true,
},
{
packageNames: ["JamesIves/github-pages-deploy-action"],
groupName: "JamesIves/github-pages-deploy-action",
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
restore-keys: |
${{ runner.os }}-node-
- if: steps.node-cache.outputs.cache-hit != 'true'
run: npm install --no-optional --no-audit --no-fund --progress=false
run: npm ci
# Test Git hooks in CI, to make sure script upgrades do not break them.
- run: npm run prepare
# Test commit message validation in CI.
Expand All @@ -44,11 +44,8 @@ jobs:
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm run report:package
- run: wc -c build/source-map-explorer.html
- run: mv coverage/lcov-report build || true
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: cat ./coverage/lcov.info | npx coveralls || true
- uses: actions/upload-artifact@v3
with:
name: build
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ class MyEditor extends Component {
this.setState({ editorState: nextState });
}

handlePastedText(text: string, html: ?string, editorState: EditorState) {
handlePastedText(
text: string,
html: string | null,
editorState: EditorState,
) {
let newState = handleDraftEditorPastedText(html, editorState);

if (newState) {
Expand Down
18 changes: 16 additions & 2 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
// flowlint untyped-import:off
const { danger, message, warn, fail, schedule } = require("danger");
const semanticRelease = require("semantic-release");
const envCi = require("env-ci");
const isLocal = !danger.github;

const libModifiedFiles = danger.git.modified_files.filter(
Expand Down Expand Up @@ -88,3 +88,17 @@ schedule(async () => {
}
}
});

if (!isLocal) {
schedule(async () => {
// Retrieve the current branch so semantic-release is configured as if it was to make a release from it.
const { branch } = envCi();

const result = await semanticRelease({ dryRun: true, branch });
if (result.nextRelease) {
message(
`:tada: Merging this will publish a new ${result.nextRelease.type} release, v${result.nextRelease.version}.`,
);
}
});
}
10 changes: 6 additions & 4 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Thank you for considering to help this project.

We welcome all support, whether on bug reports, feature requests, code, design, reviews, tests, documentation, and more.

Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.

## Development

### Install
Expand All @@ -27,18 +29,18 @@ nvm use
npm run start
# Runs linting.
npm run lint
# Start a Flow server for type errors.
npx flow
# Re-formats all of the files in the project (with Prettier).
npm run format
# Run tests in a watcher.
npm run test:watch
# Run test coverage
npm run test:coverage
# Open the coverage report with:
npm run report:coverage
# Open the build report with:
npm run report:build
# View other available commands with:
npm run
```

### Code style

This project uses [Prettier](https://prettier.io/), [ESLint](https://eslint.org/), and [TypeScript](https://www.typescriptlang.org/). All code should always be checked with those tools.
116 changes: 0 additions & 116 deletions flow-typed/npm/react-dom_v16.x.x.js

This file was deleted.

Loading

0 comments on commit 3fca3fa

Please sign in to comment.