parent
95626d821d
commit
6d391f76a9
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
yarn pre-commit
|
|
@ -13,7 +13,6 @@
|
|||
"site"
|
||||
],
|
||||
"scripts": {
|
||||
"pre-commit": "yarn workspaces foreach -pi run pre-commit",
|
||||
"scalingo-postbuild": "CI=true ; yarn test:type && yarn workspaces focus api && yarn workspace api run build && yarn workspaces focus --all && yarn test && yarn workspaces focus api --production",
|
||||
"lint:eslintrc": "npx eslint-config-prettier .eslintrc.cjs",
|
||||
"lint:eslint": "NODE_OPTIONS='--max-old-space-size=4096' eslint .",
|
||||
|
@ -22,7 +21,7 @@
|
|||
"lint:prettier:fix": "yarn lint:prettier --write",
|
||||
"lint:fix": "yarn lint:eslint:fix ; yarn lint:prettier:fix",
|
||||
"lint": "yarn lint:eslintrc && yarn lint:eslint && yarn lint:prettier",
|
||||
"postinstall": "husky install && yarn workspaces foreach -piv --exclude site run prepack",
|
||||
"postinstall": "yarn workspaces foreach -piv --exclude site run prepack",
|
||||
"test": "CI=true yarn workspaces foreach run test",
|
||||
"test:type": "yarn workspaces foreach -pi run tsc --skipLibCheck --noEmit",
|
||||
"clean": "yarn workspaces foreach run clean && rimraf node_modules",
|
||||
|
@ -51,7 +50,6 @@
|
|||
"eslint-plugin-promise": "^6.0.0",
|
||||
"eslint-plugin-react": "^7.30.0",
|
||||
"eslint-plugin-react-hooks": "^4.5.0",
|
||||
"husky": "^8.0.0",
|
||||
"prettier": "^2.6.2",
|
||||
"rimraf": "^3.0.2"
|
||||
},
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
"not ie < 11"
|
||||
],
|
||||
"scripts": {
|
||||
"pre-commit": "ts-node-esm scripts/preCommit/index.ts",
|
||||
"build:yaml-to-dts": "ts-node-esm scripts/build-yaml-to-dts.ts",
|
||||
"postinstall": "node scripts/prepare.js",
|
||||
"start": "vite dev",
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
import { execOnFileChange } from './execOnFileChange.js'
|
||||
|
||||
console.log('Search for changed file...')
|
||||
|
||||
const results = await execOnFileChange({
|
||||
basePath: './',
|
||||
depsPath: '.deps.json',
|
||||
options: [
|
||||
{
|
||||
paths: [
|
||||
'./source/pages/Simulateurs/EconomieCollaborative/activités.yaml',
|
||||
'./source/pages/Simulateurs/EconomieCollaborative/activités.en.yaml',
|
||||
],
|
||||
run: 'yarn build:yaml-to-dts',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
results
|
||||
.filter(<T>(x: null | T): x is T => !!x)
|
||||
.forEach(({ fileChanged, run, result }) => {
|
||||
console.log('Changed file detected:', fileChanged)
|
||||
console.log('Execute:', run, '\n')
|
||||
|
||||
if (result.stdout) {
|
||||
console.log(result.stdout)
|
||||
}
|
||||
if (result.stderr) {
|
||||
console.error(result.stderr)
|
||||
}
|
||||
})
|
|
@ -0,0 +1,33 @@
|
|||
import { execOnFileChange } from './execOnFileChange.js'
|
||||
|
||||
export const runScriptOnFileChange = async () => {
|
||||
console.log('Search for changed file...')
|
||||
|
||||
const results = await execOnFileChange({
|
||||
basePath: './',
|
||||
depsPath: '.deps.json',
|
||||
options: [
|
||||
{
|
||||
paths: [
|
||||
'./source/pages/Simulateurs/EconomieCollaborative/activités.yaml',
|
||||
'./source/pages/Simulateurs/EconomieCollaborative/activités.en.yaml',
|
||||
],
|
||||
run: 'yarn build:yaml-to-dts',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
results
|
||||
.filter(<T>(x: null | T): x is T => !!x)
|
||||
.forEach(({ fileChanged, run, result }) => {
|
||||
console.log('Changed file detected:', fileChanged)
|
||||
console.log('Execute:', run, '\n')
|
||||
|
||||
if (result.stdout) {
|
||||
console.log(result.stdout)
|
||||
}
|
||||
if (result.stderr) {
|
||||
console.error(result.stderr)
|
||||
}
|
||||
})
|
||||
}
|
|
@ -10,6 +10,7 @@ import serveStatic from 'serve-static'
|
|||
import { defineConfig, loadEnv, Plugin } from 'vite'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
import shimReactPdf from 'vite-plugin-shim-react-pdf'
|
||||
import { runScriptOnFileChange } from './scripts/runScriptOnFileChange'
|
||||
|
||||
const env = (mode: string) => loadEnv(mode, process.cwd(), '')
|
||||
|
||||
|
@ -23,6 +24,15 @@ export default defineConfig(({ command, mode }) => ({
|
|||
sourcemap: true,
|
||||
},
|
||||
plugins: [
|
||||
{
|
||||
name: 'run-script-on-file-change',
|
||||
apply: 'serve',
|
||||
buildStart() {
|
||||
if (mode === 'development') {
|
||||
void runScriptOnFileChange()
|
||||
}
|
||||
},
|
||||
},
|
||||
command === 'build' &&
|
||||
replace({
|
||||
__SENTRY_DEBUG__: false,
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -17566,15 +17566,6 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"husky@npm:^8.0.0":
|
||||
version: 8.0.1
|
||||
resolution: "husky@npm:8.0.1"
|
||||
bin:
|
||||
husky: lib/bin.js
|
||||
checksum: 943a73a13d0201318fd30e83d299bb81d866bd245b69e6277804c3b462638dc1921694cb94c2b8c920a4a187060f7d6058d3365152865406352e934c5fff70dc
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"hyphen@npm:^1.6.4":
|
||||
version: 1.6.4
|
||||
resolution: "hyphen@npm:1.6.4"
|
||||
|
@ -24821,7 +24812,6 @@ __metadata:
|
|||
eslint-plugin-promise: ^6.0.0
|
||||
eslint-plugin-react: ^7.30.0
|
||||
eslint-plugin-react-hooks: ^4.5.0
|
||||
husky: ^8.0.0
|
||||
prettier: ^2.6.2
|
||||
rimraf: ^3.0.2
|
||||
languageName: unknown
|
||||
|
|
Loading…
Reference in New Issue