Skip to content

Commit

Permalink
feat: omnibox
Browse files Browse the repository at this point in the history
  • Loading branch information
Rain120 committed Sep 11, 2024
0 parents commit 3d8b6b8
Show file tree
Hide file tree
Showing 48 changed files with 13,051 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
chrome >= 51
edge >= 15
firefox >= 54
safari >= 10
ios_saf >= 10
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
root: true,
extends: ['eslint-config-ts'],
rules: {
singleQuote: true,
'@typescript-eslint/ban-types': 'off',
'no-unused-variable': 'off',
},
};
77 changes: 77 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Deploy Next.js site to Pages

on:
push:
branches: ["main"]

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi
- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
- uses: pnpm/[email protected]
with:
version: latest

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: |
pnpm install
- name: Build with Next.js
run: pnpm run build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out

deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: out # The folder the action should deploy.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.DS_Store

.pnp
.pnp.js
.env.local
.env.*.local
.history
*.log*

node_modules/
.yarn-integrity
.pnpm-store/
*.tsbuildinfo
.eslintcache
.changeset/pre.json

dist/**
coverage/
release/
output/
output_resource/
log/

.vscode/**/*
!.vscode/settings.json
!.vscode/extensions.json
.idea/

**/*/typings/auto-generated

modern.config.local.*
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install lint-staged
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
strict-peer-dependencies=false
registry=https://registry.npmjs.org
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/hydrogen
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
}
15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"recommendations": [
"styled-components.vscode-styled-components",
"EditorConfig.editorconfig",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker",
"codezombiech.gitignore",
"aaron-bond.better-comments",
"jasonnutter.search-node-modules",
"jock.svg",
"mikestead.dotenv",
"vscode-icons-team.vscode-icons"
]
}
77 changes: 77 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"files.associations": {
".code-workspace": "jsonc",
".eslintrc": "jsonc",
".eslintrc*.json": "jsonc",
".stylelintrc": "jsonc",
"stylelintrc": "jsonc",
"README": "markdown"
},
"search.useIgnoreFiles": true,
"search.exclude": {
"**/dist": true,
"**/*.log": true,
"**/*.pid": true,
"**/.git": true,
"**/node_modules": true
},
//
"editor.rulers": [80, 120],
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
//
"cSpell.diagnosticLevel": "Hint",
"eslint.run": "onType",
"eslint.probe": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue"
],
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"javascript.validate.enable": false,
"typescript.validate.enable": true,
"css.validate": false,
"scss.validate": false,
"less.validate": false,
"[css]": {
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true
},
"[scss]": {
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true
},
"[less]": {
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"javascript.format.enable": false,
"typescript.format.enable": false,
//
"json.format.enable": false,
"[json]": {
"editor.tabSize": 2,
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.tabSize": 2,
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.formatOnSave": true
},
"emmet.triggerExpansionOnTab": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Modern.js App

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get Started

Start the dev server:

```bash
pnpm dev
```

Enable optional features or add a new entry:

```bash
pnpm new
```

Build the app for production:

```bash
pnpm build
```

Preview the production build locally:

```bash
pnpm serve
```

For more information, see the [Modern.js documentation](https://modernjs.dev/en).
14 changes: 14 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
declare module '*.css' {
const classes: { readonly [key: string]: string };
export default classes;
}

declare module '*.scss' {
const classes: { readonly [key: string]: string };
export default classes;
}

declare module '*.sass' {
const classes: { readonly [key: string]: string };
export default classes;
}
58 changes: 58 additions & 0 deletions menu.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import * as path from 'path';
import * as fs from 'fs';

let counter = 2;

const traverseFolder = (folderPath, parentName = '') => {
const files = fs.readdirSync(folderPath);
const tree = [];

for (const file of files) {
const filePath = path.join(folderPath, file);
const stats = fs.statSync(filePath);

if (stats.isDirectory()) {
const children = traverseFolder(
filePath,
parentName ? `${parentName}/${file}` : file,
counter,
);

const node = {
label: file,
key: `${counter++}`,
path: parentName ? `/${parentName}/${file}` : `/${file}`,
// path: filePath,
};

if (children.length) {
node.children = children;
}

tree.push(node);
}
}

return tree;
};

(() => {
const folderPath = path.resolve('./src/routes');
const result = traverseFolder(folderPath);

result.unshift({
key: '1',
label: 'home',
path: '/',
});

const folder = path.resolve('./src/shared/menu/folder.ts');
// console.log(result);
fs.writeFileSync(
folder,
`export const MENU_PATH_DATA = ${JSON.stringify(result, null, 2)}
`,
);

console.log(`menu info 👉🏻 ${folder}`);
})();
13 changes: 13 additions & 0 deletions modern.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { appTools, defineConfig } from '@modern-js/app-tools';

// https://modernjs.dev/en/configure/app/usage
export default defineConfig({
runtime: {
router: true,
},
plugins: [
appTools({
bundler: 'rspack', // Set to 'webpack' to enable webpack
}),
],
});
Loading

0 comments on commit 3d8b6b8

Please sign in to comment.