Giter VIP home page Giter VIP logo

clone-rename's Introduction

clone-rename-refactor

======================= Little commandline script to clone a directory and rename all files and folders with a certain pattern as well as all variable names in it.

Example

npm i clone-rename-refactor
clone-rename ./some-folder some-old-name cool-new-feature 

Gives the following output:

_______________CLONE_RENAME_______________
In dir:    ./some-folder
Input      some-old-name => cool-new-feature
-------------------------------------------
replaces inside file names   some-old-name => cool-new-feature
replaces inside file contents  SomeOldName => CoolNewFeature
replaces inside file contents  someOldName => coolNewFeature
replaces inside file contents  SOME_OLD_NAME => COOL_NEW_FEATURE
replaces inside file contents  some-old-name => cool-new-feature
__________________________________________

Module duplication and renaming example

The module was build with the following case (or similar in mind).

Files:

/some-named-module
  /some-named-module-sub-component
    some-named-module-sub-component.component.ts
    some-named-module-sub-component.component.html
  some-named-module.ts
...(and so on)

==> Which becomes:

/another-title-module
  /another-title-module-sub-component
    another-title-module-sub-component.component.ts
    another-title-module-sub-component.component.html
  another-title-module.ts
...(and so on)

File contents:

@Component({
  selector: 'dialog-some-named-initial-setup',
  templateUrl: './dialog-some-named-initial-setup.component.html',
  styleUrls: ['./dialog-some-named-initial-setup.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DialogSomeNamedInitialSetupComponent {
  someNamedCfg: SomeNamedCfg = DEFAULT_SOME_NAMED_CFG;
  formConfig = SOME_CONFIG_FORM;

  constructor(
    private _matDialogRef: MatDialogRef<DialogSomeNamedInitialSetupComponent>,
  ) {
  }

  saveSomeNamedCfg(someNamedCfg: SomeNamedCfg): void {
    this._matDialogRef.close(someNamedCfg);
  }
}

==> Which becomes:

@Component({
  selector: 'dialog-another-title-initial-setup',
  templateUrl: './dialog-another-title-initial-setup.component.html',
  styleUrls: ['./dialog-another-title-initial-setup.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DialogAnotherTitleInitialSetupComponent {
  anotherTitleCfg: AnotherTitleCfg = DEFAULT_ANOTHER_TITLE_CFG;
  formConfig = SOME_CONFIG_FORM;

  constructor(
    private _matDialogRef: MatDialogRef<DialogAnotherTitleInitialSetupComponent>,
  ) {
  }

  saveAnotherTitleCfg(anotherTitleCfg: AnotherTitleCfg): void {
    this._matDialogRef.close(anotherTitleCfg);
  }
}

clone-rename's People

Contributors

johannesjo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.