@stacksjs/config 0.51.0 → 0.58.43

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,38 +1,47 @@
1
- # Stacks Config
1
+ # Stacks Objects
2
2
 
3
- This package simplifies accessing your Stacks configuration.
3
+ Easily work with objects.
4
4
 
5
5
  ## ☘️ Features
6
6
 
7
- - ⚡️ API to access your Stacks config
7
+ - Access to Laravel-like Collections API
8
+ - Other object helpers
8
9
 
9
10
  ## 🤖 Usage
10
11
 
11
12
  ```bash
12
- pnpm i -D @stacksjs/config
13
+ bun install -d @stacksjs/objects
13
14
  ```
14
15
 
15
- Now, you can use it in your project:
16
+ Now, you can easily access it in your project:
16
17
 
17
- ```ts
18
- import { app, deploy, docs, git, hashing, library, services, ui } from '@stacksjs/config'
18
+ ```js
19
+ import { collect } from '@stacksjs/objects'
19
20
 
20
- console.log(app) // { name: 'Your App Name', env: 'local', url: 'https://localhost', ... }
21
+ const collection = collect([{
22
+ name: 'My story',
23
+ pages: 176,
24
+ }, {
25
+ name: 'Fantastic Beasts and Where to Find Them',
26
+ pages: 1096,
27
+ }])
28
+
29
+ console.log(collection.avg('pages')) // 636
21
30
  ```
22
31
 
23
- Learn more in the docs.
32
+ To view the full documentation, please visit [https://stacksjs.org/objects](https://stacksjs.org/objects).
24
33
 
25
34
  ## 🧪 Testing
26
35
 
27
36
  ```bash
28
- pnpm test
37
+ bun test
29
38
  ```
30
39
 
31
40
  ## 📈 Changelog
32
41
 
33
42
  Please see our [releases](https://github.com/stacksjs/stacks/releases) page for more information on what has changed recently.
34
43
 
35
- ## 💪🏼 Contributing
44
+ ## 🚜 Contributing
36
45
 
37
46
  Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.
38
47
 
@@ -44,10 +53,19 @@ For help, discussion about best practices, or any other conversation that would
44
53
 
45
54
  For casual chit-chat with others using this package:
46
55
 
47
- [Join the Stacks Discord Server](https://discord.ow3.org)
56
+ [Join the Stacks Discord Server](https://discord.gg/stacksjs)
57
+
58
+ ## 🙏🏼 Credits
59
+
60
+ Many thanks to the following core technologies & people who have contributed to this package:
61
+
62
+ - [Collect.js](https://github.com/ecrmnn/collect.js)
63
+ - [Laravel](https://laravel.com/)
64
+ - [Chris Breuer](https://github.com/chrisbbreuer)
65
+ - [All Contributors](../../contributors)
48
66
 
49
67
  ## 📄 License
50
68
 
51
69
  The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
52
70
 
53
- Made with ❤️
71
+ Made with 💙
package/package.json CHANGED
@@ -1,52 +1,54 @@
1
1
  {
2
2
  "name": "@stacksjs/config",
3
3
  "type": "module",
4
- "version": "0.51.0",
5
- "packageManager": "pnpm@7.26.3",
6
- "description": "The Stacks configuration.",
4
+ "version": "0.58.43",
5
+ "description": "The Stacks config helper methods.",
7
6
  "author": "Chris Breuer",
8
7
  "license": "MIT",
9
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
10
- "homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/config#readme",
9
+ "homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/config#readme",
11
10
  "repository": {
12
11
  "type": "git",
13
12
  "url": "git+https://github.com/stacksjs/stacks.git",
14
- "directory": "./.stacks/core/config"
13
+ "directory": "./storage/framework/core/config"
15
14
  },
16
15
  "bugs": {
17
16
  "url": "https://github.com/stacksjs/stacks/issues"
18
17
  },
19
18
  "keywords": [
20
- "configuration",
19
+ "config",
20
+ "utilities",
21
+ "functions",
21
22
  "stacks"
22
23
  ],
23
- "main": "dist/index.mjs",
24
- "module": "dist/index.mjs",
25
- "types": "dist/index.d.ts",
26
24
  "contributors": [
27
- "Chris Breuer <chris@ow3.org>"
25
+ "Chris Breuer <chris@stacksjs.org>"
28
26
  ],
27
+ "exports": {
28
+ ".": {
29
+ "bun": "./src/index.ts",
30
+ "import": "./dist/index.js"
31
+ },
32
+ "./*": {
33
+ "bun": "./*"
34
+ }
35
+ },
29
36
  "files": [
30
- "dist",
31
- "README.md"
37
+ "README.md",
38
+ "src"
32
39
  ],
33
- "engines": {
34
- "node": ">=v18.14.0",
35
- "pnpm": ">=7.26.3"
40
+ "scripts": {
41
+ "build": "bun --bun build.ts",
42
+ "typecheck": "bun --bun tsc --noEmit",
43
+ "prepublishOnly": "bun --bun run build"
36
44
  },
37
45
  "peerDependencies": {
38
- "@stacksjs/path": "0.51.0",
39
- "@stacksjs/utils": "0.51.0"
46
+ "@stacksjs/utils": "workspace:*",
47
+ "@stacksjs/validation": "workspace:*"
40
48
  },
41
49
  "devDependencies": {
42
- "mkdist": "^1.1.0",
43
- "typescript": "^4.9.5",
44
- "unbuild": "^1.1.1",
45
- "@stacksjs/testing": "0.51.0"
46
- },
47
- "scripts": {
48
- "build": "unbuild",
49
- "dev": "unbuild --stub",
50
- "typecheck": "tsc --noEmit"
50
+ "@stacksjs/alias": "workspace:*",
51
+ "@stacksjs/development": "workspace:*",
52
+ "@stacksjs/types": "workspace:*"
51
53
  }
52
- }
54
+ }
package/src/config.ts ADDED
@@ -0,0 +1,38 @@
1
+ import type { StacksOptions } from '@stacksjs/types'
2
+ import defaults from './defaults'
3
+ import overrides from './overrides'
4
+
5
+ export const config: StacksOptions = {
6
+ ...defaults,
7
+ ...overrides,
8
+ }
9
+
10
+ export const {
11
+ ai,
12
+ analytics,
13
+ api,
14
+ app,
15
+ binary,
16
+ cache,
17
+ cloud,
18
+ database,
19
+ dns,
20
+ docs,
21
+ email,
22
+ git,
23
+ hashing,
24
+ library,
25
+ notification,
26
+ payment,
27
+ queue,
28
+ security,
29
+ searchEngine,
30
+ services,
31
+ storage,
32
+ team,
33
+ ui,
34
+ }: StacksOptions = config
35
+
36
+ export { defaults, overrides }
37
+
38
+ export * from './helpers'
@@ -0,0 +1,460 @@
1
+ import { path as p } from '@stacksjs/path'
2
+ import type { StacksOptions } from '@stacksjs/types'
3
+
4
+ // import { userConfig as overrides } from './overrides'
5
+
6
+ export default {
7
+ ai: {
8
+ models: [
9
+ 'amazon.titan-embed-text-v1',
10
+ 'amazon.titan-text-express-v1',
11
+ 'amazon.titan-embed-image-v1',
12
+ 'amazon.titan-image-generator-v1',
13
+ 'anthropic.claude-v1',
14
+ 'anthropic.claude-v2',
15
+ 'anthropic.claude-v2:1',
16
+ 'anthropic.claude-instant-v1',
17
+ 'meta.llama2-13b-chat-v1',
18
+ 'meta.llama2-70b-chat-v1',
19
+ ],
20
+ },
21
+
22
+ analytics: {
23
+ driver: undefined,
24
+ },
25
+
26
+ api: {
27
+ prefix: 'api',
28
+ description: 'Stacks API',
29
+ prewarm: true,
30
+ memorySize: 512,
31
+ timeout: 30,
32
+ // version: 'v1',
33
+ },
34
+
35
+ app: {
36
+ name: 'Stacks',
37
+ description: 'A Stacks application.',
38
+ env: 'local',
39
+ url: 'stacks.localhost',
40
+ debug: true,
41
+ key: '',
42
+ timezone: 'UTC',
43
+ locale: 'en',
44
+ fallbackLocale: 'en',
45
+ cipher: 'AES-256-CBC',
46
+ docMode: false,
47
+ redirectUrls: [],
48
+ maintenanceMode: false,
49
+ ports: {
50
+ frontend: 3333,
51
+ backend: 3334,
52
+ admin: 3335,
53
+ library: 3336,
54
+ desktop: 3337,
55
+ email: 3338,
56
+ docs: 3339,
57
+ inspect: 3340,
58
+ api: 3999,
59
+ },
60
+ },
61
+
62
+ binary: {
63
+ name: 'buddy',
64
+ command: 'buddy',
65
+ description: 'Stacks is a full-stack framework for TypeScript.',
66
+ source: p.appPath('commands'),
67
+ },
68
+
69
+ cache: {
70
+ driver: 'redis',
71
+ prefix: 'stx',
72
+ ttl: 3600,
73
+
74
+ drivers: {
75
+ redis: {
76
+ connection: 'default',
77
+ host: 'localhost',
78
+ port: 6379,
79
+ },
80
+ },
81
+ },
82
+
83
+ cloud: {
84
+ driver: 'aws',
85
+
86
+ storage: {},
87
+
88
+ firewall: {
89
+ enabled: true,
90
+ countryCodes: [],
91
+ ipAddresses: [],
92
+ queryString: [],
93
+ httpHeaders: [],
94
+ // ipSets: [],
95
+ rateLimitPerMinute: 1000,
96
+ useIpReputationLists: true,
97
+ useKnownBadInputsRuleSet: true,
98
+ },
99
+
100
+ cdn: {
101
+ allowedMethods: 'GET_HEAD',
102
+ cachedMethods: 'GET_HEAD',
103
+ minTtl: 0,
104
+ defaultTtl: 86400,
105
+ maxTtl: 31536000,
106
+ compress: true,
107
+ priceClass: 'PriceClass_All',
108
+ originShieldRegion: 'us-east-1',
109
+ cookieBehavior: 'none',
110
+ allowList: {
111
+ cookies: [],
112
+ headers: [],
113
+ queryStrings: [],
114
+ },
115
+ },
116
+
117
+ ai: true,
118
+ docs: true,
119
+ api: true,
120
+ fileSystem: true,
121
+ },
122
+
123
+ database: {
124
+ default: 'sqlite',
125
+
126
+ name: 'stacks',
127
+
128
+ connections: {
129
+ sqlite: {
130
+ database: p.projectStoragePath('framework/database/stacks.sqlite'),
131
+ prefix: '',
132
+ },
133
+ },
134
+ },
135
+
136
+ dns: {
137
+ driver: 'aws',
138
+ a: [],
139
+ aaaa: [],
140
+ cname: [],
141
+ mx: [],
142
+ txt: [],
143
+ },
144
+
145
+ docs: {
146
+ lang: 'en-US',
147
+ title: 'Stacks',
148
+ description: 'Rapid application, cloud & library framework.',
149
+ lastUpdated: true,
150
+
151
+ themeConfig: {
152
+ editLink: {
153
+ pattern: 'https://github.com/stacksjs/stacks/edit/main/docs/docs/:path',
154
+ text: 'Edit this page on GitHub',
155
+ },
156
+
157
+ footer: {
158
+ message: 'Released under the MIT License.',
159
+ copyright: 'Copyright © 2024-present Stacks.js, Inc.',
160
+ },
161
+
162
+ // algolia: services.algolia,
163
+
164
+ // carbonAds: {
165
+ // code: '',
166
+ // placement: '',
167
+ // },
168
+ },
169
+ },
170
+
171
+ email: {
172
+ from: {
173
+ name: 'Stacks',
174
+ address: 'no-reply@stacksjs.org',
175
+ },
176
+
177
+ server: {
178
+ scan: true,
179
+ mailboxes: [],
180
+ },
181
+ },
182
+
183
+ git: {
184
+ hooks: {
185
+ 'pre-commit': 'lint-staged',
186
+ },
187
+
188
+ scopes: [
189
+ '',
190
+ 'ci',
191
+ 'deps',
192
+ 'dx',
193
+ 'release',
194
+ 'docs',
195
+ 'test',
196
+ 'core',
197
+ 'actions',
198
+ 'arrays',
199
+ 'auth',
200
+ 'build',
201
+ 'cache',
202
+ 'cli',
203
+ 'cloud',
204
+ 'collections',
205
+ 'config',
206
+ 'database',
207
+ 'datetime',
208
+ 'docs',
209
+ 'errors',
210
+ 'git',
211
+ 'lint',
212
+ 'x-ray',
213
+ 'modules',
214
+ 'notifications',
215
+ 'objects',
216
+ 'path',
217
+ 'realtime',
218
+ 'router',
219
+ 'buddy',
220
+ 'security',
221
+ 'server',
222
+ 'storage',
223
+ 'strings',
224
+ 'tests',
225
+ 'types',
226
+ 'ui',
227
+ 'utils',
228
+ ],
229
+
230
+ messages: {
231
+ type: 'Select the type of change that you’re committing:',
232
+ scope: 'Select the SCOPE of this change (optional):',
233
+ customScope: 'Select the SCOPE of this change:',
234
+ subject: 'Write a SHORT, IMPERATIVE tense description of the change:\n',
235
+ body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
236
+ breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
237
+ footerPrefixesSelect: 'Select the ISSUES type of the change list by this change (optional):',
238
+ customFooterPrefixes: 'Input ISSUES prefix:',
239
+ footer: 'List any ISSUES by this change. E.g.: #31, #34:\n',
240
+ confirmCommit: 'Are you sure you want to proceed with the commit above?',
241
+ },
242
+
243
+ types: [
244
+ { value: 'feat', name: 'feat: ✨ A new feature', emoji: ':sparkles:' },
245
+ { value: 'fix', name: 'fix: 🐛 A bug fix', emoji: ':bug:' },
246
+ { value: 'docs', name: 'docs: 📝 Documentation only changes', emoji: ':memo:' },
247
+ { value: 'style', name: 'style: 💄 Changes that do not affect the meaning of the code', emoji: ':lipstick:' },
248
+ { value: 'refactor', name: 'refactor: ♻️ A code change that neither fixes a bug nor adds a feature', emoji: ':recycle:' },
249
+ { value: 'perf', name: 'perf: ⚡️ A code change that improves performance', emoji: ':zap:' },
250
+ { value: 'test', name: 'test: ✅ Adding missing tests or adjusting existing tests', emoji: ':white_check_mark:' },
251
+ { value: 'build', name: 'build: 📦️ Changes that affect the build system or external dependencies', emoji: ':package:' },
252
+ { value: 'ci', name: 'ci: 🎡 Changes to our CI configuration files and scripts', emoji: ':ferris_wheel:' },
253
+ { value: 'chore', name: 'chore: 🔨 Other changes that don’t modify src or test files', emoji: ':hammer:' },
254
+ { value: 'revert', name: 'revert: ⏪️ Reverts a previous commit', emoji: ':rewind:' },
255
+ ],
256
+ },
257
+
258
+ hashing: {
259
+ driver: 'argon2',
260
+
261
+ bcrypt: {
262
+ rounds: 10,
263
+ cost: 4, // number between 4-31
264
+ },
265
+
266
+ argon2: {
267
+ memory: 65536, // memory usage in kibibytes
268
+ threads: 1,
269
+ time: 1, // the number of iterations
270
+ },
271
+ },
272
+
273
+ library: {
274
+ name: 'hello-world',
275
+ owner: '@stacksjs', // you may or may not add the @ prefix here (it is added automatically)
276
+ repository: 'stacksjs/stacks',
277
+ license: 'MIT',
278
+ author: 'Chris Breuer',
279
+ contributors: ['Chris Breuer <chris@stacksjs.org>'],
280
+ defaultLanguage: 'en',
281
+
282
+ vueComponents: {
283
+ name: 'hello-world-vue',
284
+ description: 'Your Vue component library description',
285
+ keywords: ['component', 'library', 'vue', 'vite', 'typescript', 'javascript'],
286
+ tags: [{
287
+ name: ['HelloWorld', 'AppHelloWorld'],
288
+ description: 'The Hello World custom element, built via this framework.',
289
+ attributes: [{
290
+ name: 'greeting',
291
+ description: 'The greeting.',
292
+ }],
293
+ }],
294
+ },
295
+
296
+ webComponents: {
297
+ name: 'hello-world-elements',
298
+ description: 'Your framework agnostic web component library description.',
299
+ keywords: ['custom-elements', 'web-components', 'library', 'framework-agnostic', 'typescript', 'javascript'],
300
+ tags: [{
301
+ name: ['HelloWorld', 'AppHelloWorld'],
302
+ description: 'The Hello World custom element, built via this framework.',
303
+ attributes: [{
304
+ name: 'greeting',
305
+ description: 'The greeting.',
306
+ }],
307
+ }],
308
+ },
309
+
310
+ functions: {
311
+ name: 'hello-world-fx',
312
+ description: 'Your function library description.',
313
+ keywords: ['functions', 'composables', 'library', 'typescript', 'javascript'],
314
+ shouldGenerateSourcemap: false,
315
+ functions: [
316
+ 'counter',
317
+ 'dark',
318
+ ],
319
+ },
320
+ },
321
+
322
+ notification: {
323
+ default: 'email',
324
+ },
325
+
326
+ payment: {
327
+ driver: 'stripe',
328
+ },
329
+
330
+ queue: {
331
+ default: 'sync',
332
+
333
+ connections: {
334
+ sync: {
335
+ driver: 'sync',
336
+ },
337
+
338
+ database: {
339
+ driver: 'database',
340
+ table: 'jobs',
341
+ queue: 'default',
342
+ retry_after: 90,
343
+ },
344
+
345
+ redis: {
346
+ driver: 'redis',
347
+ connection: 'default',
348
+ queue: 'default',
349
+ retry_after: 90,
350
+ },
351
+
352
+ sqs: {
353
+ driver: 'sqs',
354
+ key: '',
355
+ secret: '',
356
+ prefix: '',
357
+ suffix: '',
358
+ queue: 'default',
359
+ region: 'us-east-1',
360
+ },
361
+ },
362
+ },
363
+
364
+ searchEngine: {
365
+ driver: 'meilisearch',
366
+ },
367
+
368
+ security: {
369
+ firewall: {
370
+ enabled: true,
371
+ countryCodes: [],
372
+ ipAddresses: [],
373
+ queryString: [],
374
+ httpHeaders: [],
375
+ // ipSets: [],
376
+ rateLimitPerMinute: 1000,
377
+ useIpReputationLists: true,
378
+ useKnownBadInputsRuleSet: true,
379
+ },
380
+ },
381
+
382
+ services: {
383
+ aws: {
384
+ accountId: '',
385
+ appId: '',
386
+ apiKey: '',
387
+ region: 'us-east-1',
388
+ },
389
+
390
+ algolia: {
391
+ appId: '',
392
+ apiKey: '',
393
+ },
394
+
395
+ meilisearch: {
396
+ appId: '',
397
+ apiKey: '',
398
+ },
399
+
400
+ stripe: {
401
+ appId: '',
402
+ apiKey: '',
403
+ },
404
+
405
+ planetscale: {
406
+ appId: '',
407
+ apiKey: '',
408
+ },
409
+
410
+ supabase: {
411
+ appId: '',
412
+ apiKey: '',
413
+ },
414
+ },
415
+
416
+ storage: {
417
+ driver: 's3',
418
+ },
419
+
420
+ team: {
421
+ name: 'Stacks',
422
+ members: [{
423
+ 'Chris Breuer': 'chris@stacksjs.org',
424
+ }],
425
+ },
426
+
427
+ ui: {
428
+ shortcuts: [
429
+ ['btn', 'inline-flex items-center px-4 py-2 ml-2 border border-transparent shadow-sm text-base font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer'],
430
+ ],
431
+ safelist: 'prose prose-sm m-auto text-left',
432
+ trigger: ':stx:',
433
+ classPrefix: 'stx-',
434
+ reset: 'tailwind',
435
+
436
+ icons: ['heroicons'],
437
+
438
+ fonts: {
439
+ email: {
440
+ title: 'Mona',
441
+ text: 'Hubot',
442
+ },
443
+
444
+ desktop: {
445
+ title: 'Mona',
446
+ text: 'Hubot',
447
+ },
448
+
449
+ mobile: {
450
+ title: 'Mona',
451
+ text: 'Hubot',
452
+ },
453
+
454
+ web: {
455
+ title: 'Mona',
456
+ text: 'Hubot',
457
+ },
458
+ },
459
+ },
460
+ } satisfies StacksOptions