@appdirect/sfb-toolkit 2.0.15 → 3.0.0
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/Dockerfile +26 -0
- package/bin/index.js +191 -189
- package/commands.sh +2 -0
- package/coverage/clover.xml +567 -0
- package/coverage/coverage-final.json +19 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/constants/index.html +126 -0
- package/coverage/lcov-report/constants/pageUrls.js.html +98 -0
- package/coverage/lcov-report/constants/userMock.js.html +158 -0
- package/coverage/lcov-report/controllers/controllers-utils/assetsUtils.js.html +173 -0
- package/coverage/lcov-report/controllers/controllers-utils/index.html +111 -0
- package/coverage/lcov-report/controllers/data-filters/bootstrap-data-filter.js.html +146 -0
- package/coverage/lcov-report/controllers/data-filters/call-to-actions-filter.js.html +347 -0
- package/coverage/lcov-report/controllers/data-filters/index.html +126 -0
- package/coverage/lcov-report/controllers/index.html +111 -0
- package/coverage/lcov-report/controllers/index.js.html +1331 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/front-end-utils/src/components/base/ResultItem.js.html +518 -0
- package/coverage/lcov-report/front-end-utils/src/components/base/SearchBar.js.html +452 -0
- package/coverage/lcov-report/front-end-utils/src/components/base/index.html +141 -0
- package/coverage/lcov-report/front-end-utils/src/components/base/item.js.html +458 -0
- package/coverage/lcov-report/front-end-utils/src/components/container.js.html +548 -0
- package/coverage/lcov-report/front-end-utils/src/components/data-view.js.html +383 -0
- package/coverage/lcov-report/front-end-utils/src/components/header-view.js.html +803 -0
- package/coverage/lcov-report/front-end-utils/src/components/index.html +156 -0
- package/coverage/lcov-report/front-end-utils/src/components/search.js.html +977 -0
- package/coverage/lcov-report/front-end-utils/src/constants/index.html +141 -0
- package/coverage/lcov-report/front-end-utils/src/constants/pageUrl.js.html +86 -0
- package/coverage/lcov-report/front-end-utils/src/constants/roleType.js.html +92 -0
- package/coverage/lcov-report/front-end-utils/src/constants/searchType.js.html +164 -0
- package/coverage/lcov-report/front-end-utils/src/utils/debounce.js.html +116 -0
- package/coverage/lcov-report/front-end-utils/src/utils/index.html +111 -0
- package/coverage/lcov-report/index.html +231 -0
- package/coverage/lcov-report/middlewares/config.js.html +182 -0
- package/coverage/lcov-report/middlewares/index.html +111 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/coverage/lcov.info +1132 -0
- package/npm-shrinkwrap.json +29 -30
- package/package.json +10 -4
- package/readme.md +6 -0
- package/src/tools/toolkit-common-vars.js +1 -1
- package/src/tools/toolkit-dev-e2e.js +85 -0
- package/src/tools/toolkit-setup-e2e.js +109 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/sfb-toolkit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"integrity": "sha1-r5sX3a3DE3JXYDbIdgu668lvZPw="
|
|
11
11
|
},
|
|
12
12
|
"@appdirect/sfb-theme-plaza": {
|
|
13
|
-
"version": "0.0.
|
|
14
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/@appdirect/sfb-theme-plaza/-/sfb-theme-plaza-0.0.
|
|
15
|
-
"integrity": "sha1-
|
|
13
|
+
"version": "0.0.45",
|
|
14
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/@appdirect/sfb-theme-plaza/-/sfb-theme-plaza-0.0.45.tgz",
|
|
15
|
+
"integrity": "sha1-pigx8YnmJsvLZGlGDtN0BJW36b4="
|
|
16
16
|
},
|
|
17
17
|
"@appdirect/storefront-utils": {
|
|
18
18
|
"version": "0.0.101",
|
|
@@ -3118,9 +3118,9 @@
|
|
|
3118
3118
|
}
|
|
3119
3119
|
},
|
|
3120
3120
|
"config-chain": {
|
|
3121
|
-
"version": "1.1.
|
|
3122
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/config-chain/-/config-chain-1.1.
|
|
3123
|
-
"integrity": "sha1
|
|
3121
|
+
"version": "1.1.13",
|
|
3122
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/config-chain/-/config-chain-1.1.13.tgz",
|
|
3123
|
+
"integrity": "sha1-+tB5Wqamza/57Rto6d/5Q3LCMvQ=",
|
|
3124
3124
|
"requires": {
|
|
3125
3125
|
"ini": "^1.3.4",
|
|
3126
3126
|
"proto-list": "~1.2.1"
|
|
@@ -5883,22 +5883,16 @@
|
|
|
5883
5883
|
"integrity": "sha1-MTtidN2nGPcU0AszMLuubjjpAgk="
|
|
5884
5884
|
},
|
|
5885
5885
|
"js-beautify": {
|
|
5886
|
-
"version": "1.
|
|
5887
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/js-beautify/-/js-beautify-1.
|
|
5888
|
-
"integrity": "sha1-
|
|
5886
|
+
"version": "1.14.0",
|
|
5887
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/js-beautify/-/js-beautify-1.14.0.tgz",
|
|
5888
|
+
"integrity": "sha1-LOeQxVXVPOHj1zYyJ6z13GkCTC0=",
|
|
5889
5889
|
"requires": {
|
|
5890
5890
|
"config-chain": "^1.1.12",
|
|
5891
5891
|
"editorconfig": "^0.15.3",
|
|
5892
5892
|
"glob": "^7.1.3",
|
|
5893
|
-
"mkdirp": "^1.0.4",
|
|
5894
5893
|
"nopt": "^5.0.0"
|
|
5895
5894
|
},
|
|
5896
5895
|
"dependencies": {
|
|
5897
|
-
"mkdirp": {
|
|
5898
|
-
"version": "1.0.4",
|
|
5899
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/mkdirp/-/mkdirp-1.0.4.tgz",
|
|
5900
|
-
"integrity": "sha1-PrXtYmInVteaXw4qIh3+utdcL34="
|
|
5901
|
-
},
|
|
5902
5896
|
"nopt": {
|
|
5903
5897
|
"version": "5.0.0",
|
|
5904
5898
|
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/nopt/-/nopt-5.0.0.tgz",
|
|
@@ -6883,9 +6877,9 @@
|
|
|
6883
6877
|
}
|
|
6884
6878
|
},
|
|
6885
6879
|
"needle": {
|
|
6886
|
-
"version": "2.
|
|
6887
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/needle/-/needle-2.
|
|
6888
|
-
"integrity": "sha1-
|
|
6880
|
+
"version": "2.9.1",
|
|
6881
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/needle/-/needle-2.9.1.tgz",
|
|
6882
|
+
"integrity": "sha1-ItHf++NJDCuD4wH3cJtnNs2PJoQ=",
|
|
6889
6883
|
"requires": {
|
|
6890
6884
|
"debug": "^3.2.6",
|
|
6891
6885
|
"iconv-lite": "^0.4.4",
|
|
@@ -7034,18 +7028,23 @@
|
|
|
7034
7028
|
"osenv": "^0.1.4"
|
|
7035
7029
|
}
|
|
7036
7030
|
},
|
|
7031
|
+
"safe-buffer": {
|
|
7032
|
+
"version": "5.2.1",
|
|
7033
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
7034
|
+
"integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY="
|
|
7035
|
+
},
|
|
7037
7036
|
"tar": {
|
|
7038
|
-
"version": "4.4.
|
|
7039
|
-
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/tar/-/tar-4.4.
|
|
7040
|
-
"integrity": "sha1-
|
|
7041
|
-
"requires": {
|
|
7042
|
-
"chownr": "^1.1.
|
|
7043
|
-
"fs-minipass": "^1.2.
|
|
7044
|
-
"minipass": "^2.
|
|
7045
|
-
"minizlib": "^1.
|
|
7046
|
-
"mkdirp": "^0.5.
|
|
7047
|
-
"safe-buffer": "^5.1
|
|
7048
|
-
"yallist": "^3.
|
|
7037
|
+
"version": "4.4.19",
|
|
7038
|
+
"resolved": "https://artifactory.appdirect.tools/artifactory/api/npm/npm-repo/tar/-/tar-4.4.19.tgz",
|
|
7039
|
+
"integrity": "sha1-Lk1yY98m8rkU3uEMglqxMhI3QvM=",
|
|
7040
|
+
"requires": {
|
|
7041
|
+
"chownr": "^1.1.4",
|
|
7042
|
+
"fs-minipass": "^1.2.7",
|
|
7043
|
+
"minipass": "^2.9.0",
|
|
7044
|
+
"minizlib": "^1.3.3",
|
|
7045
|
+
"mkdirp": "^0.5.5",
|
|
7046
|
+
"safe-buffer": "^5.2.1",
|
|
7047
|
+
"yallist": "^3.1.1"
|
|
7049
7048
|
}
|
|
7050
7049
|
},
|
|
7051
7050
|
"yallist": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appdirect/sfb-toolkit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"test": "jest",
|
|
25
|
+
"test": "jest --coverage",
|
|
26
26
|
"buildToolbar": "webpack --config ./webpack.config.js --mode production",
|
|
27
27
|
"dev": "RUN_ENV=dev concurrently \"npm run watchCSS\" \"npm run devserver\"",
|
|
28
28
|
"start": "RUN_ENV=test concurrently \"npm run watchCSS\" \"npm run devserver\"",
|
|
@@ -35,12 +35,18 @@
|
|
|
35
35
|
"lint": "eslint src tools --ignore-path .eslintignore",
|
|
36
36
|
"lintfix": "eslint src tools --ignore-path .eslintignore --fix",
|
|
37
37
|
"watchCSS": "RUNDEVSERVER=true node src/tools/compiler-css.js",
|
|
38
|
-
"package": "node src/tools/compiler-css.js && node src/tools/package-fonts.js && node src/tools/zip-theme.js"
|
|
38
|
+
"package": "node src/tools/compiler-css.js && node src/tools/package-fonts.js && node src/tools/zip-theme.js",
|
|
39
|
+
"docker:toolkit:build": "DOCKER_TAG=${DOCKER_TAG:=} docker build -t $npm_package_docker_registry/$npm_package_docker_name:$DOCKER_TAG .",
|
|
40
|
+
"docker:toolkit:push": "DOCKER_TAG=${DOCKER_TAG:=} docker push $npm_package_docker_registry/$npm_package_docker_name:$DOCKER_TAG"
|
|
39
41
|
},
|
|
40
42
|
"author": "AppDirect, Inc.",
|
|
43
|
+
"docker": {
|
|
44
|
+
"registry": "docker.appdirect.tools",
|
|
45
|
+
"name": "appdirect/sfb-toolkit"
|
|
46
|
+
},
|
|
41
47
|
"dependencies": {
|
|
42
48
|
"@appdirect/sfb-theme-classic": "0.0.21",
|
|
43
|
-
"@appdirect/sfb-theme-plaza": "0.0.
|
|
49
|
+
"@appdirect/sfb-theme-plaza": "0.0.45",
|
|
44
50
|
"@babel/core": "^7.4.4",
|
|
45
51
|
"@babel/plugin-proposal-class-properties": "^7.4.4",
|
|
46
52
|
"@babel/plugin-transform-runtime": "^7.14.3",
|
package/readme.md
CHANGED
|
@@ -9,6 +9,12 @@ It can be easily mixed with eg. HTML, CSS, JavaScript, jQuery, SASS.
|
|
|
9
9
|
* Node 10.x or 12.x
|
|
10
10
|
### Release Notes:
|
|
11
11
|
|
|
12
|
+
**3.0.0**
|
|
13
|
+
- Add new storefront Header & Footer components
|
|
14
|
+
- Add new menu manager in the Visual Editor
|
|
15
|
+
- Update `sfb-theme-components` library to version [0.0.237](https://www.npmjs.com/package/@appdirect/sfb-theme-components/v/0.0.237) and the Plaza theme to meet WCAG 2.1 level AA for accessibility
|
|
16
|
+
- Update `@appdirect/sfb-theme-plaza` to version 0.0.45 ([sfb-theme-mp2@0.0.45](https://www.npmjs.com/package/@appdirect/sfb-theme-plaza/v/0.0.45))
|
|
17
|
+
|
|
12
18
|
**2.0.15**
|
|
13
19
|
- Add new domain cross-selling page in Plaza theme. ([See Documentation](https://help.appdirect.com/products/Default.htm#StorefrontBuilder/sfb-configure-domain-x-sell.htm))
|
|
14
20
|
- Read `crossSellingEnabled` setting from theme to optionally disable cross-selling
|
|
@@ -15,7 +15,7 @@ const THEME_TEMPLATES_CONFIG_PATH = `${TOOLKIT_PATH}/themes-config.json`;
|
|
|
15
15
|
const THEME_TEMPLATES = JSON.parse(fs.readFileSync(THEME_TEMPLATES_CONFIG_PATH));
|
|
16
16
|
const PAGE_OBJECTS_SUFFIX = "/api/internal/storefront/v1";
|
|
17
17
|
const THEME_COMPONENT_MODULE = "@appdirect/sfb-theme-components";
|
|
18
|
-
const THEME_COMPONENT_VERSION = "0.0.
|
|
18
|
+
const THEME_COMPONENT_VERSION = "0.0.237";
|
|
19
19
|
|
|
20
20
|
let WORKSPACE_CONFIG;
|
|
21
21
|
try {
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const fs = require("fs-extra")
|
|
2
|
+
const { shouldBeProjectFolder } = require("./toolkit-common-fun")
|
|
3
|
+
const { ACTIVE_THEME_PATH } = require("./toolkit-common-vars")
|
|
4
|
+
|
|
5
|
+
shouldBeProjectFolder(true)
|
|
6
|
+
|
|
7
|
+
const addAssetsToBase = (baseFilePath, data) => {
|
|
8
|
+
fs.writeFile(baseFilePath, data, err => {
|
|
9
|
+
if (err)
|
|
10
|
+
return console.error(
|
|
11
|
+
" ERROR: Unable to perform update to add local sfb-components assets."
|
|
12
|
+
.red
|
|
13
|
+
)
|
|
14
|
+
console.log(
|
|
15
|
+
"Successfully installed update to add local sfb-components assets!\nPlease start/restart the toolkit server to observe the changes."
|
|
16
|
+
.green
|
|
17
|
+
)
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const settingsSchemaData = `{ "useComponents": true }`
|
|
22
|
+
;(() => {
|
|
23
|
+
const baseFilePath = `${ACTIVE_THEME_PATH}/content/layout/base.html`
|
|
24
|
+
|
|
25
|
+
if (!fs.existsSync(`${ACTIVE_THEME_PATH}/settings-schema.json`)) {
|
|
26
|
+
fs.writeFile(
|
|
27
|
+
`${ACTIVE_THEME_PATH}/settings-schema.json`,
|
|
28
|
+
settingsSchemaData,
|
|
29
|
+
err => {
|
|
30
|
+
if (err)
|
|
31
|
+
return console.error(
|
|
32
|
+
" ERROR: Unable to create settings-schema.json file.".red
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
fs.readFile(baseFilePath, "utf8", (err, data) => {
|
|
39
|
+
if (err)
|
|
40
|
+
return console.error(
|
|
41
|
+
` ERROR: Unable to read the base layout file. Tried: ${baseFilePath}`
|
|
42
|
+
.red
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
const cdnComponents = data.match(
|
|
46
|
+
/\S+.+channelCanonicalBaseUrl.+(css|js).+/g
|
|
47
|
+
)
|
|
48
|
+
const assetsComponents = data.match(
|
|
49
|
+
/\S+.+r\(.+assets.+sfb-components.+(css|js).+/g
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
const sfbComponentsLocalBaseUrl = "http://localhost:3444"
|
|
53
|
+
|
|
54
|
+
if (cdnComponents !== null) {
|
|
55
|
+
data = data.replace(
|
|
56
|
+
/\S+.+channelCanonicalBaseUrl.+css.+/,
|
|
57
|
+
`<link rel="stylesheet" type="text/css" href="${sfbComponentsLocalBaseUrl}/sfb-components.css">`
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
data = data.replace(
|
|
61
|
+
/\S+.+channelCanonicalBaseUrl.+js.+/,
|
|
62
|
+
`<script src="${sfbComponentsLocalBaseUrl}/sfb-components.js"></script>`
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
addAssetsToBase(baseFilePath, data)
|
|
66
|
+
} else if (assetsComponents === null) {
|
|
67
|
+
const headElemIndex = data.indexOf("</head>")
|
|
68
|
+
const output =
|
|
69
|
+
`${data.substring(
|
|
70
|
+
0,
|
|
71
|
+
headElemIndex
|
|
72
|
+
)} <link rel="stylesheet" type="text/css" href="${sfbComponentsLocalBaseUrl}/sfb-components.css">\n` +
|
|
73
|
+
` <script src="${sfbComponentsLocalBaseUrl}/sfb-components.js"></script>\n${data.substring(
|
|
74
|
+
headElemIndex
|
|
75
|
+
)}`
|
|
76
|
+
|
|
77
|
+
addAssetsToBase(baseFilePath, output)
|
|
78
|
+
} else {
|
|
79
|
+
console.log(
|
|
80
|
+
"Theme is already setup to use local sfb-components dev server assets."
|
|
81
|
+
.green
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
})()
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const fs = require("fs")
|
|
2
|
+
const { copy, remove } = require("fs-extra")
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
CURRENT_PATH,
|
|
6
|
+
TOOLKIT_PATH,
|
|
7
|
+
COMMAND_PARAM,
|
|
8
|
+
BOOTSTRAP_FOLDERS,
|
|
9
|
+
CONFIG_PATH,
|
|
10
|
+
PAGE_OBJECTS_SUFFIX
|
|
11
|
+
} = require("./toolkit-common-vars")
|
|
12
|
+
const {
|
|
13
|
+
selfDestruction,
|
|
14
|
+
shouldBeProjectFolder,
|
|
15
|
+
getAvailableFolderWithPrompt,
|
|
16
|
+
versionCheck
|
|
17
|
+
} = require("./toolkit-common-fun")
|
|
18
|
+
const { LOCAL_CONFIG } = require("./toolkit-config")
|
|
19
|
+
|
|
20
|
+
const projectName = COMMAND_PARAM // [optional] project name
|
|
21
|
+
|
|
22
|
+
const freshLocalConfig = {
|
|
23
|
+
namespaces: [],
|
|
24
|
+
defaultValues: {}
|
|
25
|
+
}
|
|
26
|
+
;(async () => {
|
|
27
|
+
shouldBeProjectFolder(false)
|
|
28
|
+
|
|
29
|
+
await versionCheck()
|
|
30
|
+
|
|
31
|
+
// Determine project's dir path
|
|
32
|
+
let projectPath = `${CURRENT_PATH}/` // by default
|
|
33
|
+
projectPath = await getAvailableFolderWithPrompt(
|
|
34
|
+
CURRENT_PATH,
|
|
35
|
+
projectName,
|
|
36
|
+
"ProjectName"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
freshLocalConfig.projectName = projectPath.replace(`${CURRENT_PATH}/`, "")
|
|
40
|
+
|
|
41
|
+
// create bootstrap folders
|
|
42
|
+
BOOTSTRAP_FOLDERS.forEach(folderName => {
|
|
43
|
+
if (!fs.existsSync(`${projectPath}/${folderName}`)) {
|
|
44
|
+
fs.mkdirSync(`${projectPath}/${folderName}`)
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
// copy theme folder
|
|
49
|
+
try {
|
|
50
|
+
await copy(
|
|
51
|
+
`${TOOLKIT_PATH}/node_modules/@appdirect/sfb-theme-plaza`,
|
|
52
|
+
`${projectPath}/themes/Plaza`
|
|
53
|
+
)
|
|
54
|
+
await remove(`${projectPath}/themes/Plaza/package.json`)
|
|
55
|
+
freshLocalConfig.defaultValues.themeName = projectName
|
|
56
|
+
} catch (err) {
|
|
57
|
+
console.error(` Could not create theme folder due to: \n ${err}`.red)
|
|
58
|
+
selfDestruction(projectPath) // revert changes
|
|
59
|
+
process.exit(1)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// copy config/index.js file
|
|
63
|
+
try {
|
|
64
|
+
await copy(
|
|
65
|
+
`${TOOLKIT_PATH}/${CONFIG_PATH}`,
|
|
66
|
+
`${projectPath}/${CONFIG_PATH}`
|
|
67
|
+
)
|
|
68
|
+
const marketplacePath = "https://marketplace.appdirect.com"
|
|
69
|
+
freshLocalConfig.defaultValues.marketplacePath = marketplacePath
|
|
70
|
+
freshLocalConfig.defaultValues.pageObjectsPath = `${marketplacePath}${PAGE_OBJECTS_SUFFIX}`
|
|
71
|
+
} catch (err) {
|
|
72
|
+
console.error(` Couldn't copy config file due to: \n ${err}`.red)
|
|
73
|
+
selfDestruction(projectPath) // revert changes
|
|
74
|
+
process.exit(1)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
freshLocalConfig.current = freshLocalConfig.defaultValues.themeName
|
|
78
|
+
freshLocalConfig.namespaces.push(freshLocalConfig.defaultValues)
|
|
79
|
+
freshLocalConfig.created = new Date()
|
|
80
|
+
freshLocalConfig.modified = new Date()
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
LOCAL_CONFIG.save(freshLocalConfig, projectPath)
|
|
84
|
+
} catch (err) {
|
|
85
|
+
console.error(` ERROR: Unable to save config file due to: \n ${err}`.red)
|
|
86
|
+
process.exit(1)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
LOCAL_CONFIG.configFileUpdate(projectPath)
|
|
91
|
+
console.log(
|
|
92
|
+
` Project context switched to ${freshLocalConfig.current}.`.green
|
|
93
|
+
)
|
|
94
|
+
} catch (err) {
|
|
95
|
+
console.error(
|
|
96
|
+
` ERROR: Unable to switch context to ${
|
|
97
|
+
freshLocalConfig.current
|
|
98
|
+
} due to: ${err}`.red
|
|
99
|
+
)
|
|
100
|
+
process.exit(1)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
console.log(` Theme location: ${projectPath}/`.green)
|
|
104
|
+
console.log(` Configuration file location: ${projectPath}/config/`.green)
|
|
105
|
+
console.log(
|
|
106
|
+
`\n All done! You can start your server by running \`sfb-toolkit start\` inside the project root folder: ${projectPath}\n`
|
|
107
|
+
.green
|
|
108
|
+
)
|
|
109
|
+
})()
|