-
-
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.
- Loading branch information
0 parents
commit 09296e2
Showing
29 changed files
with
1,505 additions
and
0 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,22 @@ | ||
# http://editorconfig.org | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.json] | ||
insert_final_newline = ignore | ||
|
||
[**.min.js] | ||
indent_style = ignore | ||
insert_final_newline = ignore | ||
|
||
[MakeFile] | ||
indent_style = space | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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,26 @@ | ||
--- | ||
ignoreUnless: { { STALE_BOT } } | ||
--- | ||
# Configuration for Lock Threads - https://github.com/dessant/lock-threads-app | ||
|
||
# Number of days of inactivity before a closed issue or pull request is locked | ||
daysUntilLock: 60 | ||
|
||
# Skip issues and pull requests created before a given timestamp. Timestamp must | ||
# follow ISO 8601 (`YYYY-MM-DD`). Set to `false` to disable | ||
skipCreatedBefore: false | ||
|
||
# Issues and pull requests with these labels will be ignored. Set to `[]` to disable | ||
exemptLabels: ['Type: Security'] | ||
|
||
# Label to add before locking, such as `outdated`. Set to `false` to disable | ||
lockLabel: false | ||
|
||
# Comment to post before locking. Set to `false` to disable | ||
lockComment: > | ||
This thread has been automatically locked since there has not been | ||
any recent activity after it was closed. Please open a new issue for | ||
related bugs. | ||
# Assign `resolved` as the reason for locking. Set to `false` to disable | ||
setLockReason: false |
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,24 @@ | ||
--- | ||
ignoreUnless: { { STALE_BOT } } | ||
--- | ||
# Number of days of inactivity before an issue becomes stale | ||
daysUntilStale: 60 | ||
|
||
# Number of days of inactivity before a stale issue is closed | ||
daysUntilClose: 7 | ||
|
||
# Issues with these labels will never be considered stale | ||
exemptLabels: | ||
- 'Type: Security' | ||
|
||
# Label to use when marking an issue as stale | ||
staleLabel: 'Status: Abandoned' | ||
|
||
# Comment to post when marking an issue as stale. Set to `false` to disable | ||
markComment: > | ||
This issue has been automatically marked as stale because it has not had | ||
recent activity. It will be closed if no further activity occurs. Thank you | ||
for your contributions. | ||
# Comment to post when closing a stale issue. Set to `false` to disable | ||
closeComment: false |
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,15 @@ | ||
name: checks | ||
on: | ||
- push | ||
- pull_request | ||
- workflow_call | ||
|
||
jobs: | ||
test: | ||
uses: adonisjs/.github/.github/workflows/test.yml@main | ||
|
||
lint: | ||
uses: adonisjs/.github/.github/workflows/lint.yml@main | ||
|
||
typecheck: | ||
uses: adonisjs/.github/.github/workflows/typecheck.yml@main |
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,15 @@ | ||
name: Sync labels | ||
on: | ||
workflow_dispatch: | ||
permissions: | ||
issues: write | ||
jobs: | ||
labels: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: EndBug/label-sync@v2 | ||
with: | ||
config-file: 'https://raw.githubusercontent.com/thetutlage/static/main/labels.yml' | ||
delete-other-labels: true | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,32 @@ | ||
name: release | ||
on: workflow_dispatch | ||
permissions: | ||
contents: write | ||
id-token: write | ||
jobs: | ||
checks: | ||
uses: ./.github/workflows/checks.yml | ||
release: | ||
needs: checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: git config | ||
run: | | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
- name: Init npm config | ||
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- run: npm install | ||
- run: npm run release -- --ci | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,14 @@ | ||
node_modules | ||
coverage | ||
.DS_STORE | ||
.nyc_output | ||
.idea | ||
.vscode/ | ||
*.sublime-project | ||
*.sublime-workspace | ||
*.log | ||
build | ||
dist | ||
yarn.lock | ||
shrinkwrap.yaml | ||
package-lock.json |
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 @@ | ||
package-lock=false |
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,5 @@ | ||
build | ||
docs | ||
coverage | ||
*.html | ||
tests/fixtures |
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,9 @@ | ||
# The MIT License | ||
|
||
Copyright (c) 2024 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,32 @@ | ||
# Youch core | ||
|
||
<br /> | ||
|
||
[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url] | ||
|
||
## Introduction | ||
|
||
## Official Documentation | ||
|
||
## Contributing | ||
|
||
One of the primary goals of Poppinss is to have a vibrant community of users and contributors who believes in the principles of the framework. | ||
|
||
We encourage you to read the [contribution guide](https://github.com/poppinss/.github/blob/main/docs/CONTRIBUTING.md) before contributing to the framework. | ||
|
||
## Code of Conduct | ||
|
||
In order to ensure that the Poppinss community is welcoming to all, please review and abide by the [Code of Conduct](https://github.com/poppinss/.github/blob/main/docs/CODE_OF_CONDUCT.md). | ||
|
||
## License | ||
|
||
<pkg-name> is open-sourced software licensed under the [MIT license](LICENSE.md). | ||
|
||
[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/poppinss/youch-core/checks.yml?style=for-the-badge | ||
[gh-workflow-url]: https://github.com/poppinss/youch-core/actions/workflows/checks.yml 'Github action' | ||
[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/youch-core.svg?style=for-the-badge&logo=npm | ||
[npm-url]: https://npmjs.org/package/youch-core 'npm' | ||
[license-image]: https://img.shields.io/npm/l/youch-core?color=blueviolet&style=for-the-badge | ||
[license-url]: LICENSE.md 'license' |
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,21 @@ | ||
import { expect } from '@japa/expect' | ||
import { assert } from '@japa/assert' | ||
import { fileSystem } from '@japa/file-system' | ||
import { expectTypeOf } from '@japa/expect-type' | ||
import { configure, processCLIArgs, run } from '@japa/runner' | ||
|
||
processCLIArgs(process.argv.splice(2)) | ||
configure({ | ||
files: ['tests/**/*.spec.ts'], | ||
plugins: [ | ||
expect(), | ||
assert(), | ||
fileSystem({ | ||
autoClean: false, | ||
basePath: new URL('../tests/fixtures', import.meta.url), | ||
}), | ||
expectTypeOf(), | ||
], | ||
}) | ||
|
||
run() |
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,4 @@ | ||
import { configPkg } from '@adonisjs/eslint-config' | ||
export default configPkg({ | ||
ignores: ['tests/fixtures/*'], | ||
}) |
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,53 @@ | ||
import ansis from 'ansis' | ||
import { readFile } from 'node:fs/promises' | ||
import { highlight } from 'tinyhighlight/picocolors' | ||
import { ErrorParser } from '../src/parser.js' | ||
import { ParsedError } from '../src/types.js' | ||
import stripAnsi from 'strip-ansi' | ||
|
||
function print(error: ParsedError) { | ||
console.log('') | ||
console.log(ansis.red(error.message)) | ||
if (error.hint) { | ||
console.log(`${ansis.blue('●')} ${error.hint}`) | ||
} | ||
|
||
console.log('') | ||
let frameSourcePrinted = false | ||
|
||
error.frames.forEach((frame) => { | ||
if (frame.type === 'app' && !frameSourcePrinted && frame.source) { | ||
console.log(ansis.yellow(`‐ ${frame.raw!.trim()}`)) | ||
// console.log('') | ||
frameSourcePrinted = true | ||
const chunks = highlight(frame.source.map((c) => c.chunk).join('\n')).split('\n') | ||
|
||
frame.source.map(({ lineNumber }, index) => { | ||
const chunk = chunks[index] | ||
if (lineNumber === frame.lineNumber) { | ||
console.log( | ||
ansis.bgRed( | ||
`${ansis.visible('❯')} ${ansis.visible(`${lineNumber}`)} ${ansis.visible('┃')} ${ansis.visible(stripAnsi(chunk))}` | ||
) | ||
) | ||
} else { | ||
console.log(` ${ansis.dim(`${lineNumber}`)} ${ansis.dim('┃')} ${chunk}`) | ||
} | ||
}) | ||
// console.log('') | ||
} else { | ||
console.log(ansis.dim(`‐ ${frame.raw!.trim()}`)) | ||
} | ||
}) | ||
} | ||
|
||
async function run(): Promise<void> { | ||
try { | ||
await readFile('./foo.txt') | ||
} catch (error) { | ||
const parsed = await new ErrorParser().parse(error) | ||
print(parsed) | ||
} | ||
} | ||
|
||
await run() |
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,10 @@ | ||
/* | ||
* youch-error | ||
* | ||
* (c) Poppinss | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
export { ErrorParser } from './src/parser.js' |
Oops, something went wrong.