Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit b7deedb

Browse files
committed
Create a devtools-components bundle
1 parent cb01459 commit b7deedb

File tree

8 files changed

+1474
-561
lines changed

8 files changed

+1474
-561
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
### How to create a new devtools-components release for mozilla-central.
2+
3+
Before you get started, you will need clones of devtools-components and mozilla-central, as well as
4+
a Bugzilla account.
5+
6+
```
7+
1. Prepare devtools-components release
8+
a. create a release branch on github
9+
b. update minor version in package.json, reset build version:
10+
v0.N.X -> v0.N+1.0
11+
 c. commit `release: bump devtools-components version to v0.N+1.0`
12+
 d. create a PR on Github for this release
13+
 e. make sure you have a configs/local.json file, with `firefox.mcPath` pointing to your mozilla-central clone
14+
15+
2. Copy to mozilla central
16+
a. update your mozilla-central clone to the latest
17+
 b. in reps, run yarn copy-assets (or node bin/copy-assets.js)`
18+
 c. create a new bug in Developer Tools: Shared Components [1]
19+
 d. commit 'Bug XXXXXXX - devtools-components v0.N+1.0: update devtools-components bundle from GitHub;r=reviewer'
20+
21+
3. Validate & cleanup
22+
a. push to try, test locally, submit for review etc ...
23+
b. while try fails or some problem is detected, go back to devtools-components, fix the issue,
24+
create a new bundle and go back to 2.a
25+
c. when everything is fine and the patch is r+, land on autoland/inbound
26+
d. merge the PR on github
27+
e. create a tag for devtools-components-v0.N+1.0 on github
28+
```
29+
30+
After that any issue with the bundle should be addressed with a new build version.
31+
Ideally, if the bundle has to be updated in mozilla-central for a bugfix, a corresponding
32+
tag should be created on GitHub.
33+
34+
[1] https://bugzilla.mozilla.org/enter_bug.cgi?product=Firefox&component=Developer%20Tools%3A%20Shared%20Components
35+
36+
37+
### How to publish a new devtools-components release to npm.
38+
39+
Steps to publish to npm :
40+
```
41+
1. Checkout the latest release tag
42+
a. git fetch --tags # get new tags from remote
43+
b. git checkout tags/devtools-components-v0.N+1.0 # checkout the tag created for the release
44+
2. npm login # Might ask your npm username and password
45+
3. npm publish
46+
```
47+
48+
To publish a new version of the package on npm, you need to :
49+
50+
1. have an npm account and
51+
2. be a collaborator on the package.
52+
53+
If you want to become a collaborator on the devtools-components package, please ask the other collaborators, either through IRC or Slack, or by filing an issue in this repo.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
const {
6+
tools: { makeBundle }
7+
} = require("devtools-launchpad/index");
8+
const fs = require("fs-extra");
9+
const path = require("path");
10+
const minimist = require("minimist");
11+
const getConfig = require("./getConfig");
12+
const { getValue, setConfig } = require("devtools-config");
13+
14+
const args = minimist(process.argv.slice(2), {
15+
boolean: ["watch", "symlink"]
16+
});
17+
18+
async function start() {
19+
try {
20+
console.log("start: copy assets");
21+
const projectPath = path.resolve(__dirname, "..");
22+
const mcModulePath = "devtools/client/shared/components";
23+
24+
const envConfig = getConfig();
25+
setConfig(envConfig);
26+
27+
const mcPath = getValue("firefox.mcPath");
28+
29+
console.log(" output path is:", mcPath);
30+
31+
console.log(" creating devtools-components.js bundle...");
32+
await makeBundle({
33+
outputPath: path.join(mcPath, mcModulePath),
34+
projectPath,
35+
watch: args.watch
36+
});
37+
console.log(" remove build artifacts...");
38+
fs.removeSync(path.join(mcPath, mcModulePath, "devtools-components.js.map"));
39+
console.log("done: copy assets");
40+
} catch (e) {
41+
console.error(e);
42+
}
43+
}
44+
45+
start();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
const merge = require("lodash").merge;
6+
const fs = require("fs");
7+
const path = require("path");
8+
9+
function getConfig() {
10+
const developmentConfig = require("../configs/development.json");
11+
12+
let localConfig = {};
13+
if (fs.existsSync(path.resolve(__dirname, "../configs/local.json"))) {
14+
localConfig = require("../configs/local.json");
15+
}
16+
17+
return merge({}, developmentConfig, localConfig);
18+
}
19+
20+
module.exports = getConfig;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"title": "devtools-components",
3+
"environment": "development",
4+
"logging": {
5+
"client": false,
6+
"firefoxProxy": false,
7+
"actions": false
8+
},
9+
"theme": "light",
10+
"firefox": {
11+
"webSocketConnection": false,
12+
"host": "localhost",
13+
"webSocketPort": 9000,
14+
"tcpPort": 6080,
15+
"mcPath": "./firefox"
16+
},
17+
"development": {
18+
"serverPort": 8000
19+
},
20+
"features": {}
21+
}

packages/devtools-components/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
import Tree from "./src/tree";
66

7-
export default {
7+
module.exports = {
88
Tree
99
};

packages/devtools-components/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "DevTools HTML Components",
55
"main": "index.js",
66
"scripts": {
7+
"copy-assets": "node bin/copy-assets",
78
"license-check": "devtools-license-check",
89
"storybook": "start-storybook -p 9002 -c .storybook",
910
"test": "jest"
@@ -22,13 +23,15 @@
2223
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
2324
"babel-preset-react": "^6.24.1",
2425
"devtools-license-check": "^0.5.1",
26+
"devtools-launchpad": "^0.0.100",
2527
"enzyme": "^2.8.2",
2628
"eslint": "^3.12.0",
2729
"eslint-plugin-mozilla": "0.2.3",
2830
"fs-extra": "^2.0.0",
2931
"jest": "^20.0.4",
3032
"jest-cli": "^20.0.4",
31-
"jest-flow-transform": "^1.0.1"
33+
"jest-flow-transform": "^1.0.1",
34+
"lodash": "^4.17.2"
3235
},
3336
"jest": {
3437
"rootDir": "src",

packages/devtools-components/webpack.config.js

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,47 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
module.exports = {
6-
module: {
7-
rules: [
8-
{
9-
test: /\.css$/,
10-
use: [
11-
{ loader: "style-loader" },
12-
{ loader: "css-loader", options: { importLoaders: 1 } }
13-
]
14-
},
15-
{
16-
test: /\.svg$/,
17-
loader: "svg-inline-loader"
18-
}
19-
]
5+
const { toolboxConfig } = require("devtools-launchpad/index");
6+
const getConfig = require("./bin/getConfig");
7+
const {isDevelopment} = require("devtools-config");
8+
9+
const path = require("path");
10+
const projectPath = path.join(__dirname);
11+
12+
const webpackConfig = {
13+
entry: {
14+
"devtools-components": path.join(projectPath, "index.js"),
15+
},
16+
17+
output: {
18+
path: path.join(__dirname, "assets/build"),
19+
filename: "[name].js",
20+
publicPath: "/assets/build",
21+
libraryTarget: "umd",
22+
},
23+
resolve: {
24+
alias: {
25+
"devtools/client/shared/vendor/react": "react",
26+
"devtools/client/shared/vendor/react-dom": "react-dom",
27+
"devtools/client/shared/vendor/react-dom-factories": "react-dom-factories",
28+
"devtools/client/shared/vendor/react-prop-types": "prop-types",
29+
"Services": path.join(__dirname,
30+
"node_modules/devtools-modules/client/shared/shim/Services"),
31+
}
2032
}
2133
};
34+
35+
const extra = {};
36+
webpackConfig.plugins = [];
37+
if (!isDevelopment()) {
38+
extra.excludeMap = {
39+
react: "devtools/client/shared/vendor/react",
40+
"react-dom": "devtools/client/shared/vendor/react-dom",
41+
"react-dom-factories": "devtools/client/shared/vendor/react-dom-factories",
42+
"prop-types": "devtools/client/shared/vendor/react-prop-types",
43+
lodash: "devtools/client/shared/vendor/lodash",
44+
};
45+
}
46+
47+
const envConfig = getConfig();
48+
module.exports = toolboxConfig(webpackConfig, envConfig, extra);

0 commit comments

Comments
 (0)