- Push repo to npm registry.

- Remove unnecessary log prints.
- Download and create all required files.
- Generate technical repo files.
#Create Block from registry.
This commit is contained in:
2022-10-05 00:00:26 +03:00
parent e184c3483a
commit 2a5daa2445
6 changed files with 60 additions and 27 deletions
+10 -10
View File
@@ -11,7 +11,8 @@ const __dirname = path.dirname(__filename);
const baseDir = path.join(__dirname, '../../');
export const defaultGitRepo = 'git+https://roman-axe-web@bitbucket.org/axeweb/create-block-dev-tool.git#master';
// export const defaultGitRepo = 'git+https://roman-axe-web@bitbucket.org/axeweb/create-block-dev-tool.git#master';
export const defaultGitRepo = '@axe-web/create-block@1.0.8';
export default class extends Generator {
async prompting() {
@@ -128,25 +129,24 @@ export default class extends Generator {
);
// Technical Project files.
createTechnicalFiles(data, baseDir).then();
createTechnicalFiles(data, baseDir, `blocks/${data.name}`).then();
}
}
export async function createTechnicalFiles(data, baseDir) {
const pathDist = path.join(baseDir, `blocks/${data.name}`);
export async function createTechnicalFiles(data, baseDir, distPath) {
const pathDist = distPath; //path.join(baseDir, distPath);
const generatorsPath = path.join(baseDir, 'generators/block/templates');
const store = memFs.create();
const filesystem = editor.create(store);
const files = ['package.json', 'README.md', '.editorconfig', '.gitignore', 'block.json'];
const files = ['package.json', 'README.md', '.editorconfig', {from: 'gitignore', to: '.gitignore'}, 'block.json'];
for (let file of files) {
await filesystem.copyTplAsync(
`${generatorsPath}/${file}`,
`${pathDist}/${file}`,
data
);
const from = typeof file !== 'string' ? `${generatorsPath}/${file.from}` : `${generatorsPath}/${file}`;
const to = typeof file !== 'string' ? `${pathDist}/${file.to}` : `${pathDist}/${file}`;
await filesystem.copyTplAsync(from, to, data);
}
return filesystem.commit(); // Promise
+7
View File
@@ -0,0 +1,7 @@
# Basic
.idea
.DS_Store
node_modules
vendor
# Custom