Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: string-data-structure/failure-function
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.2
Choose a base ref
...
head repository: string-data-structure/failure-function
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
File renamed without changes.
1 change: 1 addition & 0 deletions .fixpackrc
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@
"unpkg",
"exports",
"files",
"publishConfig",
"scripts",
"bundledDependencies",
"dependencies",
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: ci

on:
push:
branches:
main
pull_request:

jobs:

build:
name: Continuous integration (build)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Build 🏗️
run: yarn build

- name: Archive build 💽
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 1

test:
needs: ["build"]
name: Continuous integration (tests)
runs-on: ubuntu-latest
strategy:
matrix:
bundle: ["modern", "module", "cjs"]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Load build 💽
uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Test 🔬
run: yarn test:${{ matrix.bundle }}
23 changes: 13 additions & 10 deletions .github/workflows/ci:test.yml → .github/workflows/ci:cover.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
name: ci:test
name: ci:cover
on:
- push
- pull_request
push:
branches:
main
pull_request:
jobs:
test:
name: Continuous integration (tests)
cover:
name: Continuous integration (code coverage)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install 🔧
- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Test 🔬
run: yarn ci:test
- name: Test and record coverage 🔬
run: yarn cover

- name: Publish coverage report 📃
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
continue-on-error: true
with:
fail_ci_if_error: true
22 changes: 22 additions & 0 deletions .github/workflows/ci:lint-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ci:lint-config
on:
push:
branches:
main
pull_request:
jobs:
cover:
name: Continuous integration (config linting)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Lint config 👕
run: yarn lint-config
22 changes: 22 additions & 0 deletions .github/workflows/ci:lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ci:lint
on:
push:
branches:
main
pull_request:
jobs:
cover:
name: Continuous integration (code linting)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Lint 👕
run: yarn lint
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install 🔧
run: npm install
@@ -17,7 +17,7 @@ jobs:
run: npm run build-gh-pages

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.3
uses: JamesIves/github-pages-deploy-action@v4.7.3
with:
branch: gh-pages
folder: gh-pages
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -13,9 +13,8 @@ build(s, 0, s.length, t, 0);

[![License](https://img.shields.io/github/license/string-data-structure/failure-function.svg)](https://raw.githubusercontent.com/string-data-structure/failure-function/main/LICENSE)
[![Version](https://img.shields.io/npm/v/@string-data-structure/failure-function.svg)](https://www.npmjs.org/package/@string-data-structure/failure-function)
[![Tests](https://img.shields.io/github/workflow/status/string-data-structure/failure-function/ci:test?event=push&label=tests)](https://github.com/string-data-structure/failure-function/actions/workflows/ci:test.yml?query=branch:main)
[![Dependencies](https://img.shields.io/david/string-data-structure/failure-function.svg)](https://david-dm.org/string-data-structure/failure-function)
[![Dev dependencies](https://img.shields.io/david/dev/string-data-structure/failure-function.svg)](https://david-dm.org/string-data-structure/failure-function?type=dev)
[![Tests](https://img.shields.io/github/actions/workflow/status/string-data-structure/failure-function/ci.yml?branch=main&event=push&label=tests)](https://github.com/string-data-structure/failure-function/actions/workflows/ci.yml?query=branch:main)
[![Dependencies](https://img.shields.io/librariesio/github/string-data-structure/failure-function.svg)](https://github.com/string-data-structure/failure-function/network/dependencies)
[![GitHub issues](https://img.shields.io/github/issues/string-data-structure/failure-function.svg)](https://github.com/string-data-structure/failure-function/issues)
[![Downloads](https://img.shields.io/npm/dm/@string-data-structure/failure-function.svg)](https://www.npmjs.org/package/@string-data-structure/failure-function)

2 changes: 1 addition & 1 deletion doc/manual/usage.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

Import the library where needed
```js
const {build} = require( '@string-data-structure/failure-function' ) ;
const {build} = await import( '@string-data-structure/failure-function' ) ;
// or
import {build} from '@string-data-structure/failure-function' ;
```
105 changes: 75 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@string-data-structure/failure-function",
"description": "String searching failure function for JavaScript",
"version": "0.0.2",
"version": "1.0.0",
"license": "AGPL-3.0",
"author": "make-github-pseudonymous-again",
"homepage": "https://string-data-structure.github.io/failure-function",
@@ -25,8 +25,9 @@
"table"
],
"sideEffects": false,
"type": "module",
"source": "src/index.js",
"main": "dist/index.js",
"main": "dist/index.cjs",
"module": "dist/index.module.js",
"esmodule": "dist/index.modern.js",
"umd:main": "dist/index.umd.js",
@@ -35,23 +36,25 @@
".": {
"browser": "./dist/index.module.js",
"umd": "./dist/index.umd.js",
"require": "./dist/index.js",
"require": "./dist/index.cjs",
"default": "./dist/index.modern.js"
}
},
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "NODE_ENV=production microbundle",
"build-docs": "esdoc",
"build-gh-pages": "npm run build-docs",
"ci:test": "npm run lint-config && npm run lint && npm run cover",
"commit-msg": "commitlint --edit",
"cover": "NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test",
"debug": "NODE_ENV=debug npm run test -- -st --fail-fast",
"dev": "npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast",
"install-hooks": "husky install",
"install-hooks": "husky",
"lint": "xo",
"lint-and-fix": "npm run lint -- --fix",
"lint-config": "fixpack --dryRun",
@@ -62,55 +65,57 @@
"prepare": "npm run build",
"prepublishOnly": "pinst --disable",
"release": "np --message ':hatching_chick: release: Bumping to v%s.'",
"test": "ava"
"test": "npm run test:src",
"test-cmd": "NODE_LOADER_CONFIG=test/loader/config.js ava",
"test:cjs": "IMPORT_MAP_PATH=test/import-maps/dist/index.json npm run test-cmd",
"test:dist": "npm run test:modern && npm run test:module && npm run test:cjs",
"test:modern": "IMPORT_MAP_PATH=test/import-maps/dist/index.modern.json npm run test-cmd",
"test:module": "IMPORT_MAP_PATH=test/import-maps/dist/index.module.json npm run test-cmd",
"test:src": "IMPORT_MAP_PATH=test/import-maps/src/index.json npm run test-cmd"
},
"dependencies": {},
"devDependencies": {
"@babel/core": "7.14.3",
"@babel/preset-env": "7.14.2",
"@babel/register": "7.13.16",
"@commitlint/cli": "12.1.4",
"@babel/core": "7.27.1",
"@babel/preset-env": "7.27.2",
"@commitlint/cli": "19.8.1",
"@js-library/commitlint-config": "0.0.4",
"ava": "3.15.0",
"@node-loader/babel": "2.1.0",
"@node-loader/core": "2.0.0",
"@node-loader/import-maps": "1.1.0",
"ava": "6.3.0",
"babel-plugin-transform-remove-console": "6.9.4",
"babel-plugin-unassert": "3.1.0",
"babel-plugin-unassert": "3.2.0",
"babel-preset-power-assert": "3.0.0",
"c8": "7.7.2",
"c8": "10.1.3",
"esdoc": "1.1.0",
"esdoc-ecmascript-proposal-plugin": "1.0.0",
"esdoc-inject-script-plugin": "1.0.0",
"esdoc-inject-style-plugin": "1.0.0",
"esdoc-standard-plugin": "1.0.0",
"fixpack": "4.0.0",
"husky": "6.0.0",
"lint-staged": "11.0.0",
"microbundle": "0.13.1",
"np": "7.5.0",
"pinst": "2.1.6",
"husky": "9.1.7",
"lint-staged": "16.0.0",
"microbundle": "0.15.1",
"np": "10.2.0",
"pinst": "3.0.0",
"power-assert": "1.6.1",
"regenerator-runtime": "0.13.7",
"xo": "0.40.1"
"regenerator-runtime": "0.14.1",
"xo": "0.60.0"
},
"ava": {
"files": [
"test/src/**/*"
],
"nodeArguments": [
"--import=data:text/javascript,import {register} from 'node:module'; import {pathToFileURL} from 'node:url'; register('@node-loader/core', pathToFileURL('./'))"
],
"require": [
"regenerator-runtime/runtime",
"@babel/register"
"regenerator-runtime/runtime.js"
],
"timeout": "1m"
},
"babel": {
"sourceMaps": true,
"presets": [
[
"@babel/preset-env",
{
"targets": "current node"
}
]
],
"plugins": [
[
"transform-remove-console",
@@ -125,6 +130,7 @@
],
"env": {
"debug": {
"sourceMaps": "both",
"presets": [
"babel-preset-power-assert"
],
@@ -143,6 +149,7 @@
]
},
"test": {
"sourceMaps": "both",
"presets": [
"babel-preset-power-assert"
]
@@ -210,6 +217,44 @@
"pascalCase": true
}
}
],
"unicorn/prefer-node-protocol": "off",
"unicorn/prevent-abbreviations": "off",
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type"
],
"pathGroups": [
{
"pattern": "ava",
"group": "external",
"position": "before"
},
{
"pattern": "#module",
"group": "index",
"position": "after"
}
],
"pathGroupsExcludedImportTypes": [],
"distinctGroup": true,
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"orderImportKind": "asc",
"caseInsensitive": false
},
"warnOnUnassignedImports": true
}
]
},
"overrides": [
5 changes: 5 additions & 0 deletions test/import-maps/dist/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./dist/index.cjs"
}
}
5 changes: 5 additions & 0 deletions test/import-maps/dist/index.modern.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./dist/index.modern.js"
}
}
Loading