-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nate Allen
committed
Jan 7, 2020
0 parents
commit 1e2590b
Showing
5 changed files
with
806 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM debian:9.7-slim | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y curl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -sL https://deb.nodesource.com/setup_13.x | bash - | ||
|
||
RUN apt-get install -y nodejs | ||
RUN npm install -g yarn | ||
|
||
RUN chmod +x *.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Build Yarn and npm | ||
|
||
For building yarn or npm files. | ||
|
||
### What does this repo need | ||
|
||
* Tests and Validation | ||
* Complete documentation for usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: 'Build Yarn and npm' | ||
description: 'Builds Yarn or npm files' | ||
author: 'Linchpin' | ||
inputs: | ||
working_directory: | ||
description: 'The directory that contains the Yarn or npm files' | ||
required: false | ||
default: './' | ||
outputs: | ||
success: | ||
description: 'Did the build happen or not?' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
branding: | ||
icon: 'package' | ||
color: 'blue' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/bin/bash | ||
# If any commands fail (exit code other than 0) entire script exits | ||
set -e | ||
|
||
# See if our project has a gulpfile either in the root directory if it's a theme | ||
# or in the assets/ folder if it is a plugin | ||
|
||
composer_path="./composer.json" | ||
build_file_path="./gulpfile.js" | ||
bower_file_path="./bower.json" | ||
build_type=none | ||
|
||
# Go to the working directory (current directory by default) | ||
cd ${working_directory:-./} | ||
|
||
# If we have composer dependencies make sure they are installed | ||
if [ -f "$composer_path" ] | ||
then | ||
echo "Composer File found. Starting composer install." | ||
composer install | ||
fi | ||
|
||
if [ -f "$build_file_path" ] | ||
then | ||
echo "Gulpfile found. Starting build process" | ||
build_type=gulp | ||
else | ||
build_file_path="./gulpfile.babel.js" | ||
if [ -f "$build_file_path" ] | ||
then | ||
echo "Gulpfile w/ Babel found. Starting build process" | ||
build_type=gulp_yarn | ||
fi | ||
fi | ||
|
||
if [ "$build_type" == "none" ] | ||
then | ||
echo "Gulpfile not found. Searching for Gruntfile instead." | ||
build_file_path="./Gruntfile.js" | ||
if [ -f "$build_file_path" ] | ||
then | ||
echo "Gruntfile found." | ||
build_type=grunt | ||
else | ||
echo "No build file found. No build needed." | ||
fi | ||
fi | ||
|
||
# check to see our build type and if so build using either gulp or grunt | ||
if [ "$build_type" != "none" ] | ||
then | ||
if [ "$build_type" == "gulp_yarn" ] | ||
then | ||
echo "Yarn Install" | ||
yarn global add gulp-cli | ||
yarn install | ||
|
||
# Only build if the build:production task exists in the build path | ||
if grep -q build:production "$build_file_path"; | ||
then | ||
echo "Building project using gulp" | ||
gulp build:production | ||
fi | ||
else | ||
echo "Initiating NPM Install" | ||
npm install | ||
|
||
# Only install and fire bower if we have a bower.json | ||
if [ -f "$bower_file_path" ] | ||
then | ||
echo "Initiating Bower Install" | ||
|
||
npm install -g bower | ||
bower install | ||
fi | ||
|
||
if [ $build_type = "gulp" ] | ||
then | ||
if grep -q build:production "$build_file_path"; | ||
then | ||
echo "Building project using gulp" | ||
gulp build:production | ||
fi | ||
else | ||
# Make sure we have a build command within our grunt file | ||
if grep -q build "$build_file_path"; | ||
then | ||
echo "Building project using grunt" | ||
grunt build | ||
fi | ||
fi | ||
fi | ||
fi |