Skip to content

Commit

Permalink
refactor: change boundary requirement and optimise groups (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet authored Jul 27, 2024
1 parent 51a2372 commit d6a58bc
Show file tree
Hide file tree
Showing 28 changed files with 1,397 additions and 877 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js,ts}]
[*.{js,cjs,mjs,ts,cts,mts}]
indent_size = 4
indent_style = tab
block_comment_start = /*
Expand Down
15 changes: 1 addition & 14 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
# Auto detect text files and perform LF normalization
* text=auto


*.ts text eol=lf merge=union
*.tsx text eol=lf merge=union
*.rs text eol=lf merge=union
*.js text eol=lf merge=union
*.json text eol=lf merge=union
*.debug text eol=lf merge=union

# Generated codes
index.js linguist-detectable=false
index.d.ts linguist-detectable=false
* text eol=lf
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @kyranet
17 changes: 17 additions & 0 deletions .github/CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contributing

**The issue tracker is only for issue reporting or proposals/suggestions. If you have a question, you can find us in our [Discord Server]**.

To contribute to this repository, feel free to create a new fork of the repository and
submit a pull request.

1. Fork, clone, and select the **main** branch.
1. Create a new branch in your fork.
1. Make your changes.
1. Commit your changes, and push them.
1. Submit a Pull Request [here]!

<!-- Link Dump -->

[discord server]: https://join.skyra.pw
[here]: https://github.com/skyra-project/word-match/pulls
16 changes: 16 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Security Policy

## Supported Versions

| Version | Supported |
| ------- | ------------------ |
| 1.x | :white_check_mark: |

## Reporting a Vulnerability

If you find a vulnerability in @skyra/word-match's codebase please report it immediately.
If you deem the vulnerability exploitable by Skyra's users in any shape or form please join the Discord server at https://join.skyra.pw and then DM either @kyranet or @favna.
In case the vulnerability is not exploitable by Skyra's users you are free to either:

- Use the GitHub issue tracker to report the issue
- or join the Discord server through https://join.skyra.pw and use the "#feedback" channel.
3 changes: 3 additions & 0 deletions .github/hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

yarn commitlint --edit $1
3 changes: 3 additions & 0 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

yarn lint-staged
9 changes: 2 additions & 7 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", "group:allNonMajor", ":preserveSemverRanges", ":disablePeerDependencies"],
"labels": ["dependencies"],
"extends": ["github>sapphiredev/readme:sapphire-renovate"],
"packageRules": [
{
"matchPackageNames": ["@napi/cli", "napi", "napi-build", "napi-derive"],
Expand All @@ -12,9 +11,5 @@
"matchPackagePatterns": ["^eslint", "^@typescript-eslint"],
"groupName": "linter"
}
],
"commitMessagePrefix": "chore: ",
"commitMessageAction": "bump up",
"commitMessageTopic": "{{depName}} version",
"ignoreDeps": []
]
}
37 changes: 12 additions & 25 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,14 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-latest
- host: macos-13
target: x86_64-apple-darwin
build: |
yarn build
yarn build --target x86_64-apple-darwin
strip -x *.node
- host: windows-latest
build: yarn build
target: x86_64-pc-windows-msvc
- host: windows-latest
build: |
yarn build --target i686-pc-windows-msvc
yarn test
target: i686-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
Expand All @@ -67,6 +62,7 @@ jobs:
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |-
set -e &&
rustup target add aarch64-unknown-linux-gnu &&
yarn build --target aarch64-unknown-linux-gnu &&
aarch64-unknown-linux-gnu-strip *.node
- host: ubuntu-latest
Expand Down Expand Up @@ -98,7 +94,7 @@ jobs:
- host: windows-latest
target: aarch64-pc-windows-msvc
build: yarn build --target aarch64-pc-windows-msvc
name: stable - ${{ matrix.settings.target }} - node@18
name: ${{ matrix.settings.target }} - node@18
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
Expand All @@ -109,10 +105,10 @@ jobs:
node-version: 18
cache: yarn
- name: Install
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
if: ${{ !matrix.settings.docker }}
with:
toolchain: stable
toolchain: nightly
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v4
Expand All @@ -132,19 +128,8 @@ jobs:
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Setup node x86
if: matrix.settings.target == 'i686-pc-windows-msvc'
run: yarn config set supportedArchitectures.cpu "ia32"
shell: bash
- name: Install dependencies
run: yarn install
- name: Setup node x86
uses: actions/setup-node@v4
if: matrix.settings.target == 'i686-pc-windows-msvc'
with:
node-version: 18
cache: yarn
architecture: x86
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker }}
Expand Down Expand Up @@ -172,8 +157,10 @@ jobs:
settings:
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: macos-latest
- host: macos-13
target: x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
node:
- '18'
- '20'
Expand Down Expand Up @@ -404,15 +391,15 @@ jobs:
npm config set provenance true
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_PUBLISH_TOKEN" >> ~/.npmrc
npm publish --access public
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_PUBLISH_TOKEN" >> ~/.npmrc
npm publish --tag next --access public
else
echo "Not a release, skipping publish"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
cache: 'yarn'

- name: Install
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt

Expand All @@ -35,7 +35,7 @@ jobs:
run: yarn lint

- name: Cargo fmt
run: cargo fmt -- --check
run: cargo +nightly fmt -- --check

- name: Clippy
run: cargo clippy
127 changes: 15 additions & 112 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,129 +1,32 @@

# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo
coverage/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity
### macOS ###
# General
.DS_Store

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# End of https://www.toptal.com/developers/gitignore/api/node


#Added by cargo
# Added by cargo

/target
Cargo.lock

*.node
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Ignore package locks
package-lock.json

# Ignore the GH cli downloaded by workflows
gh

# Yarn files
.yarn/install-state.gz
.yarn/build-state.yml
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

7 changes: 5 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
target
.yarn
coverage/
node_modules/
target/
deps/
.yarn/
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-git-hooks.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-git-hooks",
factory: function (require) {
var plugin=(()=>{var p=Object.create;var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var _=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,E)=>(typeof require<"u"?require:e)[E]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+n+'" is not supported')});var c=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),A=(n,e)=>{for(var E in e)i(n,E,{get:e[E],enumerable:!0})},C=(n,e,E,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let I of l(e))!m.call(n,I)&&I!==E&&i(n,I,{get:()=>e[I],enumerable:!(s=u(e,I))||s.enumerable});return n};var U=(n,e,E)=>(E=n!=null?p(P(n)):{},C(e||!n||!n.__esModule?i(E,"default",{value:n,enumerable:!0}):E,n)),v=n=>C(i({},"__esModule",{value:!0}),n);var L=c((M,B)=>{B.exports=[{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]}},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var T=c(a=>{"use strict";var D=L(),t=process.env;Object.defineProperty(a,"_vendors",{value:D.map(function(n){return n.constant})});a.name=null;a.isPR=null;D.forEach(function(n){let E=(Array.isArray(n.env)?n.env:[n.env]).every(function(s){return S(s)});if(a[n.constant]=E,!!E)switch(a.name=n.name,typeof n.pr){case"string":a.isPR=!!t[n.pr];break;case"object":"env"in n.pr?a.isPR=n.pr.env in t&&t[n.pr.env]!==n.pr.ne:"any"in n.pr?a.isPR=n.pr.any.some(function(s){return!!t[s]}):a.isPR=S(n.pr);break;default:a.isPR=null}});a.isCI=!!(t.CI!=="false"&&(t.BUILD_ID||t.BUILD_NUMBER||t.CI||t.CI_APP_ID||t.CI_BUILD_ID||t.CI_BUILD_NUMBER||t.CI_NAME||t.CONTINUOUS_INTEGRATION||t.RUN_ID||a.name||!1));function S(n){return typeof n=="string"?!!t[n]:"env"in n?t[n.env]&&t[n.env].includes(n.includes):"any"in n?n.any.some(function(e){return!!t[e]}):Object.keys(n).every(function(e){return t[e]===n[e]})}});var d={};A(d,{default:()=>O});var o=U(_("process")),r=_("@yarnpkg/core"),R=U(T()),N={configuration:{gitHooksPath:{description:"Path to git hooks directory (recommended: .github/hooks)",type:r.SettingsType.STRING,default:null},disableGitHooks:{description:"Disable automatic git hooks installation",type:r.SettingsType.BOOLEAN,default:R.default.isCI}},hooks:{afterAllInstalled:async n=>{let e=n.configuration.get("gitHooksPath"),E=n.configuration.get("disableGitHooks"),s=Boolean(n.cwd?.endsWith(`dlx-${o.default.pid}`));if(e&&!R.default.isCI&&!s&&!E)return r.execUtils.pipevp("git",["config","core.hooksPath",e],{cwd:n.cwd,strict:!0,stdin:o.default.stdin,stdout:o.default.stdout,stderr:o.default.stderr})}}},O=N;return v(d);})();
return plugin;
}
};
11 changes: 10 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
compressionLevel: mixed

enableGlobalCache: true

gitHooksPath: .github/hooks

nodeLinker: node-modules

npmAuditRegistry: 'https://registry.npmjs.org'
plugins:
- checksum: f8ce3a541a57481f6213647cfe7ac8555d87cb1fc23a73a102e64e12be07f603826d822f4d0285333400f0f15baed92510c33dcce75dde2953b2811e36efa012
path: .yarn/plugins/@yarnpkg/plugin-git-hooks.cjs
spec: 'https://raw.githubusercontent.com/trufflehq/yarn-plugin-git-hooks/main/bundles/%40yarnpkg/plugin-git-hooks.js'

yarnPath: .yarn/releases/yarn-4.3.0.cjs
Loading

0 comments on commit d6a58bc

Please # to comment.