diff --git a/package.json b/package.json index c220701..7738ae5 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "git-copycat", + "name": "copykitku", "version": "1.0.0", "main": "index.js", "author": "selfisekai ", @@ -18,7 +18,7 @@ "lint:prettier:fix": "yarn prettier --check --write src" }, "bin": { - "copycat": "./bin/run" + "copykitku": "./bin/run" }, "files": [ "/bin", @@ -27,7 +27,7 @@ ], "oclif": { "commands": "./src/cli", - "bin": "copycat", + "bin": "copykitku", "plugins": [ "@oclif/plugin-help" ] diff --git a/src/cli/account.ts b/src/cli/account.ts index 259a561..346a6ab 100644 --- a/src/cli/account.ts +++ b/src/cli/account.ts @@ -3,16 +3,16 @@ import assert from 'assert'; import child from 'child_process'; import inquirer from 'inquirer'; import { - CopycatProfile, - CopycatProfileBase, + CopykitkuProfile, + CopykitkuProfileBase, Vendor, VENDOR_TYPE, - CopycatVendorConfig, + CopykitkuVendorConfig, } from '../types'; import { getConfig, getConfigPath, setConfig } from '../utils'; export default class Account extends Command { - static description = 'manage accounts used by copycat'; + static description = 'manage accounts used by copykitku'; static flags = { help: flags.help({ char: 'h' }), @@ -33,7 +33,7 @@ export default class Account extends Command { static strict = true; - protected getPrintableAccountInfo(account: CopycatProfile) { + protected getPrintableAccountInfo(account: CopykitkuProfile) { return ` Name:\t${account.name} Vendor:\t${account.vendor.type} @@ -156,7 +156,7 @@ export default class Account extends Command { token: answers.token, }, name: answers.name, - } as CopycatProfile); + } as CopykitkuProfile); setConfig(config); break; diff --git a/src/cli/replicate.ts b/src/cli/replicate.ts index 3d16379..f3ce94e 100644 --- a/src/cli/replicate.ts +++ b/src/cli/replicate.ts @@ -1,6 +1,6 @@ import { Command, flags } from '@oclif/command'; import assert from 'assert'; -import Copycat from '../copycat'; +import Copykitku from '../copykitku'; import { ENTITY_TYPE } from '../types'; import { parsePath } from '../utils'; @@ -24,7 +24,7 @@ export default class Replicate extends Command { assert(sourcePath.entity === ENTITY_TYPE.ISSUE, 'Only issues are supported now'); - const cc = new Copycat(); + const cc = new Copykitku(); await cc.initialize(); const sourceVendor = cc.vendorManagers.find((v) => v.vendor.domain === sourcePath.domain); assert(sourceVendor, 'Source vendor not found in config'); @@ -33,7 +33,7 @@ export default class Replicate extends Command { const sourceRepo = await sourceVendor.getRepo(sourcePath.path); const destRepo = await destVendor.getRepo(destPath.path); const sourceEntity = await sourceRepo.getIssue(sourcePath.entityID); - sourceEntity.content += `\n\nReplicated from ${sourceEntity.url} with Copycat`; + sourceEntity.content += `\n\nReplicated from ${sourceEntity.url} with [Copykitku](https://git.sakamoto.pl/laudompat/copykitku)`; const replicatedEntity = await destRepo.replicateIssue(sourceEntity); console.log(`Replicated successfully: ${replicatedEntity.url}`); } diff --git a/src/copycat.ts b/src/copykitku.ts similarity index 75% rename from src/copycat.ts rename to src/copykitku.ts index 8d61f7f..90128e1 100644 --- a/src/copycat.ts +++ b/src/copykitku.ts @@ -1,5 +1,5 @@ /* - * Copycat. Copyright (C) 2020 selfisekai and other contributors. + * Copykitku. Copyright (C) 2020 selfisekai and other contributors. * * This is free software, and you are welcome to redistribute it * under the GNU General Public License 3.0 or later; see the LICENSE file for details, @@ -7,12 +7,12 @@ */ import path from 'path'; -import { VendorManager, CopycatConfig, CopycatProfile } from './types'; +import { VendorManager, CopykitkuConfig, CopykitkuProfile } from './types'; import { getConfig, DEFAULT_CONFIG } from './utils'; -export default class Copycat { +export default class Copykitku { vendorManagers: VendorManager[] = []; - config: CopycatConfig = DEFAULT_CONFIG; + config: CopykitkuConfig = DEFAULT_CONFIG; public async initialize() { this.config = getConfig(); @@ -23,7 +23,7 @@ export default class Copycat { [ require(path.join(__dirname, 'vendor', profile.vendor.type, 'vendormgr')).default, profile, - ] as [any, CopycatProfile], + ] as [any, CopykitkuProfile], ) .map(([VendorMgr, vendor]) => new VendorMgr(vendor.config) as VendorManager) .map((VendorMgr) => VendorMgr.initialize()), diff --git a/src/types.ts b/src/types.ts index 819d2ba..1d50689 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,5 @@ /* - * Copycat. Copyright (C) 2020 selfisekai and other contributors. + * Copykitku. Copyright (C) 2020 selfisekai and other contributors. * * This is free software, and you are welcome to redistribute it * under the GNU General Public License 3.0 or later; see the LICENSE file for details, @@ -9,30 +9,30 @@ import { GitHubConfig } from './vendor/github/vendormgr'; import { GitLabConfig } from './vendor/gitlab/vendormgr'; -export interface CopycatConfig { - vendorConfigs: CopycatProfile[]; +export interface CopykitkuConfig { + vendorConfigs: CopykitkuProfile[]; } -export interface CopycatProfileBase { +export interface CopykitkuProfileBase { name: string; vendor: Vendor; /** authentication etc., always depends on vendor */ - config: CopycatVendorConfig; + config: CopykitkuVendorConfig; } -export type CopycatVendorConfig = GitHubConfig | GitLabConfig; +export type CopykitkuVendorConfig = GitHubConfig | GitLabConfig; -export interface CopycatProfileGitHub extends CopycatProfileBase { +export interface CopykitkuProfileGitHub extends CopykitkuProfileBase { vendor: Vendor; config: GitHubConfig; } -export interface CopycatProfileGitLab extends CopycatProfileBase { +export interface CopykitkuProfileGitLab extends CopykitkuProfileBase { vendor: Vendor; config: GitLabConfig; } -export type CopycatProfile = CopycatProfileGitHub | CopycatProfileGitLab; +export type CopykitkuProfile = CopykitkuProfileGitHub | CopykitkuProfileGitLab; /** indicates the used api */ export enum VENDOR_TYPE { diff --git a/src/utils.ts b/src/utils.ts index fb3cfa4..7c7bdc0 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ /* - * Copycat. Copyright (C) 2020 selfisekai and other contributors. + * Copykitku. Copyright (C) 2020 selfisekai and other contributors. * * This is free software, and you are welcome to redistribute it * under the GNU General Public License 3.0 or later; see the LICENSE file for details, @@ -9,18 +9,18 @@ import { readFileSync, writeFileSync } from 'fs-extra'; import toml from '@iarna/toml'; import appdataPath from 'appdata-path'; -import { CopycatConfig, ENTITY_TYPE } from './types'; +import { CopykitkuConfig, ENTITY_TYPE } from './types'; -export const DEFAULT_CONFIG: CopycatConfig = { +export const DEFAULT_CONFIG: CopykitkuConfig = { vendorConfigs: [], }; -export const getConfigPath = () => appdataPath('copycat'); +export const getConfigPath = () => appdataPath('copykitku.toml'); export const getConfig = () => { try { const file = readFileSync(getConfigPath()); - return (toml.parse(file.toString('utf-8')) as unknown) as CopycatConfig; + return (toml.parse(file.toString('utf-8')) as unknown) as CopykitkuConfig; } catch (err) { if (err.code === 'ENOENT') { setConfig(DEFAULT_CONFIG); @@ -29,7 +29,7 @@ export const getConfig = () => { } }; -export const setConfig = (config: CopycatConfig) => +export const setConfig = (config: CopykitkuConfig) => writeFileSync(getConfigPath(), toml.stringify({ ...DEFAULT_CONFIG, ...config } as any), { encoding: 'utf-8', }); diff --git a/src/vendor/github/repomgr.ts b/src/vendor/github/repomgr.ts index 73547c6..595f515 100644 --- a/src/vendor/github/repomgr.ts +++ b/src/vendor/github/repomgr.ts @@ -1,5 +1,5 @@ /* - * Copycat. Copyright (C) 2020 selfisekai and other contributors. + * Copykitku. Copyright (C) 2020 selfisekai and other contributors. * * This is free software, and you are welcome to redistribute it * under the GNU General Public License 3.0 or later; see the LICENSE file for details, diff --git a/src/vendor/github/vendormgr.ts b/src/vendor/github/vendormgr.ts index 8a46c5d..1877991 100644 --- a/src/vendor/github/vendormgr.ts +++ b/src/vendor/github/vendormgr.ts @@ -1,5 +1,5 @@ /* - * Copycat. Copyright (C) 2020 selfisekai and other contributors. + * Copykitku. Copyright (C) 2020 selfisekai and other contributors. * * This is free software, and you are welcome to redistribute it * under the GNU General Public License 3.0 or later; see the LICENSE file for details, diff --git a/src/vendor/gitlab/repomgr.ts b/src/vendor/gitlab/repomgr.ts index a278ebf..19922c9 100644 --- a/src/vendor/gitlab/repomgr.ts +++ b/src/vendor/gitlab/repomgr.ts @@ -1,5 +1,5 @@ /* - * Copycat. Copyright (C) 2020 selfisekai and other contributors. + * Copykitku. Copyright (C) 2020 selfisekai and other contributors. * * This is free software, and you are welcome to redistribute it * under the GNU General Public License 3.0 or later; see the LICENSE file for details, diff --git a/src/vendor/gitlab/vendormgr.ts b/src/vendor/gitlab/vendormgr.ts index 4d0599b..9c4d1e0 100644 --- a/src/vendor/gitlab/vendormgr.ts +++ b/src/vendor/gitlab/vendormgr.ts @@ -1,5 +1,5 @@ /* - * Copycat. Copyright (C) 2020 selfisekai and other contributors. + * Copykitku. Copyright (C) 2020 selfisekai and other contributors. * * This is free software, and you are welcome to redistribute it * under the GNU General Public License 3.0 or later; see the LICENSE file for details,