@appdirect/sfb-toolkit 2.0.14 → 3.0.3
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 +570 -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 +1400 -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 +188 -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 +1146 -0
- package/index.js +1 -3
- package/npm-shrinkwrap.json +35 -46
- package/package.json +11 -4
- package/readme.md +24 -2
- package/src/constants/userMock.js +27 -0
- package/src/controllers/index.js +53 -25
- package/src/middlewares/config.js +3 -1
- package/src/tools/compiler-components-prod.js +30 -0
- package/src/tools/toolkit-common-vars.js +1 -1
- package/src/tools/toolkit-components.js +4 -0
- package/src/tools/toolkit-dev-e2e.js +85 -0
- package/src/tools/toolkit-package.js +44 -37
- package/src/tools/toolkit-setup-e2e.js +109 -0
- package/src/tools/zip-theme.js +15 -8
- package/webpack-components.config.js +28 -8
- package/webpack-components.config.prod.js +115 -0
- package/.node-version +0 -1
- package/src/tools/compiler-components.js +0 -25
|
@@ -1,68 +1,75 @@
|
|
|
1
1
|
const { spawn } = require("child_process")
|
|
2
|
+
|
|
2
3
|
const PACKFONTS_PATH = "src/tools/package-fonts.js"
|
|
3
4
|
const ZIPTHEME_PATH = "src/tools/zip-theme.js"
|
|
4
|
-
const COMPILECOMPONENTS_PATH = "src/tools/compiler-components.js"
|
|
5
|
-
const prompt = require("./prompt-questions")
|
|
6
|
-
const fs = require(
|
|
7
|
-
|
|
8
|
-
const
|
|
5
|
+
const COMPILECOMPONENTS_PATH = "src/tools/compiler-components-prod.js"
|
|
6
|
+
const prompt = require("./prompt-questions")
|
|
7
|
+
const fs = require("fs-extra")
|
|
8
|
+
|
|
9
|
+
const fsProm = fs.promises
|
|
10
|
+
const yaml = require("js-yaml")
|
|
11
|
+
|
|
9
12
|
const currentPath = process.cwd()
|
|
10
13
|
const config = require(`${currentPath}/config`)
|
|
11
14
|
|
|
12
|
-
const {
|
|
13
|
-
|
|
15
|
+
const {
|
|
16
|
+
TOOLKIT_PATH,
|
|
17
|
+
COMPILERCSS_PATH,
|
|
18
|
+
ACTIVE_THEME_PATH
|
|
19
|
+
} = require("./toolkit-common-vars")
|
|
20
|
+
const { shouldBeProjectFolder } = require("./toolkit-common-fun")
|
|
14
21
|
|
|
15
|
-
shouldBeProjectFolder(true)
|
|
22
|
+
shouldBeProjectFolder(true)
|
|
16
23
|
|
|
17
24
|
const yamlErrorCustomMessage = `Invalid translation files, please make sure the .yml files are in yaml format and not in JSON.
|
|
18
|
-
You can verify your yaml files on various free YAML validators on the web
|
|
25
|
+
You can verify your yaml files on various free YAML validators on the web.`
|
|
19
26
|
|
|
20
27
|
const hasTranslationErrors = async () => {
|
|
21
|
-
let yamlErrorFlag = false
|
|
22
|
-
const translationsPath = `${currentPath}/themes/${config.theme}/translations
|
|
28
|
+
let yamlErrorFlag = false
|
|
29
|
+
const translationsPath = `${currentPath}/themes/${config.theme}/translations`
|
|
23
30
|
try {
|
|
24
31
|
const translationsFiles = await fsProm.readdir(translationsPath)
|
|
25
32
|
|
|
26
|
-
translationsFiles.forEach(
|
|
33
|
+
translationsFiles.forEach(langFile => {
|
|
27
34
|
try {
|
|
28
|
-
yaml.safeLoad(fs.readFileSync(`${translationsPath}/${langFile}`))
|
|
35
|
+
yaml.safeLoad(fs.readFileSync(`${translationsPath}/${langFile}`))
|
|
29
36
|
} catch (err) {
|
|
30
|
-
yamlErrorFlag = true
|
|
31
|
-
err.name === "YAMLException"
|
|
37
|
+
yamlErrorFlag = true
|
|
38
|
+
if (err.name === "YAMLException") {
|
|
39
|
+
console.log(`${langFile} -> ${err}`.red)
|
|
40
|
+
}
|
|
41
|
+
console.log(err.red)
|
|
32
42
|
}
|
|
33
43
|
})
|
|
34
44
|
if (yamlErrorFlag) {
|
|
35
|
-
console.log(yamlErrorCustomMessage.red)
|
|
45
|
+
console.log(yamlErrorCustomMessage.red)
|
|
36
46
|
}
|
|
37
47
|
} catch (err) {
|
|
38
|
-
yamlErrorFlag = true
|
|
39
|
-
console.log(`${err}`.red)
|
|
48
|
+
yamlErrorFlag = true
|
|
49
|
+
console.log(`${err}`.red)
|
|
40
50
|
}
|
|
41
|
-
return yamlErrorFlag
|
|
51
|
+
return yamlErrorFlag
|
|
42
52
|
}
|
|
43
53
|
|
|
44
|
-
const includeSettings = async
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return userAnswerSettings.PackSettingsChoice;
|
|
54
|
+
const includeSettings = async shouldIncludeSettings => {
|
|
55
|
+
if (fs.existsSync(`${ACTIVE_THEME_PATH}/settings.json`)) {
|
|
56
|
+
const userAnswerSettings = await prompt.ask(["PackSettingsChoice"])
|
|
57
|
+
return userAnswerSettings.PackSettingsChoice
|
|
49
58
|
}
|
|
50
59
|
return shouldIncludeSettings
|
|
51
60
|
}
|
|
61
|
+
;(async () => {
|
|
62
|
+
let shouldIncludeTranslations = true
|
|
63
|
+
let shouldIncludeSettings = true
|
|
52
64
|
|
|
53
|
-
(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
shouldIncludeSettings = await includeSettings(shouldIncludeSettings);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
const translationsError = await hasTranslationErrors();
|
|
65
|
-
if(translationsError) return;
|
|
65
|
+
if (process.env.PACK_ALL !== "true") {
|
|
66
|
+
const userAnswerTranslations = await prompt.ask(["PackTranslationsChoice"])
|
|
67
|
+
shouldIncludeTranslations = userAnswerTranslations.PackTranslationsChoice
|
|
68
|
+
if (shouldIncludeTranslations && (await hasTranslationErrors())) return
|
|
69
|
+
shouldIncludeSettings = await includeSettings(shouldIncludeSettings)
|
|
70
|
+
} else {
|
|
71
|
+
const translationsError = await hasTranslationErrors()
|
|
72
|
+
if (translationsError) return
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
spawn(
|
|
@@ -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
|
+
})()
|
package/src/tools/zip-theme.js
CHANGED
|
@@ -9,10 +9,10 @@ const config = require(`${currentPath}/config`)
|
|
|
9
9
|
const theme = config.theme || "classic"
|
|
10
10
|
|
|
11
11
|
const dir = `${currentPath}/theme-zips`
|
|
12
|
-
const { COMMAND_PARAM } = require("./toolkit-common-vars")
|
|
12
|
+
const { COMMAND_PARAM } = require("./toolkit-common-vars")
|
|
13
13
|
|
|
14
|
-
const SHOULD_INCLUDE_TRANSLATIONS = COMMAND_PARAM === "true" || false
|
|
15
|
-
const SHOULD_INCLUDE_SETTINGS = process.argv[3] === "true" || false
|
|
14
|
+
const SHOULD_INCLUDE_TRANSLATIONS = COMMAND_PARAM === "true" || false
|
|
15
|
+
const SHOULD_INCLUDE_SETTINGS = process.argv[3] === "true" || false
|
|
16
16
|
|
|
17
17
|
if (!fs.existsSync(dir)) {
|
|
18
18
|
fs.mkdirSync(dir)
|
|
@@ -33,20 +33,27 @@ fileOutput.on("close", () => {
|
|
|
33
33
|
archive.pipe(fileOutput)
|
|
34
34
|
const root = `${currentPath}/themes/${theme}`
|
|
35
35
|
|
|
36
|
-
const specialIgnore = []
|
|
37
|
-
if(!SHOULD_INCLUDE_TRANSLATIONS) {
|
|
36
|
+
const specialIgnore = []
|
|
37
|
+
if (!SHOULD_INCLUDE_TRANSLATIONS) {
|
|
38
38
|
specialIgnore.push("translations/**")
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if(!SHOULD_INCLUDE_SETTINGS) {
|
|
41
|
+
if (!SHOULD_INCLUDE_SETTINGS) {
|
|
42
42
|
specialIgnore.push("settings.json")
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// some glob pattern here
|
|
46
46
|
archive.glob("**", {
|
|
47
47
|
cwd: root,
|
|
48
|
-
ignore: [
|
|
49
|
-
"
|
|
48
|
+
ignore: [
|
|
49
|
+
".*",
|
|
50
|
+
"__*/**",
|
|
51
|
+
"**/node_modules/**",
|
|
52
|
+
"*.Jenkinsfile",
|
|
53
|
+
"package-lock.json",
|
|
54
|
+
"npm-shrinkwrap.json",
|
|
55
|
+
"README.md",
|
|
56
|
+
...specialIgnore
|
|
50
57
|
]
|
|
51
58
|
})
|
|
52
59
|
// add as many as you like
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const path = require("path")
|
|
2
2
|
const webpack = require("webpack")
|
|
3
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
|
3
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
|
4
4
|
|
|
5
5
|
module.exports = (currentPath, config, isAsset) => {
|
|
6
6
|
const assetPath = path.resolve(
|
|
@@ -11,11 +11,14 @@ module.exports = (currentPath, config, isAsset) => {
|
|
|
11
11
|
currentPath,
|
|
12
12
|
`themes/${config.theme}/components/lib`
|
|
13
13
|
)
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
return {
|
|
16
16
|
entry: [
|
|
17
17
|
"webpack-hot-middleware/client?path=/__webpack_hmr&reload=true",
|
|
18
|
-
path.resolve(
|
|
18
|
+
path.resolve(
|
|
19
|
+
currentPath,
|
|
20
|
+
`themes/${config.theme}/customComponents/index.js`
|
|
21
|
+
)
|
|
19
22
|
],
|
|
20
23
|
mode: "development",
|
|
21
24
|
output: {
|
|
@@ -24,8 +27,8 @@ module.exports = (currentPath, config, isAsset) => {
|
|
|
24
27
|
filename: "sfb-components.js",
|
|
25
28
|
path: isAsset ? assetPath : libPath,
|
|
26
29
|
publicPath: `http://localhost:3555/sfb-toolkit-assets/js/components/`,
|
|
27
|
-
hotUpdateChunkFilename:
|
|
28
|
-
hotUpdateMainFilename:
|
|
30
|
+
hotUpdateChunkFilename: "hot/hot-update.js",
|
|
31
|
+
hotUpdateMainFilename: "hot/hot-update.json"
|
|
29
32
|
},
|
|
30
33
|
plugins: [
|
|
31
34
|
new webpack.HotModuleReplacementPlugin(),
|
|
@@ -49,8 +52,16 @@ module.exports = (currentPath, config, isAsset) => {
|
|
|
49
52
|
require.resolve("@babel/plugin-transform-runtime")
|
|
50
53
|
],
|
|
51
54
|
include: [
|
|
52
|
-
path.resolve(
|
|
53
|
-
|
|
55
|
+
path.resolve(
|
|
56
|
+
currentPath,
|
|
57
|
+
`themes/${config.theme}/customComponents`
|
|
58
|
+
),
|
|
59
|
+
path.resolve(
|
|
60
|
+
currentPath,
|
|
61
|
+
`themes/${
|
|
62
|
+
config.theme
|
|
63
|
+
}/node_modules/@appdirect/sfb-theme-components`
|
|
64
|
+
)
|
|
54
65
|
]
|
|
55
66
|
}
|
|
56
67
|
}
|
|
@@ -92,7 +103,16 @@ module.exports = (currentPath, config, isAsset) => {
|
|
|
92
103
|
path.resolve(__dirname, "node_modules"),
|
|
93
104
|
path.resolve(currentPath, `themes/${config.theme}/node_modules`)
|
|
94
105
|
],
|
|
95
|
-
extensions: [
|
|
106
|
+
extensions: [
|
|
107
|
+
".scss",
|
|
108
|
+
".js",
|
|
109
|
+
".jsx",
|
|
110
|
+
".json",
|
|
111
|
+
".png",
|
|
112
|
+
".gif",
|
|
113
|
+
".jpg",
|
|
114
|
+
".svg"
|
|
115
|
+
]
|
|
96
116
|
},
|
|
97
117
|
resolveLoader: {
|
|
98
118
|
modules: [
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
const path = require("path")
|
|
2
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
|
3
|
+
|
|
4
|
+
module.exports = (currentPath, config) => {
|
|
5
|
+
const assetPath = path.resolve(
|
|
6
|
+
currentPath,
|
|
7
|
+
`themes/${config.theme}/assets/js/components`
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
entry: [
|
|
12
|
+
path.resolve(
|
|
13
|
+
currentPath,
|
|
14
|
+
`themes/${config.theme}/customComponents/index.js`
|
|
15
|
+
)
|
|
16
|
+
],
|
|
17
|
+
mode: "production",
|
|
18
|
+
output: {
|
|
19
|
+
library: "__ADComponents",
|
|
20
|
+
libraryTarget: "var",
|
|
21
|
+
filename: "sfb-components.js",
|
|
22
|
+
path: assetPath
|
|
23
|
+
},
|
|
24
|
+
plugins: [
|
|
25
|
+
new MiniCssExtractPlugin({
|
|
26
|
+
filename: "sfb-components.css"
|
|
27
|
+
})
|
|
28
|
+
],
|
|
29
|
+
module: {
|
|
30
|
+
rules: [
|
|
31
|
+
{
|
|
32
|
+
test: /\.(js|jsx)$/,
|
|
33
|
+
use: {
|
|
34
|
+
loader: "babel-loader",
|
|
35
|
+
options: {
|
|
36
|
+
presets: [
|
|
37
|
+
require.resolve("@babel/preset-env"),
|
|
38
|
+
require.resolve("@babel/preset-react")
|
|
39
|
+
],
|
|
40
|
+
plugins: [
|
|
41
|
+
require.resolve("@babel/plugin-proposal-class-properties"),
|
|
42
|
+
require.resolve("@babel/plugin-transform-runtime")
|
|
43
|
+
],
|
|
44
|
+
include: [
|
|
45
|
+
path.resolve(
|
|
46
|
+
currentPath,
|
|
47
|
+
`themes/${config.theme}/customComponents`
|
|
48
|
+
),
|
|
49
|
+
path.resolve(
|
|
50
|
+
currentPath,
|
|
51
|
+
`themes/${
|
|
52
|
+
config.theme
|
|
53
|
+
}/node_modules/@appdirect/sfb-theme-components`
|
|
54
|
+
)
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
test: /\.(sa|sc|c)ss$/,
|
|
61
|
+
use: [
|
|
62
|
+
MiniCssExtractPlugin.loader,
|
|
63
|
+
{ loader: "css-loader" },
|
|
64
|
+
{ loader: "sass-loader" }
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
test: /\.(png|gif|jpg|svg)$/,
|
|
69
|
+
use: {
|
|
70
|
+
loader: "url-loader",
|
|
71
|
+
options: {
|
|
72
|
+
limit: 50000
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
|
|
78
|
+
use: [
|
|
79
|
+
{
|
|
80
|
+
loader: "file-loader",
|
|
81
|
+
options: {
|
|
82
|
+
name: "[name].[ext]",
|
|
83
|
+
outputPath: "fonts/"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
resolve: {
|
|
91
|
+
modules: [
|
|
92
|
+
path.resolve(currentPath, "node_modules"),
|
|
93
|
+
path.resolve(__dirname, "node_modules"),
|
|
94
|
+
path.resolve(currentPath, `themes/${config.theme}/node_modules`)
|
|
95
|
+
],
|
|
96
|
+
extensions: [
|
|
97
|
+
".scss",
|
|
98
|
+
".js",
|
|
99
|
+
".jsx",
|
|
100
|
+
".json",
|
|
101
|
+
".png",
|
|
102
|
+
".gif",
|
|
103
|
+
".jpg",
|
|
104
|
+
".svg"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
resolveLoader: {
|
|
108
|
+
modules: [
|
|
109
|
+
path.resolve(currentPath, "node_modules"),
|
|
110
|
+
path.resolve(__dirname, "node_modules"),
|
|
111
|
+
path.resolve(currentPath, `themes/${config.theme}/node_modules`)
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
package/.node-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8.9.4
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const webpack = require("webpack")
|
|
2
|
-
const fs = require("fs")
|
|
3
|
-
const { TOOLKIT_PATH } = require("./toolkit-common-vars")
|
|
4
|
-
|
|
5
|
-
const getConfigComponentsWebpack = require(`${TOOLKIT_PATH}/webpack-components.config`)
|
|
6
|
-
const currentPath = process.cwd() // used to get current dev folder
|
|
7
|
-
const config = require(`${currentPath}/config`)
|
|
8
|
-
|
|
9
|
-
fs.exists(
|
|
10
|
-
`${currentPath}/themes/${config.theme}/components/index.js`,
|
|
11
|
-
exist => {
|
|
12
|
-
if (exist) {
|
|
13
|
-
const configComponentsWebpackAsset = getConfigComponentsWebpack(
|
|
14
|
-
currentPath,
|
|
15
|
-
config,
|
|
16
|
-
true
|
|
17
|
-
)
|
|
18
|
-
webpack(configComponentsWebpackAsset, (err, stats) => {
|
|
19
|
-
if (err || stats.hasErrors()) {
|
|
20
|
-
console.log(stats.hasErrors())
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
)
|