create-catalyst-app-internal 0.0.1-beta.5 → 0.0.1-beta.7
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 +41 -26
- package/templates/common/config/config.json +0 -1
- package/templates/common/src/js/containers/Home/Home.js +2 -2
- package/templates/none-js/package.json +2 -2
- package/templates/redux-js/package.json +2 -2
- package/templates/redux-js/src/js/containers/App/reducer.js +1 -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,28 @@ 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
|
-
{ stdio: "inherit" }
|
|
72
|
-
)
|
|
65
|
+
execSync(
|
|
66
|
+
`cd ${projectName} && npm i && npm pkg set name=${projectName} ${projectDescription ? `description=${projectDescription}` : ""} && git init --quiet`,
|
|
67
|
+
{ stdio: "inherit" }
|
|
68
|
+
)
|
|
73
69
|
|
|
74
|
-
console.log(cyan(`Installing Packages`))
|
|
75
70
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
deleteDirectory(tempDir)
|
|
72
|
+
} catch (error) {
|
|
73
|
+
deleteDirectory(tempDir)
|
|
74
|
+
console.error(`Error: ${error.message}`)
|
|
75
|
+
process.exit(1)
|
|
76
|
+
}
|
|
77
|
+
})()
|
|
83
78
|
|
|
84
79
|
function packNpmPackage(packageName, packageVersion, tempDir) {
|
|
85
80
|
const tarballFileName = `${packageName}-${packageVersion}.tgz`
|
|
@@ -175,10 +170,10 @@ async function promptProjectName() {
|
|
|
175
170
|
if (!res.path || projectName === "") {
|
|
176
171
|
console.log(
|
|
177
172
|
"\nPlease specify the project directory:\n" +
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
173
|
+
` ${cyan(program.name())} ${green("<project-directory>")}\n` +
|
|
174
|
+
"For example:\n" +
|
|
175
|
+
` ${cyan(program.name())} ${green("my-next-app")}\n\n` +
|
|
176
|
+
`Run ${cyan(`${program.name()} --help`)} to see all options.`
|
|
182
177
|
)
|
|
183
178
|
process.exit(1)
|
|
184
179
|
}
|
|
@@ -221,3 +216,23 @@ function deleteDirectory(dirPath) {
|
|
|
221
216
|
fs.rmdirSync(dirPath)
|
|
222
217
|
}
|
|
223
218
|
}
|
|
219
|
+
|
|
220
|
+
// Function to create a .gitignore file with the hardcoded patterns
|
|
221
|
+
function createGitignore(projectName) {
|
|
222
|
+
|
|
223
|
+
const gitiIgnorePatterns = [
|
|
224
|
+
'node_modules/*',
|
|
225
|
+
'build/*',
|
|
226
|
+
'logs/*'
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
const gitignorePath = path.join(process.cwd(), projectName, '.gitignore');
|
|
230
|
+
|
|
231
|
+
if (fs.existsSync(gitignorePath)) {
|
|
232
|
+
console.log('.gitignore already exists. Please rename or remove it before running the script.');
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
fs.writeFileSync(gitignorePath, gitiIgnorePatterns.join('\n'));
|
|
237
|
+
}
|
|
238
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import css from "./Home.scss"
|
|
3
3
|
|
|
4
|
-
function
|
|
4
|
+
function Home() {
|
|
5
5
|
return (
|
|
6
6
|
<div className={css.app}>
|
|
7
7
|
<header className={css.appHeader}>
|
|
@@ -20,4 +20,4 @@ function Landing() {
|
|
|
20
20
|
)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export default
|
|
23
|
+
export default Home
|
|
@@ -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.3",
|
|
22
22
|
"@reduxjs/toolkit": "1.9.3",
|
|
23
23
|
"react-redux": "^8.1.3"
|
|
24
24
|
}
|
|
@@ -4,7 +4,7 @@ export const defaultState = {
|
|
|
4
4
|
testActionDispatched: false,
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
const shellReducer = (state = defaultState, action) => {
|
|
7
|
+
export const shellReducer = (state = defaultState, action) => {
|
|
8
8
|
switch (action.type) {
|
|
9
9
|
case ShellActions.REDUX_TEST: {
|
|
10
10
|
return {
|
|
@@ -18,4 +18,3 @@ const shellReducer = (state = defaultState, action) => {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export default shellReducer
|
|
@@ -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.3",
|
|
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
|
-
}
|