Skip to content

Commit 470adee

Browse files
committed
feat: setup linting, prettier and fix path issue for v2
1 parent 3b77666 commit 470adee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+18390
-15380
lines changed

.eslintignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.DS_Store
2+
node_modules/
3+
bundles/
4+
PIG/bundles/
5+
Parse-Dashboard/public/bundles/
6+
Parse-Dashboard/public/v2/
7+
Parse-Dashboard/v2/
8+
Parse-Dashboard/parse-dashboard-config.json
9+
npm-debug.log
10+
.eslintcache
11+
12+
// vim .swp
13+
*.swp
14+
.env
15+
.idea/
16+
17+
logs/
18+
test_logs
19+
20+
# visual studio code
21+
.vscode
22+
23+
.history
24+
.turbo
25+
26+
v2

.lintstagedrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "{src,webpack}/{**/*,*}.js": ["prettier --write", "eslint --fix --cache"] }

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ COPY --from=build /src/package*.json /src/
5353

5454
# Copy compiled src dirs
5555
COPY --from=build /src/Parse-Dashboard/ /src/Parse-Dashboard/
56-
COPY --from=v2-build /Parse-Dashboard/public/v2 /src/Parse-Dashboard/public/v2
56+
COPY --from=v2-build /Parse-Dashboard/v2 /src/Parse-Dashboard/v2
5757

5858
USER node
5959

Parse-Dashboard/app.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ module.exports = function (config, options) {
7171

7272
// Serve public files.
7373
app.use(express.static(path.join(__dirname, 'public')));
74+
app.use('/v2', express.static(path.join(__dirname, 'v2')));
7475

7576
// Allow setting via middleware
7677
if (config.trustProxy && app.disabled('trust proxy')) {
7778
app.enable('trust proxy');
7879
}
7980

8081
// wait for app to mount in order to get mountpath
81-
app.on('mount', function (parent) {
82-
parent.use('/v2/', express.static(path.join(__dirname, 'v2')));
82+
app.on('mount', function () {
8383
const mountPath = getMount(app.mountpath);
8484
const users = config.users;
8585
const useEncryptedPasswords = config.useEncryptedPasswords ? true : false;
@@ -1162,23 +1162,6 @@ You have direct access to the Parse database through function calls, so you can
11621162
} else {
11631163
if (options.dev) {
11641164
next();
1165-
} else {
1166-
res.send(`<!doctype html>
1167-
<html lang="en">
1168-
<head>
1169-
<base href="${mountPath}v2/"/>
1170-
<meta charset="UTF-8" />
1171-
<link rel="icon" type="image/svg+xml" href="${mountPath}v2/vite.svg" />
1172-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1173-
<title>Express serve</title>
1174-
<script type="module" crossorigin src="${mountPath}v2/index.bundle.js"></script>
1175-
<link rel="stylesheet" crossorigin href="${mountPath}v2/index.bundle.css">
1176-
</head>
1177-
<body>
1178-
<div id="root"></div>
1179-
</body>
1180-
</html>
1181-
`);
11821165
}
11831166
}
11841167
});

Parse-Dashboard/server.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,13 @@ module.exports = options => {
199199
)}`
200200
);
201201
});
202-
if (dev) {
202+
if (dev && fs.existsSync(path.join(__dirname, '../v2'))) {
203203
ViteExpress.config({
204204
inlineViteConfig: {
205205
base: `${mountPath}/v2/`,
206206
root: path.join(__dirname, '../v2'),
207-
build: {
208-
outDir: path.join(__dirname, './v2'),
209-
},
210207
},
211-
mode: dev && fs.existsSync(path.join(__dirname, '../v2')) ? 'development' : 'production',
208+
mode: 'development',
212209
});
213210
ViteExpress.bind(app, server);
214211
}

0 commit comments

Comments
 (0)