Skip to content

Commit

Permalink
moved files over from lib to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
DanDroryAu committed Dec 23, 2024
1 parent 4dbe04f commit df39762
Show file tree
Hide file tree
Showing 32 changed files with 38 additions and 40 deletions.
2 changes: 1 addition & 1 deletion packages/sku/scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ try {
let configure;
try {
log('postinstall', 'starting load of configure');
configure = (await import('../src/lib/configure.js')).default;
configure = (await import('../src/utils/configureApp.js')).default;
} catch (error) {
console.error(
'An error occurred loading configure script. Please check that sku.config.js is correct and try again.',
Expand Down
7 changes: 0 additions & 7 deletions packages/sku/src/context/configPath.ts

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ensureTargetDirectory,
} from '@/utils/buildFileUtils.js';
import makeWebpackConfig from '@/services/webpack/config/webpack.config.ssr.js';
import provider from '@/telemetry/index.js';
import provider from '@/services/telemetry/index.js';

import { runVocabCompile } from '@/services/vocab/runVocab.js';
import { configureProject, validatePeerDeps } from '@/utils/configure.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/sku/src/program/commands/build/build.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { run } from '@/services/webpack/runWebpack.js';
import createHtmlRenderPlugin from '@/services/webpack/config/plugins/createHtmlRenderPlugin.js';
import makeWebpackConfig from '@/services/webpack/config/webpack.config.js';
import provider from '@/telemetry/index.js';
import provider from '@/services/telemetry/index.js';
import { runVocabCompile } from '@/services/vocab/runVocab.js';
import { configureProject, validatePeerDeps } from '@/utils/configure.js';
import type { StatsChoices } from '@/program/options/stats/stats.option.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import configure from '../../../lib/configure.js';
import configure from '@/utils/configureApp.js';
import { SkuContext } from '@/context/createSkuContext.js';

export const configureAction = ({ skuContext }: { skuContext: SkuContext }) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/sku/src/program/commands/init/init.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { write as prettierWrite } from '@/services/prettier/runPrettier.js';
import { fix as esLintFix } from '@/services/eslint/runESLint.js';
import install from '@/services/packageManager/install.js';

import configure from '@/lib/configure.js';
import configure from '@/utils/configureApp.js';

import { setCwd } from '@/utils/cwd.js';
import banner from '@/utils/banners/banner.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/sku/src/program/commands/lint/lint.action.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import chalk from 'chalk';
import { check as esLintCheck } from '@/services/eslint/runESLint.js';
import { check as prettierCheck } from '@/services/prettier/runPrettier.js';
import runTsc from '@/lib/runTsc.js';
import runTsc from '@/utils/runTsc.js';

import { runVocabCompile } from '@/services/vocab/runVocab.js';
import { configureProject } from '@/utils/configure.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import preCommit from '../../../lib/preCommit.js';
import preCommit from '../../../utils/preCommit.js';
import { configureProject } from '@/utils/configure.js';
import { SkuContext } from '@/context/createSkuContext.js';

Expand Down
4 changes: 2 additions & 2 deletions packages/sku/src/program/commands/serve/serve.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import chalk from 'chalk';
import didYouMean from 'didyoumean2';
import { checkHosts, getAppHosts } from '@/utils/contextUtils/hosts.js';
import allocatePort from '@/utils/allocatePort.js';
import openBrowser from '../../../lib/openBrowser/index.js';
import openBrowser from '@/openBrowser/index.js';
import getSiteForHost from '@/utils/contextUtils/getSiteForHost.js';
import { resolveEnvironment } from '@/utils/contextUtils/resolveEnvironment.js';
import provider from '../../../telemetry/index.js';
import provider from '@/services/telemetry/index.js';
import createServer from '@/utils/createServer.js';
import {
getRouteWithLanguage,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { setupHosts } from '@/utils/contextUtils/hosts.js';
import provider from '../../../telemetry/index.js';
import provider from '@/services/telemetry/index.js';
import { SkuContext } from '@/context/createSkuContext.js';

export const setupHostsAction = async ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import onDeath from 'death';
import chalk from 'chalk';
import debug from 'debug';

import getCertificate from '../../../lib/certificate.js';
import getCertificate from '../../../utils/certificate.js';
import {
copyPublicFiles,
ensureTargetDirectory,
Expand All @@ -15,7 +15,7 @@ import { checkHosts, getAppHosts } from '@/utils/contextUtils/hosts.js';
import makeWebpackConfig from '@/services/webpack/config/webpack.config.ssr.js';
import getStatsConfig from '@/services/webpack/config/statsConfig.js';
import allocatePort from '@/utils/allocatePort.js';
import openBrowser from '../../../lib/openBrowser/index.js';
import openBrowser from '@/openBrowser/index.js';
import createServerManager from '@/services/serverManager.js';

import { watchVocabCompile } from '@/services/vocab/runVocab.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/sku/src/program/commands/start/start.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import chalk from 'chalk';
import exceptionFormatter from 'exception-formatter';
import type { RequestHandler } from 'express';

import openBrowser from '@/lib/openBrowser/index.js';
import getCertificate from '@/lib/certificate.js';
import openBrowser from '@/openBrowser/index.js';
import getCertificate from '@/utils/certificate.js';

import getStatsConfig from '@/services/webpack/config/statsConfig.js';
import createHtmlRenderPlugin from '@/services/webpack/config/plugins/createHtmlRenderPlugin.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/sku/src/program/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { configOption } from './options/config/config.option.js';
import { environmentOption } from './options/environment/environment.option.js';
import { initDebug } from '@/utils/debug.js';
import { createSkuContext, getSkuContext } from '@/context/createSkuContext.js';
import { initializeTelemetry } from '@/telemetry/index.js';
import { initializeTelemetry } from '@/services/telemetry/index.js';

const __dirname = dirname(fileURLToPath(import.meta.url));

Expand Down
2 changes: 1 addition & 1 deletion packages/sku/src/services/eslint/eslintMigration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createEslintIgnoresConfig } from '@/services/eslint/config/ignores.js';

import { getPathFromCwd } from '@/utils/cwd.js';
import exists from '@/utils/exists.js';
import { SkuConfigUpdater } from '@/lib/SkuConfigUpdater.js';
import { SkuConfigUpdater } from '@/utils/SkuConfigUpdater.js';

const oldEslintConfigPath = getPathFromCwd('.eslintrc');
const eslintIgnorePath = getPathFromCwd('.eslintignore');
Expand Down
5 changes: 5 additions & 0 deletions packages/sku/src/services/lint/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const lintService = async () => ({
prettier: {},
eslint: {},
tsc: {},
});
2 changes: 1 addition & 1 deletion packages/sku/src/services/prettier/runPrettier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path, { dirname } from 'node:path';
import chalk from 'chalk';
import { runBin } from '@/utils/runBin.js';
import { getPathFromCwd } from '@/utils/cwd.js';
import { suggestScript } from '../../lib/suggestScript.js';
import { suggestScript } from '../../utils/suggestScript.js';
import { fileURLToPath } from 'node:url';

const __dirname = dirname(fileURLToPath(import.meta.url));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import os from 'node:os';
import { requireFromCwd } from '@/utils/cwd.js';
import isCI from '@/utils/isCI.js';
import provider from './provider.js';
import skuPackageJson from '../../package.json' with { type: 'json' };
import skuPackageJson from '../../../package.json' with { type: 'json' };
import debug from 'debug';

import { SkuContext } from '@/context/createSkuContext.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createRequire } from 'node:module';

import { getAddCommand } from '../services/packageManager/packageManager.js';
import { getAddCommand } from '../packageManager/packageManager.js';
import banner from '@/utils/banners/banner.js';

const require = createRequire(import.meta.url);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { performance } from 'node:perf_hooks';
import prettyMilliseconds from 'pretty-ms';
import debug from 'debug';
import provider from '@/telemetry/index.js';
import provider from '@/services/telemetry/index.js';
import type { Compiler, WebpackPluginInstance } from 'webpack';

const log = debug('sku:metrics');
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { PathLike } from 'node:fs';
import { generate } from 'selfsigned';
import chalk from 'chalk';

import provider from '../telemetry/index.js';
import provider from '@/services/telemetry/index.js';
import { getPathFromCwd } from '@/utils/cwd.js';
import exists from '@/utils/exists.js';
import { SkuContext } from '@/context/createSkuContext.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/sku/src/utils/configure.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getPathFromCwd } from './cwd.js';
import fs from 'node:fs';
import _validatePeerDeps from '../lib/validatePeerDeps.js';
import _validatePeerDeps from './validatePeerDeps.js';
import { log } from './debug.js';
import { SkuContext } from '@/context/createSkuContext.js';

Expand All @@ -22,7 +22,7 @@ export const configureProject = async (skuContext: SkuContext) => {
return;
}

const configure = (await import('../lib/configure.js')).default;
const configure = (await import('../utils/configureApp.js')).default;
await configure(skuContext);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import chalk from 'chalk';

import ensureGitignore from 'ensure-gitignore';

import prettierConfig from '../config/prettier/prettierConfig.js';
import createTSConfig from '../config/typescript/tsconfig.js';
import { bundleReportFolder } from '../services/webpack/config/plugins/bundleAnalyzer.js';
import prettierConfig from '@/config/prettier/prettierConfig.js';
import createTSConfig from '@/config/typescript/tsconfig.js';
import { bundleReportFolder } from '@/services/webpack/config/plugins/bundleAnalyzer.js';
import {
shouldMigrateOldEslintConfig,
migrateEslintignore,
cleanUpOldEslintFiles,
addEslintIgnoreToSkuConfig,
} from '../services/eslint/eslintMigration.js';
} from '@/services/eslint/eslintMigration.js';

import getCertificate from './certificate.js';
import { getPathFromCwd, writeFileToCWD } from '@/utils/cwd.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/sku/src/utils/contextUtils/hosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { promisify } from 'node:util';
import { set, get } from 'hostile';
import chalk from 'chalk';

import { suggestScript } from '../../lib/suggestScript.js';
import { suggestScript } from '../suggestScript.js';
import { hasErrorCode } from '../error-guards.js';
import { SkuContext } from '@/context/createSkuContext.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/sku/src/utils/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from 'node:http';
import { createServer as createHttpsServer } from 'node:https';

import getCertificate from '../lib/certificate.js';
import getCertificate from './certificate.js';
import { SkuContext } from '@/context/createSkuContext.js';

const createServer = async ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import chalk from 'chalk';

import config from '../config/lintStaged/lintStagedConfig.js';
import config from '@/config/lintStaged/lintStagedConfig.js';

const preCommit = async () => {
let success = false;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
getRunCommand,
getExecuteCommand,
} from '../services/packageManager/packageManager.js';
} from '@/services/packageManager/packageManager.js';

import chalk from 'chalk';
import { requireFromCwd } from '@/utils/cwd.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
getWhyCommand,
isPnpm,
} from '../services/packageManager/packageManager.js';
} from '@/services/packageManager/packageManager.js';

import { readFile } from 'node:fs/promises';
import { readFileSync } from 'node:fs';
Expand All @@ -10,7 +10,7 @@ import semver from 'semver';
import chalk from 'chalk';

import banner from '@/utils/banners/banner.js';
import provider from '../telemetry/index.js';
import provider from '@/services/telemetry/index.js';

import { getPathFromCwd } from '@/utils/cwd.js';
import { SkuContext } from '@/context/createSkuContext.js';
Expand Down

0 comments on commit df39762

Please sign in to comment.