mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 12:51:55 +00:00
web: add empty build-config package (#25965)
This commit is contained in:
parent
3ebe2d0717
commit
e5dbb2a5e2
1
.github/workflows/lsif.yml
vendored
1
.github/workflows/lsif.yml
vendored
@ -49,6 +49,7 @@ jobs:
|
||||
root:
|
||||
- client/branded
|
||||
- client/browser
|
||||
- client/build-config
|
||||
- client/shared
|
||||
- client/web
|
||||
- client/wildcard
|
||||
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -59,6 +59,7 @@
|
||||
"./dev/release",
|
||||
"./client/web",
|
||||
"./client/browser",
|
||||
"./client/build-config",
|
||||
"./client/shared",
|
||||
"./client/branded",
|
||||
"./client/wildcard",
|
||||
|
||||
1
client/build-config/.eslintignore
Normal file
1
client/build-config/.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
out/
|
||||
13
client/build-config/.eslintrc.js
Normal file
13
client/build-config/.eslintrc.js
Normal file
@ -0,0 +1,13 @@
|
||||
// @ts-check
|
||||
|
||||
const baseConfig = require('../../.eslintrc.js')
|
||||
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc.js',
|
||||
parserOptions: {
|
||||
...baseConfig.parserOptions,
|
||||
project: [__dirname + '/tsconfig.json'],
|
||||
},
|
||||
rules: {},
|
||||
overrides: baseConfig.overrides,
|
||||
}
|
||||
3
client/build-config/README.md
Normal file
3
client/build-config/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Build config
|
||||
|
||||
Shared build configuration.
|
||||
5
client/build-config/babel.config.js
Normal file
5
client/build-config/babel.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
module.exports = {
|
||||
extends: '../../babel.config.js',
|
||||
}
|
||||
14
client/build-config/jest.config.js
Normal file
14
client/build-config/jest.config.js
Normal file
@ -0,0 +1,14 @@
|
||||
// @ts-check
|
||||
|
||||
const config = require('../../jest.config.base')
|
||||
|
||||
const exportedConfig = {
|
||||
...config,
|
||||
displayName: 'build-config',
|
||||
rootDir: __dirname,
|
||||
collectCoverage: false, // Collected through Puppeteer
|
||||
roots: ['<rootDir>'],
|
||||
verbose: true,
|
||||
}
|
||||
|
||||
module.exports = exportedConfig
|
||||
13
client/build-config/package.json
Normal file
13
client/build-config/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@sourcegraph/build-config",
|
||||
"version": "0.0.1",
|
||||
"description": "Sourcegraph Build configuration",
|
||||
"main": "./src/index.ts",
|
||||
"sideEffects": false,
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"eslint": "eslint --cache 'src/**/*.[jt]s?(x)'",
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
||||
1
client/build-config/src/index.ts
Normal file
1
client/build-config/src/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './paths'
|
||||
3
client/build-config/src/paths.ts
Normal file
3
client/build-config/src/paths.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import path from 'path'
|
||||
|
||||
export const ROOT_PATH = path.resolve(__dirname, '../../../')
|
||||
11
client/build-config/tsconfig.json
Normal file
11
client/build-config/tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"sourceRoot": "src",
|
||||
"rootDir": ".",
|
||||
"outDir": "./out",
|
||||
"baseUrl": "./src",
|
||||
},
|
||||
"include": ["./src/**/*", "./*.ts"],
|
||||
}
|
||||
@ -14,5 +14,8 @@
|
||||
"start:dll": "TS_NODE_TRANSPILE_ONLY=true WEBPACK_DLL_PLUGIN=true start-storybook -p 9001 -c ./src -s ./assets",
|
||||
"clean:dll": "rm -rf assets/dll-bundle storybook-static/*-stats.json",
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sourcegraph/build-config": "0.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,10 +17,11 @@ import webpack, {
|
||||
} from 'webpack'
|
||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
||||
|
||||
import { ROOT_PATH } from '@sourcegraph/build-config'
|
||||
|
||||
import { ensureDllBundleIsReady } from './dllPlugin'
|
||||
import { environment } from './environment-config'
|
||||
import {
|
||||
rootPath,
|
||||
monacoEditorPath,
|
||||
dllPluginConfig,
|
||||
dllBundleManifestPath,
|
||||
@ -35,18 +36,18 @@ import {
|
||||
|
||||
const getStoriesGlob = (): string[] => {
|
||||
if (process.env.STORIES_GLOB) {
|
||||
return [path.resolve(rootPath, process.env.STORIES_GLOB)]
|
||||
return [path.resolve(ROOT_PATH, process.env.STORIES_GLOB)]
|
||||
}
|
||||
|
||||
// Stories in `Chromatic.story.tsx` are guarded by the `isChromatic()` check. It will result in noop in all other environments.
|
||||
const chromaticStoriesGlob = path.resolve(rootPath, 'client/storybook/src/chromatic-story/Chromatic.story.tsx')
|
||||
const chromaticStoriesGlob = path.resolve(ROOT_PATH, 'client/storybook/src/chromatic-story/Chromatic.story.tsx')
|
||||
|
||||
// Due to an issue with constant recompiling (https://github.com/storybookjs/storybook/issues/14342)
|
||||
// we need to make the globs more specific (`(web|shared..)` also doesn't work). Once the above issue
|
||||
// is fixed, this can be removed and watched for `client/**/*.story.tsx` again.
|
||||
const directoriesWithStories = ['branded', 'browser', 'shared', 'web', 'wildcard']
|
||||
const storiesGlobs = directoriesWithStories.map(packageDirectory =>
|
||||
path.resolve(rootPath, `client/${packageDirectory}/src/**/*.story.tsx`)
|
||||
path.resolve(ROOT_PATH, `client/${packageDirectory}/src/**/*.story.tsx`)
|
||||
)
|
||||
|
||||
return [...storiesGlobs, chromaticStoriesGlob]
|
||||
@ -59,7 +60,7 @@ const getCSSLoaders = (...loaders: RuleSetUseItem[]): RuleSetUse => [
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sassOptions: {
|
||||
includePaths: [path.resolve(rootPath, 'node_modules'), path.resolve(rootPath, 'client')],
|
||||
includePaths: [path.resolve(ROOT_PATH, 'node_modules'), path.resolve(ROOT_PATH, 'client')],
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -157,8 +158,8 @@ const config = {
|
||||
config: [
|
||||
__filename,
|
||||
path.resolve(storybookWorkspacePath, 'babel.config.js'),
|
||||
path.resolve(rootPath, 'babel.config.js'),
|
||||
path.resolve(rootPath, 'postcss.config.js'),
|
||||
path.resolve(ROOT_PATH, 'babel.config.js'),
|
||||
path.resolve(ROOT_PATH, 'postcss.config.js'),
|
||||
path.resolve(__dirname, './webpack.config.dll.ts'),
|
||||
],
|
||||
},
|
||||
@ -172,7 +173,7 @@ const config = {
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: {
|
||||
cacheDirectory: true,
|
||||
configFile: path.resolve(rootPath, 'babel.config.js'),
|
||||
configFile: path.resolve(ROOT_PATH, 'babel.config.js'),
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -8,6 +8,6 @@
|
||||
"baseUrl": "./src",
|
||||
"jsx": "react",
|
||||
},
|
||||
"references": [{ "path": "../shared" }],
|
||||
"references": [{ "path": "../shared" }, { "path": "../build-config" }],
|
||||
"include": ["./src/**/*", "./*.ts"],
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ DIRS=(
|
||||
client/shared
|
||||
client/branded
|
||||
client/browser
|
||||
client/build-config
|
||||
client/wildcard
|
||||
client/extension-api
|
||||
client/eslint-plugin-sourcegraph
|
||||
|
||||
@ -7,6 +7,7 @@ const config = require('./jest.config.base')
|
||||
module.exports = {
|
||||
projects: [
|
||||
'client/browser/jest.config.js',
|
||||
'client/build-config/jest.config.js',
|
||||
'client/shared/jest.config.js',
|
||||
'client/branded/jest.config.js',
|
||||
'client/web/jest.config.js',
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"references": [
|
||||
{ "path": "client/build-config" },
|
||||
{ "path": "client/shared" },
|
||||
{ "path": "client/shared/src/testing" },
|
||||
{ "path": "client/branded" },
|
||||
|
||||
Loading…
Reference in New Issue
Block a user