5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 14:51:41 +00:00

feat: usar pnpm si existe

relacionado con sutty/jekyll/sutty-base-jekyll-theme#53
This commit is contained in:
f 2023-02-06 16:09:51 -03:00
parent c789813a46
commit ea0539bb1f
2 changed files with 22 additions and 0 deletions

View file

@ -17,6 +17,8 @@ RUN wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pando
COPY ./monit.conf /etc/monit.d/sutty.conf
RUN apk add npm && npm install -g pnpm && apk del npm
VOLUME "/srv"
EXPOSE 3000

View file

@ -15,6 +15,7 @@ class DeployLocal < Deploy
def deploy(output: false)
return false unless mkdir
return false unless yarn(output: output)
return false unless pnpm(output: output)
return false unless bundle(output: output)
jekyll_build(output: output)
@ -91,6 +92,10 @@ class DeployLocal < Deploy
Rails.root.join('_yarn_cache').to_s
end
def pnpm_cache_dir
Rails.root.join('_pnpm_cache').to_s
end
def yarn_lock
File.join(site.path, 'yarn.lock')
end
@ -103,6 +108,14 @@ class DeployLocal < Deploy
run %(gem install bundler --no-document), output: output
end
def pnpm_lock
File.join(site.path, 'pnpm-lock.yaml')
end
def pnpm_lock?
File.exist? pnpm_lock
end
# Corre yarn dentro del repositorio
def yarn(output: false)
return true unless yarn_lock?
@ -114,6 +127,13 @@ class DeployLocal < Deploy
run %(bundle install --no-cache --path="#{gems_dir}" --clean --without test development), output: output
end
def pnpm
return true unless pnpm_lock?
run %(pnpm config set store-dir "#{pnpm_cache_dir}")
run 'pnpm install --production'
end
def jekyll_build(output: false)
run %(bundle exec jekyll build --trace --profile --destination "#{escaped_destination}"), output: output
end