Skip to content
Draft
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
18 changes: 18 additions & 0 deletions .devcontainer/build-and-push-image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Script to build and push the devcontainer image to GitHub Container Registry
# This allows caching the image between Codespace sessions

Expand Down
18 changes: 18 additions & 0 deletions .devcontainer/setup-dev.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Setup script for Superset Codespaces development environment

echo "🔧 Setting up Superset development environment..."
Expand Down
18 changes: 18 additions & 0 deletions .devcontainer/start-superset.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Startup script for Superset in Codespaces

# Log to a file for debugging
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ repos:
args: ["--markdown-linebreak-ext=md"]
- repo: local
hooks:
- id: license-check
name: Apache license header check
entry: ./scripts/check_license_pre_commit.sh
language: system
pass_filenames: true
files: \.(js|jsx|ts|tsx|py|sh|java|groovy|scala)$
exclude: ^(node_modules/|build/|dist/|\.next/|target/)
- id: eslint-frontend
name: eslint (frontend)
entry: ./scripts/eslint.sh
Expand Down
87 changes: 87 additions & 0 deletions scripts/check_license_pre_commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Pre-commit hook for checking Apache license headers in changed files only
# This is much faster than running the full RAT check on the entire repository

set -e

# Files to check are passed as arguments
FILES="$@"

if [ -z "$FILES" ]; then
exit 0
fi

# License header patterns to look for
ASF_HEADER_PATTERNS=(
"Licensed to the Apache Software Foundation"
"Licensed under the Apache License"
)

# Check each file
MISSING_HEADERS=""
for file in $FILES; do
# Skip files that are in .rat-excludes patterns
# Check common excluded patterns
if [[ "$file" == *.json ]] || \
[[ "$file" == *.md ]] || \
[[ "$file" == *.yml ]] || \
[[ "$file" == *.yaml ]] || \
[[ "$file" == *.csv ]] || \
[[ "$file" == *.txt ]] || \
[[ "$file" == *.lock ]] || \
[[ "$file" == */node_modules/* ]] || \
[[ "$file" == */.next/* ]] || \
[[ "$file" == */build/* ]] || \
[[ "$file" == */dist/* ]] || \
[[ "$file" == *.min.js ]] || \
[[ "$file" == *.min.css ]]; then
continue
fi

# Check if file exists (might be deleted)
if [ ! -f "$file" ]; then
continue
fi

# Check for license header in first 20 lines
has_header=false
for pattern in "${ASF_HEADER_PATTERNS[@]}"; do
if head -20 "$file" | grep -q "$pattern"; then
has_header=true
break
fi
done

if [ "$has_header" = false ]; then
MISSING_HEADERS="$MISSING_HEADERS\n $file"
fi
done

if [ -n "$MISSING_HEADERS" ]; then
echo "❌ Apache license headers missing in the following files:"
echo -e "$MISSING_HEADERS"
echo ""
echo "Please add the Apache license header to these files."
echo "See existing files for examples."
exit 1
fi

echo "✅ License headers check passed"
exit 0
62 changes: 62 additions & 0 deletions scripts/simplify-nx-configs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env node
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

const fs = require('fs');
const path = require('path');

// Minimal project.json that inherits everything from nx.json targetDefaults
const minimalProjectConfig = (name) => ({
name,
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"targets": {
"build": {} // Empty object inherits all defaults from nx.json
}
});

// Find all project.json files
const packagesDir = path.join(__dirname, '..', 'superset-frontend', 'packages');
const pluginsDir = path.join(__dirname, '..', 'superset-frontend', 'plugins');

function updateProjectJson(dir) {
const items = fs.readdirSync(dir);
items.forEach(item => {
const itemPath = path.join(dir, item);
const projectJsonPath = path.join(itemPath, 'project.json');

if (fs.existsSync(projectJsonPath)) {
const projectName = item;
const minimalConfig = minimalProjectConfig(projectName);

fs.writeFileSync(
projectJsonPath,
JSON.stringify(minimalConfig, null, 2) + '\n'
);
console.log(`✓ Simplified ${projectJsonPath}`);
}
});
}

console.log('Simplifying Nx project.json files to use targetDefaults from nx.json...\n');

updateProjectJson(packagesDir);
updateProjectJson(pluginsDir);

console.log('\n✅ All project.json files have been simplified!');
console.log('The common configuration now lives in nx.json targetDefaults.');
4 changes: 4 additions & 0 deletions superset-frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ cypress/videos
src/temp
.temp_cache/
.tsbuildinfo

# Nx workspace data and cache
.nx/
nx-cloud.env
55 changes: 55 additions & 0 deletions superset-frontend/nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"packageManager": "bun",
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "build:lib", "build:esm"],
"cacheDirectory": ".nx/cache"
}
}
},
"targetDefaults": {
"build": {
"executor": "nx:run-script",
"options": {
"script": "build:nx"
},
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"],
"outputs": [
"{projectRoot}/lib",
"{projectRoot}/esm",
"{projectRoot}/types",
"{projectRoot}/tsconfig.tsbuildinfo"
]
},
"build:lib": {
"inputs": ["production"],
"outputs": ["{projectRoot}/lib"],
"cache": true
},
"build:esm": {
"inputs": ["production"],
"outputs": ["{projectRoot}/esm"],
"cache": true
}
},
"namedInputs": {
"production": [
"default",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s",
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/eslint.config.js"
]
},
"workspaceLayout": {
"libsDir": "packages",
"appsDir": "plugins"
},
"nxCloudAccessToken": null
}
Loading
Loading