create-catalyst-app-internal 0.0.1-beta.64 → 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 +35 -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,15 +28,37 @@ 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" })
|
|
33
42
|
return
|
|
34
43
|
}
|
|
35
44
|
|
|
45
|
+
console.log(cyan(`Using create-catalyst-app version ${bold(packageJson.version)}`))
|
|
46
|
+
|
|
36
47
|
// Use options provided through commander or prompt the user
|
|
37
48
|
validateOptions(cmd)
|
|
38
|
-
|
|
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())
|
|
39
62
|
let isNameValid = validate(projectName)
|
|
40
63
|
if (!isNameValid.validForNewPackages) {
|
|
41
64
|
isNameValid?.warnings?.forEach?.((item) => console.log(red(item)))
|
|
@@ -47,10 +70,10 @@ const program = new Commander.Command()
|
|
|
47
70
|
console.log(red(`${projectName} already exists, try again.`))
|
|
48
71
|
process.exit(1)
|
|
49
72
|
}
|
|
50
|
-
const projectDescription = await promptDescription()
|
|
51
|
-
const language = await promptTypescript()
|
|
52
|
-
const tailWindSupport = await promptTailwind()
|
|
53
|
-
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())
|
|
54
77
|
|
|
55
78
|
// Define mapping of options to repository suffixes
|
|
56
79
|
const repositorySuffixes = {
|
|
@@ -121,8 +144,8 @@ const program = new Commander.Command()
|
|
|
121
144
|
|
|
122
145
|
// to test locally, comment the upper execSync and uncomment this one.
|
|
123
146
|
// execSync(`npm pack --pack-destination=${tempDir} --silent`, {
|
|
124
|
-
//
|
|
125
|
-
// })
|
|
147
|
+
// cwd: process.cwd(),
|
|
148
|
+
// })
|
|
126
149
|
|
|
127
150
|
return tarballFilePath
|
|
128
151
|
} catch (error) {
|
|
@@ -166,7 +189,7 @@ const program = new Commander.Command()
|
|
|
166
189
|
console.log("An error occurred", e)
|
|
167
190
|
}
|
|
168
191
|
|
|
169
|
-
cyan(`Run cd ${projectName} && npm start to get started.`)
|
|
192
|
+
console.log(cyan(`Run cd ${projectName} && npm start to get started.`))
|
|
170
193
|
}
|
|
171
194
|
} catch (error) {
|
|
172
195
|
console.error(red("An error occurred:"), error.message)
|
|
@@ -281,6 +304,10 @@ function validateOptions(cmd) {
|
|
|
281
304
|
if (cmd.stateManagement && !["rtk", "redux", "none"].includes(cmd.stateManagement.toLowerCase())) {
|
|
282
305
|
throw new Error('Invalid state management option. Use "rtk", "redux", or "none".')
|
|
283
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
|
+
}
|
|
284
311
|
}
|
|
285
312
|
|
|
286
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", () => {
|