Skip to content

Commit

Permalink
Preparing for open source
Browse files Browse the repository at this point in the history
  • Loading branch information
ntotten committed Aug 16, 2024
0 parents commit 19c3f92
Show file tree
Hide file tree
Showing 351 changed files with 40,760 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": "0.2",
"language": "en",
"words": ["zudoku"]
}
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LOG_LEVEL=debug
ZUDOKU_INTERNAL_DEV=true
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist/
packages/zudoku/lib/
.nx/
packages/create-zudoku-app/templates
134 changes: 134 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/**@type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.eslint.json",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
es2020: true,
node: true,
},
settings: {
react: {
version: "detect",
},
},
plugins: ["@typescript-eslint", "react-refresh"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",

"plugin:react-hooks/recommended",
"prettier",
],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],

"no-debugger": "error",
"no-console": "error",

// Typescript
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["class"],
format: ["PascalCase"],
},
{
selector: "interface",
format: ["PascalCase"],
custom: {
regex: "^I[A-Z]",
match: false,
},
},
],
"@typescript-eslint/type-annotation-spacing": "warn",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/prefer-nullish-coalescing": [
"warn",
{
ignorePrimitives: { string: true },
},
],
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/no-unnecessary-condition": "warn",
// Typescript extension rules: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules#extension-rules
"brace-style": "off",
"default-param-last": "off",
"@typescript-eslint/default-param-last": ["warn"],

// React styles
// Disabling due to false positives
// "react/boolean-prop-naming": [
// "warn",
// {
// propTypeNames: ["bool", "boolean"],
// rule: "^(is|has|was|should|show)[A-Z]([A-Za-z0-9]?)+",
// },
// ],
"react/destructuring-assignment": "off",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/button-has-type": "warn",
"react/no-array-index-key": "warn",
"react/prop-types": "off",
"react/no-multi-comp": ["warn", { ignoreStateless: true }],
"react/no-unescaped-entities": "off",
// Formatting (handled by prettier)
"@typescript-eslint/brace-style": "off",
},
overrides: [
{
files: ["src/lib/**/*", "src/app/**/*"],
rules: {
"import/no-nodejs-modules": [
"error",
{
allow: [
"constants/defaults",
"constants/routes",
"constants/storage",
"constants/support",
"constants/colors",
"constants/user",
"constants/analytics",
"constants/file-items",
"constants/status-code",
"constants/strings/CommonStrings",
"constants/strings/FilesStrings",
"constants/strings/PolicyStrings",
"constants/strings/RouteStrings",
],
},
],
},
},
{
files: ["**.test.ts", "**.spec.ts", "scripts/**/*"],
rules: {
// Floating promises in tests
// https://github.com/nodejs/node/issues/51292
"@typescript-eslint/no-floating-promises": "off",
"import/no-nodejs-modules": "off",
"no-console": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
],
};
69 changes: 69 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build
on:
workflow_call:
push:
branches:
- "**"
- "!main"
tags-ignore:
- "*"

jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

env:
COREPACK_ENABLE_STRICT: 0
ZUDOKU_INTERNAL_DEV: true

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".tool-versions"
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- run: pnpm install nx --global

- run: pnpm run lint:ci
- run: pnpm run format:ci
- run: nx run-many -t build:ci

- name: Build Samples
run: nx run-many -t build --projects=tag:sample

- name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v2"
with:
token_format: "access_token"
workload_identity_provider: ${{ vars.GCP_ACTIONS_IDENTITY_PROVIDER }}
service_account: github-actions-opensource@zuplo-production.iam.gserviceaccount.com
access_token_lifetime: "300s"

- name: Upload Artifacts
uses: "google-github-actions/upload-cloud-storage@v2"
with:
path: packages/zudoku/stats.html
destination: cdn.zudoku.dev/build/rollup/${{ github.run_id }}-${{ github.run_attempt }}
parent: false
headers: |-
content-type: text/html
- name: Write Summary
run: |
echo "📝 Bundle stats uploaded" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "[View Stats](https://cdn.zudoku.dev/build/rollup/${{ github.run_id }}-${{ github.run_attempt }}/stats.html)" >> $GITHUB_STEP_SUMMARY
Loading

0 comments on commit 19c3f92

Please sign in to comment.