create-catalyst-app-internal 0.0.1-beta.5 → 0.0.1-beta.6
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 +44 -26
- package/templates/common/config/config.json +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/common/.eslintrc +0 -53
- package/templates/common/.prettierrc.json +0 -7
package/package.json
CHANGED
package/scripts/cli.cjs
CHANGED
|
@@ -35,9 +35,6 @@ const program = new Commander.Command()
|
|
|
35
35
|
const projectDescription = await promptDescription()
|
|
36
36
|
const stateManagement = cmd.stateManagement || (await promptStateManagement())
|
|
37
37
|
|
|
38
|
-
const resolvedProjectPath = path.resolve(projectName.trim())
|
|
39
|
-
const projectPath = path.basename(resolvedProjectPath)
|
|
40
|
-
const root = path.resolve(projectPath)
|
|
41
38
|
|
|
42
39
|
// Define mapping of options to repository suffixes
|
|
43
40
|
const repositorySuffixes = {
|
|
@@ -56,30 +53,30 @@ const program = new Commander.Command()
|
|
|
56
53
|
const subDirectoriesToExtract = [commonCodeDirectory, selectedTemplateCode]
|
|
57
54
|
const extractionDestination = `/${projectName}/`
|
|
58
55
|
let tempDir
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
; (() => {
|
|
57
|
+
try {
|
|
58
|
+
tempDir = createTempDir()
|
|
62
59
|
|
|
63
|
-
|
|
60
|
+
const packageFilePath = packNpmPackage(packageName, packageVersion, tempDir)
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
extractSubdirectory(packageFilePath)
|
|
63
|
+
createGitignore(projectName)
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)
|
|
65
|
+
execSync(
|
|
66
|
+
`cd ${projectName} && npm i && npm pkg set name=${projectName} ${projectDescription ? `description=${projectDescription}` : ""
|
|
67
|
+
} && git init --quiet`,
|
|
68
|
+
{ stdio: "inherit" }
|
|
69
|
+
)
|
|
73
70
|
|
|
74
|
-
|
|
71
|
+
console.log(cyan(`Installing Packages`))
|
|
75
72
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
deleteDirectory(tempDir)
|
|
74
|
+
} catch (error) {
|
|
75
|
+
deleteDirectory(tempDir)
|
|
76
|
+
console.error(`Error: ${error.message}`)
|
|
77
|
+
process.exit(1)
|
|
78
|
+
}
|
|
79
|
+
})()
|
|
83
80
|
|
|
84
81
|
function packNpmPackage(packageName, packageVersion, tempDir) {
|
|
85
82
|
const tarballFileName = `${packageName}-${packageVersion}.tgz`
|
|
@@ -175,10 +172,10 @@ async function promptProjectName() {
|
|
|
175
172
|
if (!res.path || projectName === "") {
|
|
176
173
|
console.log(
|
|
177
174
|
"\nPlease specify the project directory:\n" +
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
` ${cyan(program.name())} ${green("<project-directory>")}\n` +
|
|
176
|
+
"For example:\n" +
|
|
177
|
+
` ${cyan(program.name())} ${green("my-next-app")}\n\n` +
|
|
178
|
+
`Run ${cyan(`${program.name()} --help`)} to see all options.`
|
|
182
179
|
)
|
|
183
180
|
process.exit(1)
|
|
184
181
|
}
|
|
@@ -221,3 +218,24 @@ function deleteDirectory(dirPath) {
|
|
|
221
218
|
fs.rmdirSync(dirPath)
|
|
222
219
|
}
|
|
223
220
|
}
|
|
221
|
+
|
|
222
|
+
// Function to create a .gitignore file with the hardcoded patterns
|
|
223
|
+
function createGitignore(projectName) {
|
|
224
|
+
|
|
225
|
+
const gitiIgnorePatterns = [
|
|
226
|
+
'node_modules/*',
|
|
227
|
+
'build/*',
|
|
228
|
+
'logs/*'
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
const gitignorePath = path.join(process.cwd(), projectName, '.gitignore');
|
|
232
|
+
|
|
233
|
+
if (fs.existsSync(gitignorePath)) {
|
|
234
|
+
console.log('.gitignore already exists. Please rename or remove it before running the script.');
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
fs.writeFileSync(gitignorePath, gitiIgnorePatterns.join('\n'));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Create .gitignore with hardcoded patterns
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@loadable/component": "^5.16.3",
|
|
20
|
-
"@tata1mg/router": "^0.0.1-
|
|
21
|
-
"catalyst-core-internal": "0.0.1-beta.
|
|
20
|
+
"@tata1mg/router": "^0.0.1-beta.0",
|
|
21
|
+
"catalyst-core-internal": "^0.0.1-beta.2",
|
|
22
22
|
"@reduxjs/toolkit": "1.9.3",
|
|
23
23
|
"react-redux": "^8.1.3"
|
|
24
24
|
}
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@loadable/component": "^5.16.3",
|
|
20
|
-
"@tata1mg/router": "^0.0.1-
|
|
21
|
-
"catalyst-core-internal": "0.0.1-beta.
|
|
20
|
+
"@tata1mg/router": "^0.0.1-beta.0",
|
|
21
|
+
"catalyst-core-internal": "^0.0.1-beta.2",
|
|
22
22
|
"@reduxjs/toolkit": "1.9.3",
|
|
23
23
|
"react-redux": "^8.1.3"
|
|
24
24
|
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"parser": "@babel/eslint-parser",
|
|
3
|
-
"rules": {
|
|
4
|
-
"prettier/prettier": "error",
|
|
5
|
-
"no-console": "warn",
|
|
6
|
-
"react/prop-types": 1,
|
|
7
|
-
"react/display-name": [0, { "ignoreTranspilerName": true }],
|
|
8
|
-
"react-hooks/exhaustive-deps": "warn", // Checks effect dependencies
|
|
9
|
-
"no-prototype-builtins": "off",
|
|
10
|
-
"jam3/no-sanitizer-with-danger": 2,
|
|
11
|
-
"react/jsx-no-target-blank": [0, {
|
|
12
|
-
"enforceDynamicLinks": "never"
|
|
13
|
-
}]
|
|
14
|
-
},
|
|
15
|
-
"env": {
|
|
16
|
-
"browser": true,
|
|
17
|
-
"es6": true,
|
|
18
|
-
"jest": true,
|
|
19
|
-
"node": true
|
|
20
|
-
},
|
|
21
|
-
"globals": {
|
|
22
|
-
"expect": true,
|
|
23
|
-
"__non_webpack_require__": true,
|
|
24
|
-
"logger": "readonly",
|
|
25
|
-
"AppCallbacks": "readonly"
|
|
26
|
-
},
|
|
27
|
-
"extends": ["eslint:recommended", "plugin:react/recommended"],
|
|
28
|
-
"parserOptions": {
|
|
29
|
-
"sourceType": "module",
|
|
30
|
-
"ecmaFeatures": {
|
|
31
|
-
"experimentalObjectRestSpread": true,
|
|
32
|
-
"jsx": true
|
|
33
|
-
},
|
|
34
|
-
"babelOptions": {
|
|
35
|
-
"configFile": "./babel.config.js"
|
|
36
|
-
},
|
|
37
|
-
"ecmaVersion": 6
|
|
38
|
-
},
|
|
39
|
-
"plugins": ["babel", "react", "react-hooks", "prettier", "jam3"],
|
|
40
|
-
"settings": {
|
|
41
|
-
"react": {
|
|
42
|
-
"createClass": "createReactClass",
|
|
43
|
-
"pragma": "React",
|
|
44
|
-
"version": "detect"
|
|
45
|
-
},
|
|
46
|
-
"propWrapperFunctions": [
|
|
47
|
-
"forbidExtraProps",
|
|
48
|
-
{ "property": "freeze", "object": "Object" },
|
|
49
|
-
{ "property": "myFavoriteWrapper" }
|
|
50
|
-
],
|
|
51
|
-
"linkComponents": ["Hyperlink", { "name": "Link", "linkAttribute": "to" }]
|
|
52
|
-
}
|
|
53
|
-
}
|