Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup package_example #670

Merged
merged 1 commit into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:
# TODO(gmagolan): move these tests into `build` job once
# https://github.com/bazelbuild/bazel/issues/6481 is resolved
- run: bazel test @examples_program//...
- run: bazel test @packages_example//...
- run: bazel test @internal_e2e_packages//...

build_release:
<<: *job_defaults
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local_repository(
)

local_repository(
name = "packages_example",
name = "internal_e2e_packages",
path = "internal/e2e/packages",
)

Expand Down Expand Up @@ -91,9 +91,9 @@ load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")

install_bazel_dependencies()

load("@packages_example//:setup_workspace.bzl", "packages_example_setup_workspace")
load("@internal_e2e_packages//:setup_workspace.bzl", "internal_e2e_packages_setup_workspace")

packages_example_setup_workspace()
internal_e2e_packages_setup_workspace()

# Dependencies to run skydoc
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
Expand Down
10 changes: 5 additions & 5 deletions internal/e2e/packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ VARIANTS = [
[jasmine_node_test(
name = "version_" + variant + "_test",
srcs = [variant + ".spec.js"],
node_modules = "@packages_example_" + variant + "//:node_modules",
node_modules = "@internal_e2e_packages_" + variant + "//:node_modules",
deps = [":test_version"],
) for variant in VARIANTS]

jasmine_node_test(
name = "npm_determinism_test",
srcs = ["npm_determinism.spec.js"],
data = ["@packages_example_npm_install//node_modules/jsesc:package.json"],
node_modules = "@packages_example_npm_install_duplicate_for_determinism_testing//:node_modules",
data = ["@internal_e2e_packages_npm_install//node_modules/jsesc:package.json"],
node_modules = "@internal_e2e_packages_npm_install_duplicate_for_determinism_testing//:node_modules",
)

jasmine_node_test(
name = "yarn_determinism_test",
srcs = ["yarn_determinism.spec.js"],
data = ["@packages_example_yarn_install//node_modules/jsesc:package.json"],
node_modules = "@packages_example_yarn_install_duplicate_for_determinism_testing//:node_modules",
data = ["@internal_e2e_packages_yarn_install//node_modules/jsesc:package.json"],
node_modules = "@internal_e2e_packages_yarn_install_duplicate_for_determinism_testing//:node_modules",
)
8 changes: 4 additions & 4 deletions internal/e2e/packages/WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
workspace(name = "packages_example")
workspace(name = "internal_e2e_packages")

local_repository(
name = "build_bazel_rules_nodejs",
Expand All @@ -10,8 +10,8 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "check_rules_nodejs_version", "node
# Test that check_rules_nodejs_version works as expected
check_rules_nodejs_version(minimum_version_string = "0.11.2")

node_repositories(package_json = ["//:package.json"])
node_repositories()

load(":setup_workspace.bzl", "packages_example_setup_workspace")
load(":setup_workspace.bzl", "internal_e2e_packages_setup_workspace")

packages_example_setup_workspace()
internal_e2e_packages_setup_workspace()
10 changes: 10 additions & 0 deletions internal/e2e/packages/npm1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js"
}
}
108 changes: 108 additions & 0 deletions internal/e2e/packages/npm2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions internal/e2e/packages/npm2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js"
}
}
10 changes: 10 additions & 0 deletions internal/e2e/packages/npm3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js"
}
}
4 changes: 2 additions & 2 deletions internal/e2e/packages/npm_determinism.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const packageJsonPath = require.resolve('jsesc').replace('jsesc.js', 'package.js
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath));

const packageJsonPath2 = packageJsonPath.replace(
'/packages_example_npm_install_duplicate_for_determinism_testing/',
'/packages_example_npm_install/');
'/internal_e2e_packages_npm_install_duplicate_for_determinism_testing/',
'/internal_e2e_packages_npm_install/');
const packageJson2 = JSON.parse(fs.readFileSync(packageJsonPath2));

describe('jsesc package.json files', () => {
Expand Down
6 changes: 0 additions & 6 deletions internal/e2e/packages/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js",
"pretest": "bazel run @nodejs//:yarn",
"test": "bazel test //..."
}
}
44 changes: 22 additions & 22 deletions internal/e2e/packages/setup_workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,46 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Helper function to setup @package_example workspace.
"""Helper function to setup @internal_e2e_packages workspace.
"""

load("@build_bazel_rules_nodejs//:defs.bzl", "npm_install", "yarn_install")

def packages_example_setup_workspace():
"""Node repositories for @packages_examples
def internal_e2e_packages_setup_workspace():
"""Node repositories for @internal_e2e_packagess
"""
npm_install(
name = "packages_example_npm_install",
package_json = "@packages_example//:package.json",
package_lock_json = "@packages_example//:package-lock.json",
data = ["@packages_example//:postinstall.js"],
name = "internal_e2e_packages_npm_install",
package_json = "@internal_e2e_packages//:npm1/package.json",
package_lock_json = "@internal_e2e_packages//:npm1/package-lock.json",
data = ["@internal_e2e_packages//:postinstall.js"],
# Just here as a smoke test for this attribute
prod_only = True,
)

npm_install(
name = "packages_example_npm_install_duplicate_for_determinism_testing",
package_json = "@packages_example//:package.json",
package_lock_json = "@packages_example//:package-lock.json",
data = ["@packages_example//:postinstall.js"],
name = "internal_e2e_packages_npm_install_duplicate_for_determinism_testing",
package_json = "@internal_e2e_packages//:npm2/package.json",
package_lock_json = "@internal_e2e_packages//:npm2/package-lock.json",
data = ["@internal_e2e_packages//:postinstall.js"],
)

npm_install(
name = "packages_example_npm_no_lockfile",
package_json = "@packages_example//:package.json",
data = ["@packages_example//:postinstall.js"],
name = "internal_e2e_packages_npm_no_lockfile",
package_json = "@internal_e2e_packages//:npm3/package.json",
data = ["@internal_e2e_packages//:postinstall.js"],
)

yarn_install(
name = "packages_example_yarn_install",
package_json = "@packages_example//:package.json",
yarn_lock = "@packages_example//:yarn.lock",
data = ["@packages_example//:postinstall.js"],
name = "internal_e2e_packages_yarn_install",
package_json = "@internal_e2e_packages//:yarn1/package.json",
yarn_lock = "@internal_e2e_packages//:yarn1/yarn.lock",
data = ["@internal_e2e_packages//:postinstall.js"],
)

yarn_install(
name = "packages_example_yarn_install_duplicate_for_determinism_testing",
package_json = "@packages_example//:package.json",
yarn_lock = "@packages_example//:yarn.lock",
data = ["@packages_example//:postinstall.js"],
name = "internal_e2e_packages_yarn_install_duplicate_for_determinism_testing",
package_json = "@internal_e2e_packages//:yarn2/package.json",
yarn_lock = "@internal_e2e_packages//:yarn2/yarn.lock",
data = ["@internal_e2e_packages//:postinstall.js"],
)
10 changes: 10 additions & 0 deletions internal/e2e/packages/yarn1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js"
}
}
File renamed without changes.
10 changes: 10 additions & 0 deletions internal/e2e/packages/yarn2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"description": "runtime dependencies for packages example",
"dependencies": {
"jsesc": "~1.2.0",
"jasmine": "2.8.0"
},
"scripts": {
"postinstall": "node ./postinstall.js"
}
}
Loading