Redwood: 2nd/later scaffold run results in: scaffold.css already exists

Created on 10 Mar 2020  Â·  6Comments  Â·  Source: redwoodjs/redwood

ENVIRONMENT

0.1.0

OBSERVATION

I ran yarn rw g scaffold NAME for my first model, worked fine.

I ran yarn rw g scaffold NAME for my second model, failed after writing 3 out of 15 files:

$ yarn rw g scaffold workspace
yarn run v1.21.1
$ /Users/chris/proj/aw-hammer/node_modules/.bin/rw g scaffold workspace
❯ Generating scaffold files...
    âś” Writing `./api/src/graphql/workspaces.sdl.js`...
    âś” Writing `./api/src/services/workspaces/workspaces.test.js`...
    âś” Writing `./api/src/services/workspaces/workspaces.js`...
    âś– Writing `./web/src/scaffold.css`...
    → /Users/chris/proj/aw-hammer/web/src/scaffold.css already exists.
    Writing `./web/src/layouts/WorkspacesLayout/WorkspacesLayout.js`...
    Writing `./web/src/pages/EditWorkspacePage/EditWorkspacePage.js`...
    Writing `./web/src/pages/WorkspacePage/WorkspacePage.js`...
    Writing `./web/src/pages/WorkspacesPage/WorkspacesPage.js`...
    Writing `./web/src/pages/NewWorkspacePage/NewWorkspacePage.js`...
    Writing `./web/src/components/EditWorkspaceCell/EditWorkspaceCell.js`...
    Writing `./web/src/components/Workspace/Workspace.js`...
    Writing `./web/src/components/WorkspaceCell/WorkspaceCell.js`...
    Writing `./web/src/components/WorkspaceForm/WorkspaceForm.js`...
    Writing `./web/src/components/Workspaces/Workspaces.js`...
    Writing `./web/src/components/WorkspacesCell/WorkspacesCell.js`...
    Writing `./web/src/components/NewWorkspace/NewWorkspace.js`...
    Adding scaffold routes...
    Adding scaffold asset imports...
/Users/chris/proj/aw-hammer/web/src/scaffold.css already exists.

The files listed before the "X" line were generated; those after were not.

It's fine that generate scaffold would create the default version of scaffold.css if one doesn't exist. If one does exist, the process should continue without treating that as an error.

The process should skip over an existing file, since it may have been created by a prior run and left alone (= same file), or the user has altered it (= would not appreciate having it overwritten).

WORKAROUND

Temporarily -- move or delete the file before each generate.

bu2-confirmed kinbug generators

All 6 comments

Yeah that should just skip scaffold.css if it already exists, sorry about that. You can add a --force flag on your generate command and it will just overwrite it.

I had code in place to skip adding the import statement to index.js but not to skip the actual scaffold file itself, whoops!

I'm still experiencing this issue on 0.2.5.

@weaversam8 I just tried to reproduce this and I couldn't, could you give us some more information about what you're experiencing?

The issue I'm experiencing is identical to the issue reported here. When I tested on version 0.2.5, it was in an existing project that I upgraded. I was going to make a replication case for this to confirm it would happen in a brand new project, but I think I might have found the problem.

I'm running Windows. Doesn't this line (which splits paths on the / character) fail on Windows (if paths contain the \ character)?

@weaversam8 that's 100% the problem. Sorry, I didn't realise you're on Windows.

Was this page helpful?
0 / 5 - 0 ratings