Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
6edb96af
Unverified
Commit
6edb96af
authored
2 years ago
by
Derek
Committed by
GitHub
2 years ago
Browse files
Options
Download
Email Patches
Plain Diff
tools: use yarn script in scaffolder (#2436)
parent
1cea2f62
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/scaffolding/scaffolder.go
+22
-4
tools/scaffolding/scaffolder.go
with
22 additions
and
4 deletions
+22
-4
tools/scaffolding/scaffolder.go
+
22
-
4
View file @
6edb96af
...
...
@@ -79,6 +79,23 @@ func determineGoPath() string {
return
strings
.
TrimSpace
(
string
(
goPathOut
))
}
func
determineYarnPath
()
string
{
path
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
yarnScript
:=
filepath
.
Join
(
path
,
".."
,
".."
,
"build"
,
"bin"
,
"yarn.sh"
)
scriptPath
,
err
:=
exec
.
LookPath
(
yarnScript
)
if
err
!=
nil
{
path
,
err
:=
exec
.
LookPath
(
"yarn"
)
if
err
!=
nil
{
log
.
Fatal
(
"could not find yarn executable to use"
)
}
return
path
}
return
scriptPath
}
func
determineUsername
()
string
{
u
,
err
:=
user
.
Current
()
if
err
!=
nil
{
...
...
@@ -209,24 +226,25 @@ func generateAPI(args *args, tmpFolder, dest string) {
func
generateFrontend
(
args
*
args
,
tmpFolder
,
dest
string
)
{
// Update clutch.config.js for new workflow
log
.
Println
(
"Compiling workflow, this may take a few minutes..."
)
log
.
Println
(
"cd"
,
tmpFolder
,
"&& yarn --frozen-lockfile && yarn tsc && yarn compile"
)
yarn
:=
determineYarnPath
()
log
.
Println
(
"cd"
,
tmpFolder
,
"&&"
,
yarn
,
"--frozen-lockfile &&"
,
yarn
,
"tsc && "
,
yarn
,
"compile"
)
if
err
:=
os
.
Chdir
(
tmpFolder
);
err
!=
nil
{
log
.
Fatal
(
err
)
}
installCmd
:=
exec
.
Command
(
"
yarn
"
,
"--frozen-lockfile"
)
installCmd
:=
exec
.
Command
(
yarn
,
"--frozen-lockfile"
)
if
out
,
err
:=
installCmd
.
CombinedOutput
();
err
!=
nil
{
fmt
.
Println
(
string
(
out
))
log
.
Fatal
(
"`yarn --frozen-lockfile` returned the above error"
)
}
compileTypesCmd
:=
exec
.
Command
(
"
yarn
"
,
"tsc"
)
compileTypesCmd
:=
exec
.
Command
(
yarn
,
"tsc"
)
if
out
,
err
:=
compileTypesCmd
.
CombinedOutput
();
err
!=
nil
{
fmt
.
Println
(
string
(
out
))
log
.
Fatal
(
"`yarn tsc` returned the above error"
)
}
compileDevCmd
:=
exec
.
Command
(
"
yarn
"
,
"compile"
)
compileDevCmd
:=
exec
.
Command
(
yarn
,
"compile"
)
if
out
,
err
:=
compileDevCmd
.
CombinedOutput
();
err
!=
nil
{
fmt
.
Println
(
string
(
out
))
log
.
Fatal
(
"`yarn compile` returned the above error"
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help