Skip to content

Commit

Permalink
Merge pull request #116 from felipeptcho/fix-skipped-files
Browse files Browse the repository at this point in the history
Fix skipped api-something pages
  • Loading branch information
Skn0tt authored Feb 21, 2022
2 parents ec97faa + e452c8d commit 21a73a8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function shouldBeSkipped(filePath: string) {
if (!filePath.includes('pages' + nodePath.sep)) {
return true;
}
if (filePath.includes('pages' + nodePath.sep + 'api')) {
if (filePath.includes('pages' + nodePath.sep + 'api' + nodePath.sep)) {
return true;
}
return filesToSkip.some((fileToSkip) => filePath.includes(fileToSkip));
Expand Down
17 changes: 17 additions & 0 deletions test/pages/apiculture or api-something/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export async function getServerSideProps() {
const products = [
{
name: 'Hat',
publishedAt: new Date(0),
},
];
return {
props: {
products,
},
};
}

export default function Page({ products }) {
return JSON.stringify(products);
}
24 changes: 24 additions & 0 deletions test/pages/apiculture or api-something/output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { withSuperJSONPage as _withSuperJSONPage } from 'babel-plugin-superjson-next/tools';
import { withSuperJSONProps as _withSuperJSONProps } from 'babel-plugin-superjson-next/tools';
export const getServerSideProps = _withSuperJSONProps(
async function getServerSideProps() {
const products = [
{
name: 'Hat',
publishedAt: new Date(0),
},
];
return {
props: {
products,
},
};
},
['smth']
);

function Page({ products }) {
return JSON.stringify(products);
}

export default _withSuperJSONPage(Page);

0 comments on commit 21a73a8

Please sign in to comment.