Skip to content

Commit

Permalink
Storybook build has correct deps and works better with chrome://resou…
Browse files Browse the repository at this point in the history
…rces urls

and stub plural_string_proxy.js.ts so it does not error
  • Loading branch information
petemill committed Oct 15, 2022
1 parent e46493a commit fb9b2b1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .storybook/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ group("storybook") {
# are disabled in a regular brave build due to build flags,
# they will be generated before storybook is compiled.
deps = [
"//brave/components/brave_new_tab_ui:mojom_js",
"//brave/components/brave_shields/common:mojom_js",
"//brave/components/brave_today/common:mojom_js",
"//brave/components/brave_vpn/mojom:mojom_js",
"//brave/components/brave_wallet/common:mojom_js",
"//brave/components/speedreader/common:mojom_js",
"//mojo/public/js:bindings",
"//mojo/public/js:resources",
"//ui/webui/resources/js:cr.m",
"//ui/webui/resources/js:modulize",
"//ui/webui/resources/js:preprocess",
]
Expand Down
16 changes: 16 additions & 0 deletions .storybook/chrome-resources-mock/js/plural_string_proxy.js.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2022 The Brave Authors. All rights reserved.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// you can obtain one at http://mozilla.org/MPL/2.0/.

let instance: PluralStringProxyImpl | null = null

export class PluralStringProxyImpl {
static getInstance() {
return instance || (instance = new PluralStringProxyImpl())
}

getPluralString(key: string, count: number): Promise<string> {
return Promise.resolve(`${key}(${count})`)
}
}
2 changes: 1 addition & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = async ({ config, mode }) => {
// build, but has previously made a Component build, then an outdated
// version of a module will be used. Instead, accept a cli argument
// or environment variable containing which build target to use.
...getBuildOuptutPathList('gen/ui/webui/resources')
...getBuildOuptutPathList('gen/ui/webui/resources/preprocessed')
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ if (!is_ios) {
deps += [ ":packed_resources" ]
}
}

group("storybook") {
deps = [ "//brave/.storybook:storybook" ]
}
}

if (is_win) {
Expand Down Expand Up @@ -542,10 +546,6 @@ group("tools") {
}
}

group("storybook") {
deps = [ "//brave/.storybook:storybook" ]
}

if (is_redirect_cc_build) {
group("redirect_cc") {
deps = [ "//brave/tools/redirect_cc" ]
Expand Down

0 comments on commit fb9b2b1

Please sign in to comment.