refactor: remove .js extension from cli package (#350)
* refactor: remove `.js` extension from cli package * revert: rollback changes * revert: rollback unnecessary changes * Update createIntegration.ts --------- Co-authored-by: Eric Allam <eallam@icloud.com>
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { Command } from "commander";
|
||||
import inquirer from "inquirer";
|
||||
import pathModule from "node:path";
|
||||
import { createIntegrationCommand } from "../commands/createIntegration.js";
|
||||
import { devCommand } from "../commands/dev.js";
|
||||
import { initCommand } from "../commands/init.js";
|
||||
import { CLOUD_TRIGGER_URL, COMMAND_NAME } from "../consts.js";
|
||||
import { telemetryClient } from "../telemetry/telemetry.js";
|
||||
import { getVersion } from "../utils/getVersion.js";
|
||||
import { createIntegrationCommand } from "../commands/createIntegration";
|
||||
import { devCommand } from "../commands/dev";
|
||||
import { initCommand } from "../commands/init";
|
||||
import { CLOUD_TRIGGER_URL, COMMAND_NAME } from "../consts";
|
||||
import { telemetryClient } from "../telemetry/telemetry";
|
||||
import { getVersion } from "../utils/getVersion";
|
||||
|
||||
export const program = new Command();
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@ import inquirer from "inquirer";
|
||||
import pathModule from "node:path";
|
||||
import ora from "ora";
|
||||
import { z } from "zod";
|
||||
import { COMMAND_NAME } from "../consts.js";
|
||||
import { getLatestPackageVersion } from "../utils/addDependencies.js";
|
||||
import { createFile, pathExists, readJSONFile, writeJSONFile } from "../utils/fileSystem.js";
|
||||
import { generateIntegrationFiles } from "../utils/generateIntegrationFiles.js";
|
||||
import { getPackageName } from "../utils/getPackagName.js";
|
||||
import { installDependencies } from "../utils/installDependencies.js";
|
||||
import { logger } from "../utils/logger.js";
|
||||
import { resolvePath } from "../utils/parseNameAndPath.js";
|
||||
import { COMMAND_NAME } from "../consts";
|
||||
import { getLatestPackageVersion } from "../utils/addDependencies";
|
||||
import { createFile, pathExists, readJSONFile, writeJSONFile } from "../utils/fileSystem";
|
||||
import { generateIntegrationFiles } from "../utils/generateIntegrationFiles";
|
||||
import { getPackageName } from "../utils/getPackagName";
|
||||
import { installDependencies } from "../utils/installDependencies";
|
||||
import { logger } from "../utils/logger";
|
||||
import { resolvePath } from "../utils/parseNameAndPath";
|
||||
|
||||
const CLIOptionsSchema = z.object({
|
||||
packageName: z.string().optional(),
|
||||
|
||||
@@ -8,12 +8,12 @@ import ora, { Ora } from "ora";
|
||||
import pathModule from "path";
|
||||
import util from "util";
|
||||
import { z } from "zod";
|
||||
import { CLOUD_API_URL } from "../consts.js";
|
||||
import { telemetryClient } from "../telemetry/telemetry.js";
|
||||
import { pathExists, readFile } from "../utils/fileSystem.js";
|
||||
import { logger } from "../utils/logger.js";
|
||||
import { resolvePath } from "../utils/parseNameAndPath.js";
|
||||
import { TriggerApi } from "../utils/triggerApi.js";
|
||||
import { CLOUD_API_URL } from "../consts";
|
||||
import { telemetryClient } from "../telemetry/telemetry";
|
||||
import { pathExists, readFile } from "../utils/fileSystem";
|
||||
import { logger } from "../utils/logger";
|
||||
import { resolvePath } from "../utils/parseNameAndPath";
|
||||
import { TriggerApi } from "../utils/triggerApi";
|
||||
|
||||
const asyncExecFile = util.promisify(childProcess.execFile);
|
||||
|
||||
|
||||
@@ -7,17 +7,17 @@ import { pathToRegexp } from "path-to-regexp";
|
||||
import { simpleGit } from "simple-git";
|
||||
import { parse } from "tsconfck";
|
||||
import { pathToFileURL } from "url";
|
||||
import { promptApiKey, promptTriggerUrl } from "../cli/index.js";
|
||||
import { CLOUD_API_URL, CLOUD_TRIGGER_URL, COMMAND_NAME } from "../consts.js";
|
||||
import { TelemetryClient, telemetryClient } from "../telemetry/telemetry.js";
|
||||
import { addDependencies } from "../utils/addDependencies.js";
|
||||
import { detectNextJsProject } from "../utils/detectNextJsProject.js";
|
||||
import { pathExists, readJSONFile } from "../utils/fileSystem.js";
|
||||
import { logger } from "../utils/logger.js";
|
||||
import { resolvePath } from "../utils/parseNameAndPath.js";
|
||||
import { renderApiKey } from "../utils/renderApiKey.js";
|
||||
import { renderTitle } from "../utils/renderTitle.js";
|
||||
import { TriggerApi, WhoamiResponse } from "../utils/triggerApi.js";
|
||||
import { promptApiKey, promptTriggerUrl } from "../cli/index";
|
||||
import { CLOUD_API_URL, CLOUD_TRIGGER_URL, COMMAND_NAME } from "../consts";
|
||||
import { TelemetryClient, telemetryClient } from "../telemetry/telemetry";
|
||||
import { addDependencies } from "../utils/addDependencies";
|
||||
import { detectNextJsProject } from "../utils/detectNextJsProject";
|
||||
import { pathExists, readJSONFile } from "../utils/fileSystem";
|
||||
import { logger } from "../utils/logger";
|
||||
import { resolvePath } from "../utils/parseNameAndPath";
|
||||
import { renderApiKey } from "../utils/renderApiKey";
|
||||
import { renderTitle } from "../utils/renderTitle";
|
||||
import { TriggerApi, WhoamiResponse } from "../utils/triggerApi";
|
||||
|
||||
export type InitCommandOptions = {
|
||||
projectPath: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { program } from "./cli/index.js";
|
||||
import { logger } from "./utils/logger.js";
|
||||
import { program } from "./cli/index";
|
||||
import { logger } from "./utils/logger";
|
||||
|
||||
const main = async () => {
|
||||
await program.parseAsync();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PostHog } from "posthog-node";
|
||||
import { InitCommandOptions } from "../commands/init.js";
|
||||
import { InitCommandOptions } from "../commands/init";
|
||||
import { nanoid } from "nanoid";
|
||||
import { getVersion } from "../utils/getVersion.js";
|
||||
import { DevCommandOptions } from "../commands/dev.js";
|
||||
import { getVersion } from "../utils/getVersion";
|
||||
import { DevCommandOptions } from "../commands/dev";
|
||||
|
||||
const postHogApiKey = "phc_hwYmedO564b3Ik8nhA4Csrb5SueY0EwFJWCbseGwWW";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import chalk from "chalk";
|
||||
import { execa } from "execa";
|
||||
import ora, { type Ora } from "ora";
|
||||
import pathModule from "path";
|
||||
import { getUserPackageManager, type PackageManager } from "./getUserPkgManager.js";
|
||||
import { getUserPackageManager, type PackageManager } from "./getUserPkgManager";
|
||||
import fs from "fs/promises";
|
||||
import fetch from "node-fetch";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import fs from "fs/promises";
|
||||
import pathModule from "path";
|
||||
import { readPackageJson } from "./readPackageJson.js";
|
||||
import { readPackageJson } from "./readPackageJson";
|
||||
|
||||
/** Detects if the project is a Next.js project at path */
|
||||
export async function detectNextJsProject(path: string): Promise<boolean> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import pathModule from "path";
|
||||
import { pathExists } from "./fileSystem.js";
|
||||
import { pathExists } from "./fileSystem";
|
||||
|
||||
export type PackageManager = "npm" | "pnpm" | "yarn";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { type PackageJson } from "type-fest";
|
||||
import path from "path";
|
||||
import { PKG_ROOT } from "../consts.js";
|
||||
import { readJSONFileSync } from "./fileSystem.js";
|
||||
import { PKG_ROOT } from "../consts";
|
||||
import { readJSONFileSync } from "./fileSystem";
|
||||
|
||||
export function getVersion() {
|
||||
const packageJsonPath = path.join(PKG_ROOT, "package.json");
|
||||
|
||||
@@ -4,8 +4,8 @@ import { execa } from "execa";
|
||||
import inquirer from "inquirer";
|
||||
import ora from "ora";
|
||||
import path from "path";
|
||||
import { logger } from "./logger.js";
|
||||
import { pathExists, removeFile } from "./fileSystem.js";
|
||||
import { logger } from "./logger";
|
||||
import { pathExists, removeFile } from "./fileSystem";
|
||||
|
||||
const isGitInstalled = (dir: string): boolean => {
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getUserPackageManager, type PackageManager } from "./getUserPkgManager.js";
|
||||
import { logger } from "./logger.js";
|
||||
import { getUserPackageManager, type PackageManager } from "./getUserPkgManager";
|
||||
import { logger } from "./logger";
|
||||
import ora, { type Ora } from "ora";
|
||||
import chalk from "chalk";
|
||||
import { execa } from "execa";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import pathModule from "path";
|
||||
import { type PackageJson } from "type-fest";
|
||||
import { readJSONFile } from "./fileSystem.js";
|
||||
import { readJSONFile } from "./fileSystem";
|
||||
|
||||
export async function readPackageJson(directory: string): Promise<PackageJson | undefined> {
|
||||
const packageJsonPath = pathModule.join(directory, "package.json");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import gradient from "gradient-string";
|
||||
import { TITLE_TEXT } from "../consts.js";
|
||||
import { getUserPackageManager } from "./getUserPkgManager.js";
|
||||
import { TITLE_TEXT } from "../consts";
|
||||
import { getUserPackageManager } from "./getUserPkgManager";
|
||||
|
||||
// colors brought in from vscode poimandres theme
|
||||
const poimandresTheme = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TEMPLATE_ORGANIZATION } from "../consts.js";
|
||||
import { TEMPLATE_ORGANIZATION } from "../consts";
|
||||
|
||||
export function createTemplateRef(templateName: string): string {
|
||||
return `github:${TEMPLATE_ORGANIZATION}/${templateName}`;
|
||||
|
||||
Reference in New Issue
Block a user