Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sqs committed Dec 20, 2023
0 parents commit d5b8eae
Show file tree
Hide file tree
Showing 336 changed files with 32,539 additions and 0 deletions.
128 changes: 128 additions & 0 deletions .config/eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// @ts-check

/** @type {import('eslint/lib/linter/linter').ConfigData} */
const config = {
env: {
browser: true,
node: true,
es6: true,
},
root: true,
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
// @ts-ignore
EXPERIMENTAL_useProjectService: true,
project: true,
},
settings: {
react: {
version: '18',
},
},
overrides: [
{
files: '*.{js,ts,tsx}',
extends: ['@sourcegraph/eslint-config', 'plugin:storybook/recommended', 'plugin:react/jsx-runtime'],
rules: {
'import/order': 'off',
'import/export': 'off',
'etc/no-deprecated': 'off', // slow
'no-restricted-imports': 'off',
'unicorn/switch-case-braces': 'off',
'unicorn/prefer-event-target': 'off',
'unicorn/prefer-dom-node-remove': 'off',
'ban/ban': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'jsx-a11y/anchor-has-content': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'arrow-body-style': ['error', 'as-needed'],
'@typescript-eslint/consistent-type-exports': [
'error',
{
fixMixedExportsWithInlineTypeSpecifier: true,
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
disallowTypeAnnotations: false,
},
],
'jsdoc/tag-lines': ['error', 'always', { count: 0, startLines: 1, endLines: 0 }],
},
},
{
files: '*.story.ts?(x)',
rules: {
'react/forbid-dom-props': 'off',
'import/no-default-export': 'off',
'no-console': 'off',
},
},
{
files: ['vitest.workspace.ts', 'vite.config.ts', 'vitest.config.ts'],
rules: {
'import/no-default-export': 'off',
},
},
{
files: ['provider/**/index.ts'],
rules: {
'import/no-default-export': 'off',
},
},
{
files: ['provider/hello-world/*.ts', 'provider/storybook/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off', // makes for cleaner sample code
},
},
{
files: ['web/**/*.ts?(x)'],
plugins: ['react-refresh'],
rules: {
'import/no-default-export': 'off',
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'import/extensions': ['error', 'ignorePackages'],
},
},
{
files: ['**/*.mdx'],
extends: ['plugin:mdx/recommended'],
},
{
files: ['web/**/*.{mdx,ts,tsx}'],
extends: ['plugin:tailwindcss/recommended'],
rules: {
'tailwindcss/classnames-order': 'warn',
},
settings: {
tailwindcss: {
config: 'web/tailwind.config.ts',
},
},
},
],
ignorePatterns: [
'out/',
'dist/',
'*.schema.ts',
'.eslintrc.js',
'postcss.config.js',
'vitest.config.ts',
'vitest.workspace.ts',
'vite.config.ts',
'client/vscode/src/entrypoint/*',
'client/vscode/test/fixtures/',
'/coverage/',
'testdata/',
'web/src/components/ui', // shadcn components
'*.mts',
],
}
module.exports = config
15 changes: 15 additions & 0 deletions .config/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @ts-check

const baseConfig = require('@sourcegraph/prettierrc')

/** @type {import('prettier').Config} */
module.exports = {
...baseConfig,
plugins: [...(baseConfig.plugins || []), '@ianvs/prettier-plugin-sort-imports'],
overrides: [
...baseConfig.overrides,
// In *.mdx files, printWidth wrapping breaks up elements so that there are nested HTML
// tags, which means that client-side hydration fails.
{ files: '**/*.mdx', options: { proseWrap: 'preserve', printWidth: Number.MAX_SAFE_INTEGER, tabWidth: 2 } },
],
}
32 changes: 32 additions & 0 deletions .config/stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "http://json.schemastore.org/stylelintrc.json",
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
"rules": {
"color-named": "never",
"color-hex-length": "long",
"function-disallowed-list": ["rgb", "hsl"],
"declaration-block-no-duplicate-properties": [
true,
{
"ignore": ["consecutive-duplicates-with-different-values"]
}
],
"no-duplicate-selectors": true,
"custom-property-pattern": null,
"value-keyword-case": null,
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": ["global"]
}
],
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": ["tailwind"]
}
]
},
"defaultSeverity": "warning",
"ignoreFiles": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "**/*.svg", "node_modules/", "__mocks__/", "dist/"]
}
19 changes: 19 additions & 0 deletions .config/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "@sourcegraph/tsconfig",
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"strict": true,
"lib": ["ESNext"],
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"noErrorTruncation": true,
"resolveJsonModule": true,
"composite": true,
"isolatedModules": true,
"outDir": "dist"
}
}
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ensure everything is checked out using \n even on Windows, because some test
# code and snapshots assume this.
* text=auto eol=lf
CHANGELOG.md merge=union
95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: ci

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .tool-versions
- uses: pnpm/action-setup@v2
- run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
id: pnpm-cache
- name: Cache pnpm store
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-store-
- run: pnpm install
- run: pnpm run build
- run: pnpm run lint
- run: pnpm run format:check

test-unit:
strategy:
fail-fast: false
matrix:
runner: [ubuntu, macos]
# Run on the most recently supported version of node for all bots.
node: [20]
include:
# Additionally, run the oldest supported version on Ubuntu. We don't
# need to run this on all platforms as we're only verifying we don't
# call any APIs not available in this version.
- runner: ubuntu
node: 18.15.0 # Supported by VS Code 1.85.0 (November 2023).
runs-on: ${{ matrix.runner }}-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: pnpm/action-setup@v2
- run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
id: pnpm-cache
- name: Cache pnpm store
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-${{ matrix.node }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-${{ matrix.node }}-pnpm-store-
- run: pnpm install
- run: pnpm build
- run: pnpm run test:unit

test-integration:
strategy:
fail-fast: false
matrix:
runner: [ubuntu, macos]
runs-on: ${{ matrix.runner }}-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .tool-versions
- uses: pnpm/action-setup@v2
- run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
id: pnpm-cache
- name: Cache pnpm store
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-store-
- run: pnpm install
- run: xvfb-run -a pnpm -C client/vscode run test:integration
if: matrix.runner == 'ubuntu'
- run: pnpm -C client/vscode run test:integration
if: github.ref == 'refs/heads/main' && (matrix.runner == 'windows' || matrix.runner == 'macos')
48 changes: 48 additions & 0 deletions .github/workflows/scip-typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: scip-typescript
on:
push:
paths:
- '**.ts'
- '**.tsx'
- '**.js'

jobs:
scip-typescript:
if: github.repository == 'sourcegraph/opencodegraph'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
id: pnpm-install
with:
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm install --frozen-lockfile
- run: pnpm dlx @sourcegraph/scip-typescript index --pnpm-workspaces --no-global-caches
- name: Upload SCIP to Cloud
run: pnpm dlx @sourcegraph/src lsif upload -github-token='${{ secrets.GITHUB_TOKEN }}' -no-progress
env:
SRC_ENDPOINT: https://sourcegraph.com/
- name: Upload SCIP to S2
run: pnpm dlx @sourcegraph/src lsif upload -github-token='${{ secrets.GITHUB_TOKEN }}' -no-progress
env:
SRC_ENDPOINT: https://sourcegraph.sourcegraph.com/
- name: Upload lsif to Dogfood
run: pnpm dlx @sourcegraph/src lsif upload -github-token='${{ secrets.GITHUB_TOKEN }}' -no-progress || true
env:
SRC_ENDPOINT: https://k8s.sgdev.org/
- name: Upload lsif to Demo
run: pnpm dlx @sourcegraph/src lsif upload -github-token='${{ secrets.GITHUB_TOKEN }}' -no-progress || true
env:
SRC_ENDPOINT: https://demo.sourcegraph.com/
39 changes: 39 additions & 0 deletions .github/workflows/vscode-pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: vscode-pre-release

on:
schedule:
- cron: '0 15 * * *' # daily at 1500 UTC
workflow_dispatch:

jobs:
release:
if: github.ref == 'refs/heads/main' && github.repository == 'sourcegraph/opencodegraph'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .tool-versions
- uses: pnpm/action-setup@v2
with:
run_install: true
- run: pnpm build
- run: pnpm run test:unit
- run: xvfb-run -a pnpm -C client/vscode run test:integration
- run: RELEASE_TYPE=pre pnpm -C client/vscode run release
if: github.ref == 'refs/heads/main' && github.repository == 'sourcegraph/opencodegraph'
env:
VSCODE_MARKETPLACE_TOKEN: ${{ secrets.VSCODE_MARKETPLACE_TOKEN }}
VSCODE_OPENVSX_TOKEN: ${{ secrets.VSCODE_OPENVSX_TOKEN }}
- name: Slack Notification
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: opencodegraph
SLACK_ICON: https://github.com/sourcegraph.png?size=48
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: Pre-release build failed
SLACK_COLOR: danger
SLACK_FOOTER: ''
MSG_MINIMAL: actions url
Loading

0 comments on commit d5b8eae

Please sign in to comment.