Skip to content

Commit 7a20e5a

Browse files
justin808claude
andcommitted
Fix CI build failures from React on Rails 16.1.1 migration
- Move pack files from app/javascript/packs to client/app/packs - Update shakapacker config to use client/app as source_path - Fix server-bundle.js to import serverRegistration directly - Add missing i18n translation and default files - Configure webpack aliases for libs path resolution - Add sass-resources-loader for global SASS variables - Fix CSS module imports to use named exports - Build and fix ReScript generated files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c7c7d7d commit 7a20e5a

File tree

11 files changed

+81
-91
lines changed

11 files changed

+81
-91
lines changed

app/javascript/packs/client-bundle.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

app/javascript/packs/server-bundle.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/javascript/packs/stimulus-bundle.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

client/app/bundles/comments/components/CommentBox/CommentBox.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import SelectLanguage from 'libs/i18n/selectLanguage';
88
import { defaultMessages, defaultLocale } from 'libs/i18n/default';
99
import CommentForm from './CommentForm/CommentForm';
1010
import CommentList, { commentPropTypes } from './CommentList/CommentList';
11-
import css from './CommentBox.module.scss';
11+
import * as css from './CommentBox.module.scss';
1212

1313
class CommentBox extends BaseComponent {
1414
static propTypes = {

client/app/bundles/comments/components/SimpleCommentScreen/SimpleCommentScreen.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { translations } from 'libs/i18n/translations';
1212

1313
import CommentForm from '../CommentBox/CommentForm/CommentForm';
1414
import CommentList from '../CommentBox/CommentList/CommentList';
15-
import css from './SimpleCommentScreen.module.scss';
15+
import * as css from './SimpleCommentScreen.module.scss';
1616

1717
class SimpleCommentScreen extends BaseComponent {
1818
constructor(props) {

client/app/libs/i18n/default.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Default locale and messages for i18n
2+
const defaultLocale = 'en';
3+
4+
const defaultMessages = {
5+
en: {},
6+
};
7+
8+
export { defaultLocale, defaultMessages };
9+
export default { defaultLocale, defaultMessages };
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Translation messages for react-intl
2+
export const translations = {
3+
en: {
4+
'nav.toggle': 'Toggle navigation',
5+
'nav.examples': 'Examples',
6+
'nav.rails_ujs': 'Rails UJS Demo',
7+
'nav.turbo_demo': 'Turbo Demo',
8+
'nav.stimulus_demo': 'Stimulus Demo',
9+
'nav.simple_react': 'Simple React',
10+
'nav.rescript': 'Rescript',
11+
'nav.server_rendering': 'Server Rendering',
12+
'nav.react_router': 'React Router',
13+
'nav.react_router_express': 'React Router Express',
14+
'nav.code': 'Code',
15+
'comment.form.name.placeholder': 'Name',
16+
'comment.form.comment.placeholder': 'Comment',
17+
'comment.form.submit': 'Post',
18+
'comment.form.posting': 'Posting...',
19+
'comment.form.posted': 'Posted!',
20+
'comment.form.error_saving': 'Error Saving Comment',
21+
'comment.form.characters_left': '{count, number} characters left',
22+
'comment.form.characters_over_limit': '{count, number} characters over limit',
23+
'comment.actions.add': 'Add Comment',
24+
'comment.actions.delete': 'delete',
25+
'comment.actions.edit': 'edit',
26+
'comment.actions.save': 'save',
27+
'comment.actions.cancel': 'cancel',
28+
'comment.empty': 'No comments yet',
29+
'comment.loading': 'Loading...',
30+
'comment.error.fetch': 'Error fetching comments',
31+
'comment.error.delete': 'Error deleting comment',
32+
'comment.error.update': 'Error updating comment',
33+
},
34+
};
35+
36+
export default translations;

client/app/packs/server-bundle.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,2 @@
1-
// Example of React + Redux
2-
import ReactOnRails from 'react-on-rails';
3-
4-
import App from '../bundles/comments/startup/App';
5-
import RouterApp from '../bundles/comments/startup/ServerRouterApp';
6-
import SimpleCommentScreen from '../bundles/comments/components/SimpleCommentScreen/SimpleCommentScreen';
7-
import NavigationBarApp from '../bundles/comments/startup/NavigationBarApp';
8-
import routerCommentsStore from '../bundles/comments/store/routerCommentsStore';
9-
import commentsStore from '../bundles/comments/store/commentsStore';
10-
import Footer from '../bundles/comments/components/Footer/Footer';
11-
import RescriptShow from '../bundles/comments/rescript/ReScriptShow.bs.js';
12-
13-
ReactOnRails.register({
14-
App,
15-
RouterApp,
16-
NavigationBarApp,
17-
SimpleCommentScreen,
18-
Footer,
19-
RescriptShow,
20-
});
21-
22-
ReactOnRails.registerStore({
23-
routerCommentsStore,
24-
commentsStore,
25-
});
1+
// Server bundle imports
2+
import serverRegistration from '../bundles/comments/startup/serverRegistration';

config/shakapacker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file contains the defaults used by shakapacker.
33

44
default: &default
5-
source_path: app/javascript
5+
source_path: client/app
66

77
# You can have a subdirectory of the source_path, like 'packs' (recommended).
88
# Alternatively, you can use '/' to use the whole source_path directory.

config/webpack/alias.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
resolve: {
55
alias: {
66
Assets: resolve(__dirname, '..', '..', 'client', 'app', 'assets'),
7+
libs: resolve(__dirname, '..', '..', 'client', 'app', 'libs'),
78
},
89
},
910
};

0 commit comments

Comments
 (0)