🔨 chore: Vite + Valet
This commit is contained in:
parent
dfe688c5ee
commit
e644f54839
5 changed files with 55 additions and 5 deletions
6
.idea/jsLibraryMappings.xml
Normal file
6
.idea/jsLibraryMappings.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptLibraryMappings">
|
||||
<includedPredefinedLibrary name="Node.js Core" />
|
||||
</component>
|
||||
</project>
|
7
product-preview-card-component/package-lock.json
generated
7
product-preview-card-component/package-lock.json
generated
|
@ -8,6 +8,7 @@
|
|||
"name": "product-preview-card-component",
|
||||
"version": "0.0.0",
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.2.5",
|
||||
"typescript": "^5.0.2",
|
||||
"vite": "^4.3.2"
|
||||
}
|
||||
|
@ -364,6 +365,12 @@
|
|||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.2.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz",
|
||||
"integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.17.19",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"preview": "vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.2.5",
|
||||
"typescript": "^5.0.2",
|
||||
"vite": "^4.3.2"
|
||||
}
|
||||
|
|
|
@ -3,21 +3,25 @@
|
|||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"lib": [
|
||||
"ES2020",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"moduleResolution": "node",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
|
|
32
product-preview-card-component/vite.config.ts
Normal file
32
product-preview-card-component/vite.config.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import * as fs from 'fs';
|
||||
import { homedir } from 'os';
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
server: detectServerConfig('frontend-mentor.test'),
|
||||
});
|
||||
|
||||
function detectServerConfig(host: string) {
|
||||
const keyPath = resolve(homedir(), `.config/valet/Certificates/${host}.key`);
|
||||
const certificatePath = resolve(homedir(), `.config/valet/Certificates/${host}.crt`);
|
||||
|
||||
if (!fs.existsSync(keyPath)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!fs.existsSync(certificatePath)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
host: host,
|
||||
hmr: {
|
||||
host: host,
|
||||
},
|
||||
https: {
|
||||
key: fs.readFileSync(keyPath),
|
||||
cert: fs.readFileSync(certificatePath),
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue