Skip to content

Commit

Permalink
feat(nx-plugin-openapi): add .babelrc to generated api libs
Browse files Browse the repository at this point in the history
fix #37
  • Loading branch information
trumbitta committed Jul 30, 2021
1 parent e028dc3 commit c002a7c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]]
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ describe('api-lib schematic', () => {
]);
});

it('should add a .babelrc file', async () => {
await libraryGenerator(appTree, defaultSchema);
expect(appTree.exists(`libs/${defaultSchema.name}/.babelrc`)).toBeTruthy();
});

describe('When the API spec file is remote', () => {
const sourceSpecUrl = 'http://foo.bar';
const remoteSchema: ApiLibGeneratorSchema = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import {
} from '@nrwl/devkit';
import { runTasksInSerial } from '@nrwl/workspace/src/utilities/run-tasks-in-serial';

// Third Parties
import { join } from 'path';

// Schematics
import init from '../init/generator';

Expand Down Expand Up @@ -118,9 +121,10 @@ const addProject = (host: Tree, options: NormalizedSchema) => {
};

function createFiles(host: Tree, options: NormalizedSchema) {
generateFiles(host, joinPathFragments(__dirname, './files'), options.projectRoot, {
generateFiles(host, join(__dirname, './files'), options.projectRoot, {
...options,
...names(options.name),
dot: '.',
tmpl: '',
offsetFromRoot: offsetFromRoot(options.projectRoot),
});
Expand Down

0 comments on commit c002a7c

Please sign in to comment.