Update scripts

pull/2413/head
Jérémy Rialland 2022-11-15 15:24:01 +01:00 committed by Jérémy Rialland
parent 660ae1164e
commit 7525eed9ee
10 changed files with 27 additions and 24 deletions

View File

@ -1,9 +1,10 @@
/* eslint-disable no-console */
import 'isomorphic-fetch'
import { exec } from 'child_process'
import dotenv from 'dotenv'
import { promisify } from 'util'
dotenv.config()
// Extrait la liste des liens référencés dans la base de code
const { stdout, stderr } = await promisify(exec)(
"rg -oNI -e 'https?://([\\w/_\\-?=%+@]|\\.\\w)+' -g '*.{yaml,ts,tsx,js,jsx}' -g '!*-en.yaml' ./ | sort | uniq"

View File

@ -1,8 +1,6 @@
import cors from '@koa/cors'
import Router from '@koa/router'
import 'dotenv/config'
import dotenv from 'dotenv'
import Koa from 'koa'
import koaBody from 'koa-body'
@ -19,6 +17,8 @@ import { initMongodb } from './mongodb.js'
import { getAccessToken } from './oauth.js'
import { snakeToCamelCaseKeys, validateCrispBody } from './utils.js'
dotenv.config()
const mongo = await initMongodb()
type KoaState = Koa.DefaultState

View File

@ -1,5 +1,6 @@
import 'dotenv/config.js'
import 'isomorphic-fetch'
import dotenv from 'dotenv'
dotenv.config()
const fetchApiStats = async (page, start, end, interval) => {
if (!process.env.PLAUSIBLE_API_KEY) {

View File

@ -1,13 +1,14 @@
// We publish our job offers on https://beta.gouv.fr/recrutement/. To augment
// their reach, we also publish a banner on our website automatically by using
// the beta.gouv.fr API.
import 'isomorphic-fetch'
import dotenv from 'dotenv'
import { promisify } from 'util'
import { parseString } from 'xml2js'
import { createDataDir, writeInDataDir } from './utils.js'
dotenv.config()
const parseXML = promisify(parseString)
main()

View File

@ -7,11 +7,12 @@
//
// If you want to fetch unpublished "draft" release, you should check the
// "public repo" authorization when generating the access token.
import 'dotenv/config.js'
import 'isomorphic-fetch'
import dotenv from 'dotenv'
import { createDataDir, writeInDataDir } from './utils.js'
dotenv.config()
// We use the GitHub API V4 in GraphQL to download the releases. A GraphQL
// explorer can be found here : https://developer.github.com/v4/explorer/
const githubAuthToken = process.env.GITHUB_API_SECRET

View File

@ -1,6 +1,4 @@
import 'dotenv/config.js'
import 'isomorphic-fetch'
import dotenv from 'dotenv'
import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
@ -8,6 +6,8 @@ import { fileURLToPath } from 'url'
import { apiStats } from './fetch-api-stats.js'
import { createDataDir, writeInDataDir } from './utils.js'
dotenv.config()
const matomoSiteVisitsHistory = JSON.parse(
fs.readFileSync(
path.join(fileURLToPath(import.meta.url), '..', 'matomoVisitHistory.json')

View File

@ -1,5 +1,3 @@
import 'isomorphic-fetch'
import { writeInDataDir } from './utils.js'
const CURRENT_YEAR = 2022

View File

@ -1,11 +1,11 @@
import 'dotenv/config.js'
import 'isomorphic-fetch'
import dotenv from 'dotenv'
import { readFileSync } from 'fs'
import yaml from 'yaml'
import rules from '../../../modele-social/dist/index.js'
dotenv.config()
const localesPath = new URL('../../source/locales/', import.meta.url).pathname
export let UiStaticAnalysisPath = localesPath + 'static-analysis-fr.json'
export let rulesTranslationPath = localesPath + 'rules-en.yaml'

View File

@ -1,6 +1,7 @@
import 'dotenv/config.js'
import algoliasearch from 'algoliasearch'
import dotenv from 'dotenv'
dotenv.config()
const {
ALGOLIA_APP_ID,

View File

@ -1,7 +1,5 @@
import algoliasearch from 'algoliasearch'
import 'dotenv/config.js'
import dotenv from 'dotenv'
import rawRules from 'modele-social'
import Engine, { ParsedRules } from 'publicodes'
@ -9,6 +7,8 @@ import getSimulationData, {
MetadataSrc,
} from '../../source/pages/Simulateurs/metadata-src.js'
dotenv.config()
const parsedRules = new Engine(rawRules).getParsedRules()
// @ts-ignore Needed by ts-node/esm