Skip to content

Commit

Permalink
metrics: convert to ES module
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Jul 2, 2024
1 parent 19556d2 commit 3e58607
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { Storage } = require('@google-cloud/storage')
import { Storage } from '@google-cloud/storage';
import express, { json } from 'express';

const storage = new Storage();
const express = require('express')
const app = express()
app.use(express.json())
app.use(json())

async function getFileList() {

Expand Down Expand Up @@ -53,4 +54,4 @@ app.post('/', async (req, res) => {
console.log('Listening on port: ', port)
})

module.exports = app
export default app
1 change: 1 addition & 0 deletions ansible/roles/metrics/files/index-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "index-generator.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"index-generator": "node --trace-warnings index-generator.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "process-cloudflare.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"processLogs": "node --trace-warnings process-cloudflare.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

'use strict'

const { Storage } = require('@google-cloud/storage')
const express = require('express')
const app = express()
import { Storage } from '@google-cloud/storage'
import express, { json } from 'express'

app.use(express.json())
const app = express()
app.use(json())

const extensionRe = /\.(tar\.gz|tar\.xz|pkg|msi|exe|zip|7z)$/
const uriRe = /(\/+(dist|download\/+release)\/+(node-latest\.tar\.gz|([^/]+)\/+((win-x64|win-x86|win-arm64|x64)?\/+?node\.exe|(x64\/)?node-+(v[0-9.]+)[.-]([^? ]+))))/
Expand Down Expand Up @@ -230,4 +230,4 @@ app.listen(port, () => {
console.log('Listening on port: ', port)
})

module.exports = app
export default app
1 change: 1 addition & 0 deletions ansible/roles/metrics/files/summaries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "summaries.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"produceSummaries": "node --trace-warnings summaries.js"
Expand Down
11 changes: 5 additions & 6 deletions ansible/roles/metrics/files/summaries/summaries.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
// 2019-10-31,US,,/dist/v13.0.1/node-v13.0.1-linux-x64.tar.xz,v13.0.1,linux,x64,20102340
//

const { Storage } = require('@google-cloud/storage')
const express = require('express')
const app = express()

app.use(express.json())
import { Storage } from '@google-cloud/storage'
import express, { json } from 'express'

const app = express()
app.use(json())

function csvStream (chunk) {
try {
Expand Down Expand Up @@ -119,4 +118,4 @@ app.listen(port, () => {
console.log('Listening on port: ', port)
})

module.exports = app
export default app

0 comments on commit 3e58607

Please sign in to comment.