Pass $(YARNFLAGS) to all yarn invocations
This let's you set things like YARNFLAGS==--offline which is helpful when you are on an airplane. Yarn can still pick up stuff that you had pulled down recently from its local cache
This commit is contained in:
parent
c5281d29f7
commit
6bab1dbad4
|
@ -246,17 +246,27 @@ func prepareProject(t *testing.T, srcDir string, lumiSrc string, opts LumiProgra
|
|||
}
|
||||
|
||||
// Now ensure dependencies are present.
|
||||
RunCommand(t, []string{opts.YarnBin, "install", "--verbose"}, dir, opts)
|
||||
RunCommand(t, withOptionalYarnFlags([]string{opts.YarnBin, "install", "--verbose"}), dir, opts)
|
||||
for _, dependency := range opts.Dependencies {
|
||||
RunCommand(t, []string{opts.YarnBin, "link", dependency}, dir, opts)
|
||||
RunCommand(t, withOptionalYarnFlags([]string{opts.YarnBin, "link", dependency}), dir, opts)
|
||||
}
|
||||
|
||||
// And finally compile it using whatever build steps are in the package.json file.
|
||||
RunCommand(t, []string{opts.YarnBin, "run", "build"}, dir, opts)
|
||||
RunCommand(t, withOptionalYarnFlags([]string{opts.YarnBin, "run", "build"}), dir, opts)
|
||||
|
||||
return dir, nil
|
||||
}
|
||||
|
||||
func withOptionalYarnFlags(args []string) []string {
|
||||
flags := os.Getenv("YARNFLAGS")
|
||||
|
||||
if flags != "" {
|
||||
return append(args, flags)
|
||||
}
|
||||
|
||||
return args
|
||||
}
|
||||
|
||||
// copyFile is a braindead simple function that copies a src file to a dst file. Note that it is not general purpose:
|
||||
// it doesn't handle symbolic links, it doesn't try to be efficient, it doesn't handle copies where src and dst overlap,
|
||||
// and it makes no attempt to preserve file permissions. It is what we need for this test package, no more, no less.
|
||||
|
|
|
@ -11,14 +11,14 @@ banner:
|
|||
|
||||
.PHONY: configure
|
||||
configure:
|
||||
yarn install
|
||||
yarn install $(YARNFLAGS)
|
||||
cd runtime/native && ./ensure_node_v8.sh
|
||||
cd runtime/native && ../../node_modules/.bin/node-gyp configure
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
@echo "\033[0;32mLINT:\033[0m"
|
||||
yarn run lint
|
||||
yarn run lint $(YARNFLAGS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
@ -27,16 +27,16 @@ clean:
|
|||
.PHONY: build
|
||||
build:
|
||||
@echo "\033[0;32mBUILD:\033[0m"
|
||||
yarn run build
|
||||
yarn run build $(YARNFLAGS)
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@echo "\033[0;32mTEST:\033[0m"
|
||||
yarn run test
|
||||
yarn run test $(YARNFLAGS)
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
@echo "\033[0;32mINSTALL:\033[0m"
|
||||
cp package.json bin/
|
||||
cd bin/ && yarn link
|
||||
cd bin/ && yarn link $(YARNFLAGS)
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
"repository": "https://github.com/pulumi/pulumi/sdk/nodejs",
|
||||
"scripts": {
|
||||
"clean": "rm -rf bin/ && rm -rf runtime/native/build",
|
||||
"build": "yarn run copyprotos && yarn run buildnative && tsc && yarn run binplace && yarn run lint",
|
||||
"build": "yarn run copyprotos ${YARNFLAGS} && yarn run buildnative ${YARNFLAGS} && tsc && yarn run binplace ${YARNFLAGS} && yarn run lint ${YARNFLAGS}",
|
||||
"buildnative": "cd runtime/native/ && node-gyp build",
|
||||
"lint": "tslint '{,!(node_modules|bin)/!(bin|node_modules)**/}(*.d).ts'",
|
||||
"copyprotos": "cp -R ../proto/nodejs/. proto/",
|
||||
"binplaceprotos": "cp -R proto/. bin/proto/",
|
||||
"binplacenative": "mkdir -p bin/runtime/native/ && cp -R runtime/native/build/. bin/runtime/native/build/",
|
||||
"binplacetestdata": "mkdir -p bin/tests/runtime/langhost/cases/ && find tests/runtime/langhost/cases/* -type d -exec cp -R {} bin/tests/runtime/langhost/cases/ \\;",
|
||||
"binplace": "yarn run binplaceprotos && yarn run binplacenative && yarn run binplacetestdata",
|
||||
"test": "yarn run cov && yarn run covreport",
|
||||
"binplace": "yarn run binplaceprotos ${YARNFLAGS} && yarn run binplacenative ${YARNFLAGS} && yarn run binplacetestdata ${YARNFLAGS}",
|
||||
"test": "yarn run cov ${YARNFLAGS} && yarn run covreport ${YARNFLAGS}",
|
||||
"cov": "istanbul cover --print none node_modules/.bin/_mocha -- --timeout 15000 'bin/tests/**/*.spec.js'",
|
||||
"covreport": "istanbul report text-summary && istanbul report text"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue