Skip to content

Commit

Permalink
chore: switched to yarn, updates to work with internal monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Jun 1, 2021
1 parent aba6a4e commit 9fef003
Show file tree
Hide file tree
Showing 13 changed files with 3,801 additions and 11,812 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/default-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,40 @@ name: default-ci-jobs
on: [push, pull_request]
jobs:
lint:
runs-on: macos-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 15.x
- run: npm ci
- run: npm run prettier-check
- run: npm run lint
- run: npm run bazel:lint
unit-tests:
runs-on: macos-latest

- name: Setup node_modules
run: yarn

- name: Lint checks
run: |
yarn prettier-check
yarn lint
yarn bazel:lint
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 15.x
- run: npm ci
- run: npm run test:unit
- uses: c-hive/gha-yarn-cache@v1
- uses: bazelbuild/setup-bazelisk@v1

- name: Build all targets
run: bazel build //...

- name: Run all unit tests
run: bazel test --test_tag_filters=unit //...
# TODO: blocked on running integration server through cypress - see issue #15
# e2e-tests:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# - run: npm run test:e2e
# - run: yarn test:e2e
2 changes: 1 addition & 1 deletion DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ or
npm install -g @bazel/bazelisk
```

`Bazel` will invoke `NPM` and manage all dependencies.
`Bazel` will invoke `Yarn` and manage all dependencies.

## `bazel` vs `ibazel`

Expand Down
8 changes: 4 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ http_archive(
# Check the rules_nodejs version and download npm dependencies
# Note: bazel (version 2 and after) will check the .bazelversion file so we don't need to
# assert on that.
load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "npm_install")
load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "yarn_install")

check_rules_nodejs_version(minimum_version_string = "2.2.0")

# Setup the Node.js toolchain
node_repositories(
node_version = "15.0.0",
node_version = "15.0.1",
package_json = ["//:package.json"],
)

npm_install(
yarn_install(
name = "npm",
package_json = "//:package.json",
package_lock_json = "//:package-lock.json",
yarn_lock = "//:yarn.lock",
)

load("@npm//@bazel/cypress:index.bzl", "cypress_repository")
Expand Down
22 changes: 19 additions & 3 deletions client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test", "js_library", "pkg_npm")
load("@npm//@bazel/esbuild:index.bzl", "esbuild")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load("@npm//@bazel/terser:index.bzl", "terser_minified")
load("@npm//@bazel/typescript:index.bzl", "ts_project")
Expand Down Expand Up @@ -31,6 +32,20 @@ ts_project(
# TODO: https://bazelbuild.github.io/rules_nodejs/TypeScript.html#ts_project-supports_workers
)

esbuild(
name = "client_cjs",
entry_point = "index.ts",
platform = "node",
tool = select({
"@bazel_tools//src/conditions:darwin": "@esbuild_darwin//:bin/esbuild",
"@bazel_tools//src/conditions:linux_x86_64": "@esbuild_linux//:bin/esbuild",
"@bazel_tools//src/conditions:windows": "@esbuild_windows//:esbuild.exe",
}),
deps = [
":client",
],
)

filegroup(
name = "project.d.ts",
srcs = [":project"],
Expand Down Expand Up @@ -114,10 +129,12 @@ api_extractor(
"--verbose",
"--local",
"--config",
"client/api-extractor.json",
"client/api-extractor-$(TARGET_CPU).json",
],
data = [
"api-extractor.json",
"api-extractor-darwin.json",
"api-extractor-k8.json",
":project",
"//:package.json",
"//:tsconfig.base.json",
Expand Down Expand Up @@ -148,12 +165,11 @@ pkg_npm(
substitutions = {"//internal/": "//"},
deps = [
":LICENSE",
":client_cjs",
":qwik",
":qwik.d.ts",
":qwik.min",
":qwikloader",
":qwikloader.min",
"//client/cjs:package.json",
"//client/cjs:qwik",
],
)
6 changes: 6 additions & 0 deletions client/api-extractor-darwin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",

"extends": "./api-extractor.json",
"projectFolder": "../bazel-out/darwin-fastbuild/bin"
}
6 changes: 6 additions & 0 deletions client/api-extractor-k8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",

"extends": "./api-extractor.json",
"projectFolder": "../bazel-out/k8-fastbuild/bin"
}
10 changes: 5 additions & 5 deletions client/api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* SUPPORTED TOKENS: <lookup>
* DEFAULT VALUE: "<lookup>"
*/
"projectFolder": "..",
"projectFolder": "../bazel-out/darwin-fastbuild/bin",

/**
* (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
Expand All @@ -45,7 +45,7 @@
*
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
*/
"mainEntryPointFilePath": "<projectFolder>/bazel-out/darwin-fastbuild/bin/client/index.d.ts",
"mainEntryPointFilePath": "<projectFolder>/client/index.d.ts",

/**
* A list of NPM package names whose exports should be treated as part of this package.
Expand Down Expand Up @@ -89,7 +89,7 @@
* DEFAULT VALUE: no overrideTsconfig section
*/
"overrideTsconfig": {
"include": ["./bazel-out/darwin-fastbuild/bin/client/index.d.ts"]
"include": [".//client/index.d.ts"]
}
/**
* This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
Expand Down Expand Up @@ -135,7 +135,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/etc/"
*/
"reportFolder": "<projectFolder>/bazel-out/darwin-fastbuild/bin/client",
"reportFolder": "<projectFolder>/client",

/**
* Specifies the folder where the temporary report file is written. The file name portion is determined by
Expand Down Expand Up @@ -195,7 +195,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
*/
"untrimmedFilePath": "<projectFolder>/bazel-out/darwin-fastbuild/bin/client/<unscopedPackageName>.d.ts"
"untrimmedFilePath": "<projectFolder>/client/<unscopedPackageName>.d.ts"

/**
* Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
Expand Down
34 changes: 0 additions & 34 deletions client/cjs/BUILD.bazel

This file was deleted.

9 changes: 0 additions & 9 deletions client/cjs/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions client/cjs/package.json

This file was deleted.

Loading

0 comments on commit 9fef003

Please sign in to comment.