create-catalyst-app-internal 0.0.1-beta.65 → 0.0.1-beta.66
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/package.json +1 -1
- package/scripts/cli.cjs +33 -8
- package/templates/common/server/document.js +1 -1
- package/templates/none-js/client/index.js +1 -1
- package/templates/none-js/package.json +1 -1
- package/templates/none-ts/client/index.js +1 -1
- package/templates/none-ts/package.json +1 -1
- package/templates/redux-js/client/index.js +1 -1
- package/templates/redux-js/package.json +1 -1
- package/templates/redux-ts/client/index.js +1 -1
- package/templates/redux-ts/package.json +1 -1
- package/templates/rtk-js/client/index.js +1 -1
- package/templates/rtk-js/package.json +1 -1
- package/templates/rtk-ts/client/index.js +1 -1
- package/templates/rtk-ts/package.json +1 -1
package/package.json
CHANGED
package/scripts/cli.cjs
CHANGED
|
@@ -17,6 +17,7 @@ const program = new Commander.Command()
|
|
|
17
17
|
.arguments("[folderName]")
|
|
18
18
|
.usage(`${green("[folderName]")} [options]`)
|
|
19
19
|
.action((name) => (projectName = name))
|
|
20
|
+
.addOption(new Option("-y, --yes [yes]", "Use default configuration"))
|
|
20
21
|
.addOption(
|
|
21
22
|
new Option(
|
|
22
23
|
"-s, --state-management [stateManagement]",
|
|
@@ -27,6 +28,14 @@ const program = new Commander.Command()
|
|
|
27
28
|
)
|
|
28
29
|
.action(async (folderName = null, cmd) => {
|
|
29
30
|
try {
|
|
31
|
+
let config = {
|
|
32
|
+
folderName,
|
|
33
|
+
language: null,
|
|
34
|
+
tailWindSupport: null,
|
|
35
|
+
description: null,
|
|
36
|
+
stateManagement: cmd.stateManagement,
|
|
37
|
+
}
|
|
38
|
+
|
|
30
39
|
if (process.argv.includes("new-route")) {
|
|
31
40
|
const createRoutePath = path.join(__dirname, "../codemod/new-route/index.js")
|
|
32
41
|
execSync(`node ${createRoutePath}`, { stdio: "inherit" })
|
|
@@ -37,7 +46,19 @@ const program = new Commander.Command()
|
|
|
37
46
|
|
|
38
47
|
// Use options provided through commander or prompt the user
|
|
39
48
|
validateOptions(cmd)
|
|
40
|
-
|
|
49
|
+
|
|
50
|
+
if (cmd.yes) {
|
|
51
|
+
console.log("Using default configuration.")
|
|
52
|
+
config = {
|
|
53
|
+
folderName: "my-app",
|
|
54
|
+
language: "js",
|
|
55
|
+
tailWindSupport: false,
|
|
56
|
+
description: "Default catalyst app",
|
|
57
|
+
stateManagement: "none",
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const projectName = config.folderName || (await promptProjectName())
|
|
41
62
|
let isNameValid = validate(projectName)
|
|
42
63
|
if (!isNameValid.validForNewPackages) {
|
|
43
64
|
isNameValid?.warnings?.forEach?.((item) => console.log(red(item)))
|
|
@@ -49,10 +70,10 @@ const program = new Commander.Command()
|
|
|
49
70
|
console.log(red(`${projectName} already exists, try again.`))
|
|
50
71
|
process.exit(1)
|
|
51
72
|
}
|
|
52
|
-
const projectDescription = await promptDescription()
|
|
53
|
-
const language = await promptTypescript()
|
|
54
|
-
const tailWindSupport = await promptTailwind()
|
|
55
|
-
const stateManagement =
|
|
73
|
+
const projectDescription = config.description || (await promptDescription())
|
|
74
|
+
const language = config.language || (await promptTypescript())
|
|
75
|
+
const tailWindSupport = config.tailWindSupport !== null || (await promptTailwind())
|
|
76
|
+
const stateManagement = config.stateManagement || (await promptStateManagement())
|
|
56
77
|
|
|
57
78
|
// Define mapping of options to repository suffixes
|
|
58
79
|
const repositorySuffixes = {
|
|
@@ -123,8 +144,8 @@ const program = new Commander.Command()
|
|
|
123
144
|
|
|
124
145
|
// to test locally, comment the upper execSync and uncomment this one.
|
|
125
146
|
// execSync(`npm pack --pack-destination=${tempDir} --silent`, {
|
|
126
|
-
//
|
|
127
|
-
// })
|
|
147
|
+
// cwd: process.cwd(),
|
|
148
|
+
// })
|
|
128
149
|
|
|
129
150
|
return tarballFilePath
|
|
130
151
|
} catch (error) {
|
|
@@ -168,7 +189,7 @@ const program = new Commander.Command()
|
|
|
168
189
|
console.log("An error occurred", e)
|
|
169
190
|
}
|
|
170
191
|
|
|
171
|
-
cyan(`Run cd ${projectName} && npm start to get started.`)
|
|
192
|
+
console.log(cyan(`Run cd ${projectName} && npm start to get started.`))
|
|
172
193
|
}
|
|
173
194
|
} catch (error) {
|
|
174
195
|
console.error(red("An error occurred:"), error.message)
|
|
@@ -283,6 +304,10 @@ function validateOptions(cmd) {
|
|
|
283
304
|
if (cmd.stateManagement && !["rtk", "redux", "none"].includes(cmd.stateManagement.toLowerCase())) {
|
|
284
305
|
throw new Error('Invalid state management option. Use "rtk", "redux", or "none".')
|
|
285
306
|
}
|
|
307
|
+
|
|
308
|
+
if (cmd.yes && typeof cmd.yes !== "boolean") {
|
|
309
|
+
throw new Error('Invalid option for "yes". Use "-y" or "--yes" to accept defaults.')
|
|
310
|
+
}
|
|
286
311
|
}
|
|
287
312
|
|
|
288
313
|
function deleteDirectory(dirPath) {
|
|
@@ -3,7 +3,7 @@ import "./styles"
|
|
|
3
3
|
import { hydrateRoot } from "react-dom/client"
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { RouterProvider } from "@tata1mg/router"
|
|
6
|
-
import clientRouter from "catalyst-core
|
|
6
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
7
|
|
|
8
8
|
window.addEventListener("load", () => {
|
|
9
9
|
loadableReady(() => {
|
|
@@ -3,7 +3,7 @@ import "./styles"
|
|
|
3
3
|
import { hydrateRoot } from "react-dom/client"
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { RouterProvider } from "@tata1mg/router"
|
|
6
|
-
import clientRouter from "catalyst-core
|
|
6
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
7
|
|
|
8
8
|
window.addEventListener("load", () => {
|
|
9
9
|
loadableReady(() => {
|
|
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
|
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { Provider } from "react-redux"
|
|
6
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core
|
|
7
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
8
8
|
import configureStore from "@store"
|
|
9
9
|
|
|
10
10
|
window.addEventListener("load", () => {
|
|
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
|
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { Provider } from "react-redux"
|
|
6
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core
|
|
7
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
8
8
|
import configureStore from "@store"
|
|
9
9
|
|
|
10
10
|
window.addEventListener("load", () => {
|
|
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
|
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { Provider } from "react-redux"
|
|
6
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core
|
|
7
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
8
8
|
import configureStore from "@store"
|
|
9
9
|
|
|
10
10
|
window.addEventListener("load", () => {
|
|
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
|
|
|
4
4
|
import { loadableReady } from "@loadable/component"
|
|
5
5
|
import { Provider } from "react-redux"
|
|
6
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core
|
|
7
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
8
8
|
import configureStore from "@store"
|
|
9
9
|
|
|
10
10
|
window.addEventListener("load", () => {
|