create-catalyst-app-internal 0.0.1-beta.62 → 0.0.1-beta.63
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 +40 -1
- 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/templates/tailwind/postcss.config.js +5 -0
- package/templates/tailwind/src/static/css/base/index.scss +2 -0
package/package.json
CHANGED
package/scripts/cli.cjs
CHANGED
|
@@ -47,8 +47,9 @@ const program = new Commander.Command()
|
|
|
47
47
|
console.log(red(`${projectName} already exists, try again.`))
|
|
48
48
|
process.exit(1)
|
|
49
49
|
}
|
|
50
|
-
const language = await promptTypescript()
|
|
51
50
|
const projectDescription = await promptDescription()
|
|
51
|
+
const language = await promptTypescript()
|
|
52
|
+
const tailWindSupport = await promptTailwind()
|
|
52
53
|
const stateManagement = cmd.stateManagement || (await promptStateManagement())
|
|
53
54
|
|
|
54
55
|
// Define mapping of options to repository suffixes
|
|
@@ -65,7 +66,11 @@ const program = new Commander.Command()
|
|
|
65
66
|
|
|
66
67
|
const commonCodeDirectory = "package/templates/common"
|
|
67
68
|
const selectedTemplateCode = `package/templates/${repositorySuffixes[stateManagement]}-${repositorySuffixes[language]}`
|
|
69
|
+
const tailwindCodeDirectory = "package/templates/tailwind"
|
|
70
|
+
|
|
68
71
|
const subDirectoriesToExtract = [commonCodeDirectory, selectedTemplateCode]
|
|
72
|
+
if (tailWindSupport) subDirectoriesToExtract.push(tailwindCodeDirectory)
|
|
73
|
+
|
|
69
74
|
const extractionDestination = `/${projectName}/`
|
|
70
75
|
let tempDir
|
|
71
76
|
;(() => {
|
|
@@ -77,6 +82,8 @@ const program = new Commander.Command()
|
|
|
77
82
|
extractSubdirectory(packageFilePath)
|
|
78
83
|
createGitignore(projectName)
|
|
79
84
|
|
|
85
|
+
if (tailWindSupport) setupTailwind(projectName)
|
|
86
|
+
|
|
80
87
|
execSync(
|
|
81
88
|
`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"`,
|
|
82
89
|
{ stdio: "inherit" }
|
|
@@ -150,6 +157,9 @@ const program = new Commander.Command()
|
|
|
150
157
|
if (entry.path.startsWith(selectedTemplateCode)) {
|
|
151
158
|
entry.path = entry.path.replace(selectedTemplateCode, extractionDestination)
|
|
152
159
|
}
|
|
160
|
+
if (entry.path.startsWith(tailwindCodeDirectory)) {
|
|
161
|
+
entry.path = entry.path.replace(tailwindCodeDirectory, extractionDestination)
|
|
162
|
+
}
|
|
153
163
|
},
|
|
154
164
|
})
|
|
155
165
|
} catch (e) {
|
|
@@ -232,6 +242,35 @@ async function promptTypescript() {
|
|
|
232
242
|
return response.typescript
|
|
233
243
|
}
|
|
234
244
|
|
|
245
|
+
async function promptTailwind() {
|
|
246
|
+
const response = await prompts({
|
|
247
|
+
type: "select",
|
|
248
|
+
name: "tailwind",
|
|
249
|
+
message: "Would you like to use Tailwind CSS?",
|
|
250
|
+
choices: [
|
|
251
|
+
{ title: "Yes", value: true },
|
|
252
|
+
{ title: "No", value: false },
|
|
253
|
+
],
|
|
254
|
+
})
|
|
255
|
+
return response.tailwind
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
async function setupTailwind(projectName) {
|
|
259
|
+
try {
|
|
260
|
+
const packageJsonPath = path.join(process.cwd(), projectName, "package.json")
|
|
261
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"))
|
|
262
|
+
packageJson.dependencies = {
|
|
263
|
+
...(packageJson.dependencies || {}),
|
|
264
|
+
tailwindcss: "^4.1.4",
|
|
265
|
+
"@tailwindcss/postcss": "^4.1.4",
|
|
266
|
+
}
|
|
267
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
268
|
+
} catch (error) {
|
|
269
|
+
console.log("Error while setting up tailwind:", error)
|
|
270
|
+
process.exit(1)
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
235
274
|
function validateOptions(cmd) {
|
|
236
275
|
// Validate language option
|
|
237
276
|
if (cmd.lang && !["js", "ts"].includes(cmd.lang.toLowerCase())) {
|
|
@@ -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", () => {
|