create-catalyst-app 0.0.1-beta.16 → 0.0.1-beta.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-catalyst-app",
3
3
  "bin": "scripts/cli.cjs",
4
- "version": "0.0.1-beta.16",
4
+ "version": "0.0.1-beta.18",
5
5
  "description": "cli package to scaffold Catalyst application",
6
6
  "dependencies": {
7
7
  "commander": "^8.2.0",
package/scripts/cli.cjs CHANGED
@@ -33,6 +33,8 @@ const program = new Commander.Command()
33
33
  return
34
34
  }
35
35
 
36
+ console.log(cyan(`Using create-catalyst-app version ${bold(packageJson.version)}`))
37
+
36
38
  // Use options provided through commander or prompt the user
37
39
  validateOptions(cmd)
38
40
  const projectName = folderName || (await promptProjectName())
@@ -47,8 +49,9 @@ const program = new Commander.Command()
47
49
  console.log(red(`${projectName} already exists, try again.`))
48
50
  process.exit(1)
49
51
  }
50
- const language = await promptTypescript()
51
52
  const projectDescription = await promptDescription()
53
+ const language = await promptTypescript()
54
+ const tailWindSupport = await promptTailwind()
52
55
  const stateManagement = cmd.stateManagement || (await promptStateManagement())
53
56
 
54
57
  // Define mapping of options to repository suffixes
@@ -65,7 +68,11 @@ const program = new Commander.Command()
65
68
 
66
69
  const commonCodeDirectory = "package/templates/common"
67
70
  const selectedTemplateCode = `package/templates/${repositorySuffixes[stateManagement]}-${repositorySuffixes[language]}`
71
+ const tailwindCodeDirectory = "package/templates/tailwind"
72
+
68
73
  const subDirectoriesToExtract = [commonCodeDirectory, selectedTemplateCode]
74
+ if (tailWindSupport) subDirectoriesToExtract.push(tailwindCodeDirectory)
75
+
69
76
  const extractionDestination = `/${projectName}/`
70
77
  let tempDir
71
78
  ;(() => {
@@ -77,6 +84,8 @@ const program = new Commander.Command()
77
84
  extractSubdirectory(packageFilePath)
78
85
  createGitignore(projectName)
79
86
 
87
+ if (tailWindSupport) setupTailwind(projectName)
88
+
80
89
  execSync(
81
90
  `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
91
  { stdio: "inherit" }
@@ -150,6 +159,9 @@ const program = new Commander.Command()
150
159
  if (entry.path.startsWith(selectedTemplateCode)) {
151
160
  entry.path = entry.path.replace(selectedTemplateCode, extractionDestination)
152
161
  }
162
+ if (entry.path.startsWith(tailwindCodeDirectory)) {
163
+ entry.path = entry.path.replace(tailwindCodeDirectory, extractionDestination)
164
+ }
153
165
  },
154
166
  })
155
167
  } catch (e) {
@@ -232,6 +244,35 @@ async function promptTypescript() {
232
244
  return response.typescript
233
245
  }
234
246
 
247
+ async function promptTailwind() {
248
+ const response = await prompts({
249
+ type: "select",
250
+ name: "tailwind",
251
+ message: "Would you like to use Tailwind CSS?",
252
+ choices: [
253
+ { title: "Yes", value: true },
254
+ { title: "No", value: false },
255
+ ],
256
+ })
257
+ return response.tailwind
258
+ }
259
+
260
+ async function setupTailwind(projectName) {
261
+ try {
262
+ const packageJsonPath = path.join(process.cwd(), projectName, "package.json")
263
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"))
264
+ packageJson.dependencies = {
265
+ ...(packageJson.dependencies || {}),
266
+ tailwindcss: "^4.1.4",
267
+ "@tailwindcss/postcss": "^4.1.4",
268
+ }
269
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
270
+ } catch (error) {
271
+ console.log("Error while setting up tailwind:", error)
272
+ process.exit(1)
273
+ }
274
+ }
275
+
235
276
  function validateOptions(cmd) {
236
277
  // Validate language option
237
278
  if (cmd.lang && !["js", "ts"].includes(cmd.lang.toLowerCase())) {
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@loadable/component": "^5.16.3",
22
22
  "@tata1mg/router": "^0.0.1-beta.7",
23
- "catalyst-core": "0.0.1-beta.13"
23
+ "catalyst-core": "0.0.1-beta.14"
24
24
  },
25
25
  "devDependencies": {
26
26
  "eslint": "^8.26.0",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@loadable/component": "^5.16.3",
23
23
  "@tata1mg/router": "^0.0.1-beta.7",
24
- "catalyst-core": "0.0.1-beta.13"
24
+ "catalyst-core": "0.0.1-beta.14"
25
25
  },
26
26
  "devDependencies": {
27
27
  "eslint": "^8.26.0",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@loadable/component": "^5.16.3",
23
23
  "@tata1mg/router": "^0.0.1-beta.7",
24
- "catalyst-core": "0.0.1-beta.13",
24
+ "catalyst-core": "0.0.1-beta.14",
25
25
  "@reduxjs/toolkit": "1.9.3",
26
26
  "react-redux": "^8.1.3"
27
27
  },
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@loadable/component": "^5.16.3",
24
24
  "@tata1mg/router": "^0.0.1-beta.7",
25
- "catalyst-core": "0.0.1-beta.13",
25
+ "catalyst-core": "0.0.1-beta.14",
26
26
  "@reduxjs/toolkit": "1.9.3",
27
27
  "react-redux": "^8.1.3"
28
28
  },
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@loadable/component": "^5.16.3",
23
23
  "@tata1mg/router": "^0.0.1-beta.7",
24
- "catalyst-core": "0.0.1-beta.13",
24
+ "catalyst-core": "0.0.1-beta.14",
25
25
  "@reduxjs/toolkit": "1.9.3",
26
26
  "react-redux": "^8.1.3"
27
27
  },
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@loadable/component": "^5.16.3",
24
24
  "@tata1mg/router": "^0.0.1-beta.7",
25
- "catalyst-core": "0.0.1-beta.13",
25
+ "catalyst-core": "0.0.1-beta.14",
26
26
  "@reduxjs/toolkit": "1.9.3",
27
27
  "react-redux": "^8.1.3"
28
28
  },
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ plugins: {
3
+ "@tailwindcss/postcss": {},
4
+ },
5
+ }
@@ -0,0 +1,2 @@
1
+ @import "styles";
2
+ @import "tailwindcss";