Skip to content

Commit

Permalink
fix: move path related to core/node_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Feb 28, 2021
1 parent 0775b3b commit 8d9986a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
12 changes: 0 additions & 12 deletions core/core/src/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import path from 'path';
import { Compiler, Configuration, RuleSetQuery } from 'webpack';
import { LogOptions } from '@component-controls/logger';

Expand Down Expand Up @@ -98,17 +97,6 @@ export type WatchProps = {
watchOptions?: WatchOptions;
} & BuildProps;

export const getDistName = (options: BuildProps): string => {
const dist = options.distFolder || path.join(process.cwd(), 'public');
return dist;
};

export const defBundleName = 'component-controls.js';

export const getBundleName = (options: BuildProps): string =>
path.join(getDistName(options), options.bundleName || defBundleName);

export const defCssFileName = 'component-controls.css';

export const getCSSBundleName = (options: BuildProps): string =>
path.join(getDistName(options), options.cssFileName || defCssFileName);
12 changes: 12 additions & 0 deletions core/core/src/node-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import { BuildProps, defBundleName, defCssFileName } from './build';

export const findUpFile = (
filePath: string,
Expand All @@ -17,3 +18,14 @@ export const findUpFile = (
}
return findUpFile(path.resolve(filePath, '..'), fileName, levels - 1);
};

export const getDistName = (options: BuildProps): string => {
const dist = options.distFolder || path.join(process.cwd(), 'public');
return dist;
};

export const getBundleName = (options: BuildProps): string =>
path.join(getDistName(options), options.bundleName || defBundleName);

export const getCSSBundleName = (options: BuildProps): string =>
path.join(getDistName(options), options.cssFileName || defCssFileName);
7 changes: 5 additions & 2 deletions integrations/gatsby-theme-stories/src/gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ import {
} from '@component-controls/webpack-compile';
import {
BuildProps,
Store,
defaultCompileProps,
} from '@component-controls/core';
import {
getBundleName,
getCSSBundleName,
Store,
} from '@component-controls/core';
} from '@component-controls/core/node-utils';

import { mergeBuildConfiguration } from '@component-controls/config';

import {
Expand Down
2 changes: 1 addition & 1 deletion integrations/nextjs-plugin/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
BuildProps,
RuleOptions,
defaultCompileProps,
getCSSBundleName,
} from '@component-controls/core';
import { getCSSBundleName } from '@component-controls/core/node-utils';
import { Store } from '@component-controls/core';
import { loadStore } from '@component-controls/store';
import { getSiteMap } from '@component-controls/routes';
Expand Down

0 comments on commit 8d9986a

Please sign in to comment.