sdadfadas
1/**
2* Licensed to the Apache Software Foundation (ASF) under one
3* or more contributor license agreements. See the NOTICE file
4* distributed with this work for additional information
5* regarding copyright ownership. The ASF licenses this file
6* to you under the Apache License, Version 2.0 (the
7* "License"); you may not use this file except in compliance
8* with the License. You may obtain a copy of the License at
9*
10* http://www.apache.org/licenses/LICENSE-2.0
11*
12* Unless required by applicable law or agreed to in writing,
13* software distributed under the License is distributed on an
14* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15* KIND, either express or implied. See the License for the
16* specific language governing permissions and limitations
17* under the License.
18*/
19
20// Run this from the superset-frontend directory with
21// `node ../scripts/generate_frontend_ts_tasklist.js `, then copy and paste the output into issue
22// #10004
23const { readdirSync } = require("fs");24const process = require("process");25
26const INITIAL_DIRECTORIES = ["spec", "src", "packages"];27const DEFAULT_DIRECTORY = process.cwd();28
29const getDirectories = (source) =>30readdirSync(source, { withFileTypes: true })31.filter((dirent) => dirent.isDirectory())32.map((dirent) => dirent.name);33
34const getFilesByExtensions = (source, extensions) =>35readdirSync(source, { withFileTypes: true })36.filter((dirent) =>37extensions.some((extension) => dirent.name.endsWith(extension))38)39.map((dirent) => dirent.name);40
41let directories = INITIAL_DIRECTORIES;42
43while (directories.length) {44const curDirectory = directories.pop();45process.chdir(curDirectory);46// Check for existence of js, jsx, ts, and tsx files. Show a filled box if only ts and tsx,47// show an empty box if any js or jsx, and don't print the line if neither exist in the48// directory.49const hasTypeScriptFiles =50getFilesByExtensions("./", [".ts", ".tsx"]).length > 0;51const hasJavaScriptFiles =52getFilesByExtensions("./", [".js", ".jsx"]).length > 0;53
54if (hasJavaScriptFiles) {55console.log(56`${" ".repeat(57curDirectory.split("/").length - 158)}- [ ] \`${curDirectory}\``59);60} else if (hasTypeScriptFiles) {61console.log(62`${" ".repeat(63curDirectory.split("/").length - 164)}- [x] \`${curDirectory}\``65);66}67
68directories = directories.concat(69getDirectories("./")70.reverse() // For ABC order when pushed into the Array71.filter((name) => name !== "node_modules") // Don't include node_modules in our packages72.map((directory) => `${curDirectory}/${directory}`)73);74process.chdir(DEFAULT_DIRECTORY);75}
76