Merge "Add @plugins_npm for plugin dependencies"
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -31,6 +31,8 @@
|
||||
/node_modules/
|
||||
/package-lock.json
|
||||
/plugins/*
|
||||
!/plugins/package.json
|
||||
!/plugins/yarn.lock
|
||||
!/plugins/BUILD
|
||||
!/plugins/codemirror-editor
|
||||
!/plugins/commit-message-length-validator
|
||||
|
||||
10
WORKSPACE
10
WORKSPACE
@@ -10,6 +10,8 @@
|
||||
# @ui_npm folder must not have devDependencies. All dev dependencies must be placed in @ui_dev_npm
|
||||
# 4. @ui_dev_npm (polygerrit-ui/node_modules) - devDependencies for polygerrit. The packages from these
|
||||
# folder can be used for testing, but must not be included in the final bundle.
|
||||
# 5. @plugins_npm (plugins/node_modules) - plugin dependencies for polygerrit plugins.
|
||||
# The packages here are expected to be used in plugins.
|
||||
# Note: separation between @ui_npm and @ui_dev_npm is necessary because with bazel we can't generate
|
||||
# two managed directories from the same package.json. At the same time we want to avoid accidental
|
||||
# usages of code from devDependencies in polygerrit bundle.
|
||||
@@ -20,6 +22,7 @@ workspace(
|
||||
"@ui_npm": ["polygerrit-ui/app/node_modules"],
|
||||
"@ui_dev_npm": ["polygerrit-ui/node_modules"],
|
||||
"@tools_npm": ["tools/node_tools/node_modules"],
|
||||
"@plugins_npm": ["plugins/node_modules"],
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1208,6 +1211,13 @@ yarn_install(
|
||||
yarn_lock = "//:tools/node_tools/yarn.lock",
|
||||
)
|
||||
|
||||
yarn_install(
|
||||
name = "plugins_npm",
|
||||
args = ["--prod"],
|
||||
package_json = "//:plugins/package.json",
|
||||
yarn_lock = "//:plugins/yarn.lock",
|
||||
)
|
||||
|
||||
# Install all Bazel dependencies needed for npm packages that supply Bazel rules
|
||||
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
|
||||
|
||||
|
||||
8
plugins/package.json
Normal file
8
plugins/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "polygerrit-plugin-dependencies-placeholder",
|
||||
"description": "Gerrit Code Review - Polygerrit plugin dependencies placeholder, expected to be overriden by plugins",
|
||||
"browser": true,
|
||||
"dependencies": {},
|
||||
"license": "Apache-2.0",
|
||||
"private": true
|
||||
}
|
||||
3
plugins/yarn.lock
Normal file
3
plugins/yarn.lock
Normal file
@@ -0,0 +1,3 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
# This is an empty placeholder
|
||||
@@ -14,6 +14,11 @@ So we recommend all plugin owners to start migrating to Polymer 3 for your plugi
|
||||
|
||||
To get inspirations, check out our [samples here](https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/samples).
|
||||
|
||||
### Plugin dependencies
|
||||
|
||||
Since most of Gerrit plugins are treated as sub modules and part of the Gerrit workspace when develop, dependencies of plugins are also defined and installed from Gerrit WORKSPACE, currently most of them are `bower_archives`. When moving to npm, if your plugin requires dependencies, you can have them added to your plugin's `package.json` and then link that file to `plugins/package.json` in gerrit.
|
||||
Then use `@plugins_npm//:node_modules` to make sure `rollup_bundle` knows the right place to look for. More examples from `image-diff` plugin, [change 271672](https://gerrit-review.googlesource.com/c/plugins/image-diff/+/271672).
|
||||
|
||||
### Related resources
|
||||
|
||||
- [Polymer 3.0 upgrade guide](https://polymer-library.polymer-project.org/3.0/docs/upgrade)
|
||||
|
||||
Reference in New Issue
Block a user