Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Adding tag extractor helper #754

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
33 changes: 33 additions & 0 deletions scripts/extract_tags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* The Data team has a table in snowflake that categorizes arbitrary npm
* packages with arbitrary tags. This script extracts all the frameworks
* tracked by framework-info and turns them into tags so we can keep the
* two sets in sync until we find a better way to do that.
*
* All tagged packages live here (source of truth, imported into snowflake):
* https://docs.google.com/spreadsheets/d/1CXWALCMaOjyILdfDsrkzdNkxFsmAJ-RViz8apgNyjQI/edit#gid=0
*/

const FRAMEWORKS_PATH = './src/frameworks/'

import fs from 'fs'

let files = fs.readdirSync(FRAMEWORKS_PATH)

for(let i = 0; i < files.length; i++) {

if( ! files[i].match(/.*\.json$/)) continue

let framework = JSON.parse(fs.readFileSync(FRAMEWORKS_PATH + files[i]))

let packageName = framework.detect.npmDependencies[0]

if (!packageName) continue

console.log(`${packageName}\t${framework.category.replaceAll("_"," ")}`)

if(framework.category == 'frontend_framework' || framework.category == 'static_site_generator') {
console.log(`${packageName}\tweb framework`)
}

}