-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathdetect
More file actions
executable file
·76 lines (60 loc) · 2.25 KB
/
detect
File metadata and controls
executable file
·76 lines (60 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
# bin/detect <build-dir>
[ "$BUILDPACK_XTRACE" ] && set -o xtrace
error() {
local c="2,999 s/^/ ! /"
# send all of our output to stderr
exec 1>&2
echo -e "\033[1;31m" # bold; red
echo -n " ! ERROR: "
# this will be fed from stdin
case $(uname) in
Darwin) sed -l "$c";; # mac/bsd sed: -l buffers on line boundaries
*) sed -u "$c";; # unix/gnu sed: -u unbuffered (arbitrary) chunks of data
esac
echo -e "\033[0m" # reset style
exit 1
}
if [ -f "$1/package.json" ]; then
echo 'Node.js'
exit 0
fi
if [[ -f "$1/.slugignore" ]] && grep -Fxq "package.json" "$1/.slugignore"; then
error << EOF
'package.json' listed in '.slugignore' file
The 'heroku/nodejs' buildpack is set on this application, but was
unable to detect a 'package.json' file. This is likely because
the '.slugignore' file is removing it before the build begins.
For more information, refer to the following documentation:
https://devcenter.heroku.com/articles/slug-compiler#ignoring-files-with-slugignore
EOF
elif [[ -f "$1/.gitignore" ]] && grep -Fxq "package.json" "$1/.gitignore"; then
error << EOF
'package.json' listed in '.gitignore' file
The 'heroku/nodejs' buildpack is set on this application, but was
unable to detect a 'package.json' file. This is likely because
the '.gitignore' file is preventing it from being checked in to
the git repo.
For more information, refer to the following documentation:
https://devcenter.heroku.com/articles/gitignore
EOF
else
error <<- EOF
Application not supported by 'heroku/nodejs' buildpack
The 'heroku/nodejs' buildpack is set on this application, but was
unable to detect a Node.js codebase.
A Node.js app on Heroku requires a 'package.json' at the root of
the directory structure.
If you are trying to deploy a Node.js application, ensure that this
file is present at the top level directory. This directory has the
following files:
$(ls -1p "$1")
If you are trying to deploy an application written in another
language, you need to change the list of buildpacks set on your
Heroku app using the 'heroku buildpacks' command.
For more information, refer to the following documentation:
https://devcenter.heroku.com/articles/buildpacks
https://devcenter.heroku.com/articles/nodejs-support#activation
EOF
fi
exit 1