main
ChrisKader 4 months ago
parent c24b444ef5
commit 41aadc91cb
  1. 5
      index.js
  2. 6
      src/index.ts

@ -6,7 +6,8 @@ import util from 'util';
import fs from 'fs-extra'; import fs from 'fs-extra';
import path from 'path'; import path from 'path';
import { sortPackageJson } from 'sort-package-json'; import { sortPackageJson } from 'sort-package-json';
const exec = util.promisify(require('child_process').exec); import { exec } from 'child_process';
const execute = util.promisify(exec);
const repoUrls = { const repoUrls = {
js: 'https://git.tinkr.site/jeffi/js-tinkrplugin-boilerplate.git', js: 'https://git.tinkr.site/jeffi/js-tinkrplugin-boilerplate.git',
ts: 'https://git.tinkr.site/jeffi/ts-tinkr-plugin-boilerplate.git', ts: 'https://git.tinkr.site/jeffi/ts-tinkr-plugin-boilerplate.git',
@ -55,7 +56,7 @@ prompts([
]).then(async ({ name, version, author, description, lang }) => { ]).then(async ({ name, version, author, description, lang }) => {
const packageName = kebabCase(sanitize(name, { replacement: '-' })); const packageName = kebabCase(sanitize(name, { replacement: '-' }));
console.log(`Creating a Tinkr plugin in ./${packageName}`); console.log(`Creating a Tinkr plugin in ./${packageName}`);
await exec(`git clone ${repoUrls[lang]} ${packageName}`); await execute(`git clone ${repoUrls[lang]} ${packageName}`);
const packageDir = path.join(process.cwd(), packageName); const packageDir = path.join(process.cwd(), packageName);
const packageJsonPath = path.join(packageDir, 'package.json'); const packageJsonPath = path.join(packageDir, 'package.json');
const { bugs, homepage, keywords, license, repository, ...packageJson } = await fs.readJSON(packageJsonPath); const { bugs, homepage, keywords, license, repository, ...packageJson } = await fs.readJSON(packageJsonPath);

@ -6,8 +6,8 @@ import util from 'util';
import fs from 'fs-extra'; import fs from 'fs-extra';
import path from 'path'; import path from 'path';
import { sortPackageJson } from 'sort-package-json'; import { sortPackageJson } from 'sort-package-json';
import { exec } from 'child_process'
const exec = util.promisify(require('child_process').exec); const execute = util.promisify(exec);
const repoUrls = { const repoUrls = {
js: 'https://git.tinkr.site/jeffi/js-tinkrplugin-boilerplate.git', js: 'https://git.tinkr.site/jeffi/js-tinkrplugin-boilerplate.git',
@ -62,7 +62,7 @@ prompts([
console.log(`Creating a Tinkr plugin in ./${packageName}`) console.log(`Creating a Tinkr plugin in ./${packageName}`)
await exec(`git clone ${repoUrls[lang]} ${packageName}`) await execute(`git clone ${repoUrls[lang]} ${packageName}`)
const packageDir = path.join(process.cwd(), packageName) const packageDir = path.join(process.cwd(), packageName)
const packageJsonPath = path.join(packageDir, 'package.json') const packageJsonPath = path.join(packageDir, 'package.json')

Loading…
Cancel
Save