Skip to content

Commit

Permalink
[create-plasmic-app] Disable Next.js linting on builds
Browse files Browse the repository at this point in the history
Change-Id: I62693e985b301d432880205c398eb1da2ee638d9
  • Loading branch information
tmadeira committed Jul 15, 2021
1 parent e59ba7a commit 6ec5719
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/create-plasmic-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-plasmic-app",
"version": "0.0.24",
"version": "0.0.25",
"description": "Create Plasmic-powered React apps",
"main": "./dist/lib.js",
"types": "./dist/lib.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion packages/create-plasmic-app/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,16 @@ export async function create(args: CreatePlasmicAppArgs): Promise<void> {
const project = projectApiToken
? `${projectId}:${projectApiToken}`
: projectId;
if (platform === "nextjs") {
await writeDefaultNextjsConfig(resolvedProjectPath, projectId, false);
}
await spawnOrFail(
`npx -p @plasmicapp/cli plasmic sync --yes -p ${project}`,
resolvedProjectPath
);
} else if (scheme === "loader") {
if (platform === "nextjs") {
await writeDefaultNextjsConfig(resolvedProjectPath, projectId);
await writeDefaultNextjsConfig(resolvedProjectPath, projectId, true);
} else if (platform === "gatsby") {
await modifyDefaultGatsbyConfig(resolvedProjectPath, projectId);
} else {
Expand Down
23 changes: 22 additions & 1 deletion packages/create-plasmic-app/src/utils/file-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,27 @@ export function stripExtension(
*/
export async function writeDefaultNextjsConfig(
projectDir: string,
projectId: string
projectId: string,
loader: boolean
): Promise<void> {
const nextjsConfigFile = path.join(projectDir, "next.config.js");

if (!loader) {
await fs.writeFile(
nextjsConfigFile,
`
module.exports = {
eslint: {
ignoreDuringBuilds: true,
},
trailingSlash: true,
// Your NextJS config.
};
`
);
return;
}

await fs.writeFile(
nextjsConfigFile,
`
Expand All @@ -57,6 +75,9 @@ const withPlasmic = plasmic({
projects: ['${projectId}'] // An array of project ids.
});
module.exports = withPlasmic({
eslint: {
ignoreDuringBuilds: true,
},
trailingSlash: true,
// Your NextJS config.
});
Expand Down

0 comments on commit 6ec5719

Please sign in to comment.