generated from mezielabs/adonis-package-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(setup): update skeleton and add test 🎉🚨🔨
- Loading branch information
Showing
12 changed files
with
17,551 additions
and
9,023 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Test | ||
|
||
on: ['push', 'pull_request'] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
lib: ['sqlite', 'better_sqlite'] | ||
node-version: [14, 16, 18] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Run Tests | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
# adonis-package-skeleton | ||
> A skeleton repository for creating AdonisJS packages | ||
# adonis-hashids | ||
> A package to generate YouTube-like IDs for AdonisJS Lucid models | ||
[![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url] | ||
[![gh-workflow-image]][gh-workflow-url] [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url] [![download-image]][download-url] | ||
|
||
This repo can be used to quickly scaffold an AdonisJS package. To get started, follow the steps below: | ||
|
||
* Clone this repo by clicking the "Use this template" button at the top of this repo. | ||
* Swap out any placeholders (e.g skeleton) and start building your package. | ||
[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/eokwukwe/adonis-hashids/test.yml?style=for-the-badge | ||
[gh-workflow-url]: https://github.com/eokwukwe/adonis-hashids/actions/workflows/test.yml "Github action" | ||
|
||
## Learn AdonisJS | ||
Want to learn how to build AdonisJS packages? Check out the [AdonisJS package development](https://adonismastery.com/courses/adonisjs-package-development) course. You can also check out other courses and tutorials on [Adonis Mastery](https://adonismastery.com), where you get to learn AdonisJS through practical screencasts. | ||
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript | ||
[typescript-url]: "typescript" | ||
|
||
[npm-image]: https://img.shields.io/npm/v/adonis-confirm-password.svg?style=for-the-badge&logo=npm | ||
[npm-url]: https://npmjs.org/package/adonis-confirm-password "npm" | ||
[npm-image]: https://img.shields.io/npm/v/@fcodes/adonis-hashids/latest.svg?style=for-the-badge&logo=npm | ||
[npm-url]: https://npmjs.org/package/@fcodes/adonis-hashids/v/latest "npm" | ||
|
||
[license-image]: https://img.shields.io/npm/l/adonis-confirm-password?color=blueviolet&style=for-the-badge | ||
[license-image]: https://img.shields.io/npm/l/@fcodes/adonis-hashids?color=blueviolet&style=for-the-badge | ||
[license-url]: LICENSE.md "license" | ||
|
||
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript | ||
[typescript-url]: "typescript" | ||
[download-image]: https://img.shields.io/npm/dm/%40fcodes/adonis-hashids?style=for-the-badge&logo=npm&label=Downloads | ||
[download-url]: "download" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* @fcodes/adonis-hashids | ||
* | ||
* (c) Okwukwe Ewurum <okwukwe.ewurum@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare module '@ioc:Adonis/Addons/LucidHashIds' { | ||
import Hashids from 'hashids' | ||
import { LucidModel } from '@ioc:Adonis/Lucid/Orm' | ||
import { NormalizeConstructor } from '@ioc:Adonis/Core/Helpers' | ||
|
||
export interface LucidHashIdsMixin { | ||
<T extends NormalizeConstructor<LucidModel>>( | ||
superclass: T | ||
): T & { | ||
routeLookupKey: string | ||
|
||
saveHashId<Model extends LucidModel & T>(model: Model): Promise<void> | ||
|
||
getId(hashid: string): number | string | ||
|
||
$generateHashId(primaryKeyValue: number | string): string | ||
|
||
$salt(): string | ||
|
||
$minLength(): number | ||
|
||
$alphabet(): string | ||
|
||
$hashidsInstance(): Hashids | ||
|
||
new (...args: any[]): { | ||
hashid: string | ||
} | ||
} | ||
} | ||
|
||
const LucidHashIds: LucidHashIdsMixin | ||
|
||
export default LucidHashIds | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
/// <reference path="./skeleton.ts" /> | ||
/// <reference path="./hashids.ts" /> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import '@japa/runner' | ||
|
||
declare module '@japa/runner' { | ||
interface TestContext { | ||
// notify TypeScript about custom context properties | ||
} | ||
|
||
interface Test<TestData> { | ||
// notify TypeScript about custom test properties | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { assert } from '@japa/assert' | ||
import { specReporter } from '@japa/spec-reporter' | ||
import { runFailedTests } from '@japa/run-failed-tests' | ||
import { processCliArgs, configure, run } from '@japa/runner' | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Configure tests | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The configure method accepts the configuration to configure the Japa | ||
| tests runner. | ||
| | ||
| The first method call "processCliArgs" process the command line arguments | ||
| and turns them into a config object. Using this method is not mandatory. | ||
| | ||
| Please consult japa.dev/runner-config for the config docs. | ||
*/ | ||
configure({ | ||
...processCliArgs(process.argv.slice(2)), | ||
...{ | ||
files: ['tests/**/*.spec.ts'], | ||
plugins: [assert(), runFailedTests()], | ||
reporters: [specReporter()], | ||
importer: (filePath) => import(filePath), | ||
forceExit: true, | ||
}, | ||
}) | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Run tests | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The following "run" method is required to execute all the tests. | ||
| | ||
*/ | ||
run() |
Oops, something went wrong.