Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Visual Refresh] Fix theme package builds #8120

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/eui-theme-borealis/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
// We need to preserve comments as they are used by webpack for
// naming chunks during code-splitting. The compression step during
// bundling will remove them later.
comments: true,

presets: [
[
'@babel/env',
{
// `targets` property set via `.browserslistrc`
useBuiltIns: process.env.NO_COREJS_POLYFILL ? false : 'usage',
corejs: !process.env.NO_COREJS_POLYFILL ? '3.6' : undefined,
modules: process.env.BABEL_MODULES
? process.env.BABEL_MODULES === 'false'
? false
: process.env.BABEL_MODULES
: 'commonjs', // babel's default is commonjs
},
],
['@babel/react', { runtime: 'classic' }],
[
'@babel/typescript',
{ isTSX: true, allExtensions: true, allowDeclareFields: true },
],
],
};
18 changes: 15 additions & 3 deletions packages/eui-theme-borealis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
"license": "SEE LICENSE IN LICENSE.txt",
"scripts": {
"build:workspaces": "yarn workspaces foreach -Rti --from @elastic/eui-theme-borealis --exclude @elastic/eui-theme-borealis run build",
"build": "tsc",
"build:clean": "rimraf lib/",
"build": "yarn build:clean && yarn build:compile && yarn build:compile:cjs && yarn build:types",
"build:compile": "tsc --project ./tsconfig.json",
"build:compile:cjs": "NODE_ENV=production NO_COREJS_POLYFILL=true babel src --out-dir=lib/cjs --extensions .js,.ts,.tsx --source-maps=true",
"build:types": "NODE_ENV=production tsc --project tsconfig.types.json",
"build-pack": "yarn build && npm pack",
"lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-sass",
"lint-es": "eslint --cache src/**/*.ts --max-warnings 0",
Expand All @@ -20,6 +24,11 @@
},
"private": true,
"devDependencies": {
"@babel/cli": "^7.21.5",
"@babel/core": "^7.21.8",
"@babel/preset-env": "^7.21.5",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
"@elastic/eui-theme-common": "workspace:^",
"@types/jest": "^29.5.12",
"@types/prettier": "2.7.3",
Expand All @@ -33,6 +42,7 @@
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.7.0",
"prettier": "^2.8.8",
"rimraf": "^6.0.1",
"stylelint": "^15.7.0",
"stylelint-config-prettier-scss": "^1.0.0",
"stylelint-config-standard": "^33.0.0",
Expand All @@ -42,11 +52,13 @@
"peerDependencies": {
"@elastic/eui-theme-common": "0.0.1"
},
"main": "lib/index.js",
"main": "lib/cjs/index.js",
"exports": {
"./lib/*": "./lib/*",
".": {
"default": "./lib/index.js"
"require": "./lib/cjs/index.js",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
}
},
"files": [
Expand Down
29 changes: 29 additions & 0 deletions packages/eui-theme-borealis/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/cjs",
"target": "es6",
"module": "CommonJS",
"lib": [
"es6",
"DOM"
],
"moduleResolution": "Node",
"declaration": true,
"sourceMap": true,
"noEmitHelpers": true,
"incremental": true,
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"tsBuildInfoFile": "lib/cjs/.tsbuildinfo",
"importHelpers": false,
},
"include": [
"src"
],
"exclude": [
"node_modules"
],
}
46 changes: 27 additions & 19 deletions packages/eui-theme-borealis/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
"target": "ES2020",
"lib": ["ESNext", "DOM"],
"moduleResolution": "Node",
"declaration": true,
"sourceMap": true,
"noEmitHelpers": true,
"incremental": true,
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"tsBuildInfoFile": "lib/.tsbuildinfo"
},
"include": ["src"],
"exclude": ["node_modules"],
}
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/esm",
"target": "ES2020",
"module": "ESNext",
"lib": [
"ESNext",
"DOM"
],
"moduleResolution": "Node",
"declaration": true,
"sourceMap": true,
"noEmitHelpers": true,
"incremental": true,
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,
"tsBuildInfoFile": "lib/esm/.tsbuildinfo"
},
"include": [
"src",
],
"exclude": [
"node_modules"
],
}
13 changes: 13 additions & 0 deletions packages/eui-theme-borealis/tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "./tsconfig.cjs.json",
"compilerOptions": {
"outDir": "lib/cjs",
"declaration": true,
"declarationMap": true,
"isolatedModules": false,
"noEmit": false,
"allowJs": false,
"emitDeclarationOnly": true
},
"exclude": ["node_modules", "**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion packages/eui-theme-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build:clean": "rimraf lib/",
"build": "yarn build:clean && yarn build:compile && yarn build:compile:cjs && yarn build:types",
"build:compile": "tsc --project ./tsconfig.json",
"build:compile:cjs": "NODE_ENV=production babel src --out-dir=lib/cjs --extensions .js,.ts,.tsx --source-maps",
"build:compile:cjs": "NODE_ENV=production NO_COREJS_POLYFILL=true babel src --out-dir=lib/cjs --extensions .js,.ts,.tsx --source-maps=true",
"build:types": "NODE_ENV=production tsc --project tsconfig.types.json",
"build-pack": "yarn build && npm pack",
"lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-sass",
Expand Down
6 changes: 6 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5785,6 +5785,11 @@ __metadata:
version: 0.0.0-use.local
resolution: "@elastic/eui-theme-borealis@workspace:packages/eui-theme-borealis"
dependencies:
"@babel/cli": "npm:^7.21.5"
"@babel/core": "npm:^7.21.8"
"@babel/preset-env": "npm:^7.21.5"
"@babel/preset-react": "npm:^7.18.6"
"@babel/preset-typescript": "npm:^7.21.5"
"@elastic/eui-theme-common": "workspace:^"
"@types/jest": "npm:^29.5.12"
"@types/prettier": "npm:2.7.3"
Expand All @@ -5798,6 +5803,7 @@ __metadata:
eslint-plugin-prettier: "npm:^4.2.1"
jest: "npm:^29.7.0"
prettier: "npm:^2.8.8"
rimraf: "npm:^6.0.1"
stylelint: "npm:^15.7.0"
stylelint-config-prettier-scss: "npm:^1.0.0"
stylelint-config-standard: "npm:^33.0.0"
Expand Down