DEV Community

ILshat Khamitov
ILshat Khamitov

Posted on

Two updates to the rucken copy-paste utility

1) Add support correct generate new files path names

Original files
admin.ts

export class Admin {
  id: string;
}
Enter fullscreen mode Exit fullscreen mode

admin-repository.ts

import { Admin } from './admin';

export class AdminRepository {
  admins: Admin[];
  createOneAdmin() {
    //null
  }
  updateOneAdmin() {
    //null
  }
  deleteOneAdmin() {
    //null
  }
  findManyAdmins() {
    //null
  }
}
Enter fullscreen mode Exit fullscreen mode

Command

npx -y rucken copy-paste --find=admin --replace=my-company --path=./libs/feature
Enter fullscreen mode Exit fullscreen mode

New files:
my-company.ts

export class MyCompany {
  id: string;
}
Enter fullscreen mode Exit fullscreen mode

my-company-repository.ts

import { MyCompany } from './my-company';

export class MyCompanyRepository {
  myCompanies: MyCompany[];
  createOneMyCompany() {
    //null
  }
  updateOneMyCompany() {
    //null
  }
  deleteOneMyCompany() {
    //null
  }
  findManyMyCompanies() {
    //null
  }
}
Enter fullscreen mode Exit fullscreen mode

2) Add support correct replace long text with two or more words, when word for find include in replace options

Original files
new.ts

export class New {
  id: string;
}
Enter fullscreen mode Exit fullscreen mode

new-repository.ts

import { New } from './new';

export class NewRepository {
  news: New[];
  createOneNew() {
    //null
  }
  updateOneNew() {
    //null
  }
  deleteOneNew() {
    //null
  }
  findManyNews() {
    //null
  }
}
Enter fullscreen mode Exit fullscreen mode

Command

npx -y rucken copy-paste --find=new --replace=new-user --path=./libs/feature
Enter fullscreen mode Exit fullscreen mode

New files:
new-user.ts

export class NewUser {
  id: string;
}
Enter fullscreen mode Exit fullscreen mode

new-user-repository.ts

import { NewUser } from './new-user';

export class NewUserRepository {
  newUsers: NewUser[];
  createOneNewUser() {
    //null
  }
  updateOneNewUser() {
    //null
  }
  deleteOneNewUser() {
    //null
  }
  findManyNewUsers() {
    //null
  }
}
Enter fullscreen mode Exit fullscreen mode

https://www.npmjs.com/package/rucken

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay