@fedify/init 2.3.0-dev.1273 → 2.3.0-dev.1280
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/action/mod.d.ts +3 -1
- package/dist/action/mod.js +6 -4
- package/dist/action/notice.js +6 -2
- package/dist/action/utils.js +3 -1
- package/dist/command.d.ts +3 -0
- package/dist/command.js +2 -1
- package/dist/deno.js +1 -1
- package/dist/webframeworks/next.js +5 -4
- package/package.json +1 -1
package/dist/action/mod.d.ts
CHANGED
|
@@ -13,7 +13,9 @@ import { InitCommandData } from "../types.js";
|
|
|
13
13
|
* 5. Converts `InitCommandOptions` into `InitCommandData` via `setData`.
|
|
14
14
|
* 6. Branches based on `isDry`:
|
|
15
15
|
* - If dry run, executes `handleDryRun`.
|
|
16
|
-
* - Otherwise, executes `handleHydRun
|
|
16
|
+
* - Otherwise, executes `handleHydRun`, which installs dependencies, or—when
|
|
17
|
+
* `--skip-install` is set—prints how to install them manually via
|
|
18
|
+
* `noticeSkippedInstall`.
|
|
17
19
|
* 7. Recommends configuration environment via `recommendConfigEnv`.
|
|
18
20
|
* 8. Shows how to run the project via `noticeHowToRun`.
|
|
19
21
|
*/
|
package/dist/action/mod.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { set } from "../utils.js";
|
|
2
2
|
import askOptions from "../ask/mod.js";
|
|
3
3
|
import { makeDirIfHyd } from "./dir.js";
|
|
4
|
-
import { drawDinosaur, noticeHowToRun, noticeOptions, noticePrecommand } from "./notice.js";
|
|
4
|
+
import { drawDinosaur, noticeHowToRun, noticeOptions, noticePrecommand, noticeSkippedInstall } from "./notice.js";
|
|
5
5
|
import recommendConfigEnv from "./env.js";
|
|
6
|
-
import { hasCommand, installDependencies, isDry, runPrecommand } from "./utils.js";
|
|
6
|
+
import { hasCommand, installDependencies, isDry, isSkipInstall, runPrecommand } from "./utils.js";
|
|
7
7
|
import { assertNoGeneratedFileConflicts, patchFiles, recommendPatchFiles } from "./patch.js";
|
|
8
8
|
import recommendDependencies from "./recommend.js";
|
|
9
9
|
import setData from "./set.js";
|
|
@@ -21,13 +21,15 @@ import process from "node:process";
|
|
|
21
21
|
* 5. Converts `InitCommandOptions` into `InitCommandData` via `setData`.
|
|
22
22
|
* 6. Branches based on `isDry`:
|
|
23
23
|
* - If dry run, executes `handleDryRun`.
|
|
24
|
-
* - Otherwise, executes `handleHydRun
|
|
24
|
+
* - Otherwise, executes `handleHydRun`, which installs dependencies, or—when
|
|
25
|
+
* `--skip-install` is set—prints how to install them manually via
|
|
26
|
+
* `noticeSkippedInstall`.
|
|
25
27
|
* 7. Recommends configuration environment via `recommendConfigEnv`.
|
|
26
28
|
* 8. Shows how to run the project via `noticeHowToRun`.
|
|
27
29
|
*/
|
|
28
30
|
const runInit = (options) => pipe(options, tap(drawDinosaur), setTestMode, askOptions, tap(noticeOptions), setData, when(isDry, handleDryRun), unless(isDry, handleHydRun), tap(recommendConfigEnv), tap(noticeHowToRun));
|
|
29
31
|
const setTestMode = set("testMode", () => Boolean(process.env["FEDIFY_TEST_MODE"]));
|
|
30
32
|
const handleDryRun = (data) => pipe(data, tap(when(hasCommand, noticePrecommand)), tap(recommendPatchFiles), tap(recommendDependencies));
|
|
31
|
-
const handleHydRun = (data) => pipe(data, tap(makeDirIfHyd), tap(assertNoGeneratedFileConflicts), tap(when(hasCommand, runPrecommand)), tap(patchFiles), tap(installDependencies));
|
|
33
|
+
const handleHydRun = (data) => pipe(data, tap(makeDirIfHyd), tap(assertNoGeneratedFileConflicts), tap(when(hasCommand, runPrecommand)), tap(patchFiles), tap(unless(isSkipInstall, installDependencies)), tap(when(isSkipInstall, noticeSkippedInstall)));
|
|
32
34
|
//#endregion
|
|
33
35
|
export { runInit as default };
|
package/dist/action/notice.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { colors, printMessage } from "../utils.js";
|
|
2
2
|
import { flow } from "es-toolkit";
|
|
3
|
-
import { text } from "@optique/core";
|
|
3
|
+
import { commandLine, text } from "@optique/core";
|
|
4
4
|
//#region src/action/notice.ts
|
|
5
5
|
/** Prints the Feddy ASCII art banner to stderr. */
|
|
6
6
|
function drawDinosaur() {
|
|
@@ -67,5 +67,9 @@ ${instruction}
|
|
|
67
67
|
|
|
68
68
|
Start by editing the ${text(federationFile)} file to define your federation!
|
|
69
69
|
`;
|
|
70
|
+
/** Prints a notice that dependency installation was skipped and how to install them manually. */
|
|
71
|
+
const noticeSkippedInstall = ({ packageManager }) => printMessage`
|
|
72
|
+
Dependencies were not installed. Run ${commandLine(`${packageManager} install`)} in the project directory to install them.
|
|
73
|
+
`;
|
|
70
74
|
//#endregion
|
|
71
|
-
export { displayFile, drawDinosaur, noticeConfigEnv, noticeDeps, noticeDepsIfExist, noticeDevDepsIfExist, noticeEnvKeyValue, noticeFilesToCreate, noticeFilesToInsert, noticeHowToRun, noticeOptions, noticePrecommand };
|
|
75
|
+
export { displayFile, drawDinosaur, noticeConfigEnv, noticeDeps, noticeDepsIfExist, noticeDevDepsIfExist, noticeEnvKeyValue, noticeFilesToCreate, noticeFilesToInsert, noticeHowToRun, noticeOptions, noticePrecommand, noticeSkippedInstall };
|
package/dist/action/utils.js
CHANGED
|
@@ -3,6 +3,8 @@ import { join } from "node:path";
|
|
|
3
3
|
//#region src/action/utils.ts
|
|
4
4
|
/** Returns `true` if the current run is in dry-run mode. */
|
|
5
5
|
const isDry = ({ dryRun }) => dryRun;
|
|
6
|
+
/** Returns `true` if the current run skips dependency installation. */
|
|
7
|
+
const isSkipInstall = ({ skipInstall }) => skipInstall;
|
|
6
8
|
/** Returns `true` if the framework initializer has a precommand to execute. */
|
|
7
9
|
const hasCommand = (data) => !!data.initializer.command;
|
|
8
10
|
/** Returns `true` if the selected package manager is Deno. */
|
|
@@ -75,4 +77,4 @@ function* splitOnOperator(command) {
|
|
|
75
77
|
if (current.length > 0) yield current;
|
|
76
78
|
}
|
|
77
79
|
//#endregion
|
|
78
|
-
export { hasCommand, installDependencies, isDeno, isDry, joinDir, needsDenoDotenv, runPrecommand, stringifyEnvs };
|
|
80
|
+
export { hasCommand, installDependencies, isDeno, isDry, isSkipInstall, joinDir, needsDenoDotenv, runPrecommand, stringifyEnvs };
|
package/dist/command.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ declare const initOptions: _$_optique_core0.Parser<"sync", {
|
|
|
15
15
|
readonly messageQueue: "postgres" | "mysql" | "redis" | "denokv" | "in-process" | "amqp" | undefined;
|
|
16
16
|
readonly dryRun: boolean;
|
|
17
17
|
readonly allowNonEmpty: boolean;
|
|
18
|
+
readonly skipInstall: boolean;
|
|
18
19
|
}, {
|
|
19
20
|
readonly dir: [_$_optique_core0.ValueParserResult<string> | undefined] | undefined;
|
|
20
21
|
readonly webFramework: [_$_optique_core0.ValueParserResult<"bare-bones" | "hono" | "nitro" | "next" | "elysia" | "astro" | "express" | "nuxt" | "solidstart"> | undefined] | undefined;
|
|
@@ -23,6 +24,7 @@ declare const initOptions: _$_optique_core0.Parser<"sync", {
|
|
|
23
24
|
readonly messageQueue: [_$_optique_core0.ValueParserResult<"postgres" | "mysql" | "redis" | "denokv" | "in-process" | "amqp"> | undefined] | undefined;
|
|
24
25
|
readonly dryRun: _$_optique_core0.ValueParserResult<boolean> | undefined;
|
|
25
26
|
readonly allowNonEmpty: _$_optique_core0.ValueParserResult<boolean> | undefined;
|
|
27
|
+
readonly skipInstall: _$_optique_core0.ValueParserResult<boolean> | undefined;
|
|
26
28
|
}>;
|
|
27
29
|
/**
|
|
28
30
|
* The `fedify init` CLI command parser.
|
|
@@ -35,6 +37,7 @@ declare const initCommand: _$_optique_core0.Parser<"sync", {
|
|
|
35
37
|
readonly messageQueue: "postgres" | "mysql" | "redis" | "denokv" | "in-process" | "amqp" | undefined;
|
|
36
38
|
readonly dryRun: boolean;
|
|
37
39
|
readonly allowNonEmpty: boolean;
|
|
40
|
+
readonly skipInstall: boolean;
|
|
38
41
|
} & {
|
|
39
42
|
readonly command: "init";
|
|
40
43
|
}, ["matched", string] | ["parsing", Record<string | symbol, unknown>] | undefined>;
|
package/dist/command.js
CHANGED
|
@@ -18,7 +18,8 @@ const initOptions = object("Initialization options", {
|
|
|
18
18
|
kvStore,
|
|
19
19
|
messageQueue,
|
|
20
20
|
dryRun: option("--dry-run", { description: message`Perform a trial run with no changes made.` }),
|
|
21
|
-
allowNonEmpty: option("--allow-non-empty", { description: message`Allow initializing in a non-empty directory when the selected framework scaffolder supports it, failing if any generated file already exists.` })
|
|
21
|
+
allowNonEmpty: option("--allow-non-empty", { description: message`Allow initializing in a non-empty directory when the selected framework scaffolder supports it, failing if any generated file already exists.` }),
|
|
22
|
+
skipInstall: option("--skip-install", { description: message`Skip installing dependencies after scaffolding the project.` })
|
|
22
23
|
});
|
|
23
24
|
/**
|
|
24
25
|
* The `fedify init` CLI command parser.
|
package/dist/deno.js
CHANGED
|
@@ -8,8 +8,8 @@ const nextDescription = {
|
|
|
8
8
|
label: "Next.js",
|
|
9
9
|
packageManagers: PACKAGE_MANAGER,
|
|
10
10
|
defaultPort: 3e3,
|
|
11
|
-
init: async ({ packageManager: pm }) => ({
|
|
12
|
-
command: getNextInitCommand(pm),
|
|
11
|
+
init: async ({ packageManager: pm, skipInstall }) => ({
|
|
12
|
+
command: getNextInitCommand(pm, skipInstall),
|
|
13
13
|
dependencies: {
|
|
14
14
|
"@fedify/next": PACKAGE_VERSION,
|
|
15
15
|
...pm === "deno" ? defaultDenoDependencies : {}
|
|
@@ -33,10 +33,11 @@ const nextDescription = {
|
|
|
33
33
|
* Returns the shell command array to scaffold a new Next.js project
|
|
34
34
|
* in the current directory using the given package manager.
|
|
35
35
|
*/
|
|
36
|
-
const getNextInitCommand = (pm) => [
|
|
36
|
+
const getNextInitCommand = (pm, skipInstall) => [
|
|
37
37
|
...createNextAppCommand(pm),
|
|
38
38
|
".",
|
|
39
|
-
"--yes"
|
|
39
|
+
"--yes",
|
|
40
|
+
...skipInstall ? ["--skip-install"] : []
|
|
40
41
|
];
|
|
41
42
|
const createNextAppCommand = (pm) => pm === "deno" ? [
|
|
42
43
|
"deno",
|