Skip to content

Commit

Permalink
Merge pull request #1371 from opencomponents/dont-install-when-packaging
Browse files Browse the repository at this point in the history
dont install when packaging at all
  • Loading branch information
ricardo-devis-agullo authored Aug 3, 2024
2 parents 6bd9a07 + 17c9da1 commit 602afbb
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 250 deletions.
6 changes: 0 additions & 6 deletions src/cli/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ export default {
boolean: true,
description: 'Create zipped file',
default: false
},
useComponentDependencies: {
boolean: true,
description:
'Reuse already installed dependencies to save packaging time and network bandwidth',
default: false
}
},
description: 'Create the packaged component ready to be published',
Expand Down
17 changes: 5 additions & 12 deletions src/cli/domain/handle-dependencies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type { Logger } from '../../logger';
import ensureCompilerIsDeclaredAsDevDependency from './ensure-compiler-is-declared-as-devDependency';
import getCompiler from './get-compiler';
import installMissingDependencies from './install-missing-dependencies';
import linkMissingDependencies from './link-missing-dependencies';

const getComponentPackageJson = (componentPath: string): Promise<Component> =>
fs.readJson(path.join(componentPath, 'package.json'));
Expand All @@ -19,14 +18,14 @@ const union = (a: ReadonlyArray<string>, b: ReadonlyArray<string>) => [
];

export default async function handleDependencies(options: {
install?: boolean;
components: string[];
logger: Logger;
useComponentDependencies?: boolean;
}): Promise<{
modules: string[];
templates: Array<Template>;
}> {
const { components, logger, useComponentDependencies } = options;
const { components, logger } = options;

const dependencies: Record<string, string> = {};
const addDependencies = (componentDependencies?: Record<string, string>) => {
Expand Down Expand Up @@ -80,15 +79,9 @@ export default async function handleDependencies(options: {
modules: union(coreModules, Object.keys(dependencies)).sort(),
templates: Object.values(templates)
};
if (useComponentDependencies) {
linkMissingDependencies({
componentPath: components[0],
dependencies,
logger
});
return result;
}

await installMissingDependencies({ dependencies, logger });
if (options.install) {
await installMissingDependencies({ dependencies, logger });
}
return result;
}
45 changes: 0 additions & 45 deletions src/cli/domain/handle-dependencies/link-missing-dependencies.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/cli/facade/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const dev = ({ local, logger }: { logger: Logger; local: Local }) =>
logger.log(colors.green('├── ') + component);
}
const dependencies = await handleDependencies({
install: true,
components,
logger
}).catch((err) => {
Expand Down
5 changes: 1 addition & 4 deletions src/cli/facade/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ const cliPackage = ({ local, logger }: { local: Local; logger: Logger }) =>
fromPromise(
async (opts: {
componentPath: string;
useComponentDependencies?: boolean;
compress?: boolean;
}): Promise<Component> => {
const componentPath = opts.componentPath;
const useComponentDependencies = opts.useComponentDependencies;
const packageDir = path.resolve(componentPath, '_package');
const compressedPackagePath = path.resolve(
componentPath,
Expand All @@ -25,8 +23,7 @@ const cliPackage = ({ local, logger }: { local: Local; logger: Logger }) =>
try {
await handleDependencies({
components: [path.resolve(componentPath)],
logger,
useComponentDependencies
logger
});

const packageOptions = {
Expand Down
126 changes: 0 additions & 126 deletions test/unit/cli-domain-handle-dependencies-link-missing-dependencies.js

This file was deleted.

Loading

0 comments on commit 602afbb

Please sign in to comment.