Skip to content

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

Open
@fostertime

Description

@fostertime

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions