├── blessed-test
├── README.md
├── .gitignore
├── package.json
└── src
│ ├── progressbar.js
│ ├── filemanager.js
│ └── table.js
├── my-create-vite
├── .gitignore
├── template-react-ts
│ ├── src
│ │ ├── vite-env.d.ts
│ │ ├── main.tsx
│ │ ├── App.css
│ │ └── App.tsx
│ ├── .DS_Store
│ ├── tsconfig.json
│ ├── vite.config.ts
│ ├── _gitignore
│ ├── index.html
│ ├── tsconfig.node.json
│ ├── tsconfig.app.json
│ ├── package.json
│ └── eslint.config.js
├── template-vue-ts
│ ├── src
│ │ ├── vite-env.d.ts
│ │ ├── main.ts
│ │ ├── assets
│ │ │ └── vue.svg
│ │ ├── App.vue
│ │ └── components
│ │ │ └── HelloWorld.vue
│ ├── .vscode
│ │ └── extensions.json
│ ├── .DS_Store
│ ├── tsconfig.json
│ ├── vite.config.ts
│ ├── _gitignore
│ ├── index.html
│ ├── README.md
│ ├── package.json
│ ├── tsconfig.node.json
│ └── tsconfig.app.json
├── template-vue
│ ├── .vscode
│ │ └── extensions.json
│ ├── .DS_Store
│ ├── src
│ │ ├── main.js
│ │ ├── assets
│ │ │ └── vue.svg
│ │ ├── App.vue
│ │ └── components
│ │ │ └── HelloWorld.vue
│ ├── vite.config.js
│ ├── _gitignore
│ ├── README.md
│ ├── package.json
│ └── index.html
├── .DS_Store
├── template-react
│ ├── .DS_Store
│ ├── vite.config.js
│ ├── src
│ │ ├── main.jsx
│ │ ├── App.css
│ │ └── App.jsx
│ ├── _gitignore
│ ├── index.html
│ ├── README.md
│ └── package.json
├── tsconfig.json
└── package.json
├── my-prompts
├── .gitignore
├── .DS_Store
├── README.md
├── tsconfig.json
├── package.json
├── .vscode
│ └── launch.json
└── src
│ ├── test2.ts
│ └── index.ts
├── stream-test
├── src
│ ├── data.txt
│ ├── read.mjs
│ ├── fsReadStream.mjs
│ ├── test2.mjs
│ ├── fsWriteStream.mjs
│ ├── test.mjs
│ ├── zlib.mjs
│ ├── socket-client.mjs
│ ├── readable.mjs
│ ├── readable2.mjs
│ ├── socket-server.mjs
│ ├── transform.mjs
│ ├── writable.mjs
│ ├── duplex.mjs
│ └── readable3.mjs
└── package.json
├── my-git
├── .mygitignore
├── package.json
├── .vscode
│ └── launch.json
└── src
│ ├── init.mjs
│ └── cat-file.mjs
├── ansi-test
├── index.js
├── README.md
├── index4.js
├── index2.js
├── package.json
├── index3.js
└── index5.js
├── pnpm-monorepo-test
├── README.md
├── .gitignore
├── pnpm-workspace.yaml
├── packages
│ ├── core
│ │ ├── CHANGELOG.md
│ │ ├── src
│ │ │ └── index.ts
│ │ ├── tsconfig.json
│ │ └── package.json
│ └── cli
│ │ ├── CHANGELOG.md
│ │ ├── tsconfig.json
│ │ ├── package.json
│ │ └── src
│ │ └── index.ts
├── .changeset
│ ├── config.json
│ └── README.md
└── package.json
├── guang-cli
├── .gitignore
├── pnpm-workspace.yaml
├── packages
│ ├── template-react
│ │ ├── template
│ │ │ ├── src
│ │ │ │ ├── vite-env.d.ts
│ │ │ │ ├── main.tsx
│ │ │ │ ├── App.css
│ │ │ │ └── App.tsx
│ │ │ ├── tsconfig.json
│ │ │ ├── vite.config.ts
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ ├── tsconfig.node.json
│ │ │ ├── tsconfig.app.json
│ │ │ ├── eslint.config.js
│ │ │ └── package.json
│ │ ├── questions.json
│ │ ├── package.json
│ │ └── CHANGELOG.md
│ ├── template-vue
│ │ ├── template
│ │ │ ├── src
│ │ │ │ ├── vite-env.d.ts
│ │ │ │ ├── main.ts
│ │ │ │ ├── assets
│ │ │ │ │ └── vue.svg
│ │ │ │ ├── App.vue
│ │ │ │ └── components
│ │ │ │ │ └── HelloWorld.vue
│ │ │ ├── .vscode
│ │ │ │ └── extensions.json
│ │ │ ├── tsconfig.json
│ │ │ ├── vite.config.ts
│ │ │ ├── .gitignore
│ │ │ ├── index.html
│ │ │ ├── README.md
│ │ │ ├── package.json
│ │ │ ├── tsconfig.node.json
│ │ │ └── tsconfig.app.json
│ │ ├── CHANGELOG.md
│ │ └── package.json
│ ├── generate
│ │ ├── src
│ │ │ ├── configType.ts
│ │ │ └── test.ts
│ │ ├── CHANGELOG.md
│ │ ├── tsconfig.json
│ │ └── package.json
│ ├── utils
│ │ ├── src
│ │ │ ├── index.ts
│ │ │ ├── test.ts
│ │ │ └── versionUtils.ts
│ │ ├── CHANGELOG.md
│ │ ├── tsconfig.json
│ │ └── package.json
│ ├── cli
│ │ ├── tsconfig.json
│ │ ├── package.json
│ │ ├── src
│ │ │ └── index.ts
│ │ └── CHANGELOG.md
│ └── create
│ │ ├── tsconfig.json
│ │ ├── CHANGELOG.md
│ │ └── package.json
├── .changeset
│ ├── config.json
│ └── README.md
└── package.json
├── rollup-test
├── src
│ ├── index.css
│ ├── utils.css
│ ├── utils.js
│ └── index.js
├── README.md
├── package.json
├── webpack.config.mjs
├── my-extract-css-rollup-plugin.mjs
└── rollup.config.mjs
├── buffer-test
├── README.md
├── index3.js
├── index5.js
├── package.json
├── index2.js
├── index6.js
├── index.js
├── index4.js
├── index2.html
└── index.html
├── my-dns-server
├── REAME.md
└── package.json
├── node-api-test
├── path3.js
├── meta.js
├── cp4.mjs
├── child_process.mjs
├── data.db
├── cp3.mjs
├── v8.mjs
├── dns.mjs
├── cluster2.mjs
├── buffer2.mjs
├── fs.mjs
├── vm.mjs
├── crypto.mjs
├── string_decoder.mjs
├── index.html
├── meta2.mjs
├── query_string.mjs
├── util3.mjs
├── crypto3.mjs
├── readline.mjs
├── fs2.mjs
├── path.mjs
├── util.mjs
├── os.mjs
├── fs3.mjs
├── readline3.mjs
├── repl.mjs
├── crypto2.mjs
├── cp2.mjs
├── http-server.mjs
├── cp1.mjs
├── buffer.mjs
├── path2.js
├── worker_threads_worker.mjs
├── worker_threads_main.mjs
├── util4.mjs
├── zlib.mjs
├── package.json
├── events.js
├── net-tcp-client.mjs
├── sqlite.mjs
├── net-tcp-server.mjs
├── util2.mjs
├── url2.mjs
├── readline2.mjs
├── url.mjs
├── fs4.mjs
└── cluster.mjs
├── react-comp
├── src
│ ├── vite-env.d.ts
│ ├── App.tsx
│ ├── main.tsx
│ ├── Button
│ │ ├── index.scss
│ │ └── index.tsx
│ └── App.css
├── tsconfig.json
├── vite.config.ts
├── .gitignore
├── index.html
├── tsconfig.node.json
├── tsconfig.app.json
├── package.json
└── eslint.config.js
├── react-i18n-test
├── README.md
├── src
│ ├── vite-env.d.ts
│ ├── locales
│ │ ├── zh-CN.json
│ │ └── en-US.json
│ ├── main.tsx
│ ├── App.tsx
│ └── App.css
├── tsconfig.json
├── vite.config.ts
├── .gitignore
├── index.html
├── tsconfig.node.json
├── tsconfig.app.json
├── package.json
└── eslint.config.js
├── scaffold-pkg-test
├── README.md
├── src
│ ├── fs-extra.js
│ ├── cli-spinner.js
│ ├── glob.js
│ ├── ora.js
│ ├── npminstall.js
│ ├── semver.js
│ ├── inquirer.mjs
│ └── fs.js
└── package.json
├── .gitignore
├── blessed-contrib-test
├── README.md
├── package.json
└── src
│ ├── bar.js
│ ├── map.js
│ ├── line.js
│ ├── gauge.js
│ ├── grid.js
│ └── line2.js
├── my-comp-lib-test
├── src
│ ├── vite-env.d.ts
│ ├── main.tsx
│ ├── App.tsx
│ └── App.css
├── tsconfig.json
├── vite.config.ts
├── .gitignore
├── index.html
├── tsconfig.node.json
├── tsconfig.app.json
├── eslint.config.js
├── package.json
└── test.html
├── worker-test
├── README.md
├── page
│ ├── worker.js
│ ├── index.html
│ └── index2.html
├── package.json
├── node
│ ├── index.js
│ └── node-worker.js
└── pool
│ └── pool-worker.js
├── cli-args-test
├── README.md
├── index.js
├── index2.js
├── package.json
└── index3.js
├── openai-test
├── README.md
├── package.json
└── src
│ └── system.md
├── .DS_Store
├── ast-transform-test
├── README.md
├── tsconfig.json
└── package.json
├── excel-export
├── data.xlsx
├── bundle.xlsx
├── zh-CN.json
├── en-US.json
├── messages.csv
├── message2.csv
├── package.json
├── index.js
├── index3.js
└── index5.js
├── exceljs-test
├── data.xlsx
├── data2.xlsx
├── README.md
├── package.json
├── index.js
└── index.html
├── keyboard-control
├── src
│ ├── test2.ts
│ ├── test.ts
│ ├── index.ts
│ ├── base-ui.ts
│ └── list-test.ts
├── README.md
├── tsconfig.json
├── package.json
└── .vscode
│ └── launch.json
├── my-websocket
├── README.md
├── package.json
├── src
│ └── index.js
└── index.html
├── scan-thread-pool
├── README.md
├── tsconfig.json
├── package.json
└── src
│ ├── test.ts
│ └── index.ts
├── cli-progress-test
├── .DS_Store
├── README.md
├── tsconfig.json
├── src
│ ├── index2.ts
│ ├── index.ts
│ └── test.ts
└── package.json
├── cli-dashboard
├── README.md
├── tsconfig.json
├── test.js
├── .vscode
│ └── launch.json
└── package.json
├── my-nest-cli
├── nest-project
│ └── aaa.module.ts
├── README.md
├── src
│ ├── test.ts
│ └── cli.ts
├── tsconfig.json
└── package.json
├── my-source-map-support
├── README.md
├── src
│ └── index.ts
├── test.js
├── tsconfig.json
├── package.json
└── .vscode
│ └── launch.json
├── react-comp-lib
├── src
│ ├── index.ts
│ └── Button
│ │ ├── index.scss
│ │ └── index.tsx
├── tsconfig.json
└── package.json
├── sqlite-test
├── src
│ ├── index2.mjs
│ ├── index4.mjs
│ ├── many-many-query.mjs
│ ├── index.mjs
│ ├── index3.mjs
│ └── index5.mjs
└── package.json
├── auto-i18n-cli
├── tsconfig.json
├── package.json
└── .vscode
│ └── launch.json
├── mini-puppeteer
├── src
│ ├── lib
│ │ └── helpers.mjs
│ └── install.mjs
└── package.json
└── jd-spider
├── package.json
└── create-table.js
/blessed-test/README.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/my-create-vite/.gitignore:
--------------------------------------------------------------------------------
1 | dist/
--------------------------------------------------------------------------------
/my-prompts/.gitignore:
--------------------------------------------------------------------------------
1 | nest-app/
--------------------------------------------------------------------------------
/stream-test/src/data.txt:
--------------------------------------------------------------------------------
1 | 神说要有光
2 |
--------------------------------------------------------------------------------
/my-git/.mygitignore:
--------------------------------------------------------------------------------
1 | node_modules/**
2 |
--------------------------------------------------------------------------------
/ansi-test/index.js:
--------------------------------------------------------------------------------
1 | console.log('123\u001B[1K456')
--------------------------------------------------------------------------------
/pnpm-monorepo-test/README.md:
--------------------------------------------------------------------------------
1 | # pnpm monorepo test
2 |
--------------------------------------------------------------------------------
/blessed-test/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | *-lock.json
3 |
--------------------------------------------------------------------------------
/pnpm-monorepo-test/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | .DS_Store
--------------------------------------------------------------------------------
/ansi-test/README.md:
--------------------------------------------------------------------------------
1 | # ansi-test
2 |
3 | ansi 控制光标颜色
4 |
5 |
--------------------------------------------------------------------------------
/guang-cli/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
3 | .DS_Store
4 |
--------------------------------------------------------------------------------
/rollup-test/src/index.css:
--------------------------------------------------------------------------------
1 | .aaa {
2 | background: blue;
3 | }
--------------------------------------------------------------------------------
/rollup-test/src/utils.css:
--------------------------------------------------------------------------------
1 | .bbb {
2 | background: red;
3 | }
--------------------------------------------------------------------------------
/buffer-test/README.md:
--------------------------------------------------------------------------------
1 | # buffer blob
2 |
3 | node.js 操作二进制数据
4 |
--------------------------------------------------------------------------------
/guang-cli/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | packages:
2 | - 'packages/*'
3 |
--------------------------------------------------------------------------------
/my-dns-server/REAME.md:
--------------------------------------------------------------------------------
1 | # my-dns-server
2 |
3 | node ./src/index.js
--------------------------------------------------------------------------------
/node-api-test/path3.js:
--------------------------------------------------------------------------------
1 | const path = require('node:path');
2 |
3 |
--------------------------------------------------------------------------------
/pnpm-monorepo-test/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | packages:
2 | - 'packages/*'
--------------------------------------------------------------------------------
/ansi-test/index4.js:
--------------------------------------------------------------------------------
1 | console.log('\u001b[36;1;4mguang\u001b[0m 666');
2 |
--------------------------------------------------------------------------------
/node-api-test/meta.js:
--------------------------------------------------------------------------------
1 | console.log(__dirname);
2 | console.log(__filename);
--------------------------------------------------------------------------------
/react-comp/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/react-i18n-test/README.md:
--------------------------------------------------------------------------------
1 | # react-i18n-test
2 |
3 | react 项目实现国际化
4 |
--------------------------------------------------------------------------------
/scaffold-pkg-test/README.md:
--------------------------------------------------------------------------------
1 | # scaffold-pkg-test
2 |
3 | 脚手架 cli 用到的一些包
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
3 | yarn-*
4 | *-lock.json
5 | .DS_Store
--------------------------------------------------------------------------------
/blessed-contrib-test/README.md:
--------------------------------------------------------------------------------
1 | # blessed-contrib-test
2 |
3 | cli 图表库
4 |
--------------------------------------------------------------------------------
/my-comp-lib-test/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/react-i18n-test/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/worker-test/README.md:
--------------------------------------------------------------------------------
1 | # node 线程池
2 |
3 | npm install
4 |
5 | node ./pool/index.js
--------------------------------------------------------------------------------
/cli-args-test/README.md:
--------------------------------------------------------------------------------
1 | # cli-args-test
2 |
3 | npm install
4 |
5 | node ./index3.js
--------------------------------------------------------------------------------
/openai-test/README.md:
--------------------------------------------------------------------------------
1 | # openai-test
2 |
3 | npm install
4 |
5 | node ./src/index.mjs
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/.DS_Store
--------------------------------------------------------------------------------
/my-create-vite/template-react-ts/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue-ts/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/node-api-test/cp4.mjs:
--------------------------------------------------------------------------------
1 | import cp from 'node:child_process';
2 |
3 | cp.fork('./cp1.mjs');
4 |
--------------------------------------------------------------------------------
/node-api-test/child_process.mjs:
--------------------------------------------------------------------------------
1 | import cp from 'node:child_process';
2 |
3 | console.log(cp);
4 |
--------------------------------------------------------------------------------
/react-i18n-test/src/locales/zh-CN.json:
--------------------------------------------------------------------------------
1 | {
2 | "increase": "增加",
3 | "decrease": "减小"
4 | }
--------------------------------------------------------------------------------
/guang-cli/packages/template-react/template/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-vue/template/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["Vue.volar"]
3 | }
4 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue-ts/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["Vue.volar"]
3 | }
4 |
--------------------------------------------------------------------------------
/react-i18n-test/src/locales/en-US.json:
--------------------------------------------------------------------------------
1 | {
2 | "increase": "Increase",
3 | "decrease": "Decrease"
4 | }
--------------------------------------------------------------------------------
/my-prompts/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/my-prompts/.DS_Store
--------------------------------------------------------------------------------
/node-api-test/data.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/node-api-test/data.db
--------------------------------------------------------------------------------
/ast-transform-test/README.md:
--------------------------------------------------------------------------------
1 | # 基于 AST 实现精准代码修改
2 |
3 | npm install
4 |
5 | npx tsc -w
6 |
7 | node ./dist/index.js
--------------------------------------------------------------------------------
/excel-export/data.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/excel-export/data.xlsx
--------------------------------------------------------------------------------
/exceljs-test/data.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/exceljs-test/data.xlsx
--------------------------------------------------------------------------------
/exceljs-test/data2.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/exceljs-test/data2.xlsx
--------------------------------------------------------------------------------
/guang-cli/packages/template-vue/template/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": ["Vue.volar"]
3 | }
4 |
--------------------------------------------------------------------------------
/keyboard-control/src/test2.ts:
--------------------------------------------------------------------------------
1 | const arr = [];
2 |
3 | while(true){
4 | arr.push(Math.random())
5 | }
6 |
7 |
--------------------------------------------------------------------------------
/my-websocket/README.md:
--------------------------------------------------------------------------------
1 | # 手写 WebSocket 协议
2 |
3 | npx http-server . 跑静态服务
4 |
5 | node ./src/index.js 跑 node 服务
6 |
--------------------------------------------------------------------------------
/scaffold-pkg-test/src/fs-extra.js:
--------------------------------------------------------------------------------
1 | const fse = require('fs-extra');
2 |
3 | fse.copySync('./src', './aaa/bbb/')
4 |
--------------------------------------------------------------------------------
/scan-thread-pool/README.md:
--------------------------------------------------------------------------------
1 | # scan thread pool
2 |
3 | npm install
4 |
5 | npx tsc -w
6 |
7 | node ./dist/index.js
--------------------------------------------------------------------------------
/excel-export/bundle.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/excel-export/bundle.xlsx
--------------------------------------------------------------------------------
/keyboard-control/src/test.ts:
--------------------------------------------------------------------------------
1 | const arr = [];
2 |
3 | setInterval(() => {
4 | arr.push(Math.random());
5 | }, 10)
6 |
--------------------------------------------------------------------------------
/my-create-vite/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/my-create-vite/.DS_Store
--------------------------------------------------------------------------------
/cli-progress-test/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/cli-progress-test/.DS_Store
--------------------------------------------------------------------------------
/cli-dashboard/README.md:
--------------------------------------------------------------------------------
1 | # cli-dashboard
2 |
3 | cli 系统监控仪表盘
4 |
5 | npm install
6 |
7 | npx tsc -w
8 |
9 | node ./dist/index.js
--------------------------------------------------------------------------------
/pnpm-monorepo-test/packages/core/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @guang-pnpm/core
2 |
3 | ## 1.1.0
4 |
5 | ### Minor Changes
6 |
7 | - 数字加减 cli
8 |
--------------------------------------------------------------------------------
/keyboard-control/README.md:
--------------------------------------------------------------------------------
1 | # keyboard control
2 |
3 | 键盘控制 cli
4 |
5 | npm install
6 |
7 | npx tsc
8 |
9 | node ./dist/list-test.js
--------------------------------------------------------------------------------
/my-prompts/README.md:
--------------------------------------------------------------------------------
1 | # my prompts
2 |
3 | 实现 prompts
4 |
5 | npm install
6 |
7 | npx tsc -w
8 |
9 | node ./dist/test2.js
10 |
--------------------------------------------------------------------------------
/cli-args-test/index.js:
--------------------------------------------------------------------------------
1 | const minimist = require('minimist');
2 |
3 | const argv = minimist(process.argv.slice(2));
4 | console.log(argv);
5 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/my-create-vite/template-vue/.DS_Store
--------------------------------------------------------------------------------
/rollup-test/README.md:
--------------------------------------------------------------------------------
1 | # rollup-test
2 |
3 | npm install
4 |
5 | npx rollup -c rollup.config.mjs
6 |
7 | npx webpack-cli -c webpack.config.mjs
8 |
--------------------------------------------------------------------------------
/cli-progress-test/README.md:
--------------------------------------------------------------------------------
1 | # cli-progress-test
2 |
3 | 实现 cli 进度条
4 |
5 | npm install
6 |
7 | npx tsc
8 |
9 | node ./dist/index.js
10 |
--------------------------------------------------------------------------------
/exceljs-test/README.md:
--------------------------------------------------------------------------------
1 | # excel 的解析和生成
2 |
3 | npm install
4 |
5 | node ./index.js
6 |
7 | node ./index2.js
8 |
9 | npx http-server .
10 |
--------------------------------------------------------------------------------
/my-create-vite/template-react/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/my-create-vite/template-react/.DS_Store
--------------------------------------------------------------------------------
/my-create-vite/template-vue-ts/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/my-create-vite/template-vue-ts/.DS_Store
--------------------------------------------------------------------------------
/my-nest-cli/nest-project/aaa.module.ts:
--------------------------------------------------------------------------------
1 | //@ts-ignore
2 | import { Module } from "@nestjs/common";
3 |
4 | @Module({})
5 | export class AaaModule {}
6 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-react/questions.json:
--------------------------------------------------------------------------------
1 | {
2 | "eslint": {
3 | "files": [
4 | "eslint.config.js"
5 | ]
6 | }
7 | }
--------------------------------------------------------------------------------
/my-create-vite/template-react-ts/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QuarkGluonPlasma/nodejs-course-code/HEAD/my-create-vite/template-react-ts/.DS_Store
--------------------------------------------------------------------------------
/my-source-map-support/README.md:
--------------------------------------------------------------------------------
1 | # my-source-map-support
2 |
3 | npm install
4 |
5 | npx tsc -w
6 |
7 | node --import ./dist/register.js ./dist/index.js
--------------------------------------------------------------------------------
/rollup-test/src/utils.js:
--------------------------------------------------------------------------------
1 | import './utils.css';
2 |
3 | function add(a, b) {
4 | return a + b;
5 | }
6 |
7 | export {
8 | add
9 | }
10 |
--------------------------------------------------------------------------------
/guang-cli/packages/generate/src/configType.ts:
--------------------------------------------------------------------------------
1 | export interface ConfigOptions {
2 | apiKey: string;
3 | baseUrl: string;
4 | systemSetting: string;
5 | }
--------------------------------------------------------------------------------
/stream-test/src/read.mjs:
--------------------------------------------------------------------------------
1 | process.stdin.on('readable', function () {
2 | const buf = process.stdin.read();
3 | console.log(buf?.toString('utf-8'));
4 | });
5 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue-ts/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import './style.css'
3 | import App from './App.vue'
4 |
5 | createApp(App).mount('#app')
6 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue/src/main.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import './style.css'
3 | import App from './App.vue'
4 |
5 | createApp(App).mount('#app')
6 |
--------------------------------------------------------------------------------
/react-comp/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | { "path": "./tsconfig.app.json" },
5 | { "path": "./tsconfig.node.json" }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/my-comp-lib-test/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | { "path": "./tsconfig.app.json" },
5 | { "path": "./tsconfig.node.json" }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/react-comp-lib/src/index.ts:
--------------------------------------------------------------------------------
1 | import Button, { ButtonProps } from './Button';
2 |
3 | export {
4 | Button
5 | }
6 |
7 | export type {
8 | ButtonProps
9 | }
10 |
--------------------------------------------------------------------------------
/react-i18n-test/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | { "path": "./tsconfig.app.json" },
5 | { "path": "./tsconfig.node.json" }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-vue/template/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import './style.css'
3 | import App from './App.vue'
4 |
5 | createApp(App).mount('#app')
6 |
--------------------------------------------------------------------------------
/rollup-test/src/index.js:
--------------------------------------------------------------------------------
1 | import { add } from './utils';
2 | import './index.css';
3 |
4 | function main() {
5 | console.log(add(1, 2))
6 | }
7 |
8 | export default main;
9 |
--------------------------------------------------------------------------------
/my-create-vite/template-react-ts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | { "path": "./tsconfig.app.json" },
5 | { "path": "./tsconfig.node.json" }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue-ts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | { "path": "./tsconfig.app.json" },
5 | { "path": "./tsconfig.node.json" }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/node-api-test/cp3.mjs:
--------------------------------------------------------------------------------
1 | import cp from 'node:child_process';
2 |
3 | const child = cp.execFile('/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome', ['--user-data-dir=./aaa']);
4 |
--------------------------------------------------------------------------------
/node-api-test/v8.mjs:
--------------------------------------------------------------------------------
1 | import v8 from 'node:v8';
2 |
3 | console.log(v8.getHeapSpaceStatistics());
4 |
5 | console.log(v8.getHeapStatistics());
6 |
7 | v8.setFlagsFromString('--trace_gc');
8 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-react/template/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | { "path": "./tsconfig.app.json" },
5 | { "path": "./tsconfig.node.json" }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-vue/template/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": [],
3 | "references": [
4 | { "path": "./tsconfig.app.json" },
5 | { "path": "./tsconfig.node.json" }
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/guang-cli/packages/utils/src/index.ts:
--------------------------------------------------------------------------------
1 | import NpmPackage from "./NpmPackage.js";
2 | import * as versionUtils from './versionUtils.js';
3 |
4 | export {
5 | NpmPackage,
6 | versionUtils
7 | }
8 |
--------------------------------------------------------------------------------
/node-api-test/dns.mjs:
--------------------------------------------------------------------------------
1 | import dns from 'node:dns/promises';
2 |
3 | async function main() {
4 | const res = await dns.resolve('baidu.com');
5 | console.log(res);
6 | }
7 |
8 | main();
9 |
10 |
--------------------------------------------------------------------------------
/node-api-test/cluster2.mjs:
--------------------------------------------------------------------------------
1 | import http from 'node:http';
2 |
3 | const server = http.createServer((req, res) => {
4 | res.writeHead(200);
5 | res.end('hello guang\n');
6 | })
7 |
8 | server.listen(8000);
9 |
--------------------------------------------------------------------------------
/react-comp/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/my-comp-lib-test/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/react-i18n-test/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/buffer-test/index3.js:
--------------------------------------------------------------------------------
1 | const fs = require('node:fs/promises');
2 |
3 | (async function(){
4 | const res = await fs.readFile('./package.json', {
5 | encoding: 'utf-8'
6 | });
7 | console.log(res);
8 | })();
--------------------------------------------------------------------------------
/guang-cli/packages/generate/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @guang-cli/generate
2 |
3 | ## 1.2.0
4 |
5 | ### Minor Changes
6 |
7 | - generate command
8 |
9 | ## 1.1.0
10 |
11 | ### Minor Changes
12 |
13 | - generate + config
14 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import vue from '@vitejs/plugin-vue'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [vue()],
7 | })
8 |
--------------------------------------------------------------------------------
/excel-export/zh-CN.json:
--------------------------------------------------------------------------------
1 | {
2 | "username": "用户名 {name}",
3 | "password": "密码222",
4 | "rememberMe": "记住我333",
5 | "submit": "提交",
6 | "inputYourUsername": "请输入你的用户名!",
7 | "inputYourPassword": "请输入你的密码!"
8 | }
--------------------------------------------------------------------------------
/my-create-vite/template-vue-ts/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import vue from '@vitejs/plugin-vue'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [vue()],
7 | })
8 |
--------------------------------------------------------------------------------
/sqlite-test/src/index2.mjs:
--------------------------------------------------------------------------------
1 | import { DatabaseSync } from 'node:sqlite';
2 | const database = new DatabaseSync('data.db');
3 |
4 | const query = database.prepare('SELECT * FROM student ORDER BY id');
5 | console.log(query.all());
6 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-vue/template/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import vue from '@vitejs/plugin-vue'
3 |
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [vue()],
7 | })
8 |
--------------------------------------------------------------------------------
/my-create-vite/template-react-ts/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/my-create-vite/template-react/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/pnpm-monorepo-test/packages/cli/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @guang-pnpm/cli
2 |
3 | ## 1.1.0
4 |
5 | ### Minor Changes
6 |
7 | - 数字加减 cli
8 |
9 | ### Patch Changes
10 |
11 | - Updated dependencies
12 | - @guang-pnpm/core@1.1.0
13 |
--------------------------------------------------------------------------------
/buffer-test/index5.js:
--------------------------------------------------------------------------------
1 | const { Buffer } = require('node:buffer');
2 |
3 | const buffer = Buffer.alloc(10);
4 |
5 | buffer.writeUint16LE(256, 0)
6 |
7 | console.log(buffer.readUInt16LE(0));
8 | console.log(buffer.readUint8(0), buffer.readUint8(1));
--------------------------------------------------------------------------------
/guang-cli/packages/template-react/template/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/node-api-test/buffer2.mjs:
--------------------------------------------------------------------------------
1 | import { Buffer } from 'node:buffer';
2 |
3 | const buffer = Buffer.alloc(10);
4 |
5 | buffer.writeUint16LE(256, 0)
6 |
7 | console.log(buffer.readUInt16LE(0));
8 | console.log(buffer.readUint8(0), buffer.readUint8(1));
--------------------------------------------------------------------------------
/node-api-test/fs.mjs:
--------------------------------------------------------------------------------
1 | import fs from 'node:fs';
2 |
3 | fs.mkdirSync('aaa');
4 |
5 | setTimeout(() => {
6 | fs.renameSync('aaa', 'bbb');
7 | }, 1000);
8 |
9 | setTimeout(() => {
10 | fs.rmdirSync('bbb');
11 | }, 3000);
12 |
13 |
--------------------------------------------------------------------------------
/node-api-test/vm.mjs:
--------------------------------------------------------------------------------
1 | import vm from 'node:vm';
2 |
3 | const context = {
4 | console,
5 | guang: 111,
6 | dong: 222
7 | }
8 |
9 | vm.createContext(context);
10 |
11 | vm.runInContext('console.log(guang + dong)', context);
12 |
--------------------------------------------------------------------------------
/pnpm-monorepo-test/packages/core/src/index.ts:
--------------------------------------------------------------------------------
1 | function add(a: number, b: number) {
2 | return a + b;
3 | }
4 |
5 | function minus(a: number, b: number) {
6 | return a - b;
7 | }
8 |
9 | export {
10 | add,
11 | minus
12 | }
13 |
--------------------------------------------------------------------------------
/guang-cli/packages/utils/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @guang-cli/utils
2 |
3 | ## 1.1.2
4 |
5 | ### Patch Changes
6 |
7 | - utils
8 |
9 | ## 1.1.1
10 |
11 | ### Patch Changes
12 |
13 | - utils
14 |
15 | ## 1.1.0
16 |
17 | ### Minor Changes
18 |
19 | - utils 包
20 |
--------------------------------------------------------------------------------
/my-nest-cli/README.md:
--------------------------------------------------------------------------------
1 | # my nest cli
2 |
3 | 掘金小册 《Node.js 工具链通关秘籍》案例代码
4 |
5 | 第一步,全局安装这个命令:
6 |
7 | ```
8 | npm install -g my-nest-cli
9 | ```
10 |
11 | 第二步,进入 Nest 项目目录,执行 my-cli transform
12 |
13 | ```
14 | my-cli transform ./src/app.module.ts
15 | ```
--------------------------------------------------------------------------------
/node-api-test/crypto.mjs:
--------------------------------------------------------------------------------
1 | import crypto from 'node:crypto';
2 |
3 | export function md5(str) {
4 | const hash = crypto.createHash('md5');
5 | hash.update(str);
6 | return hash.digest('hex');
7 | }
8 |
9 | console.log(md5('123456'));
10 |
11 |
--------------------------------------------------------------------------------
/my-source-map-support/src/index.ts:
--------------------------------------------------------------------------------
1 | function add(a: number, b: number) {
2 | if(a === 1) {
3 | throw new Error('xxx2');
4 | }
5 | return a + b;
6 | }
7 |
8 | function main() {
9 | console.log(add(1,2));
10 | }
11 |
12 | main();
13 |
14 |
--------------------------------------------------------------------------------
/node-api-test/string_decoder.mjs:
--------------------------------------------------------------------------------
1 | import { StringDecoder } from 'node:string_decoder';
2 | import { Buffer } from 'node:buffer';
3 |
4 | const decoder = new StringDecoder('utf8');
5 |
6 | const buf = Buffer.from('神说要有光', 'utf-8');
7 | console.log(decoder.write(buf));
8 |
9 |
--------------------------------------------------------------------------------
/worker-test/page/worker.js:
--------------------------------------------------------------------------------
1 | function calc(num) {
2 | let total = 0;
3 | for(let i = 0; i< num; i++) {
4 | total += i;
5 | }
6 | return total
7 | }
8 |
9 | addEventListener('message', function(evt) {
10 | postMessage(calc(evt.data));
11 | });
--------------------------------------------------------------------------------
/excel-export/en-US.json:
--------------------------------------------------------------------------------
1 | {
2 | "username": "Username {name}",
3 | "password": "Password",
4 | "rememberMe": "Remember Me",
5 | "submit": "Submit",
6 | "inputYourUsername": "Please input your username!",
7 | "inputYourPassword": "Please input your password!"
8 | }
--------------------------------------------------------------------------------
/node-api-test/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Document
7 |
8 |
9 | hello
10 |
11 |
--------------------------------------------------------------------------------
/node-api-test/meta2.mjs:
--------------------------------------------------------------------------------
1 | import url from 'node:url';
2 |
3 | console.log(import.meta.url);
4 | console.log(import.meta.resolve('./a.js'))
5 |
6 | console.log(import.meta.dirname);
7 | console.log(import.meta.filename);
8 |
9 | console.log(url.fileURLToPath(import.meta.url))
10 |
--------------------------------------------------------------------------------
/node-api-test/query_string.mjs:
--------------------------------------------------------------------------------
1 | import queryString from 'node:querystring';
2 |
3 | const res = queryString.parse('a=1&b=2&c=xxx');
4 |
5 | console.log(res);
6 |
7 | const res2 = queryString.stringify({ aaa: '111', bbb: ['222', '33'], ccc: '444' });
8 |
9 | console.log(res2);
10 |
--------------------------------------------------------------------------------
/scaffold-pkg-test/src/cli-spinner.js:
--------------------------------------------------------------------------------
1 | const Spinner = require('cli-spinner').Spinner
2 |
3 | console.log('111');
4 | console.log('222');
5 |
6 | const spinner = new Spinner(`安装中.. %s`)
7 | spinner.start()
8 |
9 | setTimeout(() => {
10 | spinner.stop(true);
11 | }, 3000);
12 |
--------------------------------------------------------------------------------
/node-api-test/util3.mjs:
--------------------------------------------------------------------------------
1 | import util from 'util';
2 |
3 | const flag = util.debug('flag');
4 |
5 | if (flag.enabled) {
6 | console.log('这是一条 debug 日志 111');
7 | }
8 |
9 | const flag2 = util.debug('flag2');
10 |
11 | if (flag2.enabled) {
12 | console.log('这是一条 debug 日志 222');
13 | }
14 |
--------------------------------------------------------------------------------
/react-comp/src/App.tsx:
--------------------------------------------------------------------------------
1 | import Button from "./Button"
2 |
3 | function App() {
4 |
5 | return
6 |
7 |
8 |
9 | }
10 |
11 | export default App
12 |
--------------------------------------------------------------------------------
/react-comp/src/main.tsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | // import './index.css'
4 | import App from './App.tsx'
5 |
6 | createRoot(document.getElementById('root')!).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/scaffold-pkg-test/src/glob.js:
--------------------------------------------------------------------------------
1 | const { glob } = require('glob');
2 |
3 | async function main() {
4 | const files = await glob('**', {
5 | cwd: process.cwd(),
6 | nodir: true,
7 | ignore: 'node_modules/**'
8 | })
9 | console.log(files);
10 | }
11 |
12 | main();
--------------------------------------------------------------------------------
/buffer-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "buffer-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC"
12 | }
13 |
--------------------------------------------------------------------------------
/excel-export/messages.csv:
--------------------------------------------------------------------------------
1 | Message ID,zh-CN,en-US
2 | username,用户名 {name},Username {name}
3 | password,密码222,Password
4 | rememberMe,记住我,Remember Me
5 | submit,提交,Submit
6 | inputYourUsername,请输入你的用户名!,Please input your username!
7 | inputYourPassword,请输入你的密码!,Please input your password!
8 |
--------------------------------------------------------------------------------
/my-comp-lib-test/src/main.tsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | // import './index.css'
4 | import App from './App.tsx'
5 |
6 | createRoot(document.getElementById('root')!).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/my-websocket/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-websocket",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC"
12 | }
13 |
--------------------------------------------------------------------------------
/worker-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "worker-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC"
12 | }
13 |
--------------------------------------------------------------------------------
/ansi-test/index2.js:
--------------------------------------------------------------------------------
1 | import readline from 'node:readline';
2 |
3 | const repeatCount = process.stdout.rows - 2;
4 | const blank = repeatCount > 0 ? '\n'.repeat(repeatCount) : '';
5 | console.log(blank);
6 |
7 | readline.cursorTo(process.stdout, 0, 0);
8 | readline.clearScreenDown(process.stdout);
9 |
10 |
--------------------------------------------------------------------------------
/excel-export/message2.csv:
--------------------------------------------------------------------------------
1 | Message ID,zh-CN,en-US
2 | username,用户名 {name},Username {name}
3 | password,密码222,Password
4 | rememberMe,记住我333,Remember Me
5 | submit,提交,Submit
6 | inputYourUsername,请输入你的用户名!,Please input your username!
7 | inputYourPassword,请输入你的密码!,Please input your password!
--------------------------------------------------------------------------------
/my-dns-server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-dns-server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC"
12 | }
13 |
--------------------------------------------------------------------------------
/node-api-test/crypto3.mjs:
--------------------------------------------------------------------------------
1 | import crypto from 'node:crypto';
2 |
3 | console.log(crypto.randomInt(10));
4 | console.log(crypto.randomInt(10));
5 | console.log(crypto.randomInt(10));
6 | console.log(crypto.randomInt(10));
7 |
8 | console.log(crypto.randomUUID());
9 | console.log(crypto.randomUUID());
10 |
--------------------------------------------------------------------------------
/node-api-test/readline.mjs:
--------------------------------------------------------------------------------
1 | import { createReadStream } from 'node:fs';
2 | import { createInterface } from 'node:readline';
3 |
4 | const rl = createInterface({
5 | input: createReadStream('./repl.mjs')
6 | });
7 |
8 | rl.on('line', (line) => {
9 | console.log(`Line from file: ${line}`);
10 | });
11 |
--------------------------------------------------------------------------------
/buffer-test/index2.js:
--------------------------------------------------------------------------------
1 | const buffer = new ArrayBuffer(10);
2 |
3 | const dataView = new DataView(buffer);
4 |
5 | dataView.setUint16(0, 256);
6 |
7 | console.log(dataView.getUint16(0));
8 |
9 | console.log(dataView.getUint8(0));
10 | console.log(dataView.getUint8(8));
--------------------------------------------------------------------------------
/my-create-vite/template-react/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import App from './App.jsx'
4 | import './index.css'
5 |
6 | createRoot(document.getElementById('root')).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/node-api-test/fs2.mjs:
--------------------------------------------------------------------------------
1 | import fs from 'node:fs';
2 | import { EOL } from 'node:os';
3 |
4 | fs.writeFileSync('aaa.txt', 'hello' + EOL);
5 |
6 | setTimeout(() => {
7 | fs.appendFileSync('aaa.txt', 'world' + EOL)
8 | }, 2000);
9 |
10 | setTimeout(() => {
11 | fs.unlinkSync('aaa.txt');
12 | }, 4000)
13 |
--------------------------------------------------------------------------------
/node-api-test/path.mjs:
--------------------------------------------------------------------------------
1 | import path from 'node:path';
2 | import { fileURLToPath } from 'node:url'
3 |
4 | const filePath = fileURLToPath(import.meta.url)
5 |
6 | console.log(filePath)
7 | console.log(path.dirname(filePath));
8 | console.log(path.basename(filePath));
9 | console.log(path.extname(filePath));
10 |
--------------------------------------------------------------------------------
/my-create-vite/template-react-ts/src/main.tsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import App from './App.tsx'
4 | import './index.css'
5 |
6 | createRoot(document.getElementById('root')!).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/my-nest-cli/src/test.ts:
--------------------------------------------------------------------------------
1 | import path from "node:path";
2 | import { transformFile } from "./transform.js";
3 |
4 | (async function() {
5 | const filePath = path.join(process.cwd(), './nest-project/aaa.module.ts');
6 |
7 | const code = await transformFile(filePath);
8 | console.log(code);
9 | })();
10 |
--------------------------------------------------------------------------------
/node-api-test/util.mjs:
--------------------------------------------------------------------------------
1 | import util from 'node:util';
2 |
3 | console.log(util.format
4 | `这是一个数字:%d
5 | 这是一个字符串:%s
6 | 这是一个 JSON:%j
7 | 这是一个 对象:%o`, 111, '神说要有光', {
8 | a: 1,
9 | b: {
10 | c: 2
11 | }
12 | }, {
13 | a: 1,
14 | b: {
15 | c: 2
16 | }
17 | });
18 |
19 |
20 |
--------------------------------------------------------------------------------
/stream-test/src/fsReadStream.mjs:
--------------------------------------------------------------------------------
1 | import fs from 'node:fs';
2 |
3 | const readStream = fs.createReadStream(import.meta.dirname + '/data.txt', 'utf-8');
4 |
5 | readStream.on('data', (data)=> {
6 | console.log(data.toString())
7 | });
8 |
9 | readStream.on('end', () => {
10 | console.log('done');
11 | });
12 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-react/template/src/main.tsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import './index.css'
4 | import App from './App.tsx'
5 |
6 | createRoot(document.getElementById('root')!).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/node-api-test/os.mjs:
--------------------------------------------------------------------------------
1 | import os from 'node:os';
2 |
3 | console.log('aaa' + os.EOL + 'bbb' + os.EOL);
4 |
5 | console.log(os.cpus());
6 |
7 | console.log(os.type());
8 | console.log(os.userInfo())
9 | console.log(os.freemem(), os.totalmem());
10 |
11 | console.log(os.homedir());
12 | console.log(os.networkInterfaces())
13 |
--------------------------------------------------------------------------------
/scaffold-pkg-test/src/ora.js:
--------------------------------------------------------------------------------
1 | const ora = require('ora');
2 |
3 | console.log(111);
4 | console.log(222);
5 |
6 | const spinner = ora('下载中...').start();
7 |
8 | setTimeout(() => {
9 | spinner.color = 'yellow';
10 | spinner.text = '快了快了...';
11 | }, 2000);
12 |
13 | setTimeout(() => {
14 | spinner.stop();
15 | }, 5000);
--------------------------------------------------------------------------------
/stream-test/src/test2.mjs:
--------------------------------------------------------------------------------
1 | import http from 'node:http';
2 | import fs from 'node:fs';
3 |
4 | const server = http.createServer(async function (req, res) {
5 | const writeStream = fs.createWriteStream('aaa.txt', 'utf-8');
6 | req.pipe(writeStream);
7 | res.end('done');
8 | });
9 |
10 | server.listen(8000);
11 |
--------------------------------------------------------------------------------
/node-api-test/fs3.mjs:
--------------------------------------------------------------------------------
1 | import fs from 'node:fs';
2 |
3 | fs.mkdirSync('aaa/bbb/ccc/ddd', {
4 | recursive: true
5 | });
6 |
7 | fs.writeFileSync('aaa/a.txt', '111');
8 | fs.writeFileSync('aaa/bbb/b.txt', '222');
9 | fs.writeFileSync('aaa/bbb/ccc/c.txt', '333');
10 | fs.writeFileSync('aaa/bbb/ccc/ddd/d.txt', '444');
11 |
12 |
--------------------------------------------------------------------------------
/cli-args-test/index2.js:
--------------------------------------------------------------------------------
1 | const minimist = require('minimist');
2 |
3 | const argv = minimist(process.argv.slice(2), {
4 | boolean: ['x'],
5 | string: ['y'],
6 | unknown(arg) {
7 | return arg === '-u'
8 | },
9 | default: { y: 2333 },
10 | alias: { p: 'port', t: 'template' }
11 | });
12 | console.log(argv);
13 |
--------------------------------------------------------------------------------
/node-api-test/readline3.mjs:
--------------------------------------------------------------------------------
1 | import readline from 'node:readline';
2 |
3 | readline.emitKeypressEvents(process.stdin);
4 |
5 | process.stdin.setRawMode(true);
6 |
7 | process.stdin.on('keypress', (str, key) => {
8 |
9 | console.log(str, key)
10 |
11 | if(key.sequence === '\u0003') {
12 | process.exit();
13 | }
14 | });
--------------------------------------------------------------------------------
/node-api-test/repl.mjs:
--------------------------------------------------------------------------------
1 | import repl from 'node:repl';
2 | import cfonts from 'cfonts';
3 |
4 | const r = repl.start({ prompt: '> ', eval: myEval});
5 |
6 | function myEval(cmd, context, filename, callback) {
7 | cfonts.say(cmd, {
8 | font: '3D',
9 | colors: ['yellow', 'cyan']
10 | });
11 | callback();
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/guang-cli/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json",
3 | "changelog": "@changesets/cli/changelog",
4 | "commit": false,
5 | "fixed": [],
6 | "linked": [],
7 | "access": "restricted",
8 | "baseBranch": "main",
9 | "updateInternalDependencies": "patch",
10 | "ignore": []
11 | }
12 |
--------------------------------------------------------------------------------
/keyboard-control/src/index.ts:
--------------------------------------------------------------------------------
1 | import readline from 'node:readline';
2 |
3 | readline.emitKeypressEvents(process.stdin);
4 |
5 |
6 | process.stdin.setRawMode(true);
7 |
8 | process.stdin.on('keypress', (str, key) => {
9 |
10 | if(key.sequence === '\u0003') {
11 | process.exit();
12 | }
13 |
14 | console.log(str, key)
15 | });
--------------------------------------------------------------------------------
/node-api-test/crypto2.mjs:
--------------------------------------------------------------------------------
1 | import { createHash } from 'node:crypto';
2 | import { Readable } from 'node:stream';
3 |
4 | const rs = new Readable();
5 | rs._read = function() {
6 | this.push('123456');
7 | this.push(null);
8 | }
9 |
10 | const hash = createHash('sha256');
11 | rs.pipe(hash).setEncoding('hex').pipe(process.stdout);
12 |
13 |
--------------------------------------------------------------------------------
/my-prompts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | }
13 | }
--------------------------------------------------------------------------------
/node-api-test/cp2.mjs:
--------------------------------------------------------------------------------
1 | import cp from "node:child_process";
2 |
3 | const ls = cp.exec('ls -l');
4 |
5 | ls.stdout.on('data', (data) => {
6 | console.log(`stdout: ${data}`);
7 | });
8 |
9 | ls.stderr.on('data', (data) => {
10 | console.error(`stderr: ${data}`);
11 | });
12 |
13 | ls.on('close', (code) => {
14 | console.log(`进程退出 ${code}`);
15 | });
16 |
--------------------------------------------------------------------------------
/pnpm-monorepo-test/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json",
3 | "changelog": "@changesets/cli/changelog",
4 | "commit": false,
5 | "fixed": [],
6 | "linked": [],
7 | "access": "restricted",
8 | "baseBranch": "main",
9 | "updateInternalDependencies": "patch",
10 | "ignore": []
11 | }
12 |
--------------------------------------------------------------------------------
/auto-i18n-cli/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | }
13 | }
--------------------------------------------------------------------------------
/blessed-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "blessed-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "blessed": "^0.1.81"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/cli-dashboard/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | }
13 | }
--------------------------------------------------------------------------------
/exceljs-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "exceljs-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "exceljs": "^4.4.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/keyboard-control/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | }
13 | }
--------------------------------------------------------------------------------
/openai-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "openai-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "openai": "^4.73.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/scaffold-pkg-test/src/npminstall.js:
--------------------------------------------------------------------------------
1 | const npminstall = require('npminstall');
2 |
3 | (async () => {
4 | await npminstall({
5 | pkgs: [
6 | { name: 'chalk', version: 'latest' },
7 | ],
8 | root: process.cwd() + '/aaa',
9 | registry: 'https://registry.npmjs.org',
10 | });
11 | })().catch(err => {
12 | console.error(err);
13 | });
14 |
--------------------------------------------------------------------------------
/scan-thread-pool/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | }
13 | }
--------------------------------------------------------------------------------
/ast-transform-test/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | }
13 | }
--------------------------------------------------------------------------------
/buffer-test/index6.js:
--------------------------------------------------------------------------------
1 | const { Blob } = require('node:buffer');
2 |
3 | const blob = new Blob(['神说要有光']);
4 |
5 | const { port1, port2 } = new MessageChannel();
6 |
7 | port1.onmessage = async ({ data }) => {
8 | console.log(data);
9 | console.log(await data.text())
10 | console.log(await data.arrayBuffer())
11 | };
12 |
13 | port2.postMessage(blob);
14 |
15 |
--------------------------------------------------------------------------------
/my-source-map-support/test.js:
--------------------------------------------------------------------------------
1 | import { SourceMapConsumer } from 'source-map';
2 | import fs from 'node:fs';
3 |
4 | const mapContent = fs.readFileSync('./dist/index.js.map', 'utf-8');
5 |
6 | const map = new SourceMapConsumer(mapContent);
7 |
8 | const position = map.originalPositionFor({
9 | line: 54,
10 | column: 0
11 | });
12 |
13 | console.log(position);
--------------------------------------------------------------------------------
/node-api-test/http-server.mjs:
--------------------------------------------------------------------------------
1 | import http from 'node:http';
2 | import fs from 'node:fs';
3 |
4 | const server = http.createServer(async function (req, res) {
5 |
6 | const writeStream = fs.createWriteStream('aaa.txt', 'utf-8');
7 | req.pipe(writeStream);
8 |
9 | res.write('66666');
10 | res.end('done');
11 | });
12 |
13 | server.listen(8000);
14 |
--------------------------------------------------------------------------------
/stream-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "stream-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "@types/node": "^22.10.2"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/cli-progress-test/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/guang-cli/packages/generate/src/test.ts:
--------------------------------------------------------------------------------
1 | import { cosmiconfig, cosmiconfigSync } from 'cosmiconfig';
2 | import path from 'node:path';
3 |
4 | const explorer = cosmiconfig("xxx");
5 |
6 | async function main() {
7 | const result = await explorer.search(path.join(import.meta.dirname, '../'));
8 |
9 | console.log(result?.config);
10 |
11 | }
12 |
13 | main();
14 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-vue/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @guang-cli/template-vue
2 |
3 | ## 1.2.2
4 |
5 | ### Patch Changes
6 |
7 | - generate command
8 |
9 | ## 1.2.1
10 |
11 | ### Patch Changes
12 |
13 | - generate + config
14 |
15 | ## 1.2.0
16 |
17 | ### Minor Changes
18 |
19 | - ejs template
20 |
21 | ## 1.1.0
22 |
23 | ### Minor Changes
24 |
25 | - guang-cli 项目模版
26 |
--------------------------------------------------------------------------------
/mini-puppeteer/src/lib/helpers.mjs:
--------------------------------------------------------------------------------
1 | function evaluate(client, fun, args) {
2 | var argsString = args.map(x => JSON.stringify(x)).join(',');
3 | var code = `(${fun.toString()})(${argsString})`;
4 |
5 | return client.send('Runtime.evaluate', {
6 | expression: code,
7 | returnByValue: true
8 | });
9 | }
10 |
11 | export {
12 | evaluate
13 | }
--------------------------------------------------------------------------------
/node-api-test/cp1.mjs:
--------------------------------------------------------------------------------
1 | import cp from "node:child_process";
2 |
3 | const ls = cp.spawn('ls', ['-l', './']);
4 |
5 | ls.stdout.on('data', (data) => {
6 | console.log(`stdout: ${data}`);
7 | });
8 |
9 | ls.stderr.on('data', (data) => {
10 | console.error(`stderr: ${data}`);
11 | });
12 |
13 | ls.on('close', (code) => {
14 | console.log(`进程退出 ${code}`);
15 | });
16 |
--------------------------------------------------------------------------------
/stream-test/src/fsWriteStream.mjs:
--------------------------------------------------------------------------------
1 | import fs from 'node:fs';
2 |
3 | const writeStream = fs.createWriteStream('tmp.txt', 'utf-8');
4 |
5 | writeStream.on('finish', () => console.log('done'));
6 |
7 | writeStream.write('阿门阿前一棵葡萄树,');
8 | writeStream.write('阿东阿东绿的刚发芽,');
9 | writeStream.write('阿东背着那重重的的壳呀,');
10 | writeStream.write('一步一步地往上爬。');
11 | writeStream.end();
12 |
--------------------------------------------------------------------------------
/my-comp-lib-test/src/App.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from "@guang-comp/react-comp-lib"
2 | import '@guang-comp/react-comp-lib/dist/index.css';
3 |
4 | function App() {
5 |
6 | return
7 |
8 |
9 |
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/my-websocket/src/index.js:
--------------------------------------------------------------------------------
1 | const MyWebSocket = require('./ws');
2 | const ws = new MyWebSocket({ port: 8080 });
3 |
4 | ws.on('data', (data) => {
5 | console.log('receive data:' + data);
6 | setInterval(() => {
7 | ws.send(data + ' ' + Date.now());
8 | }, 2000)
9 | });
10 |
11 | ws.on('close', (code, reason) => {
12 | console.log('close:', code, reason);
13 | });
14 |
--------------------------------------------------------------------------------
/my-git/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-git",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "commander": "^13.1.0",
14 | "glob": "^11.0.1"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/node-api-test/buffer.mjs:
--------------------------------------------------------------------------------
1 | import { Buffer } from 'node:buffer';
2 |
3 | const buf1 = Buffer.alloc(10, 6);
4 |
5 | const buf2 = Buffer.from('神说要有光', 'utf-8');
6 |
7 | const buf3 = Buffer.from([1, 2, 3]);
8 |
9 | console.log(buf1.toString('hex'))
10 |
11 | console.log(buf2.toString('utf-8'))
12 | console.log(buf2.toString('base64'))
13 |
14 | console.log(buf3.toString('hex'))
15 |
--------------------------------------------------------------------------------
/react-comp/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/scaffold-pkg-test/src/semver.js:
--------------------------------------------------------------------------------
1 | const semver = require('semver');
2 |
3 | if(semver.valid('1.2.3#')) {
4 | console.log('版本号有效');
5 | } else {
6 | console.log('版本号无效');
7 | }
8 |
9 | if(semver.gt('2.0.0', '1.0.8')) {
10 | console.log('有新版本可以安装')
11 | }
12 |
13 | if(semver.lte(process.version, '22.0.0')) {
14 | console.log(`node 版本 ${process.version} 小于 22`)
15 | }
16 |
--------------------------------------------------------------------------------
/worker-test/node/index.js:
--------------------------------------------------------------------------------
1 | const { Worker, MessageChannel } = require('node:worker_threads');
2 |
3 | const { port1, port2 } = new MessageChannel();
4 |
5 | const worker = new Worker('./node-worker.js');
6 | worker.postMessage(
7 | { value: 10*10000*10000, channel: port2 },
8 | [port2]
9 | );
10 |
11 | port1.on('message', (value) => {
12 | console.log('res', value);
13 | })
--------------------------------------------------------------------------------
/my-comp-lib-test/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/node-api-test/path2.js:
--------------------------------------------------------------------------------
1 | const path = require('node:path');
2 |
3 | const filePath = path.join('../', 'node-api-test', './', 'path2.js');
4 |
5 | console.log(filePath);
6 |
7 | const filePath2 = path.resolve('../', 'node-api-test', './', 'path2.js');
8 |
9 | console.log(filePath2);
10 |
11 | console.log(path.relative('/a/b/c', '/a/d'));
12 |
13 | console.log(path.parse(__filename));
14 |
--------------------------------------------------------------------------------
/react-i18n-test/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/worker-test/node/node-worker.js:
--------------------------------------------------------------------------------
1 | const { parentPort } = require('node:worker_threads');
2 |
3 | function calc(num) {
4 | let total = 0;
5 | for(let i = 0; i< num; i++) {
6 | total += i;
7 | }
8 | return total
9 | }
10 |
11 | parentPort.on('message', (message) => {
12 | const res = calc(message.value);
13 |
14 | message.channel.postMessage(res);
15 | });
16 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-vue/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@guang-cli/template-vue",
3 | "version": "1.2.2",
4 | "publishConfig": {
5 | "access": "public"
6 | },
7 | "main": "index.js",
8 | "scripts": {
9 | "test": "echo \"Error: no test specified\" && exit 1"
10 | },
11 | "keywords": [],
12 | "author": "",
13 | "license": "ISC",
14 | "description": ""
15 | }
16 |
--------------------------------------------------------------------------------
/node-api-test/worker_threads_worker.mjs:
--------------------------------------------------------------------------------
1 | import { parentPort } from 'node:worker_threads';
2 |
3 | function calc(num) {
4 | let total = 0;
5 | for(let i = 0; i< num; i++) {
6 | total += i;
7 | }
8 | return total
9 | }
10 |
11 | parentPort.on('message', (message) => {
12 | const res = calc(message.value);
13 |
14 | message.channel.postMessage(res);
15 | });
16 |
--------------------------------------------------------------------------------
/cli-args-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cli-args-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "commander": "^12.1.0",
14 | "minimist": "^1.2.8"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-react/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@guang-cli/template-react",
3 | "version": "1.3.2",
4 | "publishConfig": {
5 | "access": "public"
6 | },
7 | "main": "index.js",
8 | "scripts": {
9 | "test": "echo \"Error: no test specified\" && exit 1"
10 | },
11 | "keywords": [],
12 | "author": "",
13 | "license": "ISC",
14 | "description": ""
15 | }
16 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue/_gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/my-source-map-support/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | "sourceMap": true
13 | }
14 | }
--------------------------------------------------------------------------------
/my-create-vite/template-react-ts/_gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/my-create-vite/template-react/_gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/my-create-vite/template-vue-ts/_gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/node-api-test/worker_threads_main.mjs:
--------------------------------------------------------------------------------
1 | import { Worker, MessageChannel } from 'node:worker_threads';
2 |
3 | const { port1, port2 } = new MessageChannel();
4 |
5 | const worker = new Worker('./worker_threads_worker.mjs');
6 | worker.postMessage(
7 | { value: 10*10000*10000, channel: port2 },
8 | [port2]
9 | );
10 |
11 | port1.on('message', (value) => {
12 | console.log('res', value);
13 | })
--------------------------------------------------------------------------------
/pnpm-monorepo-test/packages/cli/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "declaration": true,
9 | "esModuleInterop": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "strict": true,
12 | "skipLibCheck": true,
13 | }
14 | }
--------------------------------------------------------------------------------
/pnpm-monorepo-test/packages/core/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "declaration": true,
9 | "esModuleInterop": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "strict": true,
12 | "skipLibCheck": true,
13 | }
14 | }
--------------------------------------------------------------------------------
/ansi-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ansi-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "type": "module",
7 | "scripts": {
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "ansi-escapes": "^7.0.0",
15 | "chalk": "^5.3.0"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-react/template/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/guang-cli/packages/template-vue/template/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/my-create-vite/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | },
13 | "exclude": [
14 | "template-**"
15 | ]
16 | }
--------------------------------------------------------------------------------
/my-nest-cli/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | },
13 | "exclude": [
14 | "nest-project"
15 | ]
16 | }
--------------------------------------------------------------------------------
/blessed-contrib-test/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "blessed-contrib-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "blessed": "^0.1.81",
14 | "blessed-contrib": "^4.11.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/buffer-test/index.js:
--------------------------------------------------------------------------------
1 | const buffer = new ArrayBuffer(10);
2 |
3 | const arr1 = new Uint16Array(buffer);
4 |
5 | arr1[0] = 256;
6 | console.log(arr1)
7 | console.log(arr1.length);
8 | console.log(arr1.byteLength);
9 |
10 | const arr2 = new Uint8Array(buffer);
11 | console.log(arr2);
12 | console.log(arr2.length);
13 | console.log(arr2.byteLength);
--------------------------------------------------------------------------------
/ansi-test/index3.js:
--------------------------------------------------------------------------------
1 | import ansiEscapes from 'ansi-escapes';
2 |
3 | const log = process.stdout.write.bind(process.stdout);
4 |
5 | log(ansiEscapes.cursorTo(10, 1) + '111');
6 | log(ansiEscapes.cursorTo(7, 2) + '222');
7 | log(ansiEscapes.cursorTo(5, 3) + '333');
8 |
9 | setTimeout(() => {
10 | log(ansiEscapes.cursorTo(0, 2) + ansiEscapes.eraseEndLine);
11 | log(ansiEscapes.cursorTo(5, 3) + '444')
12 | }, 1000)
13 |
--------------------------------------------------------------------------------
/node-api-test/util4.mjs:
--------------------------------------------------------------------------------
1 | import util from 'node:util';
2 | import cp from 'node:child_process';
3 |
4 | // cp.exec('ls -l', (stderr, stdout) => {
5 | // console.log(stdout);
6 | // });
7 |
8 | const exec = util.promisify(cp.exec);
9 |
10 | async function main() {
11 | const { stdout, stderr } = await exec('ls -l');
12 | console.log('stdout:', stdout);
13 | console.error('stderr:', stderr);
14 | }
15 | main();
16 |
--------------------------------------------------------------------------------
/guang-cli/packages/cli/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "declaration": true,
9 | "esModuleInterop": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "strict": true,
12 | "skipLibCheck": true,
13 | "sourceMap": true
14 | }
15 | }
--------------------------------------------------------------------------------
/guang-cli/packages/utils/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "dist",
4 | "types": [ "node" ],
5 | "target": "es2016",
6 | "module": "NodeNext",
7 | "moduleResolution": "NodeNext",
8 | "declaration": true,
9 | "esModuleInterop": true,
10 | "forceConsistentCasingInFileNames": true,
11 | "strict": true,
12 | "skipLibCheck": true,
13 | "sourceMap": true
14 | },
15 | }
--------------------------------------------------------------------------------
/my-create-vite/template-vue/README.md:
--------------------------------------------------------------------------------
1 | # Vue 3 + Vite
2 |
3 | This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `
12 |