nx/packages/react-native/src/utils/testing-generators.ts
Jack Hsu 27edf71cef
feat(misc): make directory a required option for generators (#28093)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: Nicholas Cunningham <ndcunningham@gmail.com>
2024-10-01 09:29:44 -04:00

31 lines
857 B
TypeScript

import { addProjectConfiguration, names, Tree } from '@nx/devkit';
import applicationGenerator from '../generators/application/application';
import { Linter } from '@nx/eslint';
export async function createApp(tree: Tree, appName: string): Promise<void> {
await applicationGenerator(tree, {
linter: Linter.EsLint,
skipFormat: true,
style: 'css',
unitTestRunner: 'none',
directory: appName,
e2eTestRunner: 'none',
install: false,
bundler: 'webpack',
});
}
export async function createLib(tree: Tree, libName: string): Promise<void> {
const { fileName } = names(libName);
tree.write(`${fileName}/src/index.ts`, `import React from 'react';\n`);
addProjectConfiguration(tree, fileName, {
tags: [],
root: `${fileName}`,
projectType: 'library',
sourceRoot: `${fileName}/src`,
targets: {},
});
}