Skip to content

Commit 14e7ee4

Browse files
authored
build(web): integrate nx (#16706)
1 parent 601c1cc commit 14e7ee4

File tree

6 files changed

+368
-67
lines changed

6 files changed

+368
-67
lines changed

apps/web/postcss.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
/* eslint-disable @typescript-eslint/no-require-imports */
2+
const path = require("path");
3+
24
module.exports = {
35
plugins: [
4-
require("postcss-import"),
6+
require("postcss-import")({
7+
path: [path.resolve(__dirname, "../../libs"), path.resolve(__dirname, "src/scss")],
8+
}),
59
require("postcss-nested"),
6-
require("tailwindcss"),
10+
require("tailwindcss")({ config: path.resolve(__dirname, "tailwind.config.js") }),
711
require("autoprefixer"),
812
],
913
};

apps/web/project.json

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
{
2+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
3+
"name": "web",
4+
"projectType": "application",
5+
"sourceRoot": "apps/web/src",
6+
"tags": ["scope:web", "type:app"],
7+
"targets": {
8+
"build": {
9+
"executor": "@nx/webpack:webpack",
10+
"outputs": ["{options.outputPath}"],
11+
"defaultConfiguration": "oss",
12+
"options": {
13+
"outputPath": "dist/apps/web",
14+
"webpackConfig": "apps/web/webpack.config.js",
15+
"tsConfig": "apps/web/tsconfig.json",
16+
"main": "apps/web/src/main.ts",
17+
"target": "web",
18+
"compiler": "tsc"
19+
},
20+
"configurations": {
21+
"oss": {
22+
"mode": "production",
23+
"outputPath": "dist/apps/web/oss"
24+
},
25+
"oss-dev": {
26+
"mode": "development",
27+
"outputPath": "dist/apps/web/oss-dev",
28+
"env": {
29+
"NODE_ENV": "development",
30+
"ENV": "development"
31+
}
32+
},
33+
"commercial": {
34+
"mode": "production",
35+
"outputPath": "dist/apps/web/commercial",
36+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
37+
"main": "bitwarden_license/bit-web/src/main.ts"
38+
},
39+
"commercial-dev": {
40+
"mode": "development",
41+
"outputPath": "dist/apps/web/commercial-dev",
42+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
43+
"main": "bitwarden_license/bit-web/src/main.ts",
44+
"env": {
45+
"NODE_ENV": "development",
46+
"ENV": "development"
47+
}
48+
},
49+
"commercial-qa": {
50+
"mode": "production",
51+
"outputPath": "dist/apps/web/commercial-qa",
52+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
53+
"main": "bitwarden_license/bit-web/src/main.ts",
54+
"env": {
55+
"NODE_ENV": "production",
56+
"ENV": "qa"
57+
}
58+
},
59+
"commercial-cloud": {
60+
"mode": "production",
61+
"outputPath": "dist/apps/web/commercial-cloud",
62+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
63+
"main": "bitwarden_license/bit-web/src/main.ts",
64+
"env": {
65+
"NODE_ENV": "production",
66+
"ENV": "cloud"
67+
}
68+
},
69+
"commercial-euprd": {
70+
"mode": "production",
71+
"outputPath": "dist/apps/web/commercial-euprd",
72+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
73+
"main": "bitwarden_license/bit-web/src/main.ts",
74+
"env": {
75+
"NODE_ENV": "production",
76+
"ENV": "euprd"
77+
}
78+
},
79+
"commercial-euqa": {
80+
"mode": "production",
81+
"outputPath": "dist/apps/web/commercial-euqa",
82+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
83+
"main": "bitwarden_license/bit-web/src/main.ts",
84+
"env": {
85+
"NODE_ENV": "production",
86+
"ENV": "euqa"
87+
}
88+
},
89+
"commercial-usdev": {
90+
"mode": "production",
91+
"outputPath": "dist/apps/web/commercial-usdev",
92+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
93+
"main": "bitwarden_license/bit-web/src/main.ts",
94+
"env": {
95+
"NODE_ENV": "production",
96+
"ENV": "usdev"
97+
}
98+
},
99+
"commercial-ee": {
100+
"mode": "production",
101+
"outputPath": "dist/apps/web/commercial-ee",
102+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
103+
"main": "bitwarden_license/bit-web/src/main.ts",
104+
"env": {
105+
"NODE_ENV": "production",
106+
"ENV": "ee"
107+
}
108+
},
109+
"oss-selfhost": {
110+
"mode": "production",
111+
"outputPath": "dist/apps/web/oss-selfhost",
112+
"env": {
113+
"ENV": "selfhosted",
114+
"NODE_ENV": "production"
115+
}
116+
},
117+
"oss-selfhost-dev": {
118+
"mode": "development",
119+
"outputPath": "dist/apps/web/oss-selfhost-dev",
120+
"env": {
121+
"NODE_ENV": "development",
122+
"ENV": "selfhosted"
123+
}
124+
},
125+
"commercial-selfhost": {
126+
"mode": "production",
127+
"outputPath": "dist/apps/web/commercial-selfhost",
128+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
129+
"main": "bitwarden_license/bit-web/src/main.ts",
130+
"env": {
131+
"ENV": "selfhosted",
132+
"NODE_ENV": "production"
133+
}
134+
},
135+
"commercial-selfhost-dev": {
136+
"mode": "development",
137+
"outputPath": "dist/apps/web/commercial-selfhost-dev",
138+
"webpackConfig": "bitwarden_license/bit-web/webpack.config.js",
139+
"main": "bitwarden_license/bit-web/src/main.ts",
140+
"env": {
141+
"NODE_ENV": "development",
142+
"ENV": "selfhosted"
143+
}
144+
}
145+
}
146+
},
147+
"serve": {
148+
"executor": "@nx/webpack:dev-server",
149+
"defaultConfiguration": "oss-dev",
150+
"options": {
151+
"buildTarget": "web:build",
152+
"host": "localhost",
153+
"port": 8080
154+
},
155+
"configurations": {
156+
"oss": {
157+
"buildTarget": "web:build:oss"
158+
},
159+
"oss-dev": {
160+
"buildTarget": "web:build:oss-dev"
161+
},
162+
"commercial": {
163+
"buildTarget": "web:build:commercial"
164+
},
165+
"commercial-dev": {
166+
"buildTarget": "web:build:commercial-dev"
167+
},
168+
"commercial-qa": {
169+
"buildTarget": "web:build:commercial-qa"
170+
},
171+
"commercial-cloud": {
172+
"buildTarget": "web:build:commercial-cloud"
173+
},
174+
"commercial-euprd": {
175+
"buildTarget": "web:build:commercial-euprd"
176+
},
177+
"commercial-euqa": {
178+
"buildTarget": "web:build:commercial-euqa"
179+
},
180+
"commercial-usdev": {
181+
"buildTarget": "web:build:commercial-usdev"
182+
},
183+
"commercial-ee": {
184+
"buildTarget": "web:build:commercial-ee"
185+
},
186+
"oss-selfhost": {
187+
"buildTarget": "web:build:oss-selfhost"
188+
},
189+
"oss-selfhost-dev": {
190+
"buildTarget": "web:build:oss-selfhost-dev"
191+
},
192+
"commercial-selfhost": {
193+
"buildTarget": "web:build:commercial-selfhost"
194+
},
195+
"commercial-selfhost-dev": {
196+
"buildTarget": "web:build:commercial-selfhost-dev"
197+
}
198+
}
199+
},
200+
"test": {
201+
"executor": "@nx/jest:jest",
202+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
203+
"options": {
204+
"jestConfig": "apps/web/jest.config.js"
205+
}
206+
},
207+
"lint": {
208+
"executor": "@nx/eslint:lint",
209+
"outputs": ["{options.outputFile}"],
210+
"options": {
211+
"lintFilePatterns": ["apps/web/**/*.ts", "apps/web/**/*.html"]
212+
}
213+
}
214+
}
215+
}

apps/web/tailwind.config.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
/* eslint-disable no-undef, @typescript-eslint/no-var-requires */
2+
const path = require("path");
23
const config = require("../../libs/components/tailwind.config.base");
34

45
config.content = [
5-
"./src/**/*.{html,ts}",
6-
"../../libs/components/src/**/*.{html,ts}",
7-
"../../libs/assets/src/**/*.{html,ts}",
8-
"../../libs/auth/src/**/*.{html,ts}",
9-
"../../libs/key-management-ui/src/**/*.{html,ts}",
10-
"../../libs/vault/src/**/*.{html,ts}",
11-
"../../libs/angular/src/**/*.{html,ts}",
12-
"../../libs/tools/generator/components/src/**/*.{html,ts}",
13-
"../../bitwarden_license/bit-web/src/**/*.{html,ts}",
6+
path.resolve(__dirname, "./src/**/*.{html,ts}"),
7+
path.resolve(__dirname, "../../libs/components/src/**/*.{html,ts}"),
8+
path.resolve(__dirname, "../../libs/assets/src/**/*.{html,ts}"),
9+
path.resolve(__dirname, "../../libs/auth/src/**/*.{html,ts}"),
10+
path.resolve(__dirname, "../../libs/key-management-ui/src/**/*.{html,ts}"),
11+
path.resolve(__dirname, "../../libs/vault/src/**/*.{html,ts}"),
12+
path.resolve(__dirname, "../../libs/angular/src/**/*.{html,ts}"),
13+
path.resolve(__dirname, "../../libs/tools/generator/components/src/**/*.{html,ts}"),
14+
path.resolve(__dirname, "../../bitwarden_license/bit-web/src/**/*.{html,ts}"),
1415
];
1516
config.corePlugins.preflight = true;
1617

0 commit comments

Comments
 (0)