create-nattyjs 0.0.1-beta.70 → 0.0.1-beta.71
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/index.js +2 -3
- package/package.json +2 -2
- package/src/const/version-registry.js +1 -2
- package/src/const/workspace-definitions.js +33 -5
- package/src/functions/cli-theme.js +21 -5
- package/src/functions/prompt-project-options.js +48 -6
- package/src/functions/render-package-jsons.js +22 -7
- package/src/functions/render-workspace.js +164 -24
- package/template-fullstack-angular/apps/api/package.json +8 -8
- package/template-fullstack-angular/apps/web/package.json +1 -1
- package/template-fullstack-astro/apps/api/package.json +8 -8
- package/template-fullstack-astro/apps/web/package.json +1 -1
- package/template-fullstack-next/apps/api/package.json +8 -8
- package/template-fullstack-next/apps/web/package.json +1 -1
- package/template-fullstack-nuxt/apps/api/package.json +8 -8
- package/template-fullstack-nuxt/apps/web/package.json +1 -1
- package/template-fullstack-react/apps/api/package.json +8 -8
- package/template-fullstack-react/apps/web/package.json +1 -1
- package/template-fullstack-sveltekit/apps/api/package.json +8 -8
- package/template-fullstack-sveltekit/apps/web/package.json +1 -1
- package/template-fullstack-vue/apps/api/package.json +8 -8
- package/template-fullstack-vue/apps/web/package.json +1 -1
- package/template-nattyjs-blank/package.json +8 -8
package/index.js
CHANGED
|
@@ -50,8 +50,8 @@ async function initNatty() {
|
|
|
50
50
|
const targetDir = (promptResult.projectName || argv._[0] || "").trim() || "nattyjs-project";
|
|
51
51
|
const template = getTemplateById(promptResult.templateId || argv.template) || TEMPLATE_DEFINITIONS[0];
|
|
52
52
|
const isFullstack = isFullstackTemplate(template);
|
|
53
|
-
const workspaceSetup = (promptResult.workspaceSetup || argv.workspace || "
|
|
54
|
-
const selectedWorkspace = isFullstack ? getWorkspaceById(workspaceSetup) || getWorkspaceById("
|
|
53
|
+
const workspaceSetup = (promptResult.workspaceSetup || argv.workspace || "standalone").trim();
|
|
54
|
+
const selectedWorkspace = isFullstack ? getWorkspaceById(workspaceSetup) || getWorkspaceById("standalone") : undefined;
|
|
55
55
|
const includeExamples = examplesFlagProvided ? argv.examples : promptResult.includeExamples !== false;
|
|
56
56
|
const root = path.join(cwd, targetDir);
|
|
57
57
|
|
|
@@ -81,7 +81,6 @@ async function initNatty() {
|
|
|
81
81
|
cwd,
|
|
82
82
|
root,
|
|
83
83
|
packageManager: pkgManager,
|
|
84
|
-
isFullstack,
|
|
85
84
|
template,
|
|
86
85
|
workspace: selectedWorkspace,
|
|
87
86
|
includeExamples,
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-nattyjs",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.71",
|
|
4
4
|
"description": "Create NattyJS API Project",
|
|
5
5
|
"main": "./index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
6
|
"type": "module",
|
|
8
7
|
"files": [
|
|
8
|
+
"index.js",
|
|
9
9
|
"src",
|
|
10
10
|
"template-nattyjs-blank",
|
|
11
11
|
"template-fullstack-vue",
|
|
@@ -4,7 +4,7 @@ import path from "path";
|
|
|
4
4
|
const FRONTEND_PACKAGE_VERSIONS = {
|
|
5
5
|
concurrently: "^9.0.1",
|
|
6
6
|
turbo: "^2.1.3",
|
|
7
|
-
|
|
7
|
+
nx: "^20.0.0",
|
|
8
8
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
9
9
|
"@vitejs/plugin-react": "^4.3.2",
|
|
10
10
|
vue: "^3.5.13",
|
|
@@ -68,7 +68,6 @@ export function getVersionRegistry(packageBaseDir) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
return {
|
|
71
|
-
packageManager: `pnpm@${FRONTEND_PACKAGE_VERSIONS.pnpm}`,
|
|
72
71
|
versions,
|
|
73
72
|
};
|
|
74
73
|
}
|
|
@@ -1,17 +1,45 @@
|
|
|
1
|
+
export const PROJECT_LAYOUT_DEFINITIONS = [
|
|
2
|
+
{
|
|
3
|
+
id: "standalone",
|
|
4
|
+
title: "Single Repo",
|
|
5
|
+
description: "api/ + web/ folders with the simplest dev flow",
|
|
6
|
+
recommended: true,
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
id: "monorepo",
|
|
10
|
+
title: "Monorepo",
|
|
11
|
+
description: "apps/api + apps/web with a dedicated workspace tool",
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
|
|
1
15
|
export const WORKSPACE_DEFINITIONS = [
|
|
16
|
+
{
|
|
17
|
+
id: "standalone",
|
|
18
|
+
title: "Single Repo",
|
|
19
|
+
description: "api/ + web/ folders with no workspace tool",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "npm-workspaces",
|
|
23
|
+
title: "npm workspaces",
|
|
24
|
+
description: "Simple npm-native monorepo",
|
|
25
|
+
recommended: true,
|
|
26
|
+
},
|
|
2
27
|
{
|
|
3
28
|
id: "turborepo",
|
|
4
29
|
title: "Turborepo",
|
|
5
|
-
description: "Fast
|
|
6
|
-
recommended: true,
|
|
30
|
+
description: "Fast task orchestration and caching",
|
|
7
31
|
},
|
|
8
32
|
{
|
|
9
|
-
id: "
|
|
10
|
-
title: "
|
|
11
|
-
description: "
|
|
33
|
+
id: "nx",
|
|
34
|
+
title: "Nx",
|
|
35
|
+
description: "Structured workspace tooling and task graph",
|
|
12
36
|
},
|
|
13
37
|
];
|
|
14
38
|
|
|
39
|
+
export const MONOREPO_WORKSPACE_DEFINITIONS = WORKSPACE_DEFINITIONS.filter((workspace) => {
|
|
40
|
+
return workspace.id !== "standalone";
|
|
41
|
+
});
|
|
42
|
+
|
|
15
43
|
const FULLSTACK_TEMPLATE_PREFIX = "fullstack-";
|
|
16
44
|
|
|
17
45
|
export function isFullstackTemplate(template) {
|
|
@@ -10,12 +10,25 @@ export function printIntro() {
|
|
|
10
10
|
|
|
11
11
|
export function formatTemplateChoice(template) {
|
|
12
12
|
const titleColor = template.id === "api-only" ? green : cyan;
|
|
13
|
+
const badge = template.id === "api-only" ? green("API") : cyan("FULLSTACK");
|
|
13
14
|
return {
|
|
14
|
-
title: bold(titleColor(template.title))
|
|
15
|
+
title: `${bold(titleColor(template.title))} ${dim(badge)}`,
|
|
15
16
|
description: dim(template.description),
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
export function formatLayoutChoice(layout) {
|
|
21
|
+
const isRecommended = layout.recommended === true;
|
|
22
|
+
const title = isRecommended
|
|
23
|
+
? `${bold(green(layout.title))} ${dim("(recommended)")}`
|
|
24
|
+
: bold(cyan(layout.title));
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
title,
|
|
28
|
+
description: dim(layout.description),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
export function formatWorkspaceChoice(workspace) {
|
|
20
33
|
const isRecommended = workspace.recommended === true;
|
|
21
34
|
const title = isRecommended
|
|
@@ -32,20 +45,20 @@ export function formatSuccessSummary({
|
|
|
32
45
|
cwd,
|
|
33
46
|
root,
|
|
34
47
|
packageManager,
|
|
35
|
-
isFullstack,
|
|
36
48
|
template,
|
|
37
49
|
workspace,
|
|
38
50
|
includeExamples,
|
|
39
51
|
}) {
|
|
40
|
-
const activePackageManager =
|
|
52
|
+
const activePackageManager = packageManager;
|
|
41
53
|
const relativeRoot = root === cwd ? "." : path.relative(cwd, root);
|
|
54
|
+
const isStandalone = workspace?.id === "standalone";
|
|
42
55
|
|
|
43
56
|
console.log("");
|
|
44
57
|
console.log(`${bold(green("Success"))} ${dim("Project scaffolded.")}`);
|
|
45
58
|
console.log(`${bold("Location")} ${relativeRoot}`);
|
|
46
59
|
console.log(`${bold("Template")} ${template.title}`);
|
|
47
|
-
if (
|
|
48
|
-
console.log(`${bold("
|
|
60
|
+
if (workspace) {
|
|
61
|
+
console.log(`${bold("Layout")} ${workspace.title}`);
|
|
49
62
|
}
|
|
50
63
|
console.log(`${bold("Examples")} ${includeExamples ? "Yes" : "No"}`);
|
|
51
64
|
console.log("");
|
|
@@ -60,6 +73,9 @@ export function formatSuccessSummary({
|
|
|
60
73
|
return;
|
|
61
74
|
}
|
|
62
75
|
console.log(` ${activePackageManager} install`);
|
|
76
|
+
if (isStandalone) {
|
|
77
|
+
console.log(` ${activePackageManager} run install:apps`);
|
|
78
|
+
}
|
|
63
79
|
console.log(` ${activePackageManager} run dev`);
|
|
64
80
|
console.log("");
|
|
65
81
|
}
|
|
@@ -2,8 +2,13 @@ import fs from "fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import prompts from "prompts";
|
|
4
4
|
import { red, reset } from "kolorist";
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
getWorkspaceById,
|
|
7
|
+
isFullstackTemplate,
|
|
8
|
+
MONOREPO_WORKSPACE_DEFINITIONS,
|
|
9
|
+
PROJECT_LAYOUT_DEFINITIONS,
|
|
10
|
+
} from "../const/workspace-definitions.js";
|
|
11
|
+
import { formatLayoutChoice, formatTemplateChoice, formatWorkspaceChoice } from "./cli-theme.js";
|
|
7
12
|
import { isEmpty } from "./file-system.js";
|
|
8
13
|
import { isValidPackageName, toValidPackageName } from "./package-name.js";
|
|
9
14
|
|
|
@@ -16,9 +21,10 @@ export async function resolveProjectOptions({
|
|
|
16
21
|
}) {
|
|
17
22
|
let targetDir = typeof argv._[0] === "string" ? argv._[0].trim() : "";
|
|
18
23
|
let selectedWorkspace = getWorkspaceById(argv.workspace);
|
|
24
|
+
let activeTemplate = selectedTemplate;
|
|
19
25
|
|
|
20
26
|
try {
|
|
21
|
-
|
|
27
|
+
const response = await prompts(
|
|
22
28
|
[
|
|
23
29
|
{
|
|
24
30
|
type: targetDir ? null : "text",
|
|
@@ -72,17 +78,44 @@ export async function resolveProjectOptions({
|
|
|
72
78
|
value: template.id,
|
|
73
79
|
};
|
|
74
80
|
}),
|
|
81
|
+
onState: (state) => {
|
|
82
|
+
activeTemplate =
|
|
83
|
+
templateDefinitions.find((template) => template.id === state.value) ||
|
|
84
|
+
selectedTemplate;
|
|
85
|
+
},
|
|
75
86
|
},
|
|
76
87
|
{
|
|
77
88
|
type: (_, values) => {
|
|
78
|
-
|
|
89
|
+
activeTemplate =
|
|
79
90
|
selectedTemplate ||
|
|
80
91
|
templateDefinitions.find((template) => template.id === values.templateId);
|
|
81
92
|
return !selectedWorkspace && isFullstackTemplate(activeTemplate) ? "select" : null;
|
|
82
93
|
},
|
|
94
|
+
name: "projectLayout",
|
|
95
|
+
message: reset("Select project shape:"),
|
|
96
|
+
choices: PROJECT_LAYOUT_DEFINITIONS.map((layout) => {
|
|
97
|
+
const formattedChoice = formatLayoutChoice(layout);
|
|
98
|
+
return {
|
|
99
|
+
title: formattedChoice.title,
|
|
100
|
+
description: formattedChoice.description,
|
|
101
|
+
value: layout.id,
|
|
102
|
+
};
|
|
103
|
+
}),
|
|
104
|
+
initial: 0,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: (_, values) => {
|
|
108
|
+
activeTemplate =
|
|
109
|
+
selectedTemplate ||
|
|
110
|
+
templateDefinitions.find((template) => template.id === values.templateId);
|
|
111
|
+
if (selectedWorkspace || !isFullstackTemplate(activeTemplate)) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return values.projectLayout === "monorepo" ? "select" : null;
|
|
115
|
+
},
|
|
83
116
|
name: "workspaceSetup",
|
|
84
|
-
message: reset("Select
|
|
85
|
-
choices:
|
|
117
|
+
message: reset("Select monorepo tool:"),
|
|
118
|
+
choices: MONOREPO_WORKSPACE_DEFINITIONS.map((workspace) => {
|
|
86
119
|
const formattedChoice = formatWorkspaceChoice(workspace);
|
|
87
120
|
return {
|
|
88
121
|
title: formattedChoice.title,
|
|
@@ -107,6 +140,15 @@ export async function resolveProjectOptions({
|
|
|
107
140
|
},
|
|
108
141
|
}
|
|
109
142
|
);
|
|
143
|
+
|
|
144
|
+
const resolvedTemplate =
|
|
145
|
+
activeTemplate ||
|
|
146
|
+
templateDefinitions.find((template) => template.id === response.templateId);
|
|
147
|
+
if (isFullstackTemplate(resolvedTemplate) && !selectedWorkspace && response.projectLayout === "standalone") {
|
|
148
|
+
response.workspaceSetup = "standalone";
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return response;
|
|
110
152
|
} catch (error) {
|
|
111
153
|
console.log(error.message);
|
|
112
154
|
return undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { getVersionRegistry } from "../const/version-registry.js";
|
|
4
|
-
import { applyWorkspaceSetup } from "./render-workspace.js";
|
|
4
|
+
import { applyStandaloneSetup, applyWorkspaceSetup } from "./render-workspace.js";
|
|
5
5
|
|
|
6
6
|
const DEPENDENCY_FIELDS = [
|
|
7
7
|
"dependencies",
|
|
@@ -58,6 +58,19 @@ export function renderProjectPackageJsons({
|
|
|
58
58
|
workspaceSetup,
|
|
59
59
|
}) {
|
|
60
60
|
const versionRegistry = getVersionRegistry(packageBaseDir);
|
|
61
|
+
if (isFullstack && workspaceSetup === "standalone") {
|
|
62
|
+
const rootPackageJsonPath = path.join(root, "package.json");
|
|
63
|
+
const rootPackageJson = JSON.parse(fs.readFileSync(rootPackageJsonPath, "utf8"));
|
|
64
|
+
updateDependencyVersions(rootPackageJson, versionRegistry);
|
|
65
|
+
rootPackageJson.name = packageName;
|
|
66
|
+
applyStandaloneSetup({
|
|
67
|
+
root,
|
|
68
|
+
rootPackageJson,
|
|
69
|
+
versionRegistry,
|
|
70
|
+
});
|
|
71
|
+
fs.writeFileSync(rootPackageJsonPath, JSON.stringify(rootPackageJson, null, 2), "utf8");
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
const packageJsonPaths = collectPackageJsonPaths(root);
|
|
62
75
|
const rootPackageJsonPath = path.join(root, "package.json");
|
|
63
76
|
|
|
@@ -69,12 +82,14 @@ export function renderProjectPackageJsons({
|
|
|
69
82
|
if (packageJsonPath === rootPackageJsonPath) {
|
|
70
83
|
packageJson.name = packageName;
|
|
71
84
|
if (isFullstack) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
if (workspaceSetup !== "standalone") {
|
|
86
|
+
applyWorkspaceSetup({
|
|
87
|
+
root,
|
|
88
|
+
rootPackageJson: packageJson,
|
|
89
|
+
workspaceSetup,
|
|
90
|
+
versionRegistry,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
78
93
|
}
|
|
79
94
|
}
|
|
80
95
|
|
|
@@ -2,6 +2,7 @@ import fs from "fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
|
|
4
4
|
const ROOT_SCRIPT_KEYS = [
|
|
5
|
+
"install:apps",
|
|
5
6
|
"dev",
|
|
6
7
|
"generate:client",
|
|
7
8
|
"dev:api",
|
|
@@ -11,29 +12,46 @@ const ROOT_SCRIPT_KEYS = [
|
|
|
11
12
|
"build:web",
|
|
12
13
|
];
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"dev:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"build:
|
|
15
|
+
const STANDALONE_SCRIPTS = {
|
|
16
|
+
"install:apps": "npm install --prefix api && npm install --prefix web",
|
|
17
|
+
dev: 'npm run generate:client && concurrently -k -n api,web -c green,cyan "npm --prefix api run dev" "npm --prefix web run dev"',
|
|
18
|
+
"generate:client": "npm --prefix api run build",
|
|
19
|
+
"dev:api": "npm --prefix api run dev",
|
|
20
|
+
"dev:web": "npm --prefix web run dev",
|
|
21
|
+
build: "npm --prefix api run build && npm --prefix web run build",
|
|
22
|
+
"build:api": "npm --prefix api run build",
|
|
23
|
+
"build:web": "npm --prefix web run build",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const NPM_WORKSPACE_SCRIPTS = {
|
|
27
|
+
dev: 'npm run generate:client && concurrently -k -n api,web -c green,cyan "npm run dev --workspace api" "npm run dev --workspace web"',
|
|
28
|
+
"generate:client": "npm run build --workspace api",
|
|
29
|
+
"dev:api": "npm run dev --workspace api",
|
|
30
|
+
"dev:web": "npm run dev --workspace web",
|
|
31
|
+
build: "npm run build --workspace api && npm run build --workspace web",
|
|
32
|
+
"build:api": "npm run build --workspace api",
|
|
33
|
+
"build:web": "npm run build --workspace web",
|
|
22
34
|
};
|
|
23
35
|
|
|
24
36
|
const TURBOREPO_SCRIPTS = {
|
|
25
|
-
dev: "
|
|
26
|
-
"generate:client": "
|
|
27
|
-
"dev:api": "
|
|
28
|
-
"dev:web": "
|
|
37
|
+
dev: "npm run generate:client && turbo run dev --parallel --filter=api --filter=web",
|
|
38
|
+
"generate:client": "npm run build --workspace api",
|
|
39
|
+
"dev:api": "npm run dev --workspace api",
|
|
40
|
+
"dev:web": "npm run dev --workspace web",
|
|
29
41
|
build: "turbo run build --filter=api --filter=web",
|
|
30
|
-
"build:api": "
|
|
31
|
-
"build:web": "
|
|
42
|
+
"build:api": "npm run build --workspace api",
|
|
43
|
+
"build:web": "npm run build --workspace web",
|
|
32
44
|
};
|
|
33
45
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
const NX_SCRIPTS = {
|
|
47
|
+
dev: "npm run generate:client && nx run-many --target=dev --projects=api,web --parallel",
|
|
48
|
+
"generate:client": "npm run build --workspace api",
|
|
49
|
+
"dev:api": "nx run api:dev",
|
|
50
|
+
"dev:web": "nx run web:dev",
|
|
51
|
+
build: "nx run-many --target=build --projects=api,web",
|
|
52
|
+
"build:api": "nx run api:build",
|
|
53
|
+
"build:web": "nx run web:build",
|
|
54
|
+
};
|
|
37
55
|
|
|
38
56
|
const TURBO_JSON = {
|
|
39
57
|
$schema: "https://turbo.build/schema.json",
|
|
@@ -56,6 +74,50 @@ const TURBO_JSON = {
|
|
|
56
74
|
},
|
|
57
75
|
};
|
|
58
76
|
|
|
77
|
+
const NX_JSON = {
|
|
78
|
+
$schema: "./node_modules/nx/schemas/nx-schema.json",
|
|
79
|
+
namedInputs: {
|
|
80
|
+
default: ["{projectRoot}/**/*"],
|
|
81
|
+
production: [
|
|
82
|
+
"default",
|
|
83
|
+
"!{projectRoot}/**/*.spec.*",
|
|
84
|
+
"!{projectRoot}/**/*.test.*",
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
targetDefaults: {
|
|
88
|
+
build: {
|
|
89
|
+
inputs: ["production", "^production"],
|
|
90
|
+
cache: true,
|
|
91
|
+
},
|
|
92
|
+
dev: {
|
|
93
|
+
cache: false,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
function createNxProjectJson(projectName, projectRoot) {
|
|
99
|
+
return {
|
|
100
|
+
name: projectName,
|
|
101
|
+
root: projectRoot,
|
|
102
|
+
sourceRoot: projectRoot,
|
|
103
|
+
projectType: "application",
|
|
104
|
+
targets: {
|
|
105
|
+
dev: {
|
|
106
|
+
executor: "nx:run-commands",
|
|
107
|
+
options: {
|
|
108
|
+
command: `npm run dev --workspace ${projectName}`,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
build: {
|
|
112
|
+
executor: "nx:run-commands",
|
|
113
|
+
options: {
|
|
114
|
+
command: `npm run build --workspace ${projectName}`,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
59
121
|
function setRootScripts(packageJson, scripts) {
|
|
60
122
|
packageJson.scripts = packageJson.scripts || {};
|
|
61
123
|
for (const scriptKey of ROOT_SCRIPT_KEYS) {
|
|
@@ -89,26 +151,104 @@ export function applyWorkspaceSetup({
|
|
|
89
151
|
workspaceSetup,
|
|
90
152
|
versionRegistry,
|
|
91
153
|
}) {
|
|
92
|
-
const pnpmWorkspacePath = path.join(root, "pnpm-workspace.yaml");
|
|
93
154
|
const turboJsonPath = path.join(root, "turbo.json");
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
fs.writeFileSync(pnpmWorkspacePath, PNPM_WORKSPACE_FILE, "utf8");
|
|
155
|
+
const nxJsonPath = path.join(root, "nx.json");
|
|
156
|
+
const apiProjectJsonPath = path.join(root, "apps", "api", "project.json");
|
|
157
|
+
const webProjectJsonPath = path.join(root, "apps", "web", "project.json");
|
|
158
|
+
rootPackageJson.workspaces = ["apps/*"];
|
|
99
159
|
|
|
100
160
|
if (workspaceSetup === "turborepo") {
|
|
101
161
|
setRootScripts(rootPackageJson, TURBOREPO_SCRIPTS);
|
|
102
162
|
removeDevDependency(rootPackageJson, "concurrently");
|
|
163
|
+
removeDevDependency(rootPackageJson, "nx");
|
|
103
164
|
ensureDevDependency(rootPackageJson, "turbo", versionRegistry.versions.turbo);
|
|
104
165
|
fs.writeFileSync(turboJsonPath, JSON.stringify(TURBO_JSON, null, 2), "utf8");
|
|
166
|
+
if (fs.existsSync(nxJsonPath)) {
|
|
167
|
+
fs.unlinkSync(nxJsonPath);
|
|
168
|
+
}
|
|
169
|
+
if (fs.existsSync(apiProjectJsonPath)) {
|
|
170
|
+
fs.unlinkSync(apiProjectJsonPath);
|
|
171
|
+
}
|
|
172
|
+
if (fs.existsSync(webProjectJsonPath)) {
|
|
173
|
+
fs.unlinkSync(webProjectJsonPath);
|
|
174
|
+
}
|
|
105
175
|
return;
|
|
106
176
|
}
|
|
107
177
|
|
|
108
|
-
|
|
178
|
+
if (workspaceSetup === "nx") {
|
|
179
|
+
setRootScripts(rootPackageJson, NX_SCRIPTS);
|
|
180
|
+
removeDevDependency(rootPackageJson, "concurrently");
|
|
181
|
+
removeDevDependency(rootPackageJson, "turbo");
|
|
182
|
+
ensureDevDependency(rootPackageJson, "nx", versionRegistry.versions.nx);
|
|
183
|
+
if (fs.existsSync(turboJsonPath)) {
|
|
184
|
+
fs.unlinkSync(turboJsonPath);
|
|
185
|
+
}
|
|
186
|
+
fs.writeFileSync(nxJsonPath, JSON.stringify(NX_JSON, null, 2), "utf8");
|
|
187
|
+
fs.writeFileSync(
|
|
188
|
+
apiProjectJsonPath,
|
|
189
|
+
JSON.stringify(createNxProjectJson("api", "apps/api"), null, 2),
|
|
190
|
+
"utf8"
|
|
191
|
+
);
|
|
192
|
+
fs.writeFileSync(
|
|
193
|
+
webProjectJsonPath,
|
|
194
|
+
JSON.stringify(createNxProjectJson("web", "apps/web"), null, 2),
|
|
195
|
+
"utf8"
|
|
196
|
+
);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
setRootScripts(rootPackageJson, NPM_WORKSPACE_SCRIPTS);
|
|
201
|
+
removeDevDependency(rootPackageJson, "turbo");
|
|
202
|
+
removeDevDependency(rootPackageJson, "nx");
|
|
203
|
+
ensureDevDependency(rootPackageJson, "concurrently", versionRegistry.versions.concurrently);
|
|
204
|
+
if (fs.existsSync(turboJsonPath)) {
|
|
205
|
+
fs.unlinkSync(turboJsonPath);
|
|
206
|
+
}
|
|
207
|
+
if (fs.existsSync(nxJsonPath)) {
|
|
208
|
+
fs.unlinkSync(nxJsonPath);
|
|
209
|
+
}
|
|
210
|
+
if (fs.existsSync(apiProjectJsonPath)) {
|
|
211
|
+
fs.unlinkSync(apiProjectJsonPath);
|
|
212
|
+
}
|
|
213
|
+
if (fs.existsSync(webProjectJsonPath)) {
|
|
214
|
+
fs.unlinkSync(webProjectJsonPath);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function applyStandaloneSetup({
|
|
219
|
+
root,
|
|
220
|
+
rootPackageJson,
|
|
221
|
+
versionRegistry,
|
|
222
|
+
}) {
|
|
223
|
+
const appsRoot = path.join(root, "apps");
|
|
224
|
+
const apiSource = path.join(appsRoot, "api");
|
|
225
|
+
const webSource = path.join(appsRoot, "web");
|
|
226
|
+
const apiTarget = path.join(root, "api");
|
|
227
|
+
const webTarget = path.join(root, "web");
|
|
228
|
+
const turboJsonPath = path.join(root, "turbo.json");
|
|
229
|
+
const nxJsonPath = path.join(root, "nx.json");
|
|
230
|
+
|
|
231
|
+
if (fs.existsSync(apiTarget)) {
|
|
232
|
+
fs.rmSync(apiTarget, { recursive: true, force: true });
|
|
233
|
+
}
|
|
234
|
+
if (fs.existsSync(webTarget)) {
|
|
235
|
+
fs.rmSync(webTarget, { recursive: true, force: true });
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
fs.renameSync(apiSource, apiTarget);
|
|
239
|
+
fs.renameSync(webSource, webTarget);
|
|
240
|
+
fs.rmSync(appsRoot, { recursive: true, force: true });
|
|
241
|
+
|
|
242
|
+
delete rootPackageJson.workspaces;
|
|
243
|
+
setRootScripts(rootPackageJson, STANDALONE_SCRIPTS);
|
|
109
244
|
removeDevDependency(rootPackageJson, "turbo");
|
|
245
|
+
removeDevDependency(rootPackageJson, "nx");
|
|
110
246
|
ensureDevDependency(rootPackageJson, "concurrently", versionRegistry.versions.concurrently);
|
|
247
|
+
|
|
111
248
|
if (fs.existsSync(turboJsonPath)) {
|
|
112
249
|
fs.unlinkSync(turboJsonPath);
|
|
113
250
|
}
|
|
251
|
+
if (fs.existsSync(nxJsonPath)) {
|
|
252
|
+
fs.unlinkSync(nxJsonPath);
|
|
253
|
+
}
|
|
114
254
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"build:prod": "natty build --mode prod"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nattyjs/cli": "0.0.1-beta.
|
|
14
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
15
|
-
"@nattyjs/core": "0.0.1-beta.
|
|
16
|
-
"@nattyjs/entity": "0.0.1-beta.
|
|
17
|
-
"@nattyjs/express": "0.0.1-beta.
|
|
18
|
-
"@nattyjs/orm": "0.0.1-beta.
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
20
|
-
"@nattyjs/validation-decorators": "0.0.1-beta.
|
|
13
|
+
"@nattyjs/cli": "0.0.1-beta.71",
|
|
14
|
+
"@nattyjs/common": "0.0.1-beta.71",
|
|
15
|
+
"@nattyjs/core": "0.0.1-beta.71",
|
|
16
|
+
"@nattyjs/entity": "0.0.1-beta.71",
|
|
17
|
+
"@nattyjs/express": "0.0.1-beta.71",
|
|
18
|
+
"@nattyjs/orm": "0.0.1-beta.71",
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.71",
|
|
20
|
+
"@nattyjs/validation-decorators": "0.0.1-beta.71",
|
|
21
21
|
"mri": "^1.2.0",
|
|
22
22
|
"reflect-metadata": "^0.2.2"
|
|
23
23
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@angular/platform-browser": "^18.2.8",
|
|
16
16
|
"@angular/platform-browser-dynamic": "^18.2.8",
|
|
17
17
|
"@angular/router": "^18.2.8",
|
|
18
|
-
"@nattyjs/client": "0.0.1-beta.
|
|
18
|
+
"@nattyjs/client": "0.0.1-beta.71",
|
|
19
19
|
"rxjs": "^7.8.1",
|
|
20
20
|
"tslib": "^2.7.0",
|
|
21
21
|
"zone.js": "^0.14.10"
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"build:prod": "natty build --mode prod"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nattyjs/cli": "0.0.1-beta.
|
|
14
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
15
|
-
"@nattyjs/core": "0.0.1-beta.
|
|
16
|
-
"@nattyjs/entity": "0.0.1-beta.
|
|
17
|
-
"@nattyjs/express": "0.0.1-beta.
|
|
18
|
-
"@nattyjs/orm": "0.0.1-beta.
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
20
|
-
"@nattyjs/validation-decorators": "0.0.1-beta.
|
|
13
|
+
"@nattyjs/cli": "0.0.1-beta.71",
|
|
14
|
+
"@nattyjs/common": "0.0.1-beta.71",
|
|
15
|
+
"@nattyjs/core": "0.0.1-beta.71",
|
|
16
|
+
"@nattyjs/entity": "0.0.1-beta.71",
|
|
17
|
+
"@nattyjs/express": "0.0.1-beta.71",
|
|
18
|
+
"@nattyjs/orm": "0.0.1-beta.71",
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.71",
|
|
20
|
+
"@nattyjs/validation-decorators": "0.0.1-beta.71",
|
|
21
21
|
"mri": "^1.2.0",
|
|
22
22
|
"reflect-metadata": "^0.2.2"
|
|
23
23
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"build:prod": "natty build --mode prod"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nattyjs/cli": "0.0.1-beta.
|
|
14
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
15
|
-
"@nattyjs/core": "0.0.1-beta.
|
|
16
|
-
"@nattyjs/entity": "0.0.1-beta.
|
|
17
|
-
"@nattyjs/express": "0.0.1-beta.
|
|
18
|
-
"@nattyjs/orm": "0.0.1-beta.
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
20
|
-
"@nattyjs/validation-decorators": "0.0.1-beta.
|
|
13
|
+
"@nattyjs/cli": "0.0.1-beta.71",
|
|
14
|
+
"@nattyjs/common": "0.0.1-beta.71",
|
|
15
|
+
"@nattyjs/core": "0.0.1-beta.71",
|
|
16
|
+
"@nattyjs/entity": "0.0.1-beta.71",
|
|
17
|
+
"@nattyjs/express": "0.0.1-beta.71",
|
|
18
|
+
"@nattyjs/orm": "0.0.1-beta.71",
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.71",
|
|
20
|
+
"@nattyjs/validation-decorators": "0.0.1-beta.71",
|
|
21
21
|
"mri": "^1.2.0",
|
|
22
22
|
"reflect-metadata": "^0.2.2"
|
|
23
23
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"build:prod": "natty build --mode prod"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nattyjs/cli": "0.0.1-beta.
|
|
14
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
15
|
-
"@nattyjs/core": "0.0.1-beta.
|
|
16
|
-
"@nattyjs/entity": "0.0.1-beta.
|
|
17
|
-
"@nattyjs/express": "0.0.1-beta.
|
|
18
|
-
"@nattyjs/orm": "0.0.1-beta.
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
20
|
-
"@nattyjs/validation-decorators": "0.0.1-beta.
|
|
13
|
+
"@nattyjs/cli": "0.0.1-beta.71",
|
|
14
|
+
"@nattyjs/common": "0.0.1-beta.71",
|
|
15
|
+
"@nattyjs/core": "0.0.1-beta.71",
|
|
16
|
+
"@nattyjs/entity": "0.0.1-beta.71",
|
|
17
|
+
"@nattyjs/express": "0.0.1-beta.71",
|
|
18
|
+
"@nattyjs/orm": "0.0.1-beta.71",
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.71",
|
|
20
|
+
"@nattyjs/validation-decorators": "0.0.1-beta.71",
|
|
21
21
|
"mri": "^1.2.0",
|
|
22
22
|
"reflect-metadata": "^0.2.2"
|
|
23
23
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"build:prod": "natty build --mode prod"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nattyjs/cli": "0.0.1-beta.
|
|
14
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
15
|
-
"@nattyjs/core": "0.0.1-beta.
|
|
16
|
-
"@nattyjs/entity": "0.0.1-beta.
|
|
17
|
-
"@nattyjs/express": "0.0.1-beta.
|
|
18
|
-
"@nattyjs/orm": "0.0.1-beta.
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
20
|
-
"@nattyjs/validation-decorators": "0.0.1-beta.
|
|
13
|
+
"@nattyjs/cli": "0.0.1-beta.71",
|
|
14
|
+
"@nattyjs/common": "0.0.1-beta.71",
|
|
15
|
+
"@nattyjs/core": "0.0.1-beta.71",
|
|
16
|
+
"@nattyjs/entity": "0.0.1-beta.71",
|
|
17
|
+
"@nattyjs/express": "0.0.1-beta.71",
|
|
18
|
+
"@nattyjs/orm": "0.0.1-beta.71",
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.71",
|
|
20
|
+
"@nattyjs/validation-decorators": "0.0.1-beta.71",
|
|
21
21
|
"mri": "^1.2.0",
|
|
22
22
|
"reflect-metadata": "^0.2.2"
|
|
23
23
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"build:prod": "natty build --mode prod"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nattyjs/cli": "0.0.1-beta.
|
|
14
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
15
|
-
"@nattyjs/core": "0.0.1-beta.
|
|
16
|
-
"@nattyjs/entity": "0.0.1-beta.
|
|
17
|
-
"@nattyjs/express": "0.0.1-beta.
|
|
18
|
-
"@nattyjs/orm": "0.0.1-beta.
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
20
|
-
"@nattyjs/validation-decorators": "0.0.1-beta.
|
|
13
|
+
"@nattyjs/cli": "0.0.1-beta.71",
|
|
14
|
+
"@nattyjs/common": "0.0.1-beta.71",
|
|
15
|
+
"@nattyjs/core": "0.0.1-beta.71",
|
|
16
|
+
"@nattyjs/entity": "0.0.1-beta.71",
|
|
17
|
+
"@nattyjs/express": "0.0.1-beta.71",
|
|
18
|
+
"@nattyjs/orm": "0.0.1-beta.71",
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.71",
|
|
20
|
+
"@nattyjs/validation-decorators": "0.0.1-beta.71",
|
|
21
21
|
"mri": "^1.2.0",
|
|
22
22
|
"reflect-metadata": "^0.2.2"
|
|
23
23
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@nattyjs/client": "0.0.1-beta.
|
|
12
|
+
"@nattyjs/client": "0.0.1-beta.71",
|
|
13
13
|
"@sveltejs/adapter-auto": "^3.2.5",
|
|
14
14
|
"@sveltejs/kit": "^2.7.1",
|
|
15
15
|
"@sveltejs/vite-plugin-svelte": "^3.1.2",
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"build:prod": "natty build --mode prod"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nattyjs/cli": "0.0.1-beta.
|
|
14
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
15
|
-
"@nattyjs/core": "0.0.1-beta.
|
|
16
|
-
"@nattyjs/entity": "0.0.1-beta.
|
|
17
|
-
"@nattyjs/express": "0.0.1-beta.
|
|
18
|
-
"@nattyjs/orm": "0.0.1-beta.
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
20
|
-
"@nattyjs/validation-decorators": "0.0.1-beta.
|
|
13
|
+
"@nattyjs/cli": "0.0.1-beta.71",
|
|
14
|
+
"@nattyjs/common": "0.0.1-beta.71",
|
|
15
|
+
"@nattyjs/core": "0.0.1-beta.71",
|
|
16
|
+
"@nattyjs/entity": "0.0.1-beta.71",
|
|
17
|
+
"@nattyjs/express": "0.0.1-beta.71",
|
|
18
|
+
"@nattyjs/orm": "0.0.1-beta.71",
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.71",
|
|
20
|
+
"@nattyjs/validation-decorators": "0.0.1-beta.71",
|
|
21
21
|
"mri": "^1.2.0",
|
|
22
22
|
"reflect-metadata": "^0.2.2"
|
|
23
23
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"build:prod": "natty build --mode prod"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nattyjs/cli": "0.0.1-beta.
|
|
14
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
15
|
-
"@nattyjs/core": "0.0.1-beta.
|
|
16
|
-
"@nattyjs/entity": "0.0.1-beta.
|
|
17
|
-
"@nattyjs/express": "0.0.1-beta.
|
|
18
|
-
"@nattyjs/orm": "0.0.1-beta.
|
|
19
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
20
|
-
"@nattyjs/validation-decorators": "0.0.1-beta.
|
|
13
|
+
"@nattyjs/cli": "0.0.1-beta.71",
|
|
14
|
+
"@nattyjs/common": "0.0.1-beta.71",
|
|
15
|
+
"@nattyjs/core": "0.0.1-beta.71",
|
|
16
|
+
"@nattyjs/entity": "0.0.1-beta.71",
|
|
17
|
+
"@nattyjs/express": "0.0.1-beta.71",
|
|
18
|
+
"@nattyjs/orm": "0.0.1-beta.71",
|
|
19
|
+
"@nattyjs/types": "0.0.1-beta.71",
|
|
20
|
+
"@nattyjs/validation-decorators": "0.0.1-beta.71",
|
|
21
21
|
"mri": "^1.2.0",
|
|
22
22
|
"reflect-metadata": "^0.2.2"
|
|
23
23
|
}
|