Skip to content

Commit

Permalink
Upgrade packages
Browse files Browse the repository at this point in the history
  • Loading branch information
binos30 committed Jul 28, 2024
1 parent 856ebc0 commit ab3a205
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 95 deletions.
15 changes: 4 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,8 @@ jobs:
node-version-file: .node-version
cache: "yarn"

- name: Install JavaScript dependencies
env:
YARN_VERSION: 4.3.1
run: |
yarn set version $YARN_VERSION
yarn install --immutable
- name: Restore ESLint cache
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache/restore@v4.0.2
with:
path: .cache/eslint
key: eslint-main-cache
Expand All @@ -73,13 +66,13 @@ jobs:
- name: Save ESLint cache
if: github.event_name == 'push'
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache/save@v4.0.2
with:
path: .cache/eslint
key: eslint-main-cache

- name: Restore prettier cache
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache/restore@v4.0.2
with:
path: .cache/prettier
key: prettier-main-cache
Expand All @@ -98,7 +91,7 @@ jobs:
- name: Save prettier cache
if: github.event_name == 'push'
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache/save@v4.0.2
with:
path: .cache/prettier
key: prettier-main-cache
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.15.1
20.16.0
2 changes: 1 addition & 1 deletion .prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ printWidth: 115
requirePragma: false
singleQuote: false
tabWidth: 2
trailingComma: "none"
trailingComma: "all"
1 change: 0 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ AllCops:
- ".vscode/**/*"
- ".yarn/**/*"
- "app/views/**/*"
- "bin/**/*"
- "db/schema.rb"
- "docs/**/*"
- "log/**/*"
Expand Down
1 change: 0 additions & 1 deletion .streerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
--ignore-files='.vscode/*'
--ignore-files='.yarn/*'
--ignore-files='app/views/*'
--ignore-files='bin/*'
--ignore-files='db/schema.rb'
--ignore-files='docs/*'
--ignore-files='log/*'
Expand Down
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,26 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential curl git libpq-dev libvips node-gyp pkg-config python-is-python3

# Install JavaScript dependencies
ARG NODE_VERSION=20.15.1
ARG YARN_VERSION=4.3.1
ARG NODE_VERSION=20.16.0
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
corepack enable && \
rm -rf /tmp/node-build-master

# Install application gems
COPY .ruby-version ./
COPY Gemfile Gemfile.lock ./
COPY .ruby-version Gemfile Gemfile.lock ./
RUN bundle install && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
bundle exec bootsnap precompile --gemfile

# Install yarn
ARG YARN_VERSION=4.3.1
RUN corepack enable && \
corepack prepare yarn@${YARN_VERSION} --activate

# Install node modules
COPY package.json yarn.lock ./
RUN yarn set version $YARN_VERSION && yarn install --immutable
COPY .yarnrc.yml package.json yarn.lock ./
RUN yarn install --immutable

# Copy application code
COPY . .
Expand Down
32 changes: 16 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ GEM
faraday (>= 1, < 3)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (3.1.0)
faraday-net_http (3.1.1)
net-http
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-aarch64-linux-musl)
Expand All @@ -158,7 +158,7 @@ GEM
activesupport (>= 6.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
image_processing (1.13.0)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.7.2)
Expand Down Expand Up @@ -207,17 +207,17 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.6-aarch64-linux)
nokogiri (1.16.7-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.6-arm-linux)
nokogiri (1.16.7-arm-linux)
racc (~> 1.4)
nokogiri (1.16.6-arm64-darwin)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.6-x86-linux)
nokogiri (1.16.7-x86-linux)
racc (~> 1.4)
nokogiri (1.16.6-x86_64-darwin)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.6-x86_64-linux)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
pagy (9.0.2)
Expand All @@ -229,7 +229,7 @@ GEM
prettier_print (1.2.1)
psych (5.1.2)
stringio
public_suffix (6.0.0)
public_suffix (6.0.1)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.0)
Expand Down Expand Up @@ -387,21 +387,21 @@ GEM
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.1)
stripe (12.3.0)
stripe (12.4.0)
strscan (3.1.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
tailwindcss-rails (2.6.3)
tailwindcss-rails (2.6.4)
railties (>= 7.0.0)
tailwindcss-rails (2.6.3-aarch64-linux)
tailwindcss-rails (2.6.4-aarch64-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.6.3-arm-linux)
tailwindcss-rails (2.6.4-arm-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.6.3-arm64-darwin)
tailwindcss-rails (2.6.4-arm64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.6.3-x86_64-darwin)
tailwindcss-rails (2.6.4-x86_64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.6.3-x86_64-linux)
tailwindcss-rails (2.6.4-x86_64-linux)
railties (>= 7.0.0)
temple (0.10.3)
thor (1.3.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Prerequisites

- [Ruby 3.3.4](https://github.com/rbenv/rbenv)
- [PostgreSQL](https://www.postgresql.org/download/)
- [Node.js 20.15.1](https://github.com/nvm-sh/nvm)
- [Node.js ^20.15.1](https://github.com/nvm-sh/nvm)

Create `.env` file at the root of the project directory. Copy the content of `.env.template.erb` to `.env` then update the `username` and `password` based on your database credentials. Get `STRIPE_SECRET_KEY` and `STRIPE_WEBHOOK_SECRET` from your [Stripe](https://dashboard.stripe.com) account

Expand Down
26 changes: 13 additions & 13 deletions app/javascript/controllers/admin/dashboard_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,33 @@ export default class extends Controller {
label: "Revenue $",
data,
borderWidth: 3,
fill: true
}
]
fill: true,
},
],
},
options: {
plugins: {
legend: {
display: false
}
display: false,
},
},
scales: {
x: {
grid: {
display: false
}
display: false,
},
},
y: {
border: {
dash: [5, 5]
dash: [5, 5],
},
grid: {
color: "#d4f3ef"
color: "#d4f3ef",
},
beginAtZero: true
}
}
}
beginAtZero: true,
},
},
},
});
}
}
10 changes: 5 additions & 5 deletions app/javascript/controllers/site/cart_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class extends Controller {
"hover:bg-red-700",
"focus:ring-4",
"focus:outline-none",
"focus:ring-red-300"
"focus:ring-red-300",
);
deleteButton.addEventListener("click", this.removeFromCart);
div.appendChild(deleteButton);
Expand Down Expand Up @@ -62,16 +62,16 @@ export default class extends Controller {
const csrfToken = document.querySelector('meta[name="csrf-token"]').content;
const payload = {
authenticity_token: "",
cart
cart,
};

fetch("/checkout", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-CSRF-Token": csrfToken
"X-CSRF-Token": csrfToken,
},
body: JSON.stringify(payload)
body: JSON.stringify(payload),
}).then((response) => {
if (response.ok) {
response.json().then((res) => (window.location.href = res.url));
Expand All @@ -82,7 +82,7 @@ export default class extends Controller {
window.location.href = res.login_path;
} else {
this.showError(
`There was an error while processing your order: ${response.status} ${response.statusText} - ${res.error}`
`There was an error while processing your order: ${response.status} ${response.statusText} - ${res.error}`,
);
}
});
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/controllers/site/products_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class extends Controller {
if (cart) {
const cartArray = JSON.parse(cart);
const foundIndex = cartArray.findIndex(
(item) => item.id === this.productValue.id && item.size === this.sizeValue
(item) => item.id === this.productValue.id && item.size === this.sizeValue,
);

if (foundIndex >= 0) {
Expand All @@ -31,7 +31,7 @@ export default class extends Controller {
name: this.productValue.name,
price: this.productValue.price,
size: this.sizeValue,
quantity: 1
quantity: 1,
});
}
localStorage.setItem("cart", JSON.stringify(cartArray));
Expand All @@ -43,7 +43,7 @@ export default class extends Controller {
name: this.productValue.name,
price: this.productValue.price,
size: this.sizeValue,
quantity: 1
quantity: 1,
});
localStorage.setItem("cart", JSON.stringify(cartArray));
cartCountEl.innerText = cartArray.length;
Expand Down
4 changes: 4 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ FileUtils.chdir APP_ROOT do
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")

# The preferred way to manage Yarn is by-project and through Corepack, a tool shipped by default with Node.js.
# Start by enabling Corepack, if it isn't already; this will add the yarn binary to your PATH.
system! "corepack enable"

# Install JavaScript dependencies
system!("yarn install")

Expand Down
22 changes: 11 additions & 11 deletions config/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
"./app/javascript/**/*.js",
"./app/views/**/*.{erb,haml,html,slim}",
"./node_modules/flowbite/**/*.js",
"./public/*.html"
"./public/*.html",
],
darkMode: "media",
theme: {
Expand All @@ -24,8 +24,8 @@ module.exports = {
700: "#1d4ed8",
800: "#1e40af",
900: "#1e3a8a",
950: "#172554"
}
950: "#172554",
},
},
fontFamily: {
body: [
Expand All @@ -43,7 +43,7 @@ module.exports = {
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
"Noto Color Emoji"
"Noto Color Emoji",
],
sans: [
"Inter",
Expand All @@ -62,15 +62,15 @@ module.exports = {
"Segoe UI Symbol",
"Noto Color Emoji",
"Inter var",
...defaultTheme.fontFamily.sans
]
}
}
...defaultTheme.fontFamily.sans,
],
},
},
},
plugins: [
require("flowbite/plugin"),
require("@tailwindcss/forms"),
require("@tailwindcss/typography"),
require("@tailwindcss/container-queries")
]
require("@tailwindcss/container-queries"),
require("flowbite/plugin"),
],
};
6 changes: 3 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default [
"spec/",
"storage/",
"tmp/",
"vendor/"
]
}
"vendor/",
],
},
];
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
"local-time": "^3.0.2"
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"eslint": "9.x",
"@eslint/js": "^9.8.0",
"eslint": "^9.8.0",
"eslint-formatter-gha": "^1.5.0",
"globals": "^15.8.0",
"husky": "^9.1.1",
"husky": "^9.1.3",
"lint-staged": "^15.2.7",
"prettier": "^3.3.3"
},
Expand Down
Loading

0 comments on commit ab3a205

Please sign in to comment.