@stonyx/logs 1.0.1-beta.0 → 1.0.1-beta.10

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,7 +1,11 @@
1
+ [![CI](https://github.com/abofs/stonyx-logs/actions/workflows/ci.yml/badge.svg)](https://github.com/abofs/stonyx-logs/actions/workflows/ci.yml)
2
+ [![npm version](https://img.shields.io/npm/v/@stonyx/logs.svg)](https://www.npmjs.com/package/@stonyx/logs)
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
+
1
5
  <h1 align="center">
2
6
  <br>
3
7
  <br>
4
- <img width="560" src="https://github.com/abofs/stonyx-logs/raw/master/media/logo.png" alt="Chronicle">
8
+ <img width="560" src="https://github.com/abofs/stonyx-logs/raw/main/media/logo.png" alt="Stonyx Logs">
5
9
  <br>
6
10
  <br>
7
11
  <br>
@@ -9,7 +13,7 @@
9
13
 
10
14
  > Simplified logging for node applications
11
15
 
12
- ![](https://github.com/abofs/chronicle/raw/master/media/screenshot.jpg)
16
+ ![](https://github.com/abofs/stonyx-logs/raw/main/media/screenshot.jpg)
13
17
 
14
18
  <br>
15
19
 
@@ -27,10 +31,10 @@
27
31
 
28
32
  ---
29
33
 
30
- **Chronicle** is built on top of all the great work done by "Sindre Sorhus" and other collaborators of the [chalk](https://www.npmjs.com/package/chalk) project.
31
- This project is not directly associated with chalk other than chalk being a core dependency of **Chronicle**.
34
+ **Log** is built on top of all the great work done by "Sindre Sorhus" and other collaborators of the [chalk](https://www.npmjs.com/package/chalk) project.
35
+ This project is not directly associated with chalk other than chalk being a core dependency of **Log**.
32
36
 
33
- **IMPORTANT**: Please note that although **Chronicle** can be configured to any color through chalk, your output is subject to your terminal's color limitations.
37
+ **IMPORTANT**: Please note that although **Log** can be configured to any color through chalk, your output is subject to your terminal's color limitations.
34
38
 
35
39
  ## Highlights
36
40
 
@@ -41,27 +45,27 @@ This project is not directly associated with chalk other than chalk being a core
41
45
  ## Install
42
46
 
43
47
  ```sh
44
- npm install node-chronicle
48
+ npm install @stonyx/logs
45
49
  ```
46
50
 
47
51
  ## Usage
48
52
 
49
53
  ```js
50
- import Chronicle from 'node-chronicle';
54
+ import Log from '@stonyx/logs';
51
55
 
52
- const chronicle = new Chronicle();
56
+ const log = new Log();
53
57
 
54
- chronicle.info('Info: sample application has started');
55
- chronicle.warn('Warning: this is just a sample');
56
- chronicle.error('Error: no application logic detected', true); // logs to logs/error.log file
58
+ log.info('Info: sample application has started');
59
+ log.warn('Warning: this is just a sample');
60
+ log.error('Error: no application logic detected', true); // logs to logs/error.log file
57
61
  ```
58
62
 
59
63
  Easily define your own logging mechanism and color-coding preference:
60
64
 
61
65
  ```js
62
- import Chronicle from 'node-chronicle';
66
+ import Log from '@stonyx/logs';
63
67
 
64
- const chronicle = new Chronicle({
68
+ const log = new Log({
65
69
  systemLogs: {
66
70
  blue: '#007cae', // indigo blue
67
71
  yellow: '#ae8f00', // bright orange
@@ -69,17 +73,17 @@ const chronicle = new Chronicle({
69
73
  },
70
74
  });
71
75
 
72
- chronicle.blue('Info: using custom method blue, sample application has started');
73
- chronicle.yellow('Warning: using custom method yellow, this is just a sample');
74
- chronicle.red('Error: using custom method red, no application logic detected', false);
76
+ log.blue('Info: using custom method blue, sample application has started');
77
+ log.yellow('Warning: using custom method yellow, this is just a sample');
78
+ log.red('Error: using custom method red, no application logic detected', false);
75
79
  ```
76
80
 
77
81
  Customize logging options to best suit your project
78
82
 
79
83
  ```js
80
- import Chronicle from 'node-chronicle';
84
+ import Log from '@stonyx/logs';
81
85
 
82
- const chronicle = new Chronicle({
86
+ const log = new Log({
83
87
  logToFileByDefault: true,
84
88
  logTimestamp: true,
85
89
  path: 'custom-logs', // <project root>/custom-logs/*.log
@@ -87,31 +91,31 @@ const chronicle = new Chronicle({
87
91
  suffix: '\n=============================================================== \n',
88
92
  });
89
93
 
90
- chronicle.info('Info: sample application has started');
94
+ log.info('Info: sample application has started');
91
95
  ```
92
- ![](https://github.com/abofs/chronicle/raw/master/media/examples/custom-options.jpg)
96
+ ![](https://github.com/abofs/stonyx-logs/raw/main/media/examples/custom-options.jpg)
93
97
 
94
98
 
95
99
  Add additional log types extending the default options of "info", "warn", "error" and "debug"
96
100
 
97
101
  ```js
98
- import Chronicle from '../source/index.js';
102
+ import Log from '@stonyx/logs';
99
103
 
100
- const chronicle = new Chronicle({ additionalLogs: { question: 'green' } });
104
+ const log = new Log({ additionalLogs: { question: 'green' } });
101
105
 
102
106
  // create additional log with direct chalk configuration
103
- chronicle.defineType('query', chronicle.chalk().black.bgGreen);
107
+ log.defineType('query', log.chalk().black.bgGreen);
104
108
 
105
- chronicle.question('What will a fully custom chalk color function look like?');
106
- await chronicle.query('This is what a custom chalk color setting looks like', true);
109
+ log.question('What will a fully custom chalk color function look like?');
110
+ await log.query('This is what a custom chalk color setting looks like', true);
107
111
  ```
108
- ![](https://github.com/abofs/chronicle/raw/master/media/examples/additional-logs.jpg)
112
+ ![](https://github.com/abofs/stonyx-logs/raw/main/media/examples/additional-logs.jpg)
109
113
 
110
114
  ## API
111
115
 
112
116
  ### Defining Logs & Colors
113
117
 
114
- By default, **Chronicle** is instantiated with the following options:
118
+ By default, **Log** is instantiated with the following options:
115
119
 
116
120
  ```js
117
121
  additionalLogs: {},
@@ -122,10 +126,10 @@ By default, **Chronicle** is instantiated with the following options:
122
126
  },
123
127
  ```
124
128
 
125
- You can add to a new log/color setting by passing the `additionalLogs` option to the **Chronicle** constructor. Any setting that already exists in `systemLogs` will be replaced, otherwise they will be added.
129
+ You can add to a new log/color setting by passing the `additionalLogs` option to the **Log** constructor. Any setting that already exists in `systemLogs` will be replaced, otherwise they will be added.
126
130
 
127
131
  ```js
128
- const chronicle = new Chronicle({ additionalLogs: { info: 'green', custom: 'cyan' } });
132
+ const log = new Log({ additionalLogs: { info: 'green', custom: 'cyan' } });
129
133
 
130
134
  // output configuration:
131
135
  {
@@ -136,13 +140,13 @@ You can add to a new log/color setting by passing the `additionalLogs` option to
136
140
  }
137
141
  ```
138
142
 
139
- **Chronicle** will generate convenience methods for all keys provided, with the corresponding color settings. The example above would create the following convenience methods, for logging:
143
+ **Log** will generate convenience methods for all keys provided, with the corresponding color settings. The example above would create the following convenience methods, for logging:
140
144
 
141
145
  ```js
142
- chronicle.info() // green output
143
- chronicle.warn() // yellow output
144
- chronicle.error() // red output
145
- chronicle.custom() // cyan output
146
+ log.info() // green output
147
+ log.warn() // yellow output
148
+ log.error() // red output
149
+ log.custom() // cyan output
146
150
  ```
147
151
 
148
152
  These methods can then be called in your application with [logging parameters](#logging-parameters).
@@ -153,7 +157,7 @@ Additionally, these methods return a promise when `logToFile` is true, allowing
153
157
 
154
158
  ```js
155
159
  async method() {
156
- await chronicle.error('error message', true);
160
+ await log.error('error message', true);
157
161
 
158
162
  // do something after logs/error.log (default) is created
159
163
  }
@@ -161,7 +165,7 @@ async method() {
161
165
 
162
166
  ### The Debug Method
163
167
 
164
- **Chronicle** allows for the `chronicle.debug()` method to be overridden by a color setting. However, by default we do not define a color for debug and debug is handled differently. For console logging, all **debug** does is output the following:
168
+ **Log** allows for the `log.debug()` method to be overridden by a color setting. However, by default we do not define a color for debug and debug is handled differently. For console logging, all **debug** does is output the following:
165
169
 
166
170
  ```js
167
171
  // For logging to console:
@@ -171,12 +175,12 @@ console.dir(content);
171
175
  JSON.stringify(content, null, 2);
172
176
  ```
173
177
 
174
- We believe that when wanting to output complicated objects or debug **typescript** applications, there are better methods than utilizing this **Chronicle** package. But for anyone who's fully incorporated **Chronicle** into their project, this function offers some convenience.
178
+ We believe that when wanting to output complicated objects or debug **typescript** applications, there are better methods than utilizing this **Log** package. But for anyone who's fully incorporated **Log** into their project, this function offers some convenience.
175
179
 
176
180
  ### Logging Parameters
177
181
 
178
182
  ```js
179
- chronicle.error('error message', true, false); // content, logToFile, overwrite
183
+ log.error('error message', true, false); // content, logToFile, overwrite
180
184
  ```
181
185
 
182
186
  | Parameter | Type | Default | Description |
@@ -188,15 +192,16 @@ chronicle.error('error message', true, false); // content, logToFile, overwrite
188
192
  **logToFile** will log to *<project-root>/logs* unless [configured](#configuration) differently during instantiation. <br>
189
193
  ### Configuration
190
194
 
191
- When instantiating **Chronicle**, you can pass an object to customize your settings. Below is the default configuration:
195
+ When instantiating **Log**, you can pass an object to customize your settings. Below is the default configuration:
192
196
 
193
197
  ```js
194
- const chronicle = new Chronicle({
198
+ const log = new Log({
195
199
  logToFileByDefault: false,
196
200
  logTimestamp: false,
197
201
  path: 'logs/',
198
202
  prefix: '',
199
203
  suffix: '',
204
+ filename: '',
200
205
  additionalLogs: {},
201
206
  systemLogs: {
202
207
  info: 'cyan',
@@ -213,27 +218,28 @@ const chronicle = new Chronicle({
213
218
  | `path` | **String** | *'logs/'* | Path in which to store log files. This setting is relative to your project's root directory. |
214
219
  | `prefix` | **String** | *''* | Prefix string to prepend all log messages for all log types with the exception of *debug*. |
215
220
  | `suffix` | **String** | *''* | Suffix string to tack on to all log messages for all log types with the exception of *debug*. |
221
+ | `filename` | **String** | *''* | Template for log file names with variable support. Defaults to `{type}.log` when empty. See [dynamic file names](#dynamic-file-names). |
216
222
  | `additionalLogs` | **Object** | | Key value pair object containing log type to color setting for logs that will be merged with `systemLogs` |
217
- | `systemLogs` | **Object** | | Key value pair object containing log type to color setting for main **Chronicle** logs available in application |
223
+ | `systemLogs` | **Object** | | Key value pair object containing log type to color setting for main **Log** logs available in application |
218
224
 
219
225
  `additionalLogs` and `systemLogs` are explained with more detail in the [defining logs and colors](#defining-logs) section.
220
226
 
221
227
  ### Advanced Configuration
222
228
 
223
- You may want to do more than just pick a basic color for your output. **chalk** offers a variety of different options, and can be configured via `defineType()`. **Chronicle** exposes the chalk instance via `chalk()` so that you don't have to import **chalk** directly into your project. Here is an example of how you can use this method to fully customize your log color setting:
229
+ You may want to do more than just pick a basic color for your output. **chalk** offers a variety of different options, and can be configured via `defineType()`. **Log** exposes the chalk instance via `chalk()` so that you don't have to import **chalk** directly into your project. Here is an example of how you can use this method to fully customize your log color setting:
224
230
 
225
231
  ```js
226
- const chronicle = new Chronicle();
232
+ const log = new Log();
227
233
 
228
- chronicle.defineType('critical', chronicle.chalk().bold.red);
229
- chronicle.critical('This is a critical error');
234
+ log.defineType('critical', log.chalk().bold.red);
235
+ log.critical('This is a critical error');
230
236
  ```
231
237
 
232
238
  Additionally, any [configuration](#configuration) that can be set during instantiation, can also be applied exclusively to any given type by passing in a third **options** parameter.
233
239
 
234
240
  ```js
235
241
  // params: type, setting, options
236
- chronicle.definetype('notice', '#c0c0c0', {
242
+ log.definetype('notice', '#c0c0c0', {
237
243
  prefix: '--------------------------------------------------------------- \n',
238
244
  suffix: '\n=============================================================== \n'
239
245
  });
@@ -248,29 +254,62 @@ chronicle.definetype('notice', '#c0c0c0', {
248
254
 
249
255
 
250
256
  ```js
251
- const chronicle = new Chronicle();
257
+ const log = new Log();
252
258
 
253
- chronicle.defineType('info', chronicle.chalk().black.bgCyan);
254
- chronicle.defineType('critical', chronicle.chalk().bold.red);
255
- chronicle.defineType('dialog', 'magentaBright');
256
- chronicle.definetype('notice', '#c0c0c0', {
259
+ log.defineType('info', log.chalk().black.bgCyan);
260
+ log.defineType('critical', log.chalk().bold.red);
261
+ log.defineType('dialog', 'magentaBright');
262
+ log.definetype('notice', '#c0c0c0', {
257
263
  prefix: '--------------------------------------------------------------- \n',
258
264
  suffix: '\n=============================================================== \n'
259
265
  });
260
266
 
261
- chronicle.info('This pre-existing log now has a cyan background and black foreground');
262
- chronicle.critical('This new log is bold and red');
263
- chronicle.dialog('This new dialog is bright magenta');
264
- chronicle.notice('This new log is the hex "#c0c0c0" share of gray');
267
+ log.info('This pre-existing log now has a cyan background and black foreground');
268
+ log.critical('This new log is bold and red');
269
+ log.dialog('This new dialog is bright magenta');
270
+ log.notice('This new log is the hex "#c0c0c0" share of gray');
265
271
  ```
266
272
 
267
273
  `defineType()` can also be used as an alternative to populating the `additionalLogs` setting in the constructor, as if the setting doesn't already exist, it will then be created.
268
274
 
275
+ ### Dynamic File Names
276
+
277
+ The `filename` option supports template variables that are resolved at write-time, allowing each log type to produce uniquely named files.
278
+
279
+ #### Supported Variables
280
+
281
+ | Variable | Resolves To | Example Output |
282
+ | :---: | :--- | :--- |
283
+ | `{date}` | Current date in YYYY-MM-DD format | `2026-04-04` |
284
+ | `{type}` | Log type name | `error` |
285
+ | `{pid}` | Current process ID | `12345` |
286
+ | `{hostname}` | Machine hostname | `my-server` |
287
+
288
+ #### Examples
289
+
290
+ ```js
291
+ // Per-type filename via defineType
292
+ log.defineType('error', 'red', { filename: 'error-{date}.log' });
293
+ // writes to: logs/error-2026-04-04.log
294
+
295
+ // Per-type filename with multiple variables
296
+ log.defineType('info', 'cyan', { filename: '{type}-{hostname}-{date}.log' });
297
+ // writes to: logs/info-my-server-2026-04-04.log
298
+
299
+ // Global filename template via constructor
300
+ const log = new Log({ filename: '{type}-{date}.log' });
301
+ // all types write to: logs/<type>-2026-04-04.log
302
+ ```
303
+
304
+ When no `filename` is configured, the default behavior of `{type}.log` is preserved for full backward compatibility.
305
+
306
+ Path traversal characters (`..`, `/`, `\`) are automatically stripped from resolved file names for security.
307
+
269
308
  ## Origin
270
309
 
271
- As a team of developers who are constantly working on side projects, we often litter our codebase with TODOs to refactor convenience utils such as **chronicle** into classes of their own, or projects of their own. This usually turns into internal tech debt that never gets addressed. Furthermore, we also often find ourselves going the *copy -> paste -> modify* route of previously written useful logic, which saves us time in new projects, but not as much as it would if all we had to do was run an `npm install` instead.
310
+ As a team of developers who are constantly working on side projects, we often litter our codebase with TODOs to refactor convenience utils such as **@stonyx/logs** into classes of their own, or projects of their own. This usually turns into internal tech debt that never gets addressed. Furthermore, we also often find ourselves going the *copy -> paste -> modify* route of previously written useful logic, which saves us time in new projects, but not as much as it would if all we had to do was run an `npm install` instead.
272
311
 
273
- With that in mind, we are proud to release **chronicle** as an open source package, in hopes others will find this just as useful as we do in their own projects.
312
+ With that in mind, we are proud to release **@stonyx/logs** as an open source package, in hopes others will find this just as useful as we do in their own projects.
274
313
 
275
314
  ## Maintainers
276
315
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonyx/logs",
3
- "version": "1.0.1-beta.0",
3
+ "version": "1.0.1-beta.10",
4
4
  "description": "Simplified logging for node applications",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -8,6 +8,10 @@
8
8
  ".": "./src/index.js",
9
9
  "./color": "./src/color.js"
10
10
  },
11
+ "files": [
12
+ "src",
13
+ "README.md"
14
+ ],
11
15
  "publishConfig": {
12
16
  "access": "public",
13
17
  "provenance": true
@@ -20,7 +24,7 @@
20
24
  "log",
21
25
  "logging",
22
26
  "color-coding",
23
- "chronicle",
27
+ "stonyx",
24
28
  "history",
25
29
  "documentation",
26
30
  "document",
package/src/color.js CHANGED
@@ -22,7 +22,7 @@ export default class Color {
22
22
  // retrieves chalk color function, and fully validates output
23
23
  settingToChalkColorFunction(setting) {
24
24
  const errorMessage = 'Invalid chalk color function.'
25
- + 'For help with color settings, see https://github.com/abofs/chronicle#defining-logs--colors';
25
+ + 'For help with color settings, see https://github.com/abofs/stonyx-logs#defining-logs--colors';
26
26
 
27
27
  switch (typeof setting) {
28
28
  case 'string':
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { mkdirSync, promises as fsp } from 'fs';
2
2
  import { fileURLToPath } from 'url';
3
+ import { hostname } from 'os';
3
4
  import projectPath from 'path';
4
5
  import Color from './color.js';
5
6
 
@@ -9,6 +10,7 @@ const defaultOptions = {
9
10
  path: 'logs/', // default log directory (relative to main project root directory)
10
11
  prefix: '',
11
12
  suffix: '',
13
+ filename: '', // template for log file name (e.g. 'error-{date}.log'), defaults to '{type}.log'
12
14
 
13
15
  // log types with corresponding color settings
14
16
  additionalLogs: {},
@@ -22,7 +24,7 @@ const defaultOptions = {
22
24
  // used to sanitize defineType() options input
23
25
  const optionKeys = Object.keys(defaultOptions);
24
26
 
25
- export default class Chronicle {
27
+ export default class Log {
26
28
  constructor(options = defaultOptions) {
27
29
  options = {
28
30
  ...defaultOptions,
@@ -46,7 +48,7 @@ export default class Chronicle {
46
48
  }
47
49
  }
48
50
 
49
- // records setting and options for log type, and crates convenience method ie: chronicle.info()
51
+ // records setting and options for log type, and creates convenience method ie: log.info()
50
52
  defineType(type, setting, options = null) {
51
53
  this.color.setLogColor(type, setting);
52
54
 
@@ -59,7 +61,7 @@ export default class Chronicle {
59
61
  for (let option of Object.keys(options)) {
60
62
  if (!optionKeys.includes(option)) {
61
63
  throw `${option} is not a valid configuration object.`
62
- + '\n For a list of available options, see https://github.com/abofs/chronicle#configuration';
64
+ + '\n For a list of available options, see https://github.com/abofs/stonyx-logs#configuration';
63
65
  }
64
66
 
65
67
  // sanitize path input
@@ -129,7 +131,9 @@ export default class Chronicle {
129
131
 
130
132
  async writeToFile(type, content, overwrite) {
131
133
  const path = this.getOptionForType(type, 'path');
132
- const targetLog = `${path}${type}.log`;
134
+ const filenameTemplate = this.getOptionForType(type, 'filename');
135
+ const resolvedName = this.resolveFilename(filenameTemplate, type);
136
+ const targetLog = `${path}${resolvedName}`;
133
137
  await this.validateFileAndDirectory(path, targetLog);
134
138
 
135
139
  const fileAction = overwrite ? fsp.writeFile : fsp.appendFile;
@@ -137,6 +141,31 @@ export default class Chronicle {
137
141
  return fileAction(targetLog, content);
138
142
  }
139
143
 
144
+ // resolves template variables in a filename string
145
+ resolveFilename(template, type) {
146
+ // default to '{type}.log' when no template is configured
147
+ if (!template) return `${type}.log`;
148
+
149
+ const now = new Date();
150
+ const yyyy = now.getFullYear();
151
+ const mm = String(now.getMonth() + 1).padStart(2, '0');
152
+ const dd = String(now.getDate()).padStart(2, '0');
153
+
154
+ const variables = {
155
+ date: `${yyyy}-${mm}-${dd}`,
156
+ type,
157
+ pid: process.pid,
158
+ hostname: hostname(),
159
+ };
160
+
161
+ const resolved = template.replace(/\{(\w+)\}/g, (match, key) => {
162
+ return variables[key] !== undefined ? variables[key] : match;
163
+ });
164
+
165
+ // sanitize: prevent path traversal and disallow directory separators
166
+ return resolved.replace(/\.\./g, '').replace(/[/\\]/g, '');
167
+ }
168
+
140
169
  // attempts to create file and/or directory if they don't already exist
141
170
  async validateFileAndDirectory(path, targetLog) {
142
171
  const errorMethod = this.error || console.error; // prefer native method unless removed by user
package/.eslintrc.cjs DELETED
@@ -1,118 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- parserOptions: {
4
- ecmaVersion: 2018,
5
- sourceType: 'module',
6
- },
7
- extends: [
8
- 'eslint:recommended',
9
- ],
10
- globals: {
11
- Promise: 'readonly',
12
- require: 'readonly',
13
- module: 'readonly',
14
- },
15
- env: { browser: true },
16
- rules: {
17
- indent: ['error', 2],
18
- 'brace-style': ['error', '1tbs', { allowSingleLine: true }],
19
- 'eol-last': ['error', 'always'],
20
- 'comma-dangle': ['error', 'always-multiline'],
21
- 'no-alert': 'error',
22
- 'key-spacing': ['error', {
23
- beforeColon: false,
24
- afterColon: true,
25
- }],
26
- 'keyword-spacing': 'error',
27
- 'linebreak-style': ['error', 'unix'],
28
- 'lines-around-comment': ['error', {
29
- beforeBlockComment: true,
30
- afterBlockComment: false,
31
- beforeLineComment: true,
32
- afterLineComment: false,
33
- allowBlockStart: true,
34
- allowClassStart: true,
35
- allowObjectStart: true,
36
- allowArrayStart: true,
37
- }],
38
- 'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
39
- 'multiline-comment-style': ['error', 'starred-block'],
40
- 'no-lonely-if': 'error',
41
- 'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
42
- 'no-multiple-empty-lines': ['error', {
43
- max: 2,
44
- maxEOF: 1,
45
- }],
46
- 'no-trailing-spaces': 'error',
47
- 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
48
- 'no-whitespace-before-property': 'error',
49
- 'nonblock-statement-body-position': ['error', 'beside', { overrides: { while: 'below' }}],
50
- 'object-curly-newline': ['error', { multiline: true }],
51
- 'object-curly-spacing': ['error', 'always', {
52
- objectsInObjects: false,
53
- arraysInObjects: false,
54
- }],
55
- 'object-property-newline': 'error',
56
- 'operator-assignment': ['error', 'always'],
57
- 'padding-line-between-statements': ['error', {
58
- blankLine: 'always',
59
- prev: '*',
60
- next: 'return',
61
- }],
62
- 'quote-props': ['error', 'as-needed'],
63
- quotes: ['error', 'single', {
64
- avoidEscape: true,
65
- allowTemplateLiterals: true,
66
- }],
67
- semi: ['error', 'always'],
68
- 'semi-spacing': 'error',
69
- 'semi-style': ['error', 'last'],
70
- 'space-before-blocks': ['error', 'always'],
71
- 'space-before-function-paren': ['error', 'never'],
72
- 'space-in-parens': ['error', 'never'],
73
- 'space-infix-ops': 'error',
74
- 'space-unary-ops': ['error', {
75
- words: true,
76
- nonwords: false,
77
- }],
78
- 'spaced-comment': ['error', 'always'],
79
- 'switch-colon-spacing': 'error',
80
- 'template-tag-spacing': ['error', 'always'],
81
- 'wrap-regex': 'error',
82
- 'arrow-parens': ['error', 'as-needed'],
83
- 'arrow-spacing': 'error',
84
- 'generator-star-spacing': ['error', {
85
- before: true,
86
- after: false,
87
- }],
88
- 'no-console': ['error', { allow: ['warn', 'error']}],
89
- 'no-case-declarations': 'off',
90
- 'no-useless-computed-key': 'error',
91
- 'no-useless-rename': 'error',
92
- 'no-var': 'error',
93
- 'object-shorthand': 'error',
94
- 'prefer-arrow-callback': 'error',
95
- 'prefer-const': 'error',
96
- 'prefer-numeric-literals': 'error',
97
- 'prefer-template': 'error',
98
- 'template-curly-spacing': 'error',
99
- 'yield-star-spacing': 'error',
100
- },
101
- overrides: [
102
- {
103
- files: [
104
- '.eslintrc.js',
105
- ],
106
- parserOptions: {
107
- sourceType: 'script',
108
- ecmaVersion: 2018,
109
- },
110
- env: {
111
- browser: false,
112
- node: true,
113
- },
114
- plugins: ['node'],
115
- rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { 'node/no-unpublished-require': 'off' }),
116
- },
117
- ],
118
- };
@@ -1 +0,0 @@
1
- github: abofs
@@ -1,16 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- pull_request:
5
- branches: [dev, main]
6
-
7
- concurrency:
8
- group: ci-${{ github.head_ref || github.ref }}
9
- cancel-in-progress: true
10
-
11
- permissions:
12
- contents: read
13
-
14
- jobs:
15
- test:
16
- uses: abofs/stonyx-workflows/.github/workflows/ci.yml@main
@@ -1,51 +0,0 @@
1
- name: Publish to NPM
2
-
3
- on:
4
- repository_dispatch:
5
- types: [cascade-publish]
6
- workflow_dispatch:
7
- inputs:
8
- version-type:
9
- description: 'Version type'
10
- required: true
11
- type: choice
12
- options:
13
- - patch
14
- - minor
15
- - major
16
- custom-version:
17
- description: 'Custom version (optional, overrides version-type)'
18
- required: false
19
- type: string
20
- pull_request:
21
- types: [opened, synchronize, reopened]
22
- branches: [main]
23
- push:
24
- branches: [main]
25
-
26
- concurrency:
27
- group: ${{ github.event_name == 'repository_dispatch' && 'cascade-update' || format('publish-{0}', github.ref) }}
28
- cancel-in-progress: false
29
-
30
- permissions:
31
- contents: write
32
- id-token: write
33
- pull-requests: write
34
-
35
- jobs:
36
- publish:
37
- if: "!contains(github.event.head_commit.message, '[skip ci]')"
38
- uses: abofs/stonyx-workflows/.github/workflows/npm-publish.yml@main
39
- with:
40
- version-type: ${{ github.event.inputs.version-type }}
41
- custom-version: ${{ github.event.inputs.custom-version }}
42
- cascade-source: ${{ github.event.client_payload.source_package || '' }}
43
- secrets: inherit
44
-
45
- cascade:
46
- needs: publish
47
- uses: abofs/stonyx-workflows/.github/workflows/cascade.yml@main
48
- with:
49
- package-name: ${{ needs.publish.outputs.package-name }}
50
- published-version: ${{ needs.publish.outputs.published-version }}
51
- secrets: inherit