Skip to content

Commit 04e8975

Browse files
committed
chore: add Windows dev support
Add cross-env to handle setting env vars on the command line. Add tzinfo-data gem when on Windows.
1 parent 05c1d5b commit 04e8975

File tree

6 files changed

+47
-8
lines changed

6 files changed

+47
-8
lines changed

.env.sample

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ TOP_MESSAGE_INVERTED='false'
2121
UNLEASH_ENV=''
2222
UNLEASH_TOKEN=''
2323
UNLEASH_TOKEN_RAILS=''
24-
UNLEASH_URL=''
24+
UNLEASH_URL=''
25+
26+
# Windows only: set to 0 to disable Puma worker forking (not supported on Windows)
27+
# WEB_CONCURRENCY=0

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ gem 'public_suffix' # used for config/initializers/cookie_jar.rb
5656
# handy ruby extensions
5757
gem 'facets', require: false
5858

59+
# Windows does not have zoneinfo files, so bundle the tzinfo-data gem
60+
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
61+
5962
gem 'rack', '>= 2.2.3'
6063
# for redirecting
6164
gem 'rack-rewrite', '~> 1.5.0'

Gemfile.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ GEM
211211
ffi (1.17.3-aarch64-linux-gnu)
212212
ffi (1.17.3-aarch64-linux-musl)
213213
ffi (1.17.3-arm64-darwin)
214+
ffi (1.17.3-x64-mingw-ucrt)
214215
ffi (1.17.3-x86_64-darwin)
215216
ffi (1.17.3-x86_64-linux-gnu)
216217
ffi (1.17.3-x86_64-linux-musl)
@@ -262,6 +263,9 @@ GEM
262263
google-protobuf (4.33.4-arm64-darwin)
263264
bigdecimal
264265
rake (>= 13)
266+
google-protobuf (4.33.4-x64-mingw-ucrt)
267+
bigdecimal
268+
rake (>= 13)
265269
google-protobuf (4.33.4-x86_64-darwin)
266270
bigdecimal
267271
rake (>= 13)
@@ -294,6 +298,9 @@ GEM
294298
grpc (1.76.0-arm64-darwin)
295299
google-protobuf (>= 3.25, < 5.0)
296300
googleapis-common-protos-types (~> 1.0)
301+
grpc (1.76.0-x64-mingw-ucrt)
302+
google-protobuf (>= 3.25, < 5.0)
303+
googleapis-common-protos-types (~> 1.0)
297304
grpc (1.76.0-x86_64-darwin)
298305
google-protobuf (>= 3.25, < 5.0)
299306
googleapis-common-protos-types (~> 1.0)
@@ -402,6 +409,8 @@ GEM
402409
racc (~> 1.4)
403410
nokogiri (1.19.1-arm64-darwin)
404411
racc (~> 1.4)
412+
nokogiri (1.19.1-x64-mingw-ucrt)
413+
racc (~> 1.4)
405414
nokogiri (1.19.1-x86_64-darwin)
406415
racc (~> 1.4)
407416
nokogiri (1.19.1-x86_64-linux-gnu)
@@ -427,6 +436,7 @@ GEM
427436
pg (1.6.3-aarch64-linux)
428437
pg (1.6.3-aarch64-linux-musl)
429438
pg (1.6.3-arm64-darwin)
439+
pg (1.6.3-x64-mingw-ucrt)
430440
pg (1.6.3-x86_64-darwin)
431441
pg (1.6.3-x86_64-linux)
432442
pg (1.6.3-x86_64-linux-musl)
@@ -641,6 +651,8 @@ GEM
641651
tsort (0.2.0)
642652
tzinfo (2.0.6)
643653
concurrent-ruby (~> 1.0)
654+
tzinfo-data (1.2026.1)
655+
tzinfo (>= 1.0.0)
644656
uglifier (3.2.0)
645657
execjs (>= 0.3.0, < 3)
646658
unicode-display_width (3.2.0)
@@ -671,6 +683,8 @@ GEM
671683
ffi (~> 1.17.2)
672684
yggdrasil-engine (1.1.1-arm64-darwin)
673685
ffi (~> 1.17.2)
686+
yggdrasil-engine (1.1.1-x64-mingw-ucrt)
687+
ffi (~> 1.17.2)
674688
yggdrasil-engine (1.1.1-x86_64-darwin)
675689
ffi (~> 1.17.2)
676690
yggdrasil-engine (1.1.1-x86_64-linux)
@@ -684,6 +698,7 @@ PLATFORMS
684698
aarch64-linux-gnu
685699
aarch64-linux-musl
686700
arm64-darwin
701+
x64-mingw-ucrt
687702
x86_64-darwin
688703
x86_64-linux
689704
x86_64-linux-gnu
@@ -768,6 +783,7 @@ DEPENDENCIES
768783
spring
769784
sprockets-rails
770785
sprockets_uglifier_with_source_maps
786+
tzinfo-data
771787
uglifier (~> 3.2)
772788
unleash (~> 6.4.1)
773789
vcr

config/database.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ default: &default
33
encoding: utf8
44
pool: 5
55
timeout: 5000
6+
username: <%= ENV['DATABASE_USERNAME'] %>
7+
password: <%= ENV['DATABASE_PASSWORD'] %>
8+
host: <%= ENV['DATABASE_HOST'] || 'localhost' %>
69

710
development:
811
<<: *default

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"babel-loader": "^9.1.2",
2727
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
2828
"bower": "1.8.8",
29-
"react-dropzone": "^14.3.8",
3029
"clone-deep": "^4.0.1",
3130
"compression-webpack-plugin": "^10.0.0",
3231
"core-js": "^3.19",
@@ -46,6 +45,7 @@
4645
"prop-types": "^15.7.2",
4746
"react": "^18.2.0",
4847
"react-dom": "^18.2.0",
48+
"react-dropzone": "^14.3.8",
4949
"react-gtm-module": "^2.0.11",
5050
"react-helmet-async": "^1.3.0",
5151
"react-hook-form": "^6.15.5",
@@ -104,6 +104,7 @@
104104
"coffee-script": "1.12.7",
105105
"coffeelint": "^2.1.0",
106106
"concurrently": "^8.0.1",
107+
"cross-env": "^10.1.0",
107108
"cucumber": "^2.3.1",
108109
"cypress": "13.6.3",
109110
"eslint": "9.37.0",
@@ -149,22 +150,22 @@
149150
"scripts": {
150151
"postinstall": "bower install",
151152
"protractor": "protractor ./spec/e2e/conf.js",
152-
"test": "TZ='UTC' NODE_OPTIONS=\"--max-old-space-size=4096\" jest --coverage --maxWorkers=2",
153-
"test:inspect": "TZ='UTC' NODE_OPTIONS=\"--inspect --max-old-space-size=4096\" INSPECT_MODE=true jest --runInBand --logHeapUsage 2>&1 | tee jestInspectOutput.txt",
153+
"test": "cross-env TZ=UTC NODE_OPTIONS=\"--max-old-space-size=4096\" jest --coverage --maxWorkers=2",
154+
"test:inspect": "cross-env TZ=UTC NODE_OPTIONS=\"--inspect --max-old-space-size=4096\" INSPECT_MODE=true jest --runInBand --logHeapUsage 2>&1 | tee jestInspectOutput.txt",
154155
"test:e2e": "cypress run --browser chrome",
155156
"test:e2e:open": "cypress open --browser chrome",
156157
"lint": "eslint",
157158
"lint:c": "eslint --cache",
158159
"lint:fix": "eslint --fix",
159160
"lint:config": "eslint --insepct-config",
160-
"lint:benchmark": "TIMING=all eslint --stats",
161+
"lint:benchmark": "cross-env TIMING=all eslint --stats",
161162
"format": "prettier --write .",
162163
"webpack:analyze": "yarn webpack:build_json && yarn webpack:analyze_json",
163-
"webpack:build_json": "RAILS_ENV=${RAILS_ENV:-production} NODE_ENV=${NODE_ENV:-production} bin/webpack --profile --json > tmp/webpack-stats.json",
164+
"webpack:build_json": "cross-env RAILS_ENV=${RAILS_ENV:-production} NODE_ENV=${NODE_ENV:-production} bin/webpack --profile --json > tmp/webpack-stats.json",
164165
"webpack:analyze_json": "webpack-bundle-analyzer tmp/webpack-stats.json public/packs",
165-
"start": "concurrently --names \"SERVER,CLIENT\" -c \"bgBlue.bold,bgMagenta.bold\" \"bundle exec rails s -p 3000\" \"NODE_OPTIONS=\"\" ./bin/shakapacker-dev-server\"",
166+
"start": "concurrently --names \"SERVER,CLIENT\" -c \"bgBlue.bold,bgMagenta.bold\" \"yarn server\" \"yarn client\"",
166167
"server": "bundle exec rails s -p 3000",
167-
"client": "./bin/shakapacker-dev-server",
168+
"client": "cross-env NODE_OPTIONS= ./bin/shakapacker-dev-server",
168169
"storybook": "storybook dev -p 6006",
169170
"build-storybook": "storybook build"
170171
},

yarn.lock

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,11 @@
13831383
dependencies:
13841384
tslib "^2.4.0"
13851385

1386+
"@epic-web/invariant@^1.0.0":
1387+
version "1.0.0"
1388+
resolved "https://registry.yarnpkg.com/@epic-web/invariant/-/invariant-1.0.0.tgz#1073e5dee6dd540410784990eb73e4acd25c9813"
1389+
integrity sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==
1390+
13861391
"@esbuild/aix-ppc64@0.25.12":
13871392
version "0.25.12"
13881393
resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz#80fcbe36130e58b7670511e888b8e88a259ed76c"
@@ -5250,6 +5255,14 @@ create-jest@^29.7.0:
52505255
jest-util "^29.7.0"
52515256
prompts "^2.0.1"
52525257

5258+
cross-env@^10.1.0:
5259+
version "10.1.0"
5260+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-10.1.0.tgz#cfd2a6200df9ed75bfb9cb3d7ce609c13ea21783"
5261+
integrity sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==
5262+
dependencies:
5263+
"@epic-web/invariant" "^1.0.0"
5264+
cross-spawn "^7.0.6"
5265+
52535266
cross-spawn@^6.0.0:
52545267
version "6.0.6"
52555268
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.6.tgz#30d0efa0712ddb7eb5a76e1e8721bffafa6b5d57"

0 commit comments

Comments
 (0)