create-catalyst-app-internal 0.0.3-canary.30 → 0.0.3-canary.31
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 +8 -108
- package/templates/common/webpackConfig.js +0 -1
- package/templates/none-js/package.json +2 -2
- package/templates/redux-js/package.json +2 -2
- package/templates/rtk-js/package.json +2 -2
- package/templates/mcp-root/mcp/context.md +0 -674
- package/templates/mcp-root/mcp/mcp.js +0 -36
- package/templates/none-ts/client/index.js +0 -23
- package/templates/none-ts/package.json +0 -40
- package/templates/none-ts/src/js/containers/App/index.js +0 -16
- package/templates/none-ts/src/js/routes/utils.js +0 -42
- package/templates/none-ts/tsconfig.json +0 -13
- package/templates/none-ts/types.d.ts +0 -4
- package/templates/redux-ts/client/index.js +0 -28
- package/templates/redux-ts/package.json +0 -43
- package/templates/redux-ts/src/js/containers/App/actions.js +0 -17
- package/templates/redux-ts/src/js/containers/App/index.js +0 -16
- package/templates/redux-ts/src/js/containers/App/reducer.js +0 -19
- package/templates/redux-ts/src/js/routes/utils.js +0 -42
- package/templates/redux-ts/src/js/store/index.js +0 -28
- package/templates/redux-ts/tsconfig.json +0 -13
- package/templates/redux-ts/types.d.ts +0 -4
- package/templates/rtk-ts/client/index.js +0 -28
- package/templates/rtk-ts/package.json +0 -43
- package/templates/rtk-ts/src/js/containers/App/index.js +0 -16
- package/templates/rtk-ts/src/js/containers/App/reducer.js +0 -18
- package/templates/rtk-ts/src/js/routes/utils.js +0 -42
- package/templates/rtk-ts/src/js/store/index.js +0 -28
- package/templates/rtk-ts/tsconfig.json +0 -13
- package/templates/rtk-ts/types.d.ts +0 -4
- package/templates/tailwind/postcss.config.js +0 -5
- package/templates/tailwind/src/static/css/base/index.scss +0 -2
package/package.json
CHANGED
package/scripts/cli.cjs
CHANGED
|
@@ -17,7 +17,6 @@ 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"))
|
|
21
20
|
.addOption(
|
|
22
21
|
new Option(
|
|
23
22
|
"-s, --state-management [stateManagement]",
|
|
@@ -28,39 +27,15 @@ const program = new Commander.Command()
|
|
|
28
27
|
)
|
|
29
28
|
.action(async (folderName = null, cmd) => {
|
|
30
29
|
try {
|
|
31
|
-
let config = {
|
|
32
|
-
folderName,
|
|
33
|
-
language: null,
|
|
34
|
-
tailWindSupport: null,
|
|
35
|
-
description: null,
|
|
36
|
-
stateManagement: cmd.stateManagement,
|
|
37
|
-
mcpSupport: null,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
30
|
if (process.argv.includes("new-route")) {
|
|
41
31
|
const createRoutePath = path.join(__dirname, "../codemod/new-route/index.js")
|
|
42
32
|
execSync(`node ${createRoutePath}`, { stdio: "inherit" })
|
|
43
33
|
return
|
|
44
34
|
}
|
|
45
35
|
|
|
46
|
-
console.log(cyan(`Using create-catalyst-app version ${bold(packageJson.version)}`))
|
|
47
|
-
|
|
48
36
|
// Use options provided through commander or prompt the user
|
|
49
37
|
validateOptions(cmd)
|
|
50
|
-
|
|
51
|
-
if (cmd.yes) {
|
|
52
|
-
console.log("Using default configuration.")
|
|
53
|
-
config = {
|
|
54
|
-
folderName: "my-app",
|
|
55
|
-
language: "js",
|
|
56
|
-
tailWindSupport: false,
|
|
57
|
-
description: "Default catalyst app",
|
|
58
|
-
stateManagement: "none",
|
|
59
|
-
mcpSupport: true,
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const projectName = config.folderName || (await promptProjectName())
|
|
38
|
+
const projectName = folderName || (await promptProjectName())
|
|
64
39
|
let isNameValid = validate(projectName)
|
|
65
40
|
if (!isNameValid.validForNewPackages) {
|
|
66
41
|
isNameValid?.warnings?.forEach?.((item) => console.log(red(item)))
|
|
@@ -72,11 +47,9 @@ const program = new Commander.Command()
|
|
|
72
47
|
console.log(red(`${projectName} already exists, try again.`))
|
|
73
48
|
process.exit(1)
|
|
74
49
|
}
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
const stateManagement = config.stateManagement || (await promptStateManagement())
|
|
79
|
-
const mcpSupport = config.mcpSupport !== null || (await promptMcp())
|
|
50
|
+
const language = "js"
|
|
51
|
+
const projectDescription = await promptDescription()
|
|
52
|
+
const stateManagement = cmd.stateManagement || (await promptStateManagement())
|
|
80
53
|
|
|
81
54
|
// Define mapping of options to repository suffixes
|
|
82
55
|
const repositorySuffixes = {
|
|
@@ -92,13 +65,7 @@ const program = new Commander.Command()
|
|
|
92
65
|
|
|
93
66
|
const commonCodeDirectory = "package/templates/common"
|
|
94
67
|
const selectedTemplateCode = `package/templates/${repositorySuffixes[stateManagement]}-${repositorySuffixes[language]}`
|
|
95
|
-
const tailwindCodeDirectory = "package/templates/tailwind"
|
|
96
|
-
const mcpCodeDirectory = "package/templates/mcp-root"
|
|
97
|
-
|
|
98
68
|
const subDirectoriesToExtract = [commonCodeDirectory, selectedTemplateCode]
|
|
99
|
-
if (tailWindSupport) subDirectoriesToExtract.push(tailwindCodeDirectory)
|
|
100
|
-
if (mcpSupport) subDirectoriesToExtract.push(mcpCodeDirectory)
|
|
101
|
-
|
|
102
69
|
const extractionDestination = `/${projectName}/`
|
|
103
70
|
let tempDir
|
|
104
71
|
;(() => {
|
|
@@ -111,27 +78,10 @@ const program = new Commander.Command()
|
|
|
111
78
|
createGitignore(projectName)
|
|
112
79
|
|
|
113
80
|
execSync(
|
|
114
|
-
`cd ${projectName} && npm i && npm pkg set name=${projectName} ${projectDescription ? `description="${projectDescription}"` : ""} && git init --quiet`,
|
|
81
|
+
`cd ${projectName} && npm i && npm pkg set name=${projectName} ${projectDescription ? `description="${projectDescription}"` : ""} && git init --quiet && git add . && git commit -m "initial commit from Create Catalyst App"`,
|
|
115
82
|
{ stdio: "inherit" }
|
|
116
83
|
)
|
|
117
84
|
|
|
118
|
-
if (tailWindSupport) {
|
|
119
|
-
execSync(`cd ${projectName} && npm i tailwindcss@4.1.4 @tailwindcss/postcss@4.1.4`, {
|
|
120
|
-
stdio: "inherit",
|
|
121
|
-
})
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (mcpSupport) {
|
|
125
|
-
execSync(`cd ${projectName} && npm i @modelcontextprotocol/sdk`, { stdio: "inherit" })
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
execSync(
|
|
129
|
-
`cd ${projectName} && git add . && git commit -m "initial commit from Create Catalyst App"`,
|
|
130
|
-
{
|
|
131
|
-
stdio: "inherit",
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
|
|
135
85
|
console.log(`\n${green(bold("Success!"))} created ${projectName} at ${projectPath}`)
|
|
136
86
|
console.log("Inside this directory, you can run the following commands.")
|
|
137
87
|
|
|
@@ -164,8 +114,8 @@ const program = new Commander.Command()
|
|
|
164
114
|
|
|
165
115
|
// to test locally, comment the upper execSync and uncomment this one.
|
|
166
116
|
// execSync(`npm pack --pack-destination=${tempDir} --silent`, {
|
|
167
|
-
//
|
|
168
|
-
// })
|
|
117
|
+
// cwd: process.cwd(),
|
|
118
|
+
// });
|
|
169
119
|
|
|
170
120
|
return tarballFilePath
|
|
171
121
|
} catch (error) {
|
|
@@ -200,19 +150,13 @@ const program = new Commander.Command()
|
|
|
200
150
|
if (entry.path.startsWith(selectedTemplateCode)) {
|
|
201
151
|
entry.path = entry.path.replace(selectedTemplateCode, extractionDestination)
|
|
202
152
|
}
|
|
203
|
-
if (entry.path.startsWith(tailwindCodeDirectory)) {
|
|
204
|
-
entry.path = entry.path.replace(tailwindCodeDirectory, extractionDestination)
|
|
205
|
-
}
|
|
206
|
-
if (entry.path.startsWith(mcpCodeDirectory)) {
|
|
207
|
-
entry.path = entry.path.replace(mcpCodeDirectory, extractionDestination)
|
|
208
|
-
}
|
|
209
153
|
},
|
|
210
154
|
})
|
|
211
155
|
} catch (e) {
|
|
212
156
|
console.log("An error occurred", e)
|
|
213
157
|
}
|
|
214
158
|
|
|
215
|
-
|
|
159
|
+
cyan(`Run cd ${projectName} && npm start to get started.`)
|
|
216
160
|
}
|
|
217
161
|
} catch (error) {
|
|
218
162
|
console.error(red("An error occurred:"), error.message)
|
|
@@ -274,46 +218,6 @@ async function promptDescription() {
|
|
|
274
218
|
} else return null
|
|
275
219
|
}
|
|
276
220
|
|
|
277
|
-
async function promptTypescript() {
|
|
278
|
-
const response = await prompts({
|
|
279
|
-
type: "select",
|
|
280
|
-
name: "typescript",
|
|
281
|
-
message: "Would you like to use TypeScript?",
|
|
282
|
-
choices: [
|
|
283
|
-
{ title: "Yes", value: "ts" },
|
|
284
|
-
{ title: "No", value: "js" },
|
|
285
|
-
],
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
return response.typescript
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
async function promptTailwind() {
|
|
292
|
-
const response = await prompts({
|
|
293
|
-
type: "select",
|
|
294
|
-
name: "tailwind",
|
|
295
|
-
message: "Would you like to use Tailwind CSS?",
|
|
296
|
-
choices: [
|
|
297
|
-
{ title: "Yes", value: true },
|
|
298
|
-
{ title: "No", value: false },
|
|
299
|
-
],
|
|
300
|
-
})
|
|
301
|
-
return response.tailwind
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
async function promptMcp() {
|
|
305
|
-
const response = await prompts({
|
|
306
|
-
type: "select",
|
|
307
|
-
name: "mcp",
|
|
308
|
-
message: "Would you like to setup an MCP server?",
|
|
309
|
-
choices: [
|
|
310
|
-
{ title: "Yes", value: true },
|
|
311
|
-
{ title: "No", value: false },
|
|
312
|
-
],
|
|
313
|
-
})
|
|
314
|
-
return response.mcp
|
|
315
|
-
}
|
|
316
|
-
|
|
317
221
|
function validateOptions(cmd) {
|
|
318
222
|
// Validate language option
|
|
319
223
|
if (cmd.lang && !["js", "ts"].includes(cmd.lang.toLowerCase())) {
|
|
@@ -324,10 +228,6 @@ function validateOptions(cmd) {
|
|
|
324
228
|
if (cmd.stateManagement && !["rtk", "redux", "none"].includes(cmd.stateManagement.toLowerCase())) {
|
|
325
229
|
throw new Error('Invalid state management option. Use "rtk", "redux", or "none".')
|
|
326
230
|
}
|
|
327
|
-
|
|
328
|
-
if (cmd.yes && typeof cmd.yes !== "boolean") {
|
|
329
|
-
throw new Error('Invalid option for "yes". Use "-y" or "--yes" to accept defaults.')
|
|
330
|
-
}
|
|
331
231
|
}
|
|
332
232
|
|
|
333
233
|
function deleteDirectory(dirPath) {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@loadable/component": "^5.16.3",
|
|
28
|
-
"@tata1mg/router": "0.0.1-beta.
|
|
29
|
-
"catalyst-core-internal": "0.0.3-canary.
|
|
28
|
+
"@tata1mg/router": "^0.0.1-beta.6",
|
|
29
|
+
"catalyst-core-internal": "0.0.3-canary.31"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"eslint": "^8.26.0",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@loadable/component": "^5.16.3",
|
|
29
|
-
"@tata1mg/router": "0.0.1-beta.
|
|
30
|
-
"catalyst-core-internal": "0.0.3-canary.
|
|
29
|
+
"@tata1mg/router": "^0.0.1-beta.6",
|
|
30
|
+
"catalyst-core-internal": "0.0.3-canary.31",
|
|
31
31
|
"@reduxjs/toolkit": "1.9.3",
|
|
32
32
|
"react-redux": "^8.1.3"
|
|
33
33
|
},
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@loadable/component": "^5.16.3",
|
|
29
|
-
"@tata1mg/router": "0.0.1-beta.
|
|
30
|
-
"catalyst-core-internal": "0.0.3-canary.
|
|
29
|
+
"@tata1mg/router": "^0.0.1-beta.6",
|
|
30
|
+
"catalyst-core-internal": "0.0.3-canary.31",
|
|
31
31
|
"@reduxjs/toolkit": "1.9.3",
|
|
32
32
|
"react-redux": "^8.1.3"
|
|
33
33
|
},
|