Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
Fix various errors (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
andygup committed Mar 23, 2022
1 parent ae54187 commit 8d3abfb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/commands/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Argv } from 'yargs';
// yargs exports
export const command = 'styles <subcommand>';
export const describe = 'Run subcommands to work with a custom CSS theme';
export const builder = (yargs: Argv) => {
export const builder = (yargs: Argv): unknown => {
/* eslint-disable @typescript-eslint/no-var-requires */
return yargs
.command(require('./styles/create'))
Expand All @@ -18,4 +18,4 @@ export const builder = (yargs: Argv) => {
export const handler = noop;

// internals
function noop() {}
function noop(): void {}
2 changes: 1 addition & 1 deletion src/commands/styles/scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function scaffold(workspacePath: string, force = false): Promise<vo

debug(`copying preview file`);

await cpy('preview/', buildPath(`${workspacePath}/<preview>`, dirs), {
await cpy('preview', buildPath(`${workspacePath}/<preview>`, dirs), {
cwd: buildPath(`<dirname>/../../`, dirs),
});

Expand Down
2 changes: 0 additions & 2 deletions src/lib/cleanDirectories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ const cleanDirectories = async (target: string, dest: string, tests: string, typ
rimraf(`${target}/tests/unit/widgets/WidgetName/`, async () => {
await del([`${target}/src/widgets/WidgetName.tsx`]);
rimraf(`${target}/src/widgets/WidgetName/`, async () => {
await copy(`${target}/src/`, dest + '/');
await copy(`${target}/tests/`, tests + '/');
rimraf(`${target}/**`, resolve);
});
});
Expand Down
12 changes: 6 additions & 6 deletions src/lib/createWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

import path from 'path';
import fs from 'fs';
import fse from 'fs-extra';
import cpy from 'cpy';
import chalk from 'chalk';
import pkgDir from 'pkg-dir';
import camelCase from 'lodash.camelcase';
import startCase from 'lodash.startcase';

import { compose, map, replace, toLower } from 'ramda';
import { compose, replace } from 'ramda';

import cleanDirectories from './cleanDirectories';
import copyUpdateFiles from './copyUpdateFiles';
Expand All @@ -37,7 +37,7 @@ const createWidget = async ({ argv }: any) => {
try {
const data: any = await fs.promises.readFile(path.resolve(process.cwd(), 'package.json'));
pkg = JSON.parse(data);
console.log(pkg);

if (!pkg || (pkg && pkg.arcgis.type !== 'jsapi' && pkg.arcgis.type !== 'exb')) {
console.info(
chalk.red.bold(
Expand All @@ -63,13 +63,13 @@ const createWidget = async ({ argv }: any) => {

try {
const rootDir = await pkgDir(__dirname);
await fse.copy(`${rootDir}/${directory}`, target, {
filter: (s) => !s.includes('DS_Store'),
await cpy(`${rootDir}/${directory}`, target, {
filter: (s) => !s.path.includes('DS_Store'),
});
await copyUpdateFiles(readDirR(target), name);
await cleanDirectories(target, dest, tests, argv.type);
} catch (error) {
console.info(chalk.red.bold(`Widget creation failed: ${error.message}\n`));
console.error(chalk.red.bold(`Widget creation failed: ${error.message}\n`));
return Promise.reject(new Error(`Widget creation failed: ${error.message}`));
}
};
Expand Down

0 comments on commit 8d3abfb

Please sign in to comment.