@stacksjs/actions 0.59.11 → 0.61.0
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/add.js +29 -0
- package/dist/build/component-libs.js +9 -0
- package/dist/build/core.js +21 -0
- package/dist/build/stacks.js +8 -0
- package/dist/build.js +317 -0
- package/dist/bump.js +16 -0
- package/dist/changelog.js +17 -0
- package/dist/clean.js +6 -0
- package/dist/commit.js +17 -0
- package/dist/copy-types.js +14 -0
- package/dist/database/seed.js +8 -0
- package/dist/deploy/index.js +31 -0
- package/dist/dev/components.js +11 -0
- package/dist/dev/docs.js +7 -0
- package/dist/dev/index.js +112 -0
- package/dist/examples.js +43 -0
- package/dist/fresh.js +19 -0
- package/dist/generate/component-meta.js +59 -0
- package/dist/generate/ide-helpers.js +96 -0
- package/dist/generate/index.js +251 -0
- package/dist/generate/lib-entries.js +175 -0
- package/dist/generate/vscode-custom-data.js +96 -0
- package/dist/helpers/component-meta.js +50 -0
- package/dist/helpers/lib-entries.js +166 -0
- package/dist/helpers/package-json.js +146 -0
- package/dist/helpers/utils.js +67 -0
- package/dist/helpers/vscode-custom-data.js +88 -0
- package/dist/index.js +676 -0
- package/dist/key-generate.js +10 -0
- package/dist/lint/fix.js +12 -0
- package/dist/lint/index.js +16 -0
- package/dist/make.js +319 -0
- package/dist/prepublish.js +17 -0
- package/dist/release.js +646 -0
- package/dist/test/coverage.js +9 -0
- package/dist/test/feature.js +9 -0
- package/dist/test/ui.js +6 -0
- package/dist/test/unit.js +6 -0
- package/dist/test.js +6 -0
- package/dist/typecheck.js +6 -0
- package/dist/types.js +21 -0
- package/dist/upgrade/dependencies.js +6 -0
- package/dist/upgrade/framework.js +1 -0
- package/dist/upgrade/index.js +78 -0
- package/dist/upgrade.js +46 -0
- package/package.json +5 -5
- package/src/action.ts +1 -0
- package/src/actions.ts +2 -2
- package/src/add.ts +3 -6
- package/src/ai/request-model-access.ts +10 -7
- package/src/build/component-libs.ts +5 -2
- package/src/build/core.ts +1 -2
- package/src/build/stacks.ts +8 -5
- package/src/build.ts +11 -25
- package/src/bump.ts +0 -2
- package/src/check/ports.ts +2 -3
- package/src/commit.ts +2 -2
- package/src/copy-types.ts +1 -1
- package/src/database/seed.ts +8 -4
- package/src/deploy/create-receipt-rule.ts +3 -7
- package/src/deploy/index.ts +2 -1
- package/src/dev/api.ts +4 -4
- package/src/dev/components.ts +3 -5
- package/src/dev/index.ts +2 -2
- package/src/domains/add.ts +8 -6
- package/src/domains/purchase.ts +26 -24
- package/src/domains/remove.ts +5 -7
- package/src/examples.ts +9 -13
- package/src/find-projects.ts +4 -6
- package/src/fresh.ts +2 -1
- package/src/generate/action-types.ts +5 -7
- package/src/generate/component-meta.ts +2 -5
- package/src/generate/custom-cli-file.ts +4 -3
- package/src/generate/env-files.ts +38 -43
- package/src/generate/ide-helpers.ts +1 -2
- package/src/generate/index.ts +16 -40
- package/src/generate/lib-entries.ts +4 -7
- package/src/generate/pkgx-file.ts +6 -11
- package/src/generate/vscode-custom-data.ts +1 -3
- package/src/helpers/component-meta.ts +6 -11
- package/src/helpers/index.ts +5 -0
- package/src/helpers/lib-entries.ts +30 -25
- package/src/helpers/package-json.ts +13 -16
- package/src/helpers/utils.ts +56 -13
- package/src/helpers/vscode-custom-data.ts +1 -2
- package/src/index.ts +2 -1
- package/src/key-generate.ts +3 -4
- package/src/lint/fix.ts +10 -2
- package/src/lint/index.ts +6 -8
- package/src/make.ts +79 -77
- package/src/migrate/database.ts +22 -1
- package/src/migrate/fresh.ts +20 -0
- package/src/orm/base.ts +0 -0
- package/src/orm/generate-model.ts +1177 -0
- package/src/{generate/model-classes.ts → orm/user.ts} +33 -48
- package/src/prepublish.ts +5 -2
- package/src/release.ts +15 -11
- package/src/test/coverage.ts +5 -2
- package/src/test/feature.ts +5 -2
- package/src/test/ui.ts +1 -1
- package/src/test/unit.ts +1 -1
- package/src/test.ts +1 -1
- package/src/typecheck.ts +1 -1
- package/src/types.ts +2 -2
- package/src/upgrade/binary.ts +3 -5
- package/src/upgrade/index.ts +4 -8
- package/src/upgrade/shell.ts +10 -10
- package/src/upgrade.ts +28 -25
- package/dist/action.d.ts +0 -36
- package/dist/add.d.ts +0 -6
- package/dist/build/component-libs.d.ts +0 -1
- package/dist/build/core.d.ts +0 -1
- package/dist/build/stacks.d.ts +0 -1
- package/dist/build.d.ts +0 -9
- package/dist/bump.d.ts +0 -1
- package/dist/changelog.d.ts +0 -1
- package/dist/clean.d.ts +0 -1
- package/dist/commit.d.ts +0 -3
- package/dist/copy-types.d.ts +0 -5
- package/dist/database/seed.d.ts +0 -1
- package/dist/deploy/index.d.ts +0 -1
- package/dist/dev/components.d.ts +0 -1
- package/dist/dev/docs.d.ts +0 -1
- package/dist/dev/index.d.ts +0 -10
- package/dist/examples.d.ts +0 -5
- package/dist/fresh.d.ts +0 -1
- package/dist/generate/component-meta.d.ts +0 -5
- package/dist/generate/ide-helpers.d.ts +0 -6
- package/dist/generate/index.d.ts +0 -13
- package/dist/generate/lib-entries.d.ts +0 -2
- package/dist/generate/vscode-custom-data.d.ts +0 -6
- package/dist/helpers/component-meta.d.ts +0 -22
- package/dist/helpers/lib-entries.d.ts +0 -13
- package/dist/helpers/package-json.d.ts +0 -3
- package/dist/helpers/utils.d.ts +0 -18
- package/dist/helpers/vscode-custom-data.d.ts +0 -2
- package/dist/index.d.ts +0 -7
- package/dist/key-generate.d.ts +0 -1
- package/dist/lint/fix.d.ts +0 -1
- package/dist/lint/index.d.ts +0 -1
- package/dist/make.d.ts +0 -20
- package/dist/prepublish.d.ts +0 -1
- package/dist/release.d.ts +0 -2
- package/dist/test/coverage.d.ts +0 -1
- package/dist/test/feature.d.ts +0 -1
- package/dist/test/ui.d.ts +0 -1
- package/dist/test/unit.d.ts +0 -1
- package/dist/test.d.ts +0 -1
- package/dist/tinker.d.ts +0 -1
- package/dist/typecheck.d.ts +0 -1
- package/dist/types.d.ts +0 -3
- package/dist/upgrade/dependencies.d.ts +0 -1
- package/dist/upgrade/framework.d.ts +0 -1
- package/dist/upgrade/index.d.ts +0 -1
- package/dist/upgrade.d.ts +0 -4
- package/src/database/fields.ts +0 -111
- package/src/database/migration-mysql.ts +0 -72
- package/src/database/migration-sqlite.ts +0 -67
- package/src/database/migration.ts +0 -10
- package/src/database/user-migration.ts +0 -20
- package/src/generate/model-generate.ts +0 -12
- package/src/migrate/dns.ts +0 -3
- package/src/tinker.ts +0 -10
package/dist/types.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/types.ts
|
|
3
|
+
import process from "process";
|
|
4
|
+
import {NpmScript} from "@stacksjs/enums";
|
|
5
|
+
import {log} from "@stacksjs/logging";
|
|
6
|
+
import {runNpmScript} from "@stacksjs/utils";
|
|
7
|
+
async function invoke(options) {
|
|
8
|
+
const results = await runNpmScript(NpmScript.TypesFix, options);
|
|
9
|
+
if (results.isErr()) {
|
|
10
|
+
log.error("There was an error fixing your types.", results.error);
|
|
11
|
+
process.exit();
|
|
12
|
+
}
|
|
13
|
+
log.success("Types are set");
|
|
14
|
+
}
|
|
15
|
+
async function types(options) {
|
|
16
|
+
return invoke(options);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
types,
|
|
20
|
+
invoke
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// @bun
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/helpers/utils.ts
|
|
3
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
4
|
+
import {err} from "@stacksjs/error-handling";
|
|
5
|
+
import {log} from "@stacksjs/logging";
|
|
6
|
+
import * as p from "@stacksjs/path";
|
|
7
|
+
import {glob} from "@stacksjs/storage";
|
|
8
|
+
var {Glob } = globalThis.Bun;
|
|
9
|
+
async function runAction(action, options) {
|
|
10
|
+
const glob2 = new Glob("**/*.ts");
|
|
11
|
+
const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true };
|
|
12
|
+
for await (const file of glob2.scan(scanOptions)) {
|
|
13
|
+
log.debug("file", file);
|
|
14
|
+
if (file === `${action}.ts` || file.endsWith(`${action}.ts`))
|
|
15
|
+
return (await import(p.userActionsPath(file))).default.handle();
|
|
16
|
+
const a = await import(p.userActionsPath(file));
|
|
17
|
+
if (a.name === action)
|
|
18
|
+
return await a.handle();
|
|
19
|
+
}
|
|
20
|
+
const opts = buddyOptions();
|
|
21
|
+
const path = p.relativeActionsPath(`src/${action}.ts`);
|
|
22
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
23
|
+
const optionsWithCwd = {
|
|
24
|
+
cwd: options?.cwd || p.projectPath(),
|
|
25
|
+
...options
|
|
26
|
+
};
|
|
27
|
+
log.debug("runAction:", cmd);
|
|
28
|
+
log.debug("action options:", optionsWithCwd);
|
|
29
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
30
|
+
}
|
|
31
|
+
async function runActions(actions, options) {
|
|
32
|
+
log.debug("runActions:", actions, options);
|
|
33
|
+
if (!actions.length)
|
|
34
|
+
return err("No actions were specified");
|
|
35
|
+
for (const action of actions) {
|
|
36
|
+
log.debug(`running action "${action}"`);
|
|
37
|
+
if (!hasAction(action))
|
|
38
|
+
return err(`The specified action "${action}" does not exist`);
|
|
39
|
+
}
|
|
40
|
+
const opts = buddyOptions();
|
|
41
|
+
const o = {
|
|
42
|
+
cwd: options?.cwd || p.projectPath(),
|
|
43
|
+
...options
|
|
44
|
+
};
|
|
45
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`src/${action}.ts`)} ${opts}`);
|
|
46
|
+
log.debug("commands:", commands);
|
|
47
|
+
return await runCommands(commands, o);
|
|
48
|
+
}
|
|
49
|
+
function hasAction(action) {
|
|
50
|
+
const userActionPatterns = [
|
|
51
|
+
`${action}.ts`,
|
|
52
|
+
`${action}`,
|
|
53
|
+
`Dashboard/${action}.ts`,
|
|
54
|
+
`Dashboard/${action}`,
|
|
55
|
+
`Buddy/${action}.ts`,
|
|
56
|
+
`Buddy/${action}`
|
|
57
|
+
];
|
|
58
|
+
const actionPatterns = [`src/${action}.ts`, `src/${action}`, `${action}.ts`, `${action}`];
|
|
59
|
+
const userActionFiles = glob.sync(userActionPatterns.map((pattern) => p.userActionsPath(pattern)));
|
|
60
|
+
const actionFiles = glob.sync(actionPatterns.map((pattern) => p.actionsPath(pattern)));
|
|
61
|
+
return userActionFiles.length > 0 || actionFiles.length > 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/upgrade/index.ts
|
|
65
|
+
import process from "process";
|
|
66
|
+
import {parseArgs} from "@stacksjs/cli";
|
|
67
|
+
import {Action} from "@stacksjs/enums";
|
|
68
|
+
import {ExitCode} from "@stacksjs/types";
|
|
69
|
+
var options = parseArgs();
|
|
70
|
+
if (options?.dependencies || options?.all)
|
|
71
|
+
await runAction(Action.UpgradeDeps, options);
|
|
72
|
+
if (options?.bun || options?.all)
|
|
73
|
+
await runAction(Action.UpgradeBun, options);
|
|
74
|
+
if (options?.shell || options?.all)
|
|
75
|
+
await runAction(Action.UpgradeShell, options);
|
|
76
|
+
if (options?.binary || options?.all)
|
|
77
|
+
await runAction(Action.UpgradeBinary, options);
|
|
78
|
+
process.exit(ExitCode.InvalidArgument);
|
package/dist/upgrade.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/upgrade.ts
|
|
3
|
+
import process from "process";
|
|
4
|
+
import {intro, outro, runCommand} from "@stacksjs/cli";
|
|
5
|
+
import {NpmScript} from "@stacksjs/enums";
|
|
6
|
+
import {log} from "@stacksjs/logging";
|
|
7
|
+
import {projectPath} from "@stacksjs/path";
|
|
8
|
+
import * as storage from "@stacksjs/storage";
|
|
9
|
+
// package.json
|
|
10
|
+
var version = "0.61.0";
|
|
11
|
+
|
|
12
|
+
// src/upgrade.ts
|
|
13
|
+
function checkForUncommittedChanges(options) {
|
|
14
|
+
try {
|
|
15
|
+
} catch (error) {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async function downloadFrameworkUpdate(options) {
|
|
19
|
+
const tempFolderName = "updates";
|
|
20
|
+
const tempUpdatePath = projectPath(tempFolderName);
|
|
21
|
+
if (storage.doesFolderExist(tempUpdatePath))
|
|
22
|
+
await storage.deleteFolder(tempUpdatePath);
|
|
23
|
+
log.info("Downloading framework updates...");
|
|
24
|
+
await runCommand(`giget stacks ${tempFolderName}`, options);
|
|
25
|
+
log.success(`Your framework updated correctly to version: v${version}`);
|
|
26
|
+
}
|
|
27
|
+
async function updateDependencies() {
|
|
28
|
+
const perf = await intro("buddy upgrade:dependencies");
|
|
29
|
+
const result = await runCommand(NpmScript.UpgradeDependencies, {
|
|
30
|
+
cwd: projectPath()
|
|
31
|
+
});
|
|
32
|
+
if (result.isErr()) {
|
|
33
|
+
await outro("While running the upgrade:dependencies command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
34
|
+
process.exit();
|
|
35
|
+
}
|
|
36
|
+
await outro("Freshly updated your dependencies.", {
|
|
37
|
+
startTime: perf,
|
|
38
|
+
useSeconds: true
|
|
39
|
+
});
|
|
40
|
+
process.exit();
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
updateDependencies,
|
|
44
|
+
downloadFrameworkUpdate,
|
|
45
|
+
checkForUncommittedChanges
|
|
46
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.61.0",
|
|
5
5
|
"description": "The Stacks actions.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"@stacksjs/types": "latest",
|
|
68
68
|
"@stacksjs/utils": "latest",
|
|
69
69
|
"@stacksjs/validation": "latest",
|
|
70
|
-
"markdown-it": "^14.
|
|
71
|
-
"vue-component-meta": "^2.0.
|
|
70
|
+
"markdown-it": "^14.1.0",
|
|
71
|
+
"vue-component-meta": "^2.0.19"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@stacksjs/cli": "latest",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"@stacksjs/strings": "latest",
|
|
86
86
|
"@stacksjs/utils": "latest",
|
|
87
87
|
"@stacksjs/validation": "latest",
|
|
88
|
-
"markdown-it": "^14.
|
|
89
|
-
"vue-component-meta": "^2.0.
|
|
88
|
+
"markdown-it": "^14.1.0",
|
|
89
|
+
"vue-component-meta": "^2.0.19"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@stacksjs/development": "latest"
|
package/src/action.ts
CHANGED
package/src/actions.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './helpers'
|
|
2
|
-
export * as actions from './helpers'
|
|
1
|
+
export * from './helpers/utils'
|
|
2
|
+
export * as actions from './helpers/utils'
|
package/src/add.ts
CHANGED
|
@@ -2,11 +2,9 @@ import { installPackage } from '@stacksjs/cli'
|
|
|
2
2
|
import type { AddOptions } from '@stacksjs/types'
|
|
3
3
|
|
|
4
4
|
export async function invoke(options: AddOptions) {
|
|
5
|
-
if (options?.table)
|
|
6
|
-
await addTable()
|
|
5
|
+
if (options?.table) await addTable()
|
|
7
6
|
|
|
8
|
-
if (options?.calendar)
|
|
9
|
-
await addCalendar()
|
|
7
|
+
if (options?.calendar) await addCalendar()
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
export async function add(options: AddOptions) {
|
|
@@ -22,6 +20,5 @@ export async function addCalendar() {
|
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
export async function installPackages(names: string[]) {
|
|
25
|
-
for (const name of names)
|
|
26
|
-
await installPackage(name)
|
|
23
|
+
for (const name of names) await installPackage(name)
|
|
27
24
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
2
|
import * as AWS4 from 'aws4'
|
|
3
3
|
|
|
4
|
-
// todo: Remove axios and use the AWS SDK instead if possible, but I couldn't get it to work. At least, move to our own fetch wrapper
|
|
5
|
-
import axios from 'axios'
|
|
6
|
-
import { config } from 'aws-sdk'
|
|
7
4
|
import { log } from '@stacksjs/cli'
|
|
8
5
|
import { ai } from '@stacksjs/config'
|
|
6
|
+
import { config } from 'aws-sdk'
|
|
7
|
+
// todo: Remove axios and use the AWS SDK instead if possible, but I couldn't get it to work. At least, move to our own fetch wrapper
|
|
8
|
+
import axios from 'axios'
|
|
9
9
|
|
|
10
10
|
// Specify the AWS profile
|
|
11
11
|
// process.env.AWS_PROFILE = 'your-profile-name' -> no need to define this because of our .env file
|
|
@@ -14,8 +14,7 @@ process.env.AWS_REGION = 'us-east-1'
|
|
|
14
14
|
config.getCredentials((err) => {
|
|
15
15
|
if (err) {
|
|
16
16
|
log.info(err.stack)
|
|
17
|
-
}
|
|
18
|
-
else if (config.credentials) {
|
|
17
|
+
} else if (config.credentials) {
|
|
19
18
|
const { accessKeyId, secretAccessKey, sessionToken } = config.credentials
|
|
20
19
|
log.info('AWS credentials are set', accessKeyId, secretAccessKey, sessionToken)
|
|
21
20
|
|
|
@@ -39,7 +38,7 @@ config.getCredentials((err) => {
|
|
|
39
38
|
path: '/foundation-model-entitlement',
|
|
40
39
|
headers: {
|
|
41
40
|
'Content-Type': 'application/json',
|
|
42
|
-
|
|
41
|
+
authority: 'http://bedrock.us-east-1.amazonaws.com',
|
|
43
42
|
},
|
|
44
43
|
body: JSON.stringify({ modelId: model }), // use the current model in the loop
|
|
45
44
|
service,
|
|
@@ -47,7 +46,11 @@ config.getCredentials((err) => {
|
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
// Sign the request
|
|
50
|
-
const signedRequest = AWS4.sign(request, {
|
|
49
|
+
const signedRequest = AWS4.sign(request, {
|
|
50
|
+
accessKeyId,
|
|
51
|
+
secretAccessKey,
|
|
52
|
+
sessionToken,
|
|
53
|
+
})
|
|
51
54
|
|
|
52
55
|
// Convert headers to the correct type
|
|
53
56
|
const axiosHeaders = Object.fromEntries(
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { frameworkPath } from '@stacksjs/path'
|
|
2
1
|
import { runCommand } from '@stacksjs/cli'
|
|
3
2
|
import { NpmScript } from '@stacksjs/enums'
|
|
3
|
+
import { frameworkPath } from '@stacksjs/path'
|
|
4
4
|
|
|
5
|
-
await runCommand(NpmScript.BuildComponents, {
|
|
5
|
+
await runCommand(NpmScript.BuildComponents, {
|
|
6
|
+
cwd: frameworkPath(),
|
|
7
|
+
verbose: true,
|
|
8
|
+
})
|
package/src/build/core.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import { glob } from '@stacksjs/storage'
|
|
3
2
|
import { dim, italic, log } from '@stacksjs/cli'
|
|
4
3
|
import { corePath } from '@stacksjs/path'
|
|
4
|
+
import { glob } from '@stacksjs/storage'
|
|
5
5
|
import { ExitCode } from '@stacksjs/types'
|
|
6
6
|
import { $ } from 'bun'
|
|
7
7
|
|
|
@@ -21,7 +21,6 @@ for (const folder of dirs) {
|
|
|
21
21
|
await $`bun run build`
|
|
22
22
|
log.success(`${italic(dim(folder))} built`)
|
|
23
23
|
|
|
24
|
-
// eslint-disable-next-line no-console
|
|
25
24
|
console.log(``)
|
|
26
25
|
}
|
|
27
26
|
|
package/src/build/stacks.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { frameworkPath } from '@stacksjs/path'
|
|
2
1
|
import { runCommands } from '@stacksjs/cli'
|
|
2
|
+
import { frameworkPath } from '@stacksjs/path'
|
|
3
3
|
|
|
4
|
-
await runCommands(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
await runCommands(
|
|
5
|
+
[
|
|
6
|
+
'bun build:cli', // command to build the Buddy CLI
|
|
7
|
+
'bun build:core', // command to build the Stacks Core
|
|
8
|
+
],
|
|
9
|
+
{ verbose: true, cwd: frameworkPath() },
|
|
10
|
+
)
|
package/src/build.ts
CHANGED
|
@@ -1,28 +1,17 @@
|
|
|
1
|
+
import { NpmScript } from '@stacksjs/enums'
|
|
1
2
|
import { log } from '@stacksjs/logging'
|
|
2
3
|
import { hasComponents, hasFunctions } from '@stacksjs/storage'
|
|
3
|
-
import { runNpmScript } from '@stacksjs/utils'
|
|
4
4
|
import type { BuildOptions } from '@stacksjs/types'
|
|
5
|
-
import {
|
|
5
|
+
import { runNpmScript } from '@stacksjs/utils'
|
|
6
6
|
import { generateTypes } from './generate'
|
|
7
7
|
|
|
8
8
|
export async function invoke(options: BuildOptions) {
|
|
9
|
-
if (options.components)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
else if (options.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
else if (options.webComponents || options.elements)
|
|
16
|
-
await webComponentLibrary(options)
|
|
17
|
-
|
|
18
|
-
else if (options.functions)
|
|
19
|
-
await functionsLibrary(options)
|
|
20
|
-
|
|
21
|
-
else if (options.docs)
|
|
22
|
-
await docs(options)
|
|
23
|
-
|
|
24
|
-
else if (options.stacks)
|
|
25
|
-
await stacks(options)
|
|
9
|
+
if (options.components) await componentLibraries(options)
|
|
10
|
+
else if (options.vueComponents) await vueComponentLibrary(options)
|
|
11
|
+
else if (options.webComponents || options.elements) await webComponentLibrary(options)
|
|
12
|
+
else if (options.functions) await functionsLibrary(options)
|
|
13
|
+
else if (options.docs) await docs(options)
|
|
14
|
+
else if (options.stacks) await stacks(options)
|
|
26
15
|
|
|
27
16
|
await generateTypes()
|
|
28
17
|
}
|
|
@@ -42,8 +31,7 @@ export async function vueComponentLibrary(options: BuildOptions) {
|
|
|
42
31
|
log.info('Building your component library...')
|
|
43
32
|
await runNpmScript(NpmScript.BuildComponents, options)
|
|
44
33
|
log.success('Your component library was built successfully')
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
34
|
+
} else {
|
|
47
35
|
// todo: throw custom error here
|
|
48
36
|
log.warn('No components found.')
|
|
49
37
|
log.info('Before you can build components,')
|
|
@@ -57,8 +45,7 @@ export async function webComponentLibrary(options: BuildOptions) {
|
|
|
57
45
|
if (hasComponents()) {
|
|
58
46
|
await runNpmScript(NpmScript.BuildWebComponents, options)
|
|
59
47
|
log.success('Your Web Component library was built successfully')
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
48
|
+
} else {
|
|
62
49
|
// todo: throw custom error here
|
|
63
50
|
log.info('No components found.')
|
|
64
51
|
}
|
|
@@ -82,8 +69,7 @@ export async function functionsLibrary(options: BuildOptions) {
|
|
|
82
69
|
log.info('Production usages include: manual npm distribution and/or CDN distribution')
|
|
83
70
|
await runNpmScript(NpmScript.BuildFunctions, options)
|
|
84
71
|
log.success('Functions library built successfully')
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
72
|
+
} else {
|
|
87
73
|
log.info('No functions found')
|
|
88
74
|
}
|
|
89
75
|
}
|
package/src/bump.ts
CHANGED
|
@@ -12,9 +12,7 @@ const bumpCommand = options?.dryRun
|
|
|
12
12
|
? 'bunx bumpp ./package.json ./**/package.json ../ide/vscode/package.json --no-push'
|
|
13
13
|
: 'bunx bumpp ./package.json ./**/package.json ../ide/vscode/package.json --all'
|
|
14
14
|
|
|
15
|
-
// eslint-disable-next-line no-console
|
|
16
15
|
console.log(`Running: ${bumpCommand}`)
|
|
17
|
-
// eslint-disable-next-line no-console
|
|
18
16
|
console.log(`In frameworkPath: ${p.frameworkPath()}`)
|
|
19
17
|
|
|
20
18
|
await runCommand(bumpCommand, {
|
package/src/check/ports.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import { $ } from 'bun'
|
|
3
|
-
import { findStacksProjects } from '@stacksjs/utils'
|
|
4
2
|
import { log } from '@stacksjs/logging'
|
|
3
|
+
import { findStacksProjects } from '@stacksjs/utils'
|
|
4
|
+
import { $ } from 'bun'
|
|
5
5
|
|
|
6
6
|
const projects = await findStacksProjects(undefined, { quiet: true })
|
|
7
7
|
|
|
@@ -18,7 +18,6 @@ for (const project of projects) {
|
|
|
18
18
|
$.cwd(project)
|
|
19
19
|
const ports = await $`./buddy ports --project ${project} --quiet`.text()
|
|
20
20
|
|
|
21
|
-
// eslint-disable-next-line no-console
|
|
22
21
|
console.log('ports', ports)
|
|
23
22
|
}
|
|
24
23
|
|
package/src/commit.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { NpmScript } from '@stacksjs/enums'
|
|
1
2
|
import { log } from '@stacksjs/logging'
|
|
2
|
-
import { runNpmScript } from '@stacksjs/utils'
|
|
3
3
|
import type { CleanOptions } from '@stacksjs/types'
|
|
4
|
-
import {
|
|
4
|
+
import { runNpmScript } from '@stacksjs/utils'
|
|
5
5
|
|
|
6
6
|
export async function invoke(options: CleanOptions) {
|
|
7
7
|
log.info('Committing...')
|
package/src/copy-types.ts
CHANGED
package/src/database/seed.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import { log } from '@stacksjs/cli'
|
|
3
|
+
import { seed } from '@stacksjs/database'
|
|
4
|
+
|
|
5
|
+
log.info('Seeding database...')
|
|
6
|
+
await seed()
|
|
7
|
+
|
|
8
|
+
process.exit(0)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import { log } from '@stacksjs/cli'
|
|
3
2
|
import { S3 } from '@aws-sdk/client-s3'
|
|
4
3
|
import { SES } from '@aws-sdk/client-ses'
|
|
4
|
+
import { log } from '@stacksjs/cli'
|
|
5
5
|
import { ExitCode } from '@stacksjs/types'
|
|
6
6
|
|
|
7
7
|
const ses = new SES({ apiVersion: '2010-12-01' })
|
|
@@ -16,14 +16,11 @@ const s3 = new S3({ apiVersion: '2006-03-01' })
|
|
|
16
16
|
let bucketName: string | undefined
|
|
17
17
|
const data = await s3.listBuckets({})
|
|
18
18
|
|
|
19
|
-
if (data.Buckets)
|
|
20
|
-
bucketName = data.Buckets.find(bucket => bucket.Name && bucket.Name.includes('-email-'))?.Name
|
|
19
|
+
if (data.Buckets) bucketName = data.Buckets.find((bucket) => bucket.Name?.includes('-email-'))?.Name
|
|
21
20
|
|
|
22
|
-
// eslint-disable-next-line no-console
|
|
23
21
|
console.log('Bucket Name:', bucketName)
|
|
24
22
|
|
|
25
23
|
if (!bucketName) {
|
|
26
|
-
// eslint-disable-next-line no-console
|
|
27
24
|
console.log('Stacks Email Bucket not found')
|
|
28
25
|
process.exit(ExitCode.FatalError)
|
|
29
26
|
}
|
|
@@ -49,7 +46,6 @@ const params: any = {
|
|
|
49
46
|
try {
|
|
50
47
|
const data = await ses.createReceiptRule(params)
|
|
51
48
|
log.info('Success', data)
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
49
|
+
} catch (error) {
|
|
54
50
|
console.error(error)
|
|
55
51
|
}
|
package/src/deploy/index.ts
CHANGED
|
@@ -14,7 +14,8 @@ if (storage.hasFiles(p.projectPath('docs'))) {
|
|
|
14
14
|
})
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
if (config.app.docMode !== true) {
|
|
17
|
+
if (config.app.docMode !== true) {
|
|
18
|
+
// when in docMode, we can disregard building views
|
|
18
19
|
await runCommand('bun run build', {
|
|
19
20
|
cwd: p.frameworkPath('views'),
|
|
20
21
|
})
|
package/src/dev/api.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { path as p } from '@stacksjs/path'
|
|
2
1
|
import { log, parseOptions, runCommand } from '@stacksjs/cli'
|
|
3
|
-
import { serve } from '@stacksjs/router'
|
|
4
2
|
import { config } from '@stacksjs/config'
|
|
3
|
+
import { path as p } from '@stacksjs/path'
|
|
4
|
+
import { serve } from '@stacksjs/router'
|
|
5
5
|
|
|
6
6
|
const options = parseOptions()
|
|
7
7
|
|
|
8
|
-
log.debug('Running API dev server via', `bunx vite --config ${p.
|
|
8
|
+
log.debug('Running API dev server via', `bunx vite --config ${p.viteConfigPath('src/api.ts')}`, options)
|
|
9
9
|
|
|
10
10
|
serve({
|
|
11
11
|
port: config.ports?.api, // defaults to 3008
|
|
12
12
|
})
|
|
13
13
|
|
|
14
14
|
// the reason we start a Vite dev server next is because we need the Bun server proxied by vite
|
|
15
|
-
await runCommand(`bunx vite --config ${p.
|
|
15
|
+
await runCommand(`bunx vite --config ${p.viteConfigPath('src/api.ts')}`, {
|
|
16
16
|
// ...options,
|
|
17
17
|
cwd: p.frameworkPath(),
|
|
18
18
|
})
|
package/src/dev/components.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { frameworkPath, vitePath } from '@stacksjs/path'
|
|
2
1
|
import { parseOptions, runCommand } from '@stacksjs/cli'
|
|
2
|
+
import { frameworkPath, viteConfigPath } from '@stacksjs/path'
|
|
3
3
|
import type { DeployOptions } from '@stacksjs/types'
|
|
4
4
|
|
|
5
5
|
const options: DeployOptions = parseOptions()
|
|
6
6
|
|
|
7
|
-
if (options.verbose)
|
|
8
|
-
// eslint-disable-next-line no-console
|
|
9
|
-
console.log('dev components options', options)
|
|
7
|
+
if (options.verbose) console.log('dev components options', options)
|
|
10
8
|
|
|
11
|
-
await runCommand(`bunx vite --config ${
|
|
9
|
+
await runCommand(`bunx vite --config ${viteConfigPath('src/components.ts')}`, {
|
|
12
10
|
...options,
|
|
13
11
|
cwd: frameworkPath(),
|
|
14
12
|
})
|
package/src/dev/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Action } from '@stacksjs/enums'
|
|
1
2
|
import { log } from '@stacksjs/logging'
|
|
2
3
|
import type { DevOptions } from '@stacksjs/types'
|
|
3
|
-
import {
|
|
4
|
-
import { runAction } from '../helpers/utils'
|
|
4
|
+
import { runAction } from '../helpers'
|
|
5
5
|
|
|
6
6
|
export async function runDevServer(options: DevOptions) {
|
|
7
7
|
log.info('Starting your Frontend Engine...')
|
package/src/domains/add.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import { createHostedZone, getNameservers, updateNameservers } from '@stacksjs/dns'
|
|
3
|
-
import { app } from '@stacksjs/config'
|
|
4
2
|
import { italic, log, parseOptions, runCommand } from '@stacksjs/cli'
|
|
5
|
-
import {
|
|
3
|
+
import { app } from '@stacksjs/config'
|
|
4
|
+
import { createHostedZone, getNameservers, updateNameservers } from '@stacksjs/dns'
|
|
5
|
+
import { handleError } from '@stacksjs/error-handling'
|
|
6
6
|
import { logger } from '@stacksjs/logging'
|
|
7
7
|
import { projectConfigPath } from '@stacksjs/path'
|
|
8
|
+
import { whois } from '@stacksjs/whois'
|
|
8
9
|
|
|
9
10
|
const options = parseOptions()
|
|
10
11
|
const domain = (options.domain as string | undefined) ?? app.url
|
|
11
12
|
|
|
12
13
|
if (!domain) {
|
|
13
|
-
log.error(
|
|
14
|
+
log.error(
|
|
15
|
+
'There was no Domain or App URL provided. Please provide a domain using the --domain flag or add a url to your app config.',
|
|
16
|
+
)
|
|
14
17
|
process.exit(1)
|
|
15
18
|
}
|
|
16
19
|
|
|
@@ -38,8 +41,7 @@ const registrar: string = (await whois(domain, true)).parsedData.Registrar
|
|
|
38
41
|
if (registrar.includes('Amazon')) {
|
|
39
42
|
if (options.deploy) {
|
|
40
43
|
await runCommand('buddy deploy')
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
44
|
+
} else {
|
|
43
45
|
logger.log('')
|
|
44
46
|
logger.log('You can now continue your deployment process by re-running:')
|
|
45
47
|
logger.log('')
|
package/src/domains/purchase.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
+
import type { CountryCode } from '@aws-sdk/client-route-53-domains'
|
|
3
|
+
import { ContactType } from '@aws-sdk/client-route-53-domains'
|
|
2
4
|
import { log, parseOptions } from '@stacksjs/cli'
|
|
3
5
|
import type { PurchaseOptions } from '@stacksjs/cloud'
|
|
4
6
|
import { purchaseDomain } from '@stacksjs/cloud'
|
|
@@ -24,36 +26,36 @@ const defaultOptions: PurchaseOptions = {
|
|
|
24
26
|
registrantAddressLine2: c.addressLine2 as string,
|
|
25
27
|
registrantCity: c.city as string,
|
|
26
28
|
registrantState: c.state as string,
|
|
27
|
-
registrantCountry: c.countryCode as
|
|
29
|
+
registrantCountry: c.countryCode as CountryCode,
|
|
28
30
|
registrantZip: c.zip as string,
|
|
29
31
|
registrantPhone: c.phoneNumber as string,
|
|
30
32
|
registrantEmail: c.email as string,
|
|
31
|
-
adminFirstName: c.admin?.firstName || c.firstName as string,
|
|
32
|
-
adminLastName: c.admin?.lastName || c.lastName as string,
|
|
33
|
-
adminOrganization: c.admin?.organizationName || c.organizationName as string,
|
|
34
|
-
adminAddressLine1: c.admin?.addressLine1 || c.addressLine1 as string,
|
|
35
|
-
adminAddressLine2: c.admin?.addressLine2 || c.addressLine2 as string,
|
|
36
|
-
adminCity: c.admin?.city || c.city as string,
|
|
37
|
-
adminState: c.admin?.state || c.state as string,
|
|
38
|
-
adminCountry: c.admin?.countryCode || c.countryCode as string,
|
|
39
|
-
adminZip: c.admin?.zip || c.zip as string,
|
|
40
|
-
adminPhone: c.admin?.phoneNumber as string || c.phoneNumber as string,
|
|
41
|
-
adminEmail: c.admin?.email || c.email as string,
|
|
42
|
-
techFirstName: c.tech?.firstName || c.firstName as string,
|
|
43
|
-
techLastName: c.tech?.lastName || c.lastName as string,
|
|
44
|
-
techOrganization: c.tech?.organizationName || c.organizationName as string,
|
|
45
|
-
techAddressLine1: c.tech?.addressLine1 || c.addressLine1 as string,
|
|
46
|
-
techAddressLine2: c.tech?.addressLine2 || c.addressLine2 as string,
|
|
47
|
-
techCity: c.tech?.city || c.city as string,
|
|
48
|
-
techState: c.tech?.state || c.state as string,
|
|
49
|
-
techCountry: c.tech?.countryCode || c.countryCode as string,
|
|
50
|
-
techZip: c.tech?.zip || c.zip as string,
|
|
51
|
-
techPhone: c.tech?.phoneNumber as string || c.phoneNumber as string,
|
|
52
|
-
techEmail: c.tech?.email || c.email as string,
|
|
33
|
+
adminFirstName: c.admin?.firstName || (c.firstName as string),
|
|
34
|
+
adminLastName: c.admin?.lastName || (c.lastName as string),
|
|
35
|
+
adminOrganization: c.admin?.organizationName || (c.organizationName as string),
|
|
36
|
+
adminAddressLine1: c.admin?.addressLine1 || (c.addressLine1 as string),
|
|
37
|
+
adminAddressLine2: c.admin?.addressLine2 || (c.addressLine2 as string),
|
|
38
|
+
adminCity: c.admin?.city || (c.city as string),
|
|
39
|
+
adminState: c.admin?.state || (c.state as string),
|
|
40
|
+
adminCountry: (c.admin?.countryCode as CountryCode) || (c.countryCode as string),
|
|
41
|
+
adminZip: c.admin?.zip || (c.zip as string),
|
|
42
|
+
adminPhone: (c.admin?.phoneNumber as string) || (c.phoneNumber as string),
|
|
43
|
+
adminEmail: c.admin?.email || (c.email as string),
|
|
44
|
+
techFirstName: c.tech?.firstName || (c.firstName as string),
|
|
45
|
+
techLastName: c.tech?.lastName || (c.lastName as string),
|
|
46
|
+
techOrganization: c.tech?.organizationName || (c.organizationName as string),
|
|
47
|
+
techAddressLine1: c.tech?.addressLine1 || (c.addressLine1 as string),
|
|
48
|
+
techAddressLine2: c.tech?.addressLine2 || (c.addressLine2 as string),
|
|
49
|
+
techCity: c.tech?.city || (c.city as string),
|
|
50
|
+
techState: c.tech?.state || (c.state as string),
|
|
51
|
+
techCountry: (c.tech?.countryCode as CountryCode) || (c.countryCode as string),
|
|
52
|
+
techZip: c.tech?.zip || (c.zip as string),
|
|
53
|
+
techPhone: (c.tech?.phoneNumber as string) || (c.phoneNumber as string),
|
|
54
|
+
techEmail: c.tech?.email || (c.email as string),
|
|
53
55
|
privacyAdmin: c.privacyAdmin || c.privacy || true,
|
|
54
56
|
privacyTech: c.privacyTech || c.privacy || true,
|
|
55
57
|
privacyRegistrant: c.privacyRegistrant || c.privacy || true,
|
|
56
|
-
contactType:
|
|
58
|
+
contactType: ContactType.PERSON,
|
|
57
59
|
verbose: false,
|
|
58
60
|
}
|
|
59
61
|
|