Remove disable-node option due to node being installed in the php-fpm container by default

This commit is contained in:
Daniel Winning 2025-04-24 01:12:48 +01:00
parent 7a5b393ed1
commit 13b27e0ec0
7 changed files with 13 additions and 41 deletions

View file

@ -43,9 +43,8 @@ Creates a new PHP development environment and mounts your project files.
> #### Option: --node
>
> Set which version of Node to install in your container. Is ignored if the `--disable-node` flag is
> passed, or if Node is disabled in your projects `spinner.yaml` file. Equivalent to setting
> `options.environment.node.version: x` in your projects Spinner config.
> Set which version of Node to install in your container. Equivalent to setting `options.environment.node.version: x`
> in your projects Spinner config.
> #### Option: --database
>
@ -59,11 +58,6 @@ Creates a new PHP development environment and mounts your project files.
> Does not install a database with your environment. Equivalent to setting `options.environment.database.enabled: false`
> in your Spinner config.
> #### Option: --disable-node
>
> Disables Node for your environment, so it isn't included in your PHP container. Equivalent to setting
> `options.environment.node.enabled: false` in your Spinner config.
> #### Option: --disable-server
>
> Does not install a webserver (so no Nginx). Useful if you just need a PHP container to run unit tests or something.

View file

@ -22,4 +22,13 @@ COPY ./opcache.ini "${PHP_INI_DIR}/conf.d"
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
WORKDIR /var/www/html
WORKDIR /var/www/html
ENV NVM_DIR /root/.nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install ${NODE_VERSION} \
&& nvm use ${NODE_VERSION}
COPY --from=node:${NODE_VERSION} /usr/local/bin/npx /usr/local/bin/npx

View file

@ -1,8 +0,0 @@
ENV NVM_DIR /root/.nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install ${NODE_VERSION} \
&& nvm use ${NODE_VERSION}
COPY --from=node:${NODE_VERSION} /usr/local/bin/npx /usr/local/bin/npx

View file

@ -4,7 +4,6 @@ options:
version: 8.4
xdebug: true
node:
enabled: true
version: 23
server:
enabled: true

View file

@ -58,18 +58,6 @@ class Config
return (float) $this->getEnvironmentOption('php', 'version');
}
/**
* @throws \Exception
*/
public function isNodeEnabled(InputInterface $input): bool
{
if ($input->getOption('disable-node')) {
return false;
}
return $this->getEnvironmentOption('node', 'enabled');
}
/**
* @throws \Exception
*/

View file

@ -36,11 +36,7 @@ class PHPDockerFileBuilder extends AbstractFileBuilder
$this->content .= $this->config->getConfigFileContents('php-fpm/Sqlite.Dockerfile');
}
if ($this->config->isNodeEnabled($input)) {
$this->addNewLine();
$this->content .= $this->config->getConfigFileContents('php-fpm/Node.Dockerfile');
$this->content = str_replace('${NODE_VERSION}', (string) $this->config->getNodeVersion($input), $this->content);
}
$this->content = str_replace('${NODE_VERSION}', (string) $this->config->getNodeVersion($input), $this->content);
if ($this->config->isXdebugEnabled($input)) {
$this->addNewLine();

View file

@ -48,12 +48,6 @@ class SpinCommand extends AbstractSpinnerCommand
InputOption::VALUE_OPTIONAL,
'The PHP version to use (e.g., 8.0).'
)
->addOption(
'disable-node',
null,
InputOption::VALUE_NONE,
'Set this flag to disable Node.js for your environment.'
)
->addOption(
'disable-server',
null,