UNPKG

1.13 kBJavaScriptView Raw
1import { resolve } from 'path';
2import { readFileSync } from 'fs';
3import { Tags } from './types';
4export async function guessTargets() {
5 const pkg = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), {
6 encoding: 'utf-8'
7 }));
8 const dependencies = Object.keys(Object.assign({}, pkg.dependencies, pkg.devDependencies));
9 return {
10 [Tags.angular]: isAngular(dependencies),
11 [Tags.react]: isReact(dependencies),
12 [Tags.stencil]: isStencil(dependencies),
13 [Tags.browser]: false,
14 [Tags.node]: false,
15 [Tags.typescript]: isTypescript(dependencies),
16 [Tags.flow]: isFlow(dependencies)
17 };
18}
19function isAngular(dependencies) {
20 return dependencies.includes('@angular/core');
21}
22function isReact(dependencies) {
23 return dependencies.includes('react');
24}
25function isStencil(dependencies) {
26 return dependencies.includes('@stencil/core');
27}
28function isTypescript(dependencies) {
29 return dependencies.includes('typescript');
30}
31function isFlow(dependencies) {
32 return dependencies.includes('flow');
33}
34//# sourceMappingURL=targets.js.map
\No newline at end of file