UNPKG

@arc-fusion/cli

Version:

CLI for running Arc Fusion on your local machine

29 lines (25 loc) 1.41 kB
'use strict' const path = require('path') const { dirExists, fileExists } = require('../bin/utils/promises') const { getDockerImage } = require('../bin/utils/docker') module.exports = async ({ PROJECT_ROOT, rebuild, themesVersion, cssVersion, sdkVersion, componentsVersion, npmLegacyPeerDeps }) => { const hasScripts = await dirExists(path.join(PROJECT_ROOT, 'scripts')) const hasNPMRC = await fileExists(path.join(PROJECT_ROOT, '.npmrc')) const hasBlocks = await fileExists(path.join(PROJECT_ROOT, 'blocks.json')) return ` ARG FUSION_RELEASE=latest FROM ${getDockerImage()} ${(hasBlocks && themesVersion) ? `ENV BLOCK_DIST_TAG=${themesVersion}` : ''} ${(hasBlocks && cssVersion) ? `ENV CSS_DIST_TAG=${cssVersion}` : ''} ${(hasBlocks && sdkVersion) ? `ENV ENGINE_SDK_DIST_TAG=${sdkVersion}` : ''} ${(hasBlocks && componentsVersion) ? `ENV THEME_COMPONENTS_DIST_TAG=${componentsVersion}` : ''} ${(npmLegacyPeerDeps) ? `ENV NPM_LEGACY_PEER_DEPS=${npmLegacyPeerDeps}` : ''} ${rebuild ? `RUN echo "rebuilding at ${Date.now()}"` : ''} # package.json and .npmrc will be copied from ./bundle/src/ back into ./bundle/ COPY ./package*.json ./bundle/src/ ${hasScripts ? 'COPY ./scripts/ ./bundle/scripts/' : ''} ${hasNPMRC ? 'COPY ./.npmrc ./bundle/src/' : ''} ${hasBlocks ? 'COPY ./blocks.json ./bundle/src' : ''} RUN npm run install:bundle ` }