@stacksjs/actions 0.58.58 → 0.58.61
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/build.js +18 -26
- package/dist/src/bump.js +9 -3
- package/dist/src/changelog.js +11 -3
- package/dist/src/clean.js +2 -2
- package/dist/src/dev/index.js +18 -26
- package/dist/src/generate/index.js +18 -26
- package/dist/src/helpers/index.js +18 -26
- package/dist/src/helpers/utils.js +18 -26
- package/dist/src/index.js +26 -34
- package/dist/src/lint/fix.js +6 -2
- package/dist/src/release.js +30 -35
- package/dist/src/upgrade/index.js +18 -26
- package/dist/src/upgrade.js +10 -7
- package/package.json +1 -1
- package/src/action.ts +18 -8
- package/src/bump.ts +13 -6
- package/src/changelog.ts +14 -4
- package/src/clean.ts +2 -2
- package/src/dev/api.ts +1 -2
- package/src/domains/add.ts +12 -27
- package/src/helpers/utils.ts +24 -36
- package/src/lint/fix.ts +8 -2
- package/src/migrate/dns.ts +1 -1
- package/src/release.ts +4 -1
- package/src/upgrade.ts +5 -2
package/dist/src/build.js
CHANGED
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/helpers/utils.ts
|
|
3
3
|
import * as storage from "@stacksjs/storage";
|
|
4
|
-
import {
|
|
4
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {err, handleError} from "@stacksjs/error-handling";
|
|
8
|
-
var parseOptions = function(options) {
|
|
9
|
-
if (!options)
|
|
10
|
-
return "";
|
|
11
|
-
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
12
|
-
if (key.length === 1)
|
|
13
|
-
return `-${key}=${value}`;
|
|
14
|
-
if (typeof value === "boolean" && value)
|
|
15
|
-
return `--${key}`;
|
|
16
|
-
return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
|
|
17
|
-
});
|
|
18
|
-
return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
|
|
19
|
-
};
|
|
20
8
|
async function runAction(action, options) {
|
|
21
|
-
|
|
22
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
23
|
-
const opts = parseOptions(options);
|
|
9
|
+
const opts = buddyOptions();
|
|
24
10
|
const path = p.relativeActionsPath(`${action}.ts`);
|
|
25
|
-
const cmd = `bun --bun ${
|
|
26
|
-
const
|
|
11
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
12
|
+
const optionsWithCwd = {
|
|
27
13
|
cwd: options?.cwd || p.projectPath(),
|
|
28
14
|
...options
|
|
29
15
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return await runCommand(cmd, o);
|
|
16
|
+
log.debug("runAction:", cmd);
|
|
17
|
+
log.debug("action options:", optionsWithCwd);
|
|
18
|
+
if (!hasAction(action))
|
|
19
|
+
return err(handleError(`The specified action "${action}" does not exist`));
|
|
20
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
36
21
|
}
|
|
37
22
|
async function runActions(actions, options) {
|
|
23
|
+
log.debug("runActions:", actions);
|
|
24
|
+
log.debug("actions options:", options);
|
|
38
25
|
if (!actions.length)
|
|
39
26
|
return err("No actions were specified");
|
|
40
27
|
for (const action of actions) {
|
|
41
28
|
if (!hasAction(action))
|
|
42
29
|
return err(`The specified action "${action}" does not exist`);
|
|
43
30
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
31
|
+
const opts = buddyOptions();
|
|
32
|
+
const o = {
|
|
33
|
+
cwd: options?.cwd || p.projectPath(),
|
|
34
|
+
...options
|
|
35
|
+
};
|
|
36
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
37
|
+
return await runCommands(commands, o);
|
|
46
38
|
}
|
|
47
39
|
function hasAction(action) {
|
|
48
40
|
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
package/dist/src/bump.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/bump.ts
|
|
3
|
-
import {runCommand} from "@stacksjs/cli";
|
|
3
|
+
import {parseOptions, runCommand} from "@stacksjs/cli";
|
|
4
4
|
import {path as p} from "@stacksjs/path";
|
|
5
|
-
|
|
5
|
+
var options = parseOptions();
|
|
6
|
+
var changelogCommand = options?.dryRun ? "buddy changelog --quiet --dry-run" : "buddy changelog --quiet";
|
|
7
|
+
await runCommand(changelogCommand, {
|
|
6
8
|
cwd: p.projectPath()
|
|
7
9
|
});
|
|
8
|
-
|
|
10
|
+
var bumpCommand = options?.dryRun ? "bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --no-push" : "bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --all";
|
|
11
|
+
await runCommand(bumpCommand, {
|
|
12
|
+
cwd: p.frameworkPath(),
|
|
13
|
+
stdin: "inherit"
|
|
14
|
+
});
|
package/dist/src/changelog.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/changelog.ts
|
|
3
|
-
import {execSync, runCommand} from "@stacksjs/cli";
|
|
3
|
+
import {execSync, log, parseOptions, runCommand} from "@stacksjs/cli";
|
|
4
4
|
import {projectPath} from "@stacksjs/path";
|
|
5
|
+
log.debug("Generating changelog");
|
|
5
6
|
var fromRevision = await execSync("git describe --abbrev=0 --tags HEAD^");
|
|
7
|
+
log.debug("FromRevision", fromRevision);
|
|
6
8
|
var toRevision = await execSync("git describe");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
log.debug("ToRevision", toRevision);
|
|
10
|
+
var options = parseOptions();
|
|
11
|
+
log.debug("Changelog Options", options);
|
|
12
|
+
var command = options?.dryRun ? `bunx changelogen --no-output --from ${fromRevision} --to ${toRevision}` : `bunx changelogen --output CHANGELOG.md --from ${fromRevision} --to ${toRevision}`;
|
|
13
|
+
await runCommand(command, {
|
|
14
|
+
cwd: projectPath(),
|
|
15
|
+
quiet: options?.quiet,
|
|
16
|
+
verbose: options?.verbose
|
|
9
17
|
});
|
package/dist/src/clean.js
CHANGED
package/dist/src/dev/index.js
CHANGED
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/helpers/utils.ts
|
|
3
3
|
import * as storage from "@stacksjs/storage";
|
|
4
|
-
import {
|
|
4
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {err, handleError} from "@stacksjs/error-handling";
|
|
8
|
-
var parseOptions = function(options) {
|
|
9
|
-
if (!options)
|
|
10
|
-
return "";
|
|
11
|
-
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
12
|
-
if (key.length === 1)
|
|
13
|
-
return `-${key}=${value}`;
|
|
14
|
-
if (typeof value === "boolean" && value)
|
|
15
|
-
return `--${key}`;
|
|
16
|
-
return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
|
|
17
|
-
});
|
|
18
|
-
return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
|
|
19
|
-
};
|
|
20
8
|
async function runAction(action, options) {
|
|
21
|
-
|
|
22
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
23
|
-
const opts = parseOptions(options);
|
|
9
|
+
const opts = buddyOptions();
|
|
24
10
|
const path = p.relativeActionsPath(`${action}.ts`);
|
|
25
|
-
const cmd = `bun --bun ${
|
|
26
|
-
const
|
|
11
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
12
|
+
const optionsWithCwd = {
|
|
27
13
|
cwd: options?.cwd || p.projectPath(),
|
|
28
14
|
...options
|
|
29
15
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return await runCommand(cmd, o);
|
|
16
|
+
log.debug("runAction:", cmd);
|
|
17
|
+
log.debug("action options:", optionsWithCwd);
|
|
18
|
+
if (!hasAction(action))
|
|
19
|
+
return err(handleError(`The specified action "${action}" does not exist`));
|
|
20
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
36
21
|
}
|
|
37
22
|
async function runActions(actions, options) {
|
|
23
|
+
log.debug("runActions:", actions);
|
|
24
|
+
log.debug("actions options:", options);
|
|
38
25
|
if (!actions.length)
|
|
39
26
|
return err("No actions were specified");
|
|
40
27
|
for (const action of actions) {
|
|
41
28
|
if (!hasAction(action))
|
|
42
29
|
return err(`The specified action "${action}" does not exist`);
|
|
43
30
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
31
|
+
const opts = buddyOptions();
|
|
32
|
+
const o = {
|
|
33
|
+
cwd: options?.cwd || p.projectPath(),
|
|
34
|
+
...options
|
|
35
|
+
};
|
|
36
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
37
|
+
return await runCommands(commands, o);
|
|
46
38
|
}
|
|
47
39
|
function hasAction(action) {
|
|
48
40
|
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/helpers/utils.ts
|
|
3
3
|
import * as storage from "@stacksjs/storage";
|
|
4
|
-
import {
|
|
4
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {err, handleError} from "@stacksjs/error-handling";
|
|
8
|
-
var parseOptions = function(options) {
|
|
9
|
-
if (!options)
|
|
10
|
-
return "";
|
|
11
|
-
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
12
|
-
if (key.length === 1)
|
|
13
|
-
return `-${key}=${value}`;
|
|
14
|
-
if (typeof value === "boolean" && value)
|
|
15
|
-
return `--${key}`;
|
|
16
|
-
return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
|
|
17
|
-
});
|
|
18
|
-
return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
|
|
19
|
-
};
|
|
20
8
|
async function runAction(action, options) {
|
|
21
|
-
|
|
22
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
23
|
-
const opts = parseOptions(options);
|
|
9
|
+
const opts = buddyOptions();
|
|
24
10
|
const path = p.relativeActionsPath(`${action}.ts`);
|
|
25
|
-
const cmd = `bun --bun ${
|
|
26
|
-
const
|
|
11
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
12
|
+
const optionsWithCwd = {
|
|
27
13
|
cwd: options?.cwd || p.projectPath(),
|
|
28
14
|
...options
|
|
29
15
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return await runCommand(cmd, o);
|
|
16
|
+
log.debug("runAction:", cmd);
|
|
17
|
+
log.debug("action options:", optionsWithCwd);
|
|
18
|
+
if (!hasAction(action))
|
|
19
|
+
return err(handleError(`The specified action "${action}" does not exist`));
|
|
20
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
36
21
|
}
|
|
37
22
|
async function runActions(actions, options) {
|
|
23
|
+
log.debug("runActions:", actions);
|
|
24
|
+
log.debug("actions options:", options);
|
|
38
25
|
if (!actions.length)
|
|
39
26
|
return err("No actions were specified");
|
|
40
27
|
for (const action of actions) {
|
|
41
28
|
if (!hasAction(action))
|
|
42
29
|
return err(`The specified action "${action}" does not exist`);
|
|
43
30
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
31
|
+
const opts = buddyOptions();
|
|
32
|
+
const o = {
|
|
33
|
+
cwd: options?.cwd || p.projectPath(),
|
|
34
|
+
...options
|
|
35
|
+
};
|
|
36
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
37
|
+
return await runCommands(commands, o);
|
|
46
38
|
}
|
|
47
39
|
function hasAction(action) {
|
|
48
40
|
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/helpers/utils.ts
|
|
3
3
|
import * as storage from "@stacksjs/storage";
|
|
4
|
-
import {
|
|
4
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {err, handleError} from "@stacksjs/error-handling";
|
|
8
|
-
var parseOptions = function(options) {
|
|
9
|
-
if (!options)
|
|
10
|
-
return "";
|
|
11
|
-
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
12
|
-
if (key.length === 1)
|
|
13
|
-
return `-${key}=${value}`;
|
|
14
|
-
if (typeof value === "boolean" && value)
|
|
15
|
-
return `--${key}`;
|
|
16
|
-
return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
|
|
17
|
-
});
|
|
18
|
-
return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
|
|
19
|
-
};
|
|
20
8
|
async function runAction(action, options) {
|
|
21
|
-
|
|
22
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
23
|
-
const opts = parseOptions(options);
|
|
9
|
+
const opts = buddyOptions();
|
|
24
10
|
const path = p.relativeActionsPath(`${action}.ts`);
|
|
25
|
-
const cmd = `bun --bun ${
|
|
26
|
-
const
|
|
11
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
12
|
+
const optionsWithCwd = {
|
|
27
13
|
cwd: options?.cwd || p.projectPath(),
|
|
28
14
|
...options
|
|
29
15
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return await runCommand(cmd, o);
|
|
16
|
+
log.debug("runAction:", cmd);
|
|
17
|
+
log.debug("action options:", optionsWithCwd);
|
|
18
|
+
if (!hasAction(action))
|
|
19
|
+
return err(handleError(`The specified action "${action}" does not exist`));
|
|
20
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
36
21
|
}
|
|
37
22
|
async function runActions(actions, options) {
|
|
23
|
+
log.debug("runActions:", actions);
|
|
24
|
+
log.debug("actions options:", options);
|
|
38
25
|
if (!actions.length)
|
|
39
26
|
return err("No actions were specified");
|
|
40
27
|
for (const action of actions) {
|
|
41
28
|
if (!hasAction(action))
|
|
42
29
|
return err(`The specified action "${action}" does not exist`);
|
|
43
30
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
31
|
+
const opts = buddyOptions();
|
|
32
|
+
const o = {
|
|
33
|
+
cwd: options?.cwd || p.projectPath(),
|
|
34
|
+
...options
|
|
35
|
+
};
|
|
36
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
37
|
+
return await runCommands(commands, o);
|
|
46
38
|
}
|
|
47
39
|
function hasAction(action) {
|
|
48
40
|
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/helpers/utils.ts
|
|
3
3
|
import * as storage from "@stacksjs/storage";
|
|
4
|
-
import {
|
|
4
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {err, handleError} from "@stacksjs/error-handling";
|
|
8
|
-
var parseOptions = function(options) {
|
|
9
|
-
if (!options)
|
|
10
|
-
return "";
|
|
11
|
-
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
12
|
-
if (key.length === 1)
|
|
13
|
-
return `-${key}=${value}`;
|
|
14
|
-
if (typeof value === "boolean" && value)
|
|
15
|
-
return `--${key}`;
|
|
16
|
-
return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
|
|
17
|
-
});
|
|
18
|
-
return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
|
|
19
|
-
};
|
|
20
8
|
async function runAction(action, options) {
|
|
21
|
-
|
|
22
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
23
|
-
const opts = parseOptions(options);
|
|
9
|
+
const opts = buddyOptions();
|
|
24
10
|
const path = p.relativeActionsPath(`${action}.ts`);
|
|
25
|
-
const cmd = `bun --bun ${
|
|
26
|
-
const
|
|
11
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
12
|
+
const optionsWithCwd = {
|
|
27
13
|
cwd: options?.cwd || p.projectPath(),
|
|
28
14
|
...options
|
|
29
15
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return await runCommand(cmd, o);
|
|
16
|
+
log.debug("runAction:", cmd);
|
|
17
|
+
log.debug("action options:", optionsWithCwd);
|
|
18
|
+
if (!hasAction(action))
|
|
19
|
+
return err(handleError(`The specified action "${action}" does not exist`));
|
|
20
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
36
21
|
}
|
|
37
22
|
async function runActions(actions, options) {
|
|
23
|
+
log.debug("runActions:", actions);
|
|
24
|
+
log.debug("actions options:", options);
|
|
38
25
|
if (!actions.length)
|
|
39
26
|
return err("No actions were specified");
|
|
40
27
|
for (const action of actions) {
|
|
41
28
|
if (!hasAction(action))
|
|
42
29
|
return err(`The specified action "${action}" does not exist`);
|
|
43
30
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
31
|
+
const opts = buddyOptions();
|
|
32
|
+
const o = {
|
|
33
|
+
cwd: options?.cwd || p.projectPath(),
|
|
34
|
+
...options
|
|
35
|
+
};
|
|
36
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
37
|
+
return await runCommands(commands, o);
|
|
46
38
|
}
|
|
47
39
|
function hasAction(action) {
|
|
48
40
|
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
package/dist/src/index.js
CHANGED
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/helpers/utils.ts
|
|
3
3
|
import * as storage from "@stacksjs/storage";
|
|
4
|
-
import {
|
|
4
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {err, handleError} from "@stacksjs/error-handling";
|
|
8
|
-
var parseOptions = function(options) {
|
|
9
|
-
if (!options)
|
|
10
|
-
return "";
|
|
11
|
-
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
12
|
-
if (key.length === 1)
|
|
13
|
-
return `-${key}=${value}`;
|
|
14
|
-
if (typeof value === "boolean" && value)
|
|
15
|
-
return `--${key}`;
|
|
16
|
-
return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
|
|
17
|
-
});
|
|
18
|
-
return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
|
|
19
|
-
};
|
|
20
8
|
async function runAction(action, options) {
|
|
21
|
-
|
|
22
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
23
|
-
const opts = parseOptions(options);
|
|
9
|
+
const opts = buddyOptions();
|
|
24
10
|
const path = p.relativeActionsPath(`${action}.ts`);
|
|
25
|
-
const cmd = `bun --bun ${
|
|
26
|
-
const
|
|
11
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
12
|
+
const optionsWithCwd = {
|
|
27
13
|
cwd: options?.cwd || p.projectPath(),
|
|
28
14
|
...options
|
|
29
15
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return await runCommand(cmd, o);
|
|
16
|
+
log.debug("runAction:", cmd);
|
|
17
|
+
log.debug("action options:", optionsWithCwd);
|
|
18
|
+
if (!hasAction(action))
|
|
19
|
+
return err(handleError(`The specified action "${action}" does not exist`));
|
|
20
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
36
21
|
}
|
|
37
22
|
async function runActions(actions, options) {
|
|
23
|
+
log.debug("runActions:", actions);
|
|
24
|
+
log.debug("actions options:", options);
|
|
38
25
|
if (!actions.length)
|
|
39
26
|
return err("No actions were specified");
|
|
40
27
|
for (const action of actions) {
|
|
41
28
|
if (!hasAction(action))
|
|
42
29
|
return err(`The specified action "${action}" does not exist`);
|
|
43
30
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
31
|
+
const opts = buddyOptions();
|
|
32
|
+
const o = {
|
|
33
|
+
cwd: options?.cwd || p.projectPath(),
|
|
34
|
+
...options
|
|
35
|
+
};
|
|
36
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
37
|
+
return await runCommands(commands, o);
|
|
46
38
|
}
|
|
47
39
|
function hasAction(action) {
|
|
48
40
|
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
|
@@ -254,7 +246,7 @@ async function installPackages(names) {
|
|
|
254
246
|
|
|
255
247
|
// src/make.ts
|
|
256
248
|
import process3 from "process";
|
|
257
|
-
import {italic
|
|
249
|
+
import {italic} from "@stacksjs/cli";
|
|
258
250
|
import {log as log6} from "@stacksjs/logging";
|
|
259
251
|
import {createFolder, doesFolderExist, writeTextFile} from "@stacksjs/storage";
|
|
260
252
|
import {frameworkPath as frameworkPath2, projectPath as projectPath3, resolve} from "@stacksjs/path";
|
|
@@ -282,7 +274,7 @@ async function makeComponent(options) {
|
|
|
282
274
|
const name = options.name;
|
|
283
275
|
log6.info("Creating your component...");
|
|
284
276
|
await createComponent(options);
|
|
285
|
-
log6.success(`Created ${
|
|
277
|
+
log6.success(`Created ${italic(name)} component`);
|
|
286
278
|
} catch (error) {
|
|
287
279
|
log6.error("There was an error creating your component", error);
|
|
288
280
|
process3.exit();
|
|
@@ -308,9 +300,9 @@ console.log('Hello World component created')
|
|
|
308
300
|
function makeDatabase(options) {
|
|
309
301
|
try {
|
|
310
302
|
const name = options.name;
|
|
311
|
-
log6.info(`Creating your ${
|
|
303
|
+
log6.info(`Creating your ${italic(name)} database...`);
|
|
312
304
|
createDatabase(options);
|
|
313
|
-
log6.success(`Created ${
|
|
305
|
+
log6.success(`Created ${italic(name)} database`);
|
|
314
306
|
} catch (error) {
|
|
315
307
|
log6.error("There was an error creating your database", error);
|
|
316
308
|
process3.exit();
|
|
@@ -322,9 +314,9 @@ function createDatabase(options) {
|
|
|
322
314
|
function factory(options) {
|
|
323
315
|
try {
|
|
324
316
|
const name = options.name;
|
|
325
|
-
log6.info(`Creating your ${
|
|
317
|
+
log6.info(`Creating your ${italic(name)} factory...`);
|
|
326
318
|
createDatabase(options);
|
|
327
|
-
log6.success(`Created ${
|
|
319
|
+
log6.success(`Created ${italic(name)} factory`);
|
|
328
320
|
} catch (error) {
|
|
329
321
|
log6.error("There was an error creating your factory", error);
|
|
330
322
|
process3.exit();
|
|
@@ -336,9 +328,9 @@ function createFactory(options) {
|
|
|
336
328
|
async function makeNotification(options) {
|
|
337
329
|
try {
|
|
338
330
|
const name = options.name;
|
|
339
|
-
log6.info(`Creating your ${
|
|
331
|
+
log6.info(`Creating your ${italic(name)} notification...`);
|
|
340
332
|
await createNotification(options);
|
|
341
|
-
log6.success(`Created ${
|
|
333
|
+
log6.success(`Created ${italic(name)} notification`);
|
|
342
334
|
} catch (error) {
|
|
343
335
|
log6.error("There was an error creating your notification", error);
|
|
344
336
|
process3.exit();
|
package/dist/src/lint/fix.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/lint/fix.ts
|
|
3
|
-
import {log,
|
|
3
|
+
import {log, parseOptions, runCommand} from "@stacksjs/cli";
|
|
4
4
|
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, {
|
|
9
|
+
cwd: projectPath(),
|
|
10
|
+
...options
|
|
11
|
+
});
|
|
8
12
|
log.success("Linted");
|
package/dist/src/release.js
CHANGED
|
@@ -3,48 +3,40 @@
|
|
|
3
3
|
|
|
4
4
|
// src/helpers/utils.ts
|
|
5
5
|
import * as storage from "@stacksjs/storage";
|
|
6
|
-
import {
|
|
6
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
7
7
|
import {log} from "@stacksjs/logging";
|
|
8
8
|
import * as p from "@stacksjs/path";
|
|
9
9
|
import {err, handleError} from "@stacksjs/error-handling";
|
|
10
|
-
var parseOptions = function(options) {
|
|
11
|
-
if (!options)
|
|
12
|
-
return "";
|
|
13
|
-
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
14
|
-
if (key.length === 1)
|
|
15
|
-
return `-${key}=${value}`;
|
|
16
|
-
if (typeof value === "boolean" && value)
|
|
17
|
-
return `--${key}`;
|
|
18
|
-
return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
|
|
19
|
-
});
|
|
20
|
-
return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
|
|
21
|
-
};
|
|
22
10
|
async function runAction(action, options) {
|
|
23
|
-
|
|
24
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
25
|
-
const opts = parseOptions(options);
|
|
11
|
+
const opts = buddyOptions();
|
|
26
12
|
const path = p.relativeActionsPath(`${action}.ts`);
|
|
27
|
-
const cmd = `bun --bun ${
|
|
28
|
-
const
|
|
13
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
14
|
+
const optionsWithCwd = {
|
|
29
15
|
cwd: options?.cwd || p.projectPath(),
|
|
30
16
|
...options
|
|
31
17
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return await runCommand(cmd, o);
|
|
18
|
+
log.debug("runAction:", cmd);
|
|
19
|
+
log.debug("action options:", optionsWithCwd);
|
|
20
|
+
if (!hasAction(action))
|
|
21
|
+
return err(handleError(`The specified action "${action}" does not exist`));
|
|
22
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
38
23
|
}
|
|
39
24
|
async function runActions(actions, options) {
|
|
25
|
+
log.debug("runActions:", actions);
|
|
26
|
+
log.debug("actions options:", options);
|
|
40
27
|
if (!actions.length)
|
|
41
28
|
return err("No actions were specified");
|
|
42
29
|
for (const action of actions) {
|
|
43
30
|
if (!hasAction(action))
|
|
44
31
|
return err(`The specified action "${action}" does not exist`);
|
|
45
32
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
33
|
+
const opts = buddyOptions();
|
|
34
|
+
const o = {
|
|
35
|
+
cwd: options?.cwd || p.projectPath(),
|
|
36
|
+
...options
|
|
37
|
+
};
|
|
38
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
39
|
+
return await runCommands(commands, o);
|
|
48
40
|
}
|
|
49
41
|
function hasAction(action) {
|
|
50
42
|
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
|
@@ -256,7 +248,7 @@ async function installPackages(names) {
|
|
|
256
248
|
|
|
257
249
|
// src/make.ts
|
|
258
250
|
import process3 from "process";
|
|
259
|
-
import {italic
|
|
251
|
+
import {italic} from "@stacksjs/cli";
|
|
260
252
|
import {log as log6} from "@stacksjs/logging";
|
|
261
253
|
import {createFolder, doesFolderExist, writeTextFile} from "@stacksjs/storage";
|
|
262
254
|
import {frameworkPath as frameworkPath2, projectPath as projectPath3, resolve} from "@stacksjs/path";
|
|
@@ -284,7 +276,7 @@ async function makeComponent(options) {
|
|
|
284
276
|
const name = options.name;
|
|
285
277
|
log6.info("Creating your component...");
|
|
286
278
|
await createComponent(options);
|
|
287
|
-
log6.success(`Created ${
|
|
279
|
+
log6.success(`Created ${italic(name)} component`);
|
|
288
280
|
} catch (error) {
|
|
289
281
|
log6.error("There was an error creating your component", error);
|
|
290
282
|
process3.exit();
|
|
@@ -310,9 +302,9 @@ console.log('Hello World component created')
|
|
|
310
302
|
function makeDatabase(options) {
|
|
311
303
|
try {
|
|
312
304
|
const name = options.name;
|
|
313
|
-
log6.info(`Creating your ${
|
|
305
|
+
log6.info(`Creating your ${italic(name)} database...`);
|
|
314
306
|
createDatabase(options);
|
|
315
|
-
log6.success(`Created ${
|
|
307
|
+
log6.success(`Created ${italic(name)} database`);
|
|
316
308
|
} catch (error) {
|
|
317
309
|
log6.error("There was an error creating your database", error);
|
|
318
310
|
process3.exit();
|
|
@@ -324,9 +316,9 @@ function createDatabase(options) {
|
|
|
324
316
|
function factory(options) {
|
|
325
317
|
try {
|
|
326
318
|
const name = options.name;
|
|
327
|
-
log6.info(`Creating your ${
|
|
319
|
+
log6.info(`Creating your ${italic(name)} factory...`);
|
|
328
320
|
createDatabase(options);
|
|
329
|
-
log6.success(`Created ${
|
|
321
|
+
log6.success(`Created ${italic(name)} factory`);
|
|
330
322
|
} catch (error) {
|
|
331
323
|
log6.error("There was an error creating your factory", error);
|
|
332
324
|
process3.exit();
|
|
@@ -338,9 +330,9 @@ function createFactory(options) {
|
|
|
338
330
|
async function makeNotification(options) {
|
|
339
331
|
try {
|
|
340
332
|
const name = options.name;
|
|
341
|
-
log6.info(`Creating your ${
|
|
333
|
+
log6.info(`Creating your ${italic(name)} notification...`);
|
|
342
334
|
await createNotification(options);
|
|
343
|
-
log6.success(`Created ${
|
|
335
|
+
log6.success(`Created ${italic(name)} notification`);
|
|
344
336
|
} catch (error) {
|
|
345
337
|
log6.error("There was an error creating your notification", error);
|
|
346
338
|
process3.exit();
|
|
@@ -552,5 +544,8 @@ await runActions([
|
|
|
552
544
|
Action4.GenerateLibraryEntries,
|
|
553
545
|
Action4.LintFix,
|
|
554
546
|
Action4.Bump
|
|
555
|
-
], {
|
|
547
|
+
], {
|
|
548
|
+
cwd: projectPath4(),
|
|
549
|
+
stdin: "inherit"
|
|
550
|
+
});
|
|
556
551
|
log7.success(`Successfully released ${app.name}`);
|
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/helpers/utils.ts
|
|
3
3
|
import * as storage from "@stacksjs/storage";
|
|
4
|
-
import {
|
|
4
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {err, handleError} from "@stacksjs/error-handling";
|
|
8
|
-
var parseOptions = function(options) {
|
|
9
|
-
if (!options)
|
|
10
|
-
return "";
|
|
11
|
-
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
12
|
-
if (key.length === 1)
|
|
13
|
-
return `-${key}=${value}`;
|
|
14
|
-
if (typeof value === "boolean" && value)
|
|
15
|
-
return `--${key}`;
|
|
16
|
-
return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
|
|
17
|
-
});
|
|
18
|
-
return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
|
|
19
|
-
};
|
|
20
8
|
async function runAction(action, options) {
|
|
21
|
-
|
|
22
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
23
|
-
const opts = parseOptions(options);
|
|
9
|
+
const opts = buddyOptions();
|
|
24
10
|
const path = p.relativeActionsPath(`${action}.ts`);
|
|
25
|
-
const cmd = `bun --bun ${
|
|
26
|
-
const
|
|
11
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
12
|
+
const optionsWithCwd = {
|
|
27
13
|
cwd: options?.cwd || p.projectPath(),
|
|
28
14
|
...options
|
|
29
15
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return await runCommand(cmd, o);
|
|
16
|
+
log.debug("runAction:", cmd);
|
|
17
|
+
log.debug("action options:", optionsWithCwd);
|
|
18
|
+
if (!hasAction(action))
|
|
19
|
+
return err(handleError(`The specified action "${action}" does not exist`));
|
|
20
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
36
21
|
}
|
|
37
22
|
async function runActions(actions, options) {
|
|
23
|
+
log.debug("runActions:", actions);
|
|
24
|
+
log.debug("actions options:", options);
|
|
38
25
|
if (!actions.length)
|
|
39
26
|
return err("No actions were specified");
|
|
40
27
|
for (const action of actions) {
|
|
41
28
|
if (!hasAction(action))
|
|
42
29
|
return err(`The specified action "${action}" does not exist`);
|
|
43
30
|
}
|
|
44
|
-
const
|
|
45
|
-
|
|
31
|
+
const opts = buddyOptions();
|
|
32
|
+
const o = {
|
|
33
|
+
cwd: options?.cwd || p.projectPath(),
|
|
34
|
+
...options
|
|
35
|
+
};
|
|
36
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
37
|
+
return await runCommands(commands, o);
|
|
46
38
|
}
|
|
47
39
|
function hasAction(action) {
|
|
48
40
|
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
package/dist/src/upgrade.js
CHANGED
|
@@ -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.
|
|
10
|
+
var version = "0.58.61";
|
|
10
11
|
|
|
11
12
|
// src/upgrade.ts
|
|
12
|
-
function checkForUncommittedChanges(
|
|
13
|
+
function checkForUncommittedChanges(options) {
|
|
13
14
|
try {
|
|
14
15
|
} catch (error) {
|
|
15
16
|
if (error.status === 1) {
|
|
16
|
-
if (!
|
|
17
|
+
if (!options?.force) {
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
async function downloadFrameworkUpdate(
|
|
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}`,
|
|
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,
|
|
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
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
|
|
5
|
-
description
|
|
6
|
-
rate
|
|
7
|
-
tries
|
|
8
|
-
backoff
|
|
9
|
-
enabled
|
|
10
|
-
handle: () => Promise<
|
|
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 }:
|
|
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/bump.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { runCommand } from '@stacksjs/cli'
|
|
1
|
+
import { parseOptions, runCommand } from '@stacksjs/cli'
|
|
2
2
|
import { path as p } from '@stacksjs/path'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const options = parseOptions()
|
|
5
|
+
const changelogCommand = options?.dryRun ? 'buddy changelog --quiet --dry-run' : 'buddy changelog --quiet'
|
|
6
|
+
|
|
7
|
+
await runCommand(changelogCommand, {
|
|
5
8
|
cwd: p.projectPath(),
|
|
6
9
|
})
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
'bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const bumpCommand = options?.dryRun
|
|
12
|
+
? 'bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --no-push'
|
|
13
|
+
: 'bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --all'
|
|
14
|
+
|
|
15
|
+
await runCommand(bumpCommand, {
|
|
16
|
+
cwd: p.frameworkPath(),
|
|
17
|
+
stdin: 'inherit',
|
|
18
|
+
})
|
package/src/changelog.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import { execSync, runCommand } from '@stacksjs/cli'
|
|
1
|
+
import { execSync, log, parseOptions, runCommand } from '@stacksjs/cli'
|
|
2
2
|
import { projectPath } from '@stacksjs/path'
|
|
3
3
|
|
|
4
|
+
// when log.debug is used, only log to file in production
|
|
5
|
+
log.debug('Generating changelog')
|
|
4
6
|
const fromRevision = await execSync('git describe --abbrev=0 --tags HEAD^')
|
|
5
|
-
|
|
7
|
+
log.debug('FromRevision', fromRevision)
|
|
6
8
|
const toRevision = await execSync('git describe')
|
|
7
|
-
|
|
9
|
+
log.debug('ToRevision', toRevision)
|
|
10
|
+
const options = parseOptions()
|
|
11
|
+
log.debug('Changelog Options', options)
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
const command = options?.dryRun
|
|
14
|
+
? `bunx changelogen --no-output --from ${fromRevision} --to ${toRevision}`
|
|
15
|
+
: `bunx changelogen --output CHANGELOG.md --from ${fromRevision} --to ${toRevision}`
|
|
16
|
+
|
|
17
|
+
await runCommand(command, {
|
|
10
18
|
cwd: projectPath(),
|
|
19
|
+
quiet: options?.quiet,
|
|
20
|
+
verbose: options?.verbose,
|
|
11
21
|
})
|
package/src/clean.ts
CHANGED
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
|
-
|
|
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
|
package/src/domains/add.ts
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
11
|
-
|
|
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 (!
|
|
22
|
-
|
|
23
|
-
|
|
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(
|
|
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(
|
|
25
|
+
const nameServers = await getNameservers(domain)
|
|
40
26
|
|
|
41
27
|
if (!nameServers) {
|
|
42
|
-
handleError(`No nameservers found for domain: ${
|
|
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
|
|
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 (
|
|
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
|
-
|
|
58
|
+
nameServers.forEach((nameserver: string, index: number) => {
|
|
74
59
|
logger.log(` ${emojis[index]} Nameserver: ${nameserver}`)
|
|
75
60
|
})
|
|
76
61
|
logger.log('')
|
package/src/helpers/utils.ts
CHANGED
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import * as storage from '@stacksjs/storage'
|
|
2
|
-
import {
|
|
2
|
+
import { buddyOptions, runCommand, runCommands } from '@stacksjs/cli'
|
|
3
3
|
import { log } from '@stacksjs/logging'
|
|
4
4
|
import * as p from '@stacksjs/path'
|
|
5
5
|
import type { ActionOptions, StacksError, Subprocess } from '@stacksjs/types'
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
function parseOptions(options?: ActionOptions) {
|
|
9
|
-
if (!options)
|
|
10
|
-
return ''
|
|
11
|
-
|
|
12
|
-
const parsedOptions = Object.entries(options).map(([key, value]) => {
|
|
13
|
-
if (key.length === 1)
|
|
14
|
-
return `-${key}=${value}`
|
|
15
|
-
|
|
16
|
-
if (typeof value === 'boolean' && value) // if the value is `true`, just return the key
|
|
17
|
-
return `--${key}`
|
|
18
|
-
|
|
19
|
-
return `--${key}=${typeof value === 'string' && value.includes(' ') ? `"${value}"` : value}`
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
// filter out undefined values and join the array
|
|
23
|
-
return parsedOptions.filter(Boolean).join(' ').replace('----=', '')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// export type ActionResult = CommandResult
|
|
6
|
+
import type { Result } from '@stacksjs/error-handling'
|
|
7
|
+
import { err, handleError } from '@stacksjs/error-handling'
|
|
27
8
|
|
|
28
9
|
/**
|
|
29
10
|
* Run an Action the Stacks way.
|
|
@@ -33,24 +14,21 @@ function parseOptions(options?: ActionOptions) {
|
|
|
33
14
|
* @returns The result of the command.
|
|
34
15
|
*/
|
|
35
16
|
export async function runAction(action: string, options?: ActionOptions): Promise<Result<Subprocess, StacksError>> {
|
|
36
|
-
|
|
37
|
-
return err(handleError(`The specified action "${action}" does not exist`))
|
|
38
|
-
|
|
39
|
-
const opts = parseOptions(options)
|
|
17
|
+
const opts = buddyOptions()
|
|
40
18
|
const path = p.relativeActionsPath(`${action}.ts`)
|
|
41
|
-
const cmd = `bun --bun ${
|
|
42
|
-
const
|
|
19
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd()
|
|
20
|
+
const optionsWithCwd = {
|
|
43
21
|
cwd: options?.cwd || p.projectPath(),
|
|
44
22
|
...options,
|
|
45
23
|
}
|
|
46
24
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
25
|
+
log.debug('runAction:', cmd)
|
|
26
|
+
log.debug('action options:', optionsWithCwd)
|
|
27
|
+
|
|
28
|
+
if (!hasAction(action))
|
|
29
|
+
return err(handleError(`The specified action "${action}" does not exist`))
|
|
52
30
|
|
|
53
|
-
return await runCommand(cmd,
|
|
31
|
+
return await runCommand(cmd, optionsWithCwd)
|
|
54
32
|
}
|
|
55
33
|
|
|
56
34
|
/**
|
|
@@ -61,6 +39,9 @@ export async function runAction(action: string, options?: ActionOptions): Promis
|
|
|
61
39
|
* @returns The result of the command.
|
|
62
40
|
*/
|
|
63
41
|
export async function runActions(actions: string[], options?: ActionOptions) {
|
|
42
|
+
log.debug('runActions:', actions)
|
|
43
|
+
log.debug('actions options:', options)
|
|
44
|
+
|
|
64
45
|
if (!actions.length)
|
|
65
46
|
return err('No actions were specified')
|
|
66
47
|
|
|
@@ -69,9 +50,16 @@ export async function runActions(actions: string[], options?: ActionOptions) {
|
|
|
69
50
|
return err(`The specified action "${action}" does not exist`)
|
|
70
51
|
}
|
|
71
52
|
|
|
72
|
-
const
|
|
53
|
+
const opts = buddyOptions()
|
|
54
|
+
|
|
55
|
+
const o = {
|
|
56
|
+
cwd: options?.cwd || p.projectPath(),
|
|
57
|
+
...options,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const commands = actions.map(action => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`)
|
|
73
61
|
|
|
74
|
-
return await runCommands(commands,
|
|
62
|
+
return await runCommands(commands, o)
|
|
75
63
|
}
|
|
76
64
|
|
|
77
65
|
export function hasAction(action: string) {
|
package/src/lint/fix.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { log,
|
|
1
|
+
import { log, parseOptions, runCommand } from '@stacksjs/cli'
|
|
2
2
|
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()
|
|
8
|
+
await runCommand(NpmScript.LintFix, {
|
|
9
|
+
cwd: projectPath(),
|
|
10
|
+
...options,
|
|
11
|
+
})
|
|
12
|
+
|
|
7
13
|
log.success('Linted')
|
package/src/migrate/dns.ts
CHANGED
package/src/release.ts
CHANGED
|
@@ -10,6 +10,9 @@ await runActions([
|
|
|
10
10
|
Action.LintFix, // ensure there are no lint errors
|
|
11
11
|
// Action.Test, // run the tests
|
|
12
12
|
Action.Bump, // bump the versions, create the git tag, generate the changelog, commit & push the changes
|
|
13
|
-
], {
|
|
13
|
+
], { // debug mode needs to be enabled to see the output due to the interactive prompts
|
|
14
|
+
cwd: projectPath(),
|
|
15
|
+
stdin: 'inherit',
|
|
16
|
+
})
|
|
14
17
|
|
|
15
18
|
log.success(`Successfully released ${app.name}`)
|
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,
|
|
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
|
|