adonisjs-pulse 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,119 +1,9 @@
1
- # AdonisJS package starter kit
1
+ # AdonisJS Pulse
2
2
 
3
- > A boilerplate for creating AdonisJS packages
3
+ Laravel Pulse inspired package for AdonisJS.
4
4
 
5
- This repo provides you with a starting point for creating AdonisJS packages. Of course, you can create a package from scratch with your folder structure and workflow. However, using this starter kit can speed up the process, as you have fewer decisions to make.
5
+ ## Installation
6
6
 
7
- ## Setup
8
-
9
- - Clone the repo on your computer, or use `giget` to download this repo without the Git history.
10
- ```sh
11
- npx giget@latest gh:adonisjs/pkg-starter-kit
12
- ```
13
- - Install dependencies.
14
- - Update the `package.json` file and define the `name`, `description`, `keywords`, and `author` properties.
15
- - The repo is configured with an MIT license. Feel free to change that if you are not publishing under the MIT license.
16
-
17
- ## Folder structure
18
-
19
- The starter kit mimics the folder structure of the official packages. Feel free to rename files and folders as per your requirements.
20
-
21
- ```
22
- ├── providers
23
- ├── src
24
- ├── bin
25
- ├── stubs
26
- ├── configure.ts
27
- ├── index.ts
28
- ├── LICENSE.md
29
- ├── package.json
30
- ├── README.md
31
- ├── tsconfig.json
32
- ├── tsnode.esm.js
7
+ ```sh
8
+ node ace add adonisjs-pulse
33
9
  ```
34
-
35
- - The `configure.ts` file exports the `configure` hook to configure the package using the `node ace configure` command.
36
- - The `index.ts` file is the main entry point of the package.
37
- - The `tsnode.esm.js` file runs TypeScript code using TS-Node + SWC. Please read the code comment in this file to learn more.
38
- - The `bin` directory contains the entry point file to run Japa tests.
39
- - Learn more about [the `providers` directory](./providers/README.md).
40
- - Learn more about [the `src` directory](./src/README.md).
41
- - Learn more about [the `stubs` directory](./stubs/README.md).
42
-
43
- ### File system naming convention
44
-
45
- We use `snake_case` naming conventions for the file system. The rule is enforced using ESLint. However, turn off the rule and use your preferred naming conventions.
46
-
47
- ## Peer dependencies
48
-
49
- The starter kit has a peer dependency on `@adonisjs/core@6`. Since you are creating a package for AdonisJS, you must make it against a specific version of the framework core.
50
-
51
- If your package needs Lucid to be functional, you may install `@adonisjs/lucid` as a development dependency and add it to the list of `peerDependencies`.
52
-
53
- As a rule of thumb, packages installed in the user application should be part of the `peerDependencies` of your package and not the main dependency.
54
-
55
- For example, if you install `@adonisjs/core` as a main dependency, then essentially, you are importing a separate copy of `@adonisjs/core` and not sharing the one from the user application. Here is a great article explaining [peer dependencies](https://blog.bitsrc.io/understanding-peer-dependencies-in-javascript-dbdb4ab5a7be).
56
-
57
- ## Published files
58
-
59
- Instead of publishing your repo's source code to npm, you must cherry-pick files and folders to publish only the required files.
60
-
61
- The cherry-picking uses the `files` property inside the `package.json` file. By default, we publish the following files and folders.
62
-
63
- ```json
64
- {
65
- "files": ["build/src", "build/providers", "build/stubs", "build/index.d.ts", "build/index.js", "build/configure.d.ts", "build/configure.js"]
66
- }
67
- ```
68
-
69
- If you create additional folders or files, mention them inside the `files` array.
70
-
71
- ## Exports
72
-
73
- [Node.js Subpath exports](https://nodejs.org/api/packages.html#subpath-exports) allows you to define the exports of your package regardless of the folder structure. This starter kit defines the following exports.
74
-
75
- ```json
76
- {
77
- "exports": {
78
- ".": "./build/index.js",
79
- "./types": "./build/src/types.js"
80
- }
81
- }
82
- ```
83
-
84
- - The dot `.` export is the main export.
85
- - The `./types` exports all the types defined inside the `./build/src/types.js` file (the compiled output).
86
-
87
- Feel free to change the exports as per your requirements.
88
-
89
- ## Testing
90
-
91
- We configure the [Japa test runner](https://japa.dev/) with this starter kit. Japa is used in AdonisJS applications as well. Just run one of the following commands to execute tests.
92
-
93
- - `npm run test`: This command will first lint the code using ESlint and then run tests and report the test coverage using [c8](https://github.com/bcoe/c8).
94
- - `npm run quick:test`: Runs only the tests without linting or coverage reporting.
95
-
96
- The starter kit also has a Github workflow file to run tests using Github Actions. The tests are executed against `Node.js 20.x` and `Node.js 21.x` versions on both Linux and Windows. Feel free to edit the workflow file in the `.github/workflows` directory.
97
-
98
- ## TypeScript workflow
99
-
100
- - The starter kit uses [tsc](https://www.typescriptlang.org/docs/handbook/compiler-options.html) for compiling the TypeScript to JavaScript when publishing the package.
101
- - [TS-Node](https://typestrong.org/ts-node/) and [SWC](https://swc.rs/) are used to run tests without compiling the source code.
102
- - The `tsconfig.json` file is extended from [`@adonisjs/tsconfig`](https://github.com/adonisjs/tooling-config/tree/main/packages/typescript-config) and uses the `NodeNext` module system. Meaning the packages are written using ES modules.
103
- - You can perform type checking without compiling the source code using the `npm run type check` script.
104
-
105
- Feel free to explore the `tsconfig.json` file for all the configured options.
106
-
107
- ## ESLint and Prettier setup
108
-
109
- The starter kit configures ESLint and Prettier
110
- using our [shared config](https://github.com/adonisjs/tooling-config/tree/main/packages).
111
- ESLint configuration is stored within the `eslint.config.js` file.
112
- Prettier configuration is stored within the `package.json` file.
113
- Feel free to change the configuration, use custom plugins, or remove both tools altogether.
114
-
115
- ## Using Stale bot
116
-
117
- The [Stale bot](https://github.com/apps/stale) is a Github application that automatically marks issues and PRs as stale and closes after a specific duration of inactivity.
118
-
119
- Feel free to delete the `.github/stale.yml` and `.github/lock.yml` files if you decide not to use the Stale bot.
@@ -52,9 +52,9 @@
52
52
  <h1 class="text-2xl font-semibold text-gray-900 dark:text-gray-100">
53
53
  Pulse
54
54
  </h1>
55
- @livewire('pulse::period-selector')
56
55
  </div>
57
56
  <div class="flex items-center gap-2">
57
+ @livewire('pulse::period-selector')
58
58
  @!component('pulse::components/theme-switcher')
59
59
  </div>
60
60
  </header>
@@ -1,11 +1,19 @@
1
- <div class="flex items-center gap-2">
2
- <select
3
- wire:model.live="period"
4
- class="block w-full rounded-md border-0 bg-white dark:bg-gray-800 py-1.5 pl-3 pr-10 text-gray-900 dark:text-gray-100 ring-1 ring-inset ring-gray-300 dark:ring-gray-700 focus:ring-2 focus:ring-indigo-600 sm:text-sm sm:leading-6"
5
- >
6
- <option value="1_hour">Last hour</option>
7
- <option value="6_hours">Last 6 hours</option>
8
- <option value="24_hours">Last 24 hours</option>
9
- <option value="7_days">Last 7 days</option>
10
- </select>
1
+ <div class="flex"
2
+ x-data="{
3
+ setPeriod(period) {
4
+ let query = new URLSearchParams(window.location.search)
5
+ if (period === '1_hour') {
6
+ query.delete('period')
7
+ } else {
8
+ query.set('period', period)
9
+ }
10
+
11
+ Livewire.navigate(`${location.pathname}?${query}`)
12
+ }
13
+ }"
14
+ >
15
+ <button @click="setPeriod('1_hour')" class="p-1 font-semibold sm:text-lg {{ period === '1_hour' ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500'}}">1h</button>
16
+ <button @click="setPeriod('6_hours')" class="p-1 font-semibold sm:text-lg {{ period === '6_hours' ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500'}}">6h</button>
17
+ <button @click="setPeriod('24_hours')" class="p-1 font-semibold sm:text-lg {{ period === '24_hours' ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500'}}">24h</button>
18
+ <button @click="setPeriod('7_days')" class="p-1 font-semibold sm:text-lg {{ period === '7_days' ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500'}}">7d</button>
11
19
  </div>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adonisjs-pulse",
3
3
  "description": "",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "engines": {
6
6
  "node": ">=20.6.0"
7
7
  },