@stacksjs/actions 0.58.59 → 0.58.62

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/dist/src/clean.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // src/clean.ts
3
3
  import {log} from "@stacksjs/logging";
4
- import {clean} from "@stacksjs/utils";
4
+ import {cleanProject} from "@stacksjs/utils";
5
5
  log.info("Running clean command...");
6
- await clean();
6
+ await cleanProject();
@@ -5,5 +5,8 @@ import {projectPath} from "@stacksjs/path";
5
5
  import {NpmScript} from "@stacksjs/enums";
6
6
  log.info("Ensuring Code Style...");
7
7
  var options = parseOptions();
8
- await runCommand(NpmScript.LintFix, { cwd: projectPath() }, options);
8
+ await runCommand(NpmScript.LintFix, {
9
+ cwd: projectPath(),
10
+ ...options
11
+ });
9
12
  log.success("Linted");
@@ -5,33 +5,36 @@ import {intro, outro, runCommand} from "@stacksjs/cli";
5
5
  import {log} from "@stacksjs/logging";
6
6
  import {projectPath} from "@stacksjs/path";
7
7
  import * as storage from "@stacksjs/storage";
8
+ import {NpmScript} from "@stacksjs/enums";
8
9
  // package.json
9
- var version = "0.58.59";
10
+ var version = "0.58.62";
10
11
 
11
12
  // src/upgrade.ts
12
- function checkForUncommittedChanges(options2) {
13
+ function checkForUncommittedChanges(options) {
13
14
  try {
14
15
  } catch (error) {
15
16
  if (error.status === 1) {
16
- if (!options2?.force) {
17
+ if (!options?.force) {
17
18
  }
18
19
  }
19
20
  }
20
21
  }
21
- async function downloadFrameworkUpdate(options2) {
22
+ async function downloadFrameworkUpdate(options) {
22
23
  const tempFolderName = "updates";
23
24
  const tempUpdatePath = projectPath(tempFolderName);
24
25
  if (storage.doesFolderExist(tempUpdatePath))
25
26
  await deleteFolder(tempUpdatePath);
26
27
  log.info("Downloading framework updates...");
27
- await runCommand(`giget stacks ${tempFolderName}`, options2);
28
+ await runCommand(`giget stacks ${tempFolderName}`, options);
28
29
  log.success(`Your framework updated correctly to version: v${version}`);
29
30
  }
30
31
  async function updateDependencies() {
31
32
  const perf = await intro("buddy upgrade:dependencies");
32
- const result = await runCommand(NpmScript.UpgradeDependencies, options);
33
+ const result = await runCommand(NpmScript.UpgradeDependencies, {
34
+ cwd: projectPath()
35
+ });
33
36
  if (result.isErr()) {
34
- outro("While running the upgrade:dependencies command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
37
+ await outro("While running the upgrade:dependencies command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
35
38
  process.exit();
36
39
  }
37
40
  await outro("Freshly updated your dependencies.", { startTime: perf, useSeconds: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/actions",
3
3
  "type": "module",
4
- "version": "0.58.59",
4
+ "version": "0.58.62",
5
5
  "description": "The Stacks actions.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
package/src/action.ts CHANGED
@@ -1,15 +1,25 @@
1
1
  import type { JobOptions } from '@stacksjs/types'
2
2
 
3
+ interface ActionOptions {
4
+ name?: string
5
+ description?: string
6
+ handle: () => Promise<any> | any
7
+ rate?: JobOptions['rate']
8
+ tries?: JobOptions['tries']
9
+ backoff?: JobOptions['backoff']
10
+ enabled?: JobOptions['enabled']
11
+ }
12
+
3
13
  export class Action {
4
- name: string
5
- description: string
6
- rate: JobOptions['rate']
7
- tries: JobOptions['tries']
8
- backoff: JobOptions['backoff']
9
- enabled: JobOptions['enabled']
10
- handle: () => Promise<string>
14
+ name?: string
15
+ description?: string
16
+ rate?: JobOptions['rate']
17
+ tries?: JobOptions['tries']
18
+ backoff?: JobOptions['backoff']
19
+ enabled?: JobOptions['enabled']
20
+ handle: () => Promise<any>
11
21
 
12
- constructor({ name, description, handle, rate, tries, backoff, enabled }: { name: string, description: string, handle: () => Promise<string>, rate: JobOptions['rate'], tries: JobOptions['tries'], backoff: JobOptions['backoff'], enabled: JobOptions['enabled'] }) {
22
+ constructor({ name, description, handle, rate, tries, backoff, enabled }: ActionOptions) {
13
23
  this.name = name
14
24
  this.description = description
15
25
  this.rate = rate
package/src/clean.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { log } from '@stacksjs/logging'
2
- import { clean } from '@stacksjs/utils'
2
+ import { cleanProject } from '@stacksjs/utils'
3
3
 
4
4
  log.info('Running clean command...')
5
5
 
6
- await clean()
6
+ await cleanProject()
package/src/dev/api.ts CHANGED
@@ -5,8 +5,7 @@ import { config } from '@stacksjs/config'
5
5
 
6
6
  const options = parseOptions()
7
7
 
8
- if (options.verbose)
9
- log.info('Running API dev server via', `bunx vite --config ${p.vitePath('src/api.ts')}`, options)
8
+ log.debug('Running API dev server via', `bunx vite --config ${p.vitePath('src/api.ts')}`, options)
10
9
 
11
10
  serve({
12
11
  port: config.app.ports?.api, // defaults to 3999
@@ -1,34 +1,20 @@
1
1
  import process from 'node:process'
2
2
  import { createHostedZone, getNameservers, updateNameservers } from '@stacksjs/dns'
3
3
  import { app } from '@stacksjs/config'
4
- import { handleError } from '@stacksjs/error-handling'
5
- import { italic, parseOptions, runCommand } from '@stacksjs/cli'
4
+ import { italic, log, parseOptions, runCommand } from '@stacksjs/cli'
6
5
  import { whois } from '@stacksjs/whois'
7
6
  import { logger } from '@stacksjs/logging'
8
7
  import { projectConfigPath } from '@stacksjs/path'
9
8
 
10
- interface AddOptions {
11
- domain?: string
12
- verbose: boolean
13
- }
14
-
15
- const parsedOptions = parseOptions()
16
- const options: AddOptions = {
17
- domain: parsedOptions.domain as string,
18
- verbose: parsedOptions.verbose as boolean,
19
- }
9
+ const options = parseOptions()
10
+ const domain = (options.domain as string | undefined) ?? app.url
20
11
 
21
- if (!options.domain) {
22
- if (app.url) {
23
- options.domain = app.url
24
- }
25
- else {
26
- handleError('there was no domain provided when')
27
- process.exit(1)
28
- }
12
+ if (!domain) {
13
+ log.error('There was no Domain or App URL provided. Please provide a domain using the --domain flag or add a url to your app config.')
14
+ process.exit(1)
29
15
  }
30
16
 
31
- const result = await createHostedZone(options.domain)
17
+ const result = await createHostedZone(domain)
32
18
 
33
19
  if (result.isErr()) {
34
20
  handleError(result.error)
@@ -36,22 +22,21 @@ if (result.isErr()) {
36
22
  }
37
23
 
38
24
  // Update the nameservers
39
- const nameServers = await getNameservers(options.domain)
25
+ const nameServers = await getNameservers(domain)
40
26
 
41
27
  if (!nameServers) {
42
- handleError(`No nameservers found for domain: ${options.domain}. Please ensure the Hosted Zone exists in Route53.`)
28
+ handleError(`No nameservers found for domain: ${domain}. Please ensure the Hosted Zone exists in Route53.`)
43
29
  process.exit(1)
44
30
  }
45
31
 
46
32
  await updateNameservers(nameServers)
47
33
 
48
- const nameservers = result.value
49
- const registrar: string = (await whois(options.domain, true)).parsedData.Registrar
34
+ const registrar: string = (await whois(domain, true)).parsedData.Registrar
50
35
 
51
36
  // usually for Route53 registered domains, we don't need to update create a hosted zone as it's already
52
37
  // done for us. But in case it's not, we still need to ensure it's created before we can deploy
53
38
  if (registrar.includes('Amazon')) {
54
- if (parsedOptions.deploy) {
39
+ if (options.deploy) {
55
40
  await runCommand('buddy deploy')
56
41
  }
57
42
  else {
@@ -70,7 +55,7 @@ logger.log(` update your ${registrar} nameservers to the following:`)
70
55
 
71
56
  const emojis = ['1️⃣', '2️⃣', '3️⃣', '4️⃣']
72
57
  logger.log('')
73
- nameservers.forEach((nameserver, index) => {
58
+ nameServers.forEach((nameserver: string, index: number) => {
74
59
  logger.log(` ${emojis[index]} Nameserver: ${nameserver}`)
75
60
  })
76
61
  logger.log('')
package/src/lint/fix.ts CHANGED
@@ -3,6 +3,11 @@ import { projectPath } from '@stacksjs/path'
3
3
  import { NpmScript } from '@stacksjs/enums'
4
4
 
5
5
  log.info('Ensuring Code Style...')
6
+
6
7
  const options = parseOptions()
7
- await runCommand(NpmScript.LintFix, { cwd: projectPath() }, options)
8
+ await runCommand(NpmScript.LintFix, {
9
+ cwd: projectPath(),
10
+ ...options,
11
+ })
12
+
8
13
  log.success('Linted')
@@ -1,3 +1,3 @@
1
- import { generateMigrations } from './generate'
1
+ import { generateMigrations } from '../generate'
2
2
 
3
3
  generateMigrations()
package/src/upgrade.ts CHANGED
@@ -3,6 +3,7 @@ import { intro, outro, runCommand } from '@stacksjs/cli'
3
3
  import { log } from '@stacksjs/logging'
4
4
  import { projectPath } from '@stacksjs/path'
5
5
  import * as storage from '@stacksjs/storage'
6
+ import { NpmScript } from '@stacksjs/enums'
6
7
  import type { UpgradeOptions } from '@stacksjs/types'
7
8
  import { version } from '../package.json'
8
9
 
@@ -53,10 +54,12 @@ export async function downloadFrameworkUpdate(options: UpgradeOptions) {
53
54
  // export async function updateDependencies(options: UpgradeOptions) {
54
55
  export async function updateDependencies() {
55
56
  const perf = await intro('buddy upgrade:dependencies')
56
- const result = await runCommand(NpmScript.UpgradeDependencies, options)
57
+ const result = await runCommand(NpmScript.UpgradeDependencies, {
58
+ cwd: projectPath(),
59
+ })
57
60
 
58
61
  if (result.isErr()) {
59
- outro('While running the upgrade:dependencies command, there was an issue', { startTime: perf, useSeconds: true }, result.error)
62
+ await outro('While running the upgrade:dependencies command, there was an issue', { startTime: perf, useSeconds: true }, result.error)
60
63
  process.exit()
61
64
  }
62
65