Skip to content

Commit

Permalink
copy files wip
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime-urbanski committed Jun 5, 2024
1 parent e57f0c5 commit 2298678
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 deletions.
54 changes: 32 additions & 22 deletions src/generators/AngularGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,43 +86,53 @@ export default class extends BaseGenerator {
[
`${dir}/assets`,
`${dir}/utils`,
`${dir}/app/components/${lc}`,
`${dir}/app/components/common`,
`${dir}/app/components/svg`,
`${dir}/app/components/${lc}/create`,
`${dir}/app/components/${lc}/edit`,
`${dir}/app/components/${lc}/list`,
`${dir}/app/components/${lc}/show`,
`${dir}/app/components/common/delete`,
`${dir}/app/components/common/form`,
`${dir}/app/components/common/header`,
`${dir}/app/components/common/sidebar`,
`${dir}/app/components/common/table`,
`${dir}/app/components/svg/list-svg`,
`${dir}/app/components/svg/menu`,
`${dir}/app/interface`,
`${dir}/app/router`,
`${dir}/app/service`,
].forEach((dir) => this.createDir(dir, false));

//CREATE FILE
[
`${dir}/app/components/svg/list-svg/list-svg.component.svg`,
`${dir}/app/components/svg/list-svg/list-svg.component.ts`,
`${dir}/app/components/svg/menu/menu.component.svg`,
`${dir}/app/components/svg/menu/menu.component.ts`,
`${dir}/app/components/common/delete/delete.component.html`,
`${dir}/app/components/common/delete/delete.component.ts`,
`${dir}/app/components/common/form/form.component.html`,
`${dir}/app/components/common/form/form.component.ts`,
`${dir}/app/components/common/header/header.component.html`,
`${dir}/app/components/common/header/header.component.ts`,
`${dir}/app/components/common/sidebar/sidebar.component.html`,
`${dir}/app/components/common/sidebar/sidebar.component.ts`,
`${dir}/app/components/common/table/table.component.html`,
`${dir}/app/app.component.html`,
`${dir}/app/app.component.ts`,
`${dir}/app/app.routes.ts`,
].forEach((file) => this.createFile(file, file, context, false));
"app/components/svg/list-svg/list-svg.component.svg",
"app/components/svg/list-svg/list-svg.component.ts",
"app/components/svg/menu/menu.component.svg",
"app/components/svg/menu/menu.component.ts",
"app/components/common/delete/delete.component.html",
"app/components/common/delete/delete.component.ts",
"app/components/common/form/form.component.html",
"app/components/common/form/form.component.ts",
"app/components/common/header/header.component.html",
"app/components/common/header/header.component.ts",
"app/components/common/sidebar/sidebar.component.html",
"app/components/common/sidebar/sidebar.component.ts",

"app/app.component.html",
"app/app.component.ts",
"app/app.routes.ts",
].forEach((file) =>
this.createFile(file, `${dir}/${file}`, context, false)
);

[
`app/components/%s/create/create.component.html",
"app/components/%s/create/create.component.html",
"app/components/%s/create/create.component.ts",
"app/components/%s/edit/edit.component.html",
"app/components/%s/edit/edit.component.ts",
"app/components/%s/list/list.component.html",
"app/components/%s/list/list.component.ts",
"app/components/%s/show/show.component.html",
"app/components/%s/show/show.component.ts",`,
"app/components/%s/show/show.component.ts",
].forEach((file) => this.createFileFromPattern(file, dir, [lc], context));
}

Expand Down
4 changes: 3 additions & 1 deletion src/generators/BaseGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export default class {
context,
templateValues = ["foo", "Foo"]
) {
console.log(dir);
this.createFile(
vsprintf(pattern, templateValues),
vsprintf(`${dir}/${pattern}`, values),
Expand All @@ -53,6 +52,9 @@ export default class {
}

createFile(template, dest, context = {}, warn = true) {
console.table(this.templates);
console.log("template ==>", template);
console.log("dest ==>", dest);
if (undefined === this.templates[template]) {
console.log(
`The template ${template} does not exists in the registered templates.`
Expand Down

0 comments on commit 2298678

Please sign in to comment.