liuyuqi-dellpc 1 year ago
parent
commit
f2a3f2ec72

+ 25 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1,25 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the
+// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
+{
+	"name": "Node.js & TypeScript",
+	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
+	"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
+	"features": {
+		"ghcr.io/devcontainers-contrib/features/vercel-cli:1": {}
+	}
+
+	// Features to add to the dev container. More info: https://containers.dev/features.
+	// "features": {},
+
+	// Use 'forwardPorts' to make a list of ports inside the container available locally.
+	// "forwardPorts": [],
+
+	// Use 'postCreateCommand' to run commands after the container is created.
+	// "postCreateCommand": "yarn install",
+
+	// Configure tool-specific properties.
+	// "customizations": {},
+
+	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
+	// "remoteUser": "root"
+}

+ 1 - 0
.npmrc

@@ -0,0 +1 @@
+engine-strict=true

+ 4 - 0
.prettierignore

@@ -0,0 +1,4 @@
+.yarn
+.next
+dist
+node_modules

+ 6 - 0
.prettierrc

@@ -0,0 +1,6 @@
+{
+  "trailingComma": "es5",
+  "tabWidth": 2,
+  "semi": true,
+  "singleQuote": true
+}

+ 29 - 0
.vscode/launch.json

@@ -0,0 +1,29 @@
+{
+  "version": "0.1.0",
+  "configurations": [
+    {
+      "name": "Next.js: debug server-side",
+      "type": "node-terminal",
+      "request": "launch",
+      "command": "npm run dev"
+    },
+    {
+      "name": "Next.js: debug client-side",
+      "type": "pwa-chrome",
+      "request": "launch",
+      "url": "http://localhost:3000"
+    },
+    {
+      "name": "Next.js: debug full stack",
+      "type": "node-terminal",
+      "request": "launch",
+      "command": "npm run dev",
+      "console": "integratedTerminal",
+      "serverReadyAction": {
+        "pattern": "started server on .+, url: (https?://.+)",
+        "uriFormat": "%s",
+        "action": "debugWithChrome"
+      }
+    }
+  ]
+}

+ 13 - 0
.vscode/settings.json

@@ -0,0 +1,13 @@
+{
+    "typescript.tsdk": "node_modules/typescript/lib",
+    "typescript.enablePromptUseWorkspaceTsdk": true,
+    "editor.defaultFormatter": "esbenp.prettier-vscode",
+    "editor.formatOnSave": true,
+    "editor.codeActionsOnSave": {
+        "source.fixAll": true,
+        "source.organizeImports": true
+    },
+    "[jsonc]": {
+        "editor.defaultFormatter": "vscode.json-language-features"
+    }
+}

+ 3 - 32
README.md

@@ -1,47 +1,18 @@
-
----
-title: 项目介绍
-date: 2023-05-02 12:00:00
----
-    # next-note
+# next-note
 
 This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
 
-## Getting Started
+## Develop
 
 First, run the development server:
 
 ```bash
-npm run dev
-# or
 yarn dev
 ```
 
 Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
 
-You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
-
-[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
-
-The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
-
-## Learn More
-
-To learn more about Next.js, take a look at the following resources:
-
-- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
-- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
-
-You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
-
-## Deploy on Vercel
-
-The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
-
-Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
-
-
-# pm2 守护进程
+pm2 守护进程
 
 pm2 start pm2.json
 

+ 51 - 0
commitlint.config.js

@@ -0,0 +1,51 @@
+// build: 影响构建系统或外部依赖项的更改(示例范围:gulp、broccoli、npm)
+// ci: 更改我们的 CI 配置文件和脚本(示例范围:Travis、Circle、BrowserStack、SauceLabs)
+// docs: 文档修改
+// feat: 一个新的功能
+// fix: 一个 bug 修复
+// perf: 提升性能的代码修改
+// refactor: 既不修复错误也不添加功能的代码更改
+// style: 不影响代码含义的更改(空格、格式、缺少分号等)
+// test: 添加缺失的测试或更正现有测试
+
+
+module.exports = {
+    extends: ['@commitlint/config-conventional'],
+    rules: {
+      'body-leading-blank': [1, 'always'],
+      'body-max-line-length': [2, 'always', 100],
+      'footer-leading-blank': [1, 'always'],
+      'footer-max-line-length': [2, 'always', 100],
+      'header-max-length': [2, 'always', 100],
+      'scope-case': [2, 'always', 'lower-case'],
+      'subject-case': [
+        2,
+        'never',
+        ['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
+      ],
+      'subject-empty': [2, 'never'],
+      'subject-full-stop': [2, 'never', '.'],
+      'type-case': [2, 'always', 'lower-case'],
+      'type-empty': [2, 'never'],
+      'type-enum': [
+        2,
+        'always',
+        [
+          'build',
+          'chore',
+          'ci',
+          'docs',
+          'feat',
+          'fix',
+          'perf',
+          'refactor',
+          'revert',
+          'style',
+          'test',
+          'translation',
+          'security',
+          'changeset',
+        ],
+      ],
+    },
+  };

+ 3 - 3
package.json

@@ -1,6 +1,6 @@
 {
-  "name": "nextjs-demo",
-  "description": "nextjs demo",
+  "name": "nextjs-node",
+  "description": "nextjs node",
   "version": "1.1.0",
   "private": true,
   "scripts": {
@@ -18,4 +18,4 @@
     "eslint": "8.13.0",
     "eslint-config-next": "12.1.5"
   }
-}
+}

+ 0 - 0
components/button.js → src/components/button.js


+ 0 - 0
pages/_app.js → src/pages/_app.js


+ 0 - 0
pages/api/hello.js → src/pages/api/hello.js


+ 0 - 0
pages/index.js → src/pages/index.js


+ 0 - 0
pages/posts/first-post.js → src/pages/posts/first-post.js


+ 44 - 0
tsconfig.json

@@ -0,0 +1,44 @@
+{
+    "compilerOptions": {
+        "target": "es5",
+        "lib": [
+            "dom",
+            "dom.iterable",
+            "esnext"
+        ],
+        "allowJs": true,
+        "skipLibCheck": true,
+        "strict": true,
+        "forceConsistentCasingInFileNames": true,
+        "noEmit": true,
+        "esModuleInterop": true,
+        "module": "esnext",
+        "moduleResolution": "node",
+        "resolveJsonModule": true,
+        "isolatedModules": true,
+        "jsx": "preserve",
+        "incremental": true,
+        "plugins": [
+            {
+                "name": "next"
+            }
+        ],
+        "baseUrl": ".",
+        "paths": {
+            "@/*": [
+                "./src/*"
+            ]
+        }
+    },
+    "include": [
+        "next-env.d.ts",
+        "**/*.ts",
+        "**/*.js",
+        "**/*.tsx",
+        ".next/types/**/*.ts",
+        "src/pages/index.js"
+    ],
+    "exclude": [
+        "node_modules"
+    ]
+}