53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/node/compiler.rb', line 53
def init_entrance
@entrance = File.expand_path(@entrance)
raise Error, "Cannot find entrance #{@entrance}." unless File.exist?(@entrance)
if @options[:project_root]
@project_root = File.expand_path(@options[:project_root])
else
@project_root = File.dirname(@entrance)
while !File.exist?(File.expand_path('./package.json', @project_root))
break if '/' == @project_root
@project_root = File.expand_path('..', @project_root)
end
end
unless File.exist?(File.expand_path('./package.json', @project_root))
raise Error, "Cannot find a package.json at the project root #{@project_root}"
end
end
|