Skip to content

Commit

Permalink
Merge branch 'main' into typescript-dev-guide
Browse files Browse the repository at this point in the history
  • Loading branch information
mrigankmg committed Aug 29, 2024
2 parents 1853712 + 9d3589e commit d89a41c
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 51 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ If the changes are larger (API design, architecture, etc), [opening an issue](ht
* [Signed Commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification). For convenience it is recommended to set git to sign all commits by default as mentioned [here](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key)

## Building and Testing Locally (All platforms)

> This project also contains [just](https://github.com/casey/just) recipes for many common commands. They can be listed using `just -l`
### Player
For speed and consistency, this repo leverages `bazel` as it's main build tool. Check out the [bazel](https://bazel.build/) docs for more info.

Expand Down
15 changes: 13 additions & 2 deletions DEV_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,34 @@ plugins/example

To scaffold your plugin, create a new create a new `core` or `react` folder in the appropriate plugin directory, with the appropriate folders, a package.json and a blank `BUILD.bazel`:

For core plugins:
```bash
mkdir -p plugins/example-plugin/core/src
cd plugins/example-plugin/core
pnpm init
touch BUILD.bazel
```

or for React plugins:
For react plugins:
```bash
mkdir -p plugins/example-plugin/react/src
cd plugins/example-plugin/react
pnpm init
touch BUILD.bazel
```

For both, core and react, set the name, version, and entry point of the package:
Set the name, version, and entry point of the package in the `package.json`:

For core plugins:
```javascript
{
"name": "@player-ui/example-plugin",
"version": "0.0.0-PLACEHOLDER",
"main": "src/index.ts",
}
```

For react plugins:
```javascript
{
"name": "@player-ui/example-plugin",
Expand Down
53 changes: 53 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[doc('Build all JS/TS files')]
build-js:
bazel build -- $(bazel query "kind(npm_package, //...)" --output label 2>/dev/null | tr '\n' ' ')

[doc('Build all core JS/TS files')]
build-core:
bazel build //core/...

[doc('Test targets in the project')]
test-all:
bazel test //...

[doc('Test all JS/TS files')]
test-js:
bazel test -- $(bazel query "kind(js_test, //...)" --output label 2>/dev/null | tr '\n' ' ')

[doc('Test all core JS/TS files')]
test-core:
bazel test //core/...

[doc('Lint all JS/TS files')]
lint-js:
bazel test -- $(bazel query "kind(js_test, //...) intersect attr(name, 'eslint$', //...)" --output label 2>/dev/null | tr '\n' ' ')

[doc('Run a dev server of the main docs page')]
start-docs:
bazel run //docs/site:start

[doc('Run a dev server of storybook')]
start-storybook:
bazel run //docs/storybook:start

[doc('Install all generated artifacts into the system .m2 repository')]
mvn-install:
#!/usr/bin/env bash
set -u -e -o pipefail
# Find all the maven packages in the repo
readonly DEPLOY_LABELS=$(bazel query --output=label 'kind("maven_publish rule", //...) - attr("tags", "\[.*do-not-publish.*\]", //...)')
for pkg in $DEPLOY_LABELS ; do
bazel run "$pkg" --define=maven_repo="file://$HOME/.m2/repository"
done

alias maven-install := mvn-install

[doc('Generate and open the xcodeproj for Player')]
dev-ios:
bazel run //ios:xcodeproj
open -a Xcode ios/PlayerUI.xcodeproj/

[doc('Build and run the iOS demo app in a simulator')]
start-ios-demo:
bazel run //ios/demo:PlayerUIDemo
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
"type": "git",
"url": "https://github.com/player-ui/player.git"
},
"scripts": {
"dev:docs": "ibazel run //docs/site:start",
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx $(scripts/pkg-roots.sh)",
"prepare": "is-ci || husky install",
"test": "bazel test -- $(bazel query \"kind(nodejs_test, //...)\" --output label 2>/dev/null | tr '\\n' ' ')"
},
"engines": {
"node": "^20.14.0",
"pnpm": "^8.9.2"
Expand Down Expand Up @@ -116,7 +110,7 @@
"husky": "^7.0.2",
"is-ci-cli": "^2.2.0",
"lcov-result-merger": "^3.1.0",
"leven":"4.0.0",
"leven": "4.0.0",
"lint-staged": "^11.2.3",
"lucide-react": "^0.316.0",
"lunr": "^2.3.9",
Expand Down
9 changes: 0 additions & 9 deletions scripts/mvn-install.sh

This file was deleted.

1 change: 0 additions & 1 deletion scripts/pkg-roots.sh

This file was deleted.

32 changes: 0 additions & 32 deletions scripts/yarn-link-setup.js

This file was deleted.

0 comments on commit d89a41c

Please sign in to comment.