Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: convert from CommonJS to ES Modules #3830

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 5 additions & 5 deletions ansible/roles/metrics/files/summaries/summaries.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +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()
import { Storage } from '@google-cloud/storage'
import express, { json } from 'express'

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

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

module.exports = app
export default app