diff --git a/changelog.md b/changelog.md index e9890f7..7f03012 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.7] - 2020-08-28 +### Changed + +- Add the `npm_lts` service and service to the stack to run `npm` commands on the current LTS version of node. + ## [0.5.6] - 2020-08-27 ### Changed diff --git a/containers/npm/Dockerfile b/containers/npm/Dockerfile index 0c8e22f..af83ef9 100644 --- a/containers/npm/Dockerfile +++ b/containers/npm/Dockerfile @@ -1,4 +1,6 @@ -FROM tarampampam/node:8.9-alpine +ARG NODE_VERSION=8.9 + +FROM tarampampam/node:${NODE_VERSION}-alpine RUN apk update && apk add curl && rm -rf /var/cache/apk/* diff --git a/src/commands/npm.php b/src/commands/npm.php index 6c6bc70..db34cde 100644 --- a/src/commands/npm.php +++ b/src/commands/npm.php @@ -3,7 +3,7 @@ namespace Tribe\Test; if ( $is_help ) { - echo "Runs an npm command in the stack.\n"; + echo "Runs an npm command in the stack using the node 8.9 container.\n"; echo PHP_EOL; echo colorize( "This command requires a use target set using the use command.\n" ); echo colorize( "usage: {$cli_name} npm [...]\n" ); diff --git a/src/commands/npm_lts.php b/src/commands/npm_lts.php new file mode 100644 index 0000000..a7491c5 --- /dev/null +++ b/src/commands/npm_lts.php @@ -0,0 +1,23 @@ +use command.\n" ); + echo colorize( "usage: {$cli_name} npm_lts [...]\n" ); + echo colorize( "example: {$cli_name} npm_lts install" ); + return; +} + +$using = tric_target(); +echo light_cyan( "Using {$using}\n" ); + +$command = $args( '...' ); +$pool = build_command_pool( 'npm_lts', $command, [ 'common' ] ); +$status = execute_command_pool( $pool ); + +exit( $status ); + + diff --git a/tric b/tric index b66966a..304c9b9 100755 --- a/tric +++ b/tric @@ -25,7 +25,7 @@ $args = args( [ ] ); $cli_name = basename( $argv[0] ); -const CLI_VERSION = '0.5.6'; +const CLI_VERSION = '0.5.7'; $cli_header = implode( ' - ', [ light_cyan( $cli_name ) . ' version ' . light_cyan( CLI_VERSION ), @@ -52,7 +52,8 @@ Available commands: here Sets the current plugins directory to be the one used by tric. init Initializes a plugin for use in tric. composer Runs a Composer command in the stack. -npm Runs an npm command in the stack. +npm Runs an npm command in the stack using the node 8.9 container. +npm_lts Runs an npm command in the stack using the node LTS container. target Runs a set of commands on a set of targets. xdebug Activates and deactivates XDebug in the stack, returns the current XDebug status or sets its values. airplane-mode Activates or deactivates the airplane-mode plugin. @@ -127,6 +128,7 @@ switch ( $subcommand ) { case 'interactive': case 'logs': case 'npm': + case 'npm_lts': case 'phpcs': case 'phpcbf': case 'reset': diff --git a/tric-stack.yml b/tric-stack.yml index 9e96371..e236afd 100644 --- a/tric-stack.yml +++ b/tric-stack.yml @@ -192,6 +192,8 @@ services: npm: build: context: containers/npm + args: + NODE_VERSION: 8.9 image: tric_npm user: "${DOCKER_RUN_UID:-}:${DOCKER_RUN_GID:-}" environment: @@ -203,6 +205,22 @@ services: # Share SSH keys with the container to pull from private repositories. - ${DOCKER_RUN_SSH_AUTH_SOCK}:/ssh-agent:ro + npm_lts: + build: + context: containers/npm + args: + NODE_VERSION: lts + image: tric_npm_lts + user: "${DOCKER_RUN_UID:-}:${DOCKER_RUN_GID:-}" + environment: + FIXUID: ${FIXUID:-1} + TRIC_CURRENT_PROJECT_SUBDIR: ${TRIC_CURRENT_PROJECT_SUBDIR:-} + volumes: + # Set the current plugin as project. + - ${TRIC_PLUGINS_DIR}/${TRIC_CURRENT_PROJECT:-test}:/project:cached + # Share SSH keys with the container to pull from private repositories. + - ${DOCKER_RUN_SSH_AUTH_SOCK}:/ssh-agent:ro + php: image: php:7.4-cli user: "${DOCKER_RUN_UID:-}:${DOCKER_RUN_GID:-}"