Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
holoyan committed Jun 18, 2024
0 parents commit 6ac9d26
Show file tree
Hide file tree
Showing 19 changed files with 347 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
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
26 changes: 26 additions & 0 deletions .github/lock.yml
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
24 changes: 24 additions & 0 deletions .github/stale.yml
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
60 changes: 60 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: test

on:
- push
- pull_request

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install
run: npm install
- name: Run lint
run: npm run lint

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install
run: npm install
- name: Run typecheck
run: npm run typecheck

tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version:
- 20.10.0
- 21.x
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install
- name: Run tests
run: npm test
windows:
runs-on: windows-latest
strategy:
matrix:
node-version:
- 20.10.0
- 21.x
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install
- name: Run tests
run: npm test
14 changes: 14 additions & 0 deletions .gitignore
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
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
docs
coverage
*.html
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The MIT License

Copyright (c) 2023

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.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# AdonisJS activity log




### License
MIT
11 changes: 11 additions & 0 deletions bin/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { assert } from '@japa/assert'
import { configure, processCLIArgs, run } from '@japa/runner'

processCLIArgs(process.argv.splice(2))

configure({
files: ['tests/**/*.spec.ts'],
plugins: [assert()],
})

run()
17 changes: 17 additions & 0 deletions configure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
|--------------------------------------------------------------------------
| Configure hook
|--------------------------------------------------------------------------
|
| The configure hook is called when someone runs "node ace configure <package>"
| command. You are free to perform any operations inside this function to
| configure the package.
|
| To make things easier, you have access to the underlying "ConfigureCommand"
| instance and you can use codemods to modify the source files.
|
*/

import ConfigureCommand from '@adonisjs/core/commands/configure'

export async function configure(_command: ConfigureCommand) {}
10 changes: 10 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
|--------------------------------------------------------------------------
| Package entrypoint
|--------------------------------------------------------------------------
|
| Export values from the package entrypoint as you see fit.
|
*/

export { configure } from './configure.js'
91 changes: 91 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "@holoyan/adonis-activitylog",
"description": "AdonisJs activity log",
"version": "0.0.0",
"engines": {
"node": ">=20.6.0"
},
"type": "module",
"files": [
"build/src",
"build/providers",
"build/stubs",
"build/index.d.ts",
"build/index.js",
"build/configure.d.ts",
"build/configure.js"
],
"exports": {
".": "./build/index.js",
"./types": "./build/src/types.js"
},
"scripts": {
"clean": "del-cli build",
"copy:templates": "copyfiles \"stubs/**/*.stub\" build",
"typecheck": "tsc --noEmit",
"lint": "eslint . --ext=.ts",
"format": "prettier --write .",
"quick:test": "node --import=./tsnode.esm.js --enable-source-maps bin/test.ts",
"pretest": "npm run lint",
"test": "c8 npm run quick:test",
"prebuild": "npm run lint && npm run clean",
"build": "tsc",
"postbuild": "npm run copy:templates",
"release": "np",
"version": "npm run build",
"prepublishOnly": "npm run build"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@adonisjs/assembler": "^7.2.3",
"@adonisjs/core": "^6.3.1",
"@adonisjs/eslint-config": "^1.3.0",
"@adonisjs/lucid": "^21.0.0",
"@adonisjs/prettier-config": "^1.3.0",
"@adonisjs/tsconfig": "^1.3.0",
"@japa/assert": "^2.1.0",
"@japa/runner": "^3.1.1",
"@swc/core": "^1.4.6",
"@types/luxon": "^3.4.2",
"@types/node": "^20.11.25",
"c8": "^9.1.0",
"copyfiles": "^2.4.1",
"del-cli": "^5.1.0",
"eslint": "^8.57.0",
"luxon": "^3.4.4",
"np": "^10.0.0",
"prettier": "^3.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.4.2"
},
"peerDependencies": {
"@adonisjs/core": "^6.2.0",
"@adonisjs/lucid": "^21.0.0",
"luxon": "^3.4.4"
},
"publishConfig": {
"access": "public",
"tag": "latest"
},
"np": {
"message": "chore(release): %s",
"tag": "latest",
"branch": "main",
"anyBranch": false
},
"c8": {
"reporter": [
"text",
"html"
],
"exclude": [
"tests/**"
]
},
"eslintConfig": {
"extends": "@adonisjs/eslint-config/package"
},
"prettier": "@adonisjs/prettier-config"
}
5 changes: 5 additions & 0 deletions providers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# The providers directory

The `providers` directory contains the service providers exported by your application. Make sure to register these providers within the `exports` collection (aka package entrypoints) defined within the `package.json` file.

Learn more about [package entrypoints](https://nodejs.org/api/packages.html#package-entry-points).
6 changes: 6 additions & 0 deletions stubs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The stubs directory

The `stubs` directory stores all the stubs needed by your package. It could be config files you will publish during the initial setup or stubs you want to use within the scaffolding commands.

- Inside the `package.json` file, we have defined a `copy:templates` script that copies the `stubs` folder to the `build` folder.
- Ensure the `build/stubs` are always published to npm via the `files` array inside the `package.json` file.
8 changes: 8 additions & 0 deletions stubs/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'

/**
* Path to the root directory where the stubs are stored. We use
* this path within commands and the configure hook
*/
export const stubsRoot = dirname(fileURLToPath(import.meta.url))
7 changes: 7 additions & 0 deletions tests/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { test } from '@japa/runner'

test.group('Example', () => {
test('add two numbers', ({ assert }) => {
assert.equal(1 + 1, 2)
})
})
7 changes: 7 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "@adonisjs/tsconfig/tsconfig.package.json",
"compilerOptions": {
"rootDir": "./",
"outDir": "./build",
}
}
18 changes: 18 additions & 0 deletions tsnode.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
|--------------------------------------------------------------------------
| TS-Node ESM hook
|--------------------------------------------------------------------------
|
| Importing this file before any other file will allow you to run TypeScript
| code directly using TS-Node + SWC. For example
|
| node --import="./tsnode.esm.js" bin/test.ts
| node --import="./tsnode.esm.js" index.ts
|
|
| Why not use "--loader=ts-node/esm"?
| Because, loaders have been deprecated.
*/

import { register } from 'node:module'
register('ts-node/esm', import.meta.url)

0 comments on commit 6ac9d26

Please sign in to comment.