Skip to content

Commit 9f1a08d

Browse files
committed
Merge branch 'release/1.11.0'
2 parents dc447fe + 49abb9c commit 9f1a08d

File tree

9 files changed

+1359
-818
lines changed

9 files changed

+1359
-818
lines changed

‎.eslintrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ rules:
1818
- 2
1919
- 2
2020
-
21+
SwitchCase: 1
2122
VariableDeclarator:
2223
var: 2
2324
let: 2

‎README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ Please use `yarn [taskName]` or `npm run [taskName]` to avoid necessity of insta
7171
* `--theme name` - Process single theme.
7272
* `--ci` - Enable throwing errors. Useful in CI/CD pipelines.
7373
* `inheritance` - Create necessary symlinks to resolve theme styles inheritance and make the base for styles processing. You have to run in before styles compilation and after adding new files.
74+
* `magepackBundle` - Run [magepack](https://github.com/magesuite/magepack) `bundle` command.
75+
* `-c` or `--config` - (required) Path to previously generated Magepack config file.
76+
* `--theme name` - Process single theme.
77+
* `magepackGenerate` - Run [magepack](https://github.com/magesuite/magepack) `generate` command.
78+
* `--cms-url` - (required) URL to one of CMS pages (e.g. homepage).
79+
* `--category-url` - (required) URL to one of category pages.
80+
* `--product-url` - (required) URL to one of product pages.
81+
* `-u` or `--auth-username` - Username for Basic Auth.
82+
* `-p` or `--auth-password` - Passoword for Basic Auth.
83+
* `-d` or `--debug` - Turn on debugging mode.
7484
* `sasslint` - Run [sass-lint](https://github.com/sasstools/sass-lint) based tests.
7585
* `--theme name` - Process single theme.
7686
* `--ci` - Enable throwing errors. Useful in CI/CD pipelines.

‎gulpfile.esm.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { setup as setupTask } from './tasks/setup'
1414
import { styles as stylesTask } from './tasks/styles'
1515
import { svg as svgTask } from './tasks/svg'
1616
import { watch as watchTask } from './tasks/watch'
17+
import magepackBundleTask from './tasks/magepack-bundle'
18+
import magepackGenerateTask from './tasks/magepack-generate'
1719

1820
export const babel = series(inheritanceTask, babelTask)
1921
export const clean = cleanTask
@@ -27,5 +29,7 @@ export const setup = setupTask
2729
export const styles = series(inheritanceTask, stylesTask)
2830
export const svg = series(inheritanceTask, svgTask)
2931
export const watch = watchTask
32+
export const magepackBundle = magepackBundleTask
33+
export const magepackGenerate = magepackGenerateTask
3034

3135
export { default as default } from './tasks/default'

‎helpers/config-loader.js‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,30 @@ import yaml from 'js-yaml'
66
import errorMessage from './error-message'
77
import { projectPath } from './config'
88

9+
function getContent(filePath) {
10+
if (filePath.endsWith('.yml')) {
11+
return yaml.safeLoad(fs.readFileSync(filePath))
12+
}
13+
14+
if (filePath.endsWith('.json')) {
15+
return JSON.parse(fs.readFileSync(filePath))
16+
}
17+
18+
if (filePath.endsWith('.js')) {
19+
return require(filePath)
20+
}
21+
}
22+
923
export default (file, failOnError = true) => {
1024
const externalPath = path.join(projectPath, 'dev/tools/frontools/config/', file)
1125

1226
// Check if file exists inside the config directory
1327
if (globby.sync(externalPath).length) {
14-
if (file.includes('yml')) {
15-
return yaml.safeLoad(fs.readFileSync(externalPath))
16-
}
17-
else {
18-
return JSON.parse(fs.readFileSync(externalPath))
19-
}
28+
return getContent(externalPath)
2029
}
2130

2231
if (globby.sync('config/' + file).length) {
23-
if (file.includes('yml')) {
24-
return yaml.safeLoad(fs.readFileSync('config/' + file))
25-
}
26-
else {
27-
return JSON.parse(fs.readFileSync('config/' + file))
28-
}
32+
return getContent('config/' + file)
2933
}
3034

3135
if (failOnError) {

‎package-lock.json‎

Lines changed: 640 additions & 431 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "magento2-frontools",
3-
"version": "1.10.0",
3+
"version": "1.11.0",
44
"author": {
55
"name": "Bartek Igielski",
66
"email": "igloczek@gmail.com"
@@ -12,12 +12,12 @@
1212
},
1313
"license": "MIT",
1414
"dependencies": {
15-
"@babel/core": "^7.11.6",
16-
"@babel/preset-env": "^7.11.5",
15+
"@babel/core": "^7.12.3",
16+
"@babel/preset-env": "^7.12.1",
1717
"ansi-colors": "^4.1.1",
1818
"autoprefixer": "^9.7.3",
19-
"browser-sync": "^2.26.12",
20-
"chokidar": "^3.4.2",
19+
"browser-sync": "^2.26.13",
20+
"chokidar": "^3.4.3",
2121
"cssnano": "^4.1.10",
2222
"esm": "^3.2.25",
2323
"fancy-log": "^1.3.3",
@@ -42,14 +42,15 @@
4242
"gulp-svg-sprite": "^1.5.0",
4343
"gulp-uglify": "^3.0.2",
4444
"js-yaml": "^3.14.0",
45-
"marked": "^1.1.1",
45+
"magepack": "^2.4.0",
46+
"marked": "^1.2.2",
4647
"marked-terminal": "^4.1.0",
4748
"merge-stream": "^2.0.0",
4849
"minimist": "^1.2.5",
4950
"node-sass": "^5.0.0",
5051
"postcss-reporter": "^6.0.1",
5152
"run-sequence": "^2.2.1",
52-
"sass": "^1.27.0",
53+
"sass": "^1.28.0",
5354
"stylelint": "^11.1.1",
5455
"stylelint-config-standard": "^19.0.0"
5556
},
@@ -66,6 +67,8 @@
6667
"emailfix": "gulp emailfix",
6768
"eslint": "gulp eslint",
6869
"inheritance": "gulp inheritance",
70+
"magepackBundle": "gulp magepackBundle",
71+
"magepackGenerate": "gulp magepackGenerate",
6972
"sasslint": "gulp sasslint",
7073
"setup": "gulp setup",
7174
"styles": "gulp styles",

‎tasks/magepack-bundle.js‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import bundle from 'magepack/lib/bundle'
2+
3+
import getThemes from '../helpers/get-themes'
4+
import { env, projectPath, themes } from '../helpers/config'
5+
6+
function getThemesGlobPattern() {
7+
const themesNames = getThemes()
8+
9+
if (themesNames.length === 1) {
10+
return `${projectPath}${themes[themesNames[0]].dest}/*`
11+
}
12+
13+
return `${projectPath}{${themesNames.map(name => themes[name].dest).join(',')}}/*`
14+
}
15+
16+
export default async function() {
17+
const configPath = env.c || env.config
18+
const themesGlobPattern = getThemesGlobPattern()
19+
await bundle(configPath, themesGlobPattern)
20+
}

‎tasks/magepack-generate.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import generate from 'magepack/lib/generate'
2+
3+
import { env } from '../helpers/config'
4+
5+
export default async function() {
6+
const config = {
7+
cmsUrl: env['cms-url'],
8+
categoryUrl: env['category-url'],
9+
productUrl: env['product-url'],
10+
authUsername: env.u || env['auth-username'],
11+
authPassword: env.p || env['auth-password'],
12+
debug: env.d || env.debug || false
13+
}
14+
15+
await generate(config)
16+
}

0 commit comments

Comments
 (0)