Update the generator template.

Add remToPx parameter + design folder.
This commit is contained in:
2022-05-02 18:55:55 +03:00
parent 718e6b32a9
commit 0ea8f8b443
4 changed files with 42 additions and 171 deletions
+9 -21
View File
@@ -1,6 +1,6 @@
const path = require('path');
const Generator = require('yeoman-generator');
// const exec = require('child_process').exec;
const mkdirp = require('mkdirp');
const baseDir = path.join(__dirname, '../../');
@@ -21,11 +21,6 @@ module.exports = class extends Generator {
return !!str;
}
},
// {
// type: "input",
// name: "name",
// message: "Project ID"
// },
{
type: "list",
name: "baseView",
@@ -33,12 +28,12 @@ module.exports = class extends Generator {
default: 'container',
choices: ['container', 'alignfull'],
},
// {
// type: "confirm",
// name: "include_script",
// default: false,
// message: "Include script.js File?"
// },
{
type: "number",
name: "remToPx",
message: "Provide declaration of 1rem:",
default: 16
},
]);
}
@@ -76,6 +71,8 @@ module.exports = class extends Generator {
data
);
mkdirp.sync(path.join(pathDist, 'design'));
this.fs.copyTpl(
this.templatePath('config/default.cjs'),
this.destinationPath(path.join(pathDist, 'config', 'default.cjs')),
@@ -117,15 +114,6 @@ module.exports = class extends Generator {
this.destinationPath(path.join(pathDist, '.gitignore')),
data
);
// Run BUILD script
// var cmd = exec("npm run build", function (err, stdout, stderr) {
// if (err) {
// console.log('Issue with running - "npm run build"\n\n', err);
// }
// });
// console.log(`\n\nDon't forget to connect the Component in your functions.php file ;)\n\n`);
}
};
@@ -2,4 +2,5 @@ module.exports = {
cssUrl: "https://",
blockName: "<%= blockFilename %>",
baseView: "<%= baseView %>",
remToPx: <%= remToPx %>,
}