Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn dependency from the NodeJS Snap causes conflict with package.json files. #43

Open
fostertime opened this issue Sep 9, 2022 · 0 comments

Comments

@fostertime
Copy link

fostertime commented Sep 9, 2022

Yarn dependency from the NodeJS Snap causes conflict with package.json files as the Yarn package.json is never removed.

The below snapcraft.yaml is an example of how we are able to get around this, currently. But, is this the best way to handle this situation? Or is there a "best practice" method that we are not following?

name: beta-application
version: git
summary: BETA Application
description: |
  For Ubuntu Core 22 systems with the ubuntu-frame display server.

base: core22
confinement: strict
grade: devel
compression: lzo

architectures:
  - build-on: amd64
  - build-on: armhf
  - build-on: arm64

environment:
  PATH: '$SNAP/bin:$PATH'

apps:
  beta-application:
    command: bin/npm start

parts:
  snapstage:
    plugin: nil
    stage-snaps:
      - node/16/stable
    override-build: |
      craftctl default
      rm ${CRAFT_PART_INSTALL}/package.json
  beta-app:
    plugin: nil
    source: .
    after: [ snapstage ]
    build-environment:
      - PATH: "$PATH:$SNAPCRAFT_PART_BUILD/node_modules/.bin"
    override-build: |
      set +u
      npm install 2>&1
      cp -a src ${CRAFT_PART_INSTALL}
      cp -a node_modules ${CRAFT_PART_INSTALL}
      cp package.json ${CRAFT_PART_INSTALL}
    build-snaps:
      - node/16/stable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant