@planet-matrix/mobius-mono 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oxlintrc.json +5 -0
- package/CHANGELOG.md +23 -0
- package/README.md +24 -0
- package/dist/app/index.d.ts +2 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +11 -0
- package/dist/internals/change/index.d.ts +7 -0
- package/dist/internals/change/index.d.ts.map +1 -0
- package/dist/internals/index.d.ts +3 -0
- package/dist/internals/index.d.ts.map +1 -0
- package/dist/internals/package/check-package-json.d.ts +2 -0
- package/dist/internals/package/check-package-json.d.ts.map +1 -0
- package/dist/internals/package/index.d.ts +2 -0
- package/dist/internals/package/index.d.ts.map +1 -0
- package/package.json +55 -0
- package/scripts/build.ts +52 -0
- package/src/app/index.ts +26 -0
- package/src/index.ts +1 -0
- package/src/internals/change/index.ts +49 -0
- package/src/internals/index.ts +2 -0
- package/src/internals/lint/oxfmtrc.json +20 -0
- package/src/internals/lint/oxlintrc.json +1771 -0
- package/src/internals/package/check-package-json.ts +3 -0
- package/src/internals/package/index.ts +1 -0
- package/src/internals/typescript/tsconfig.base.json +161 -0
- package/tsconfig.json +13 -0
package/.oxlintrc.json
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @planet-matrix/mobius-mono
|
|
2
|
+
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ecc5f4e: Optimize change publish command.
|
|
8
|
+
|
|
9
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 2335c56: support change/publish command
|
|
14
|
+
|
|
15
|
+
## 0.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- b77e358: support change commands
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- e39ef39: Initialize a source file as a plan to implement the package json checking logic.
|
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Mobius Mono
|
|
2
|
+
|
|
3
|
+
Repository rules as code.
|
|
4
|
+
|
|
5
|
+
## Principles
|
|
6
|
+
|
|
7
|
+
- 不考虑保障原则与 Mobius Mono 相悖的项目的开发体验。
|
|
8
|
+
- 优先使用 TypeScript,并且只在必要的时候转译为 JavaScript。
|
|
9
|
+
- 业务代码中优先使用跨运行时、跨平台兼容的特性。
|
|
10
|
+
- 优先使用 Bun 提供的 infra 能力。
|
|
11
|
+
- 优先使用 Oxc 生态系统中的工具。
|
|
12
|
+
- 将 Formatting 视为 Linting 的一部分。
|
|
13
|
+
- 源码即包,尽可能将所有可以发布的东西都作为包的一部分发布出去。
|
|
14
|
+
|
|
15
|
+
## Rules
|
|
16
|
+
|
|
17
|
+
- 可执行文件放在单独的 `bin` 目录,不需要打包,通过 `package.json` 的 `bin` 字段对外提供。
|
|
18
|
+
- `package.json` 不需要设置 `main` 字段。
|
|
19
|
+
|
|
20
|
+
## Todos
|
|
21
|
+
|
|
22
|
+
[] 当 oxfmt 支持在 monorepo 中为不同的包添加不同的配置之后将其引入。
|
|
23
|
+
[] 当 oxlint `extends` 字段支持指定包产物时,更新所有相关配置。
|
|
24
|
+
[] `change publish` 支持 dry-run 参数。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// Enjoy using Mobius Mono!
|
|
3
|
+
import{$ as r}from"zx";var o=async()=>{await r({stdio:"inherit"})`bun changeset add`},x=async()=>{await r({stdio:"inherit"})`bun changeset version && bun update`},m=async()=>{await r({stdio:"inherit"})`
|
|
4
|
+
echo "[Publish] Publishing packages..."
|
|
5
|
+
for dir in packages/*; do
|
|
6
|
+
# \u786E\u4FDD\u662F\u76EE\u5F55
|
|
7
|
+
if [ ! -d "$dir" ]; then
|
|
8
|
+
echo "[Publish] Skipping $dir, not a directory."
|
|
9
|
+
continue
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
echo "[Publish] Processing $dir..."
|
|
13
|
+
# \u5C1D\u8BD5\u8FDB\u5165\u76EE\u5F55
|
|
14
|
+
cd "$dir" || {
|
|
15
|
+
echo "[Publish] Cannot enter $dir, skipping..."
|
|
16
|
+
continue
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
# \u53D1\u5E03
|
|
20
|
+
if ! bun publish; then
|
|
21
|
+
echo "[Publish] Publish failed for $dir, skipping..."
|
|
22
|
+
cd - >/dev/null # \u8FD4\u56DE\u539F\u76EE\u5F55
|
|
23
|
+
continue
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
echo "[Publish] Publish succeeded for $dir."
|
|
27
|
+
|
|
28
|
+
# \u8FD4\u56DE\u539F\u76EE\u5F55
|
|
29
|
+
cd - >/dev/null
|
|
30
|
+
done
|
|
31
|
+
echo "[Publish] Publish complete."
|
|
32
|
+
|
|
33
|
+
echo "[Publish] Add tags..."
|
|
34
|
+
bun changeset tag
|
|
35
|
+
echo "[Publish] Tagging complete."
|
|
36
|
+
`};var q=()=>{};export{x as version,m as publish,q as check,o as add};
|
|
37
|
+
// Made with ♥ by the Planet Matrix team!
|
|
38
|
+
|
|
39
|
+
//# debugId=B1087EE961405B9664756E2164756E21
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["..\\src\\internals\\change\\index.ts", "..\\src\\internals\\package\\check-package-json.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { $ } from \"zx\"\n\nexport const add = async (): Promise<void> => {\n await $({ stdio: 'inherit' })`bun changeset add`\n}\n\nexport const version = async (): Promise<void> => {\n await $({ stdio: 'inherit' })`bun changeset version && bun update`\n}\n\n/**\n * @see https://ianm.com/posts/2025-08-18-setting-up-changesets-with-bun-workspaces\n */\nexport const publish = async (): Promise<void> => {\n await $({ stdio: 'inherit' })`\necho \"[Publish] Publishing packages...\"\nfor dir in packages/*; do\n # 确保是目录\n if [ ! -d \"$dir\" ]; then\n echo \"[Publish] Skipping $dir, not a directory.\"\n continue\n fi\n\n echo \"[Publish] Processing $dir...\"\n # 尝试进入目录\n cd \"$dir\" || {\n echo \"[Publish] Cannot enter $dir, skipping...\"\n continue\n }\n\n # 发布\n if ! bun publish; then\n echo \"[Publish] Publish failed for $dir, skipping...\"\n cd - >/dev/null # 返回原目录\n continue\n fi\n\n echo \"[Publish] Publish succeeded for $dir.\"\n\n # 返回原目录\n cd - >/dev/null\ndone\necho \"[Publish] Publish complete.\"\n\necho \"[Publish] Add tags...\"\nbun changeset tag\necho \"[Publish] Tagging complete.\"\n `\n}\n",
|
|
6
|
+
"export const check = (): void => {\n // Check package.json logic here\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";;AAAA,YAAS,WAEF,IAAM,EAAM,SAA2B,CAC5C,KAAM,GAAE,CAAE,MAAO,SAAU,CAAC,sBAGjB,EAAU,SAA2B,CAChD,KAAM,GAAE,CAAE,MAAO,SAAU,CAAC,wCAMjB,EAAU,SAA2B,CAChD,KAAM,GAAE,CAAE,MAAO,SAAU,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;KCdvB,IAAM,EAAQ,IAAY",
|
|
9
|
+
"debugId": "B1087EE961405B9664756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const add: () => Promise<void>;
|
|
2
|
+
export declare const version: () => Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* @see https://ianm.com/posts/2025-08-18-setting-up-changesets-with-bun-workspaces
|
|
5
|
+
*/
|
|
6
|
+
export declare const publish: () => Promise<void>;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internals/change/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,qBAEf,CAAA;AAED,eAAO,MAAM,OAAO,qBAEnB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,qBAmCnB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/internals/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-package-json.d.ts","sourceRoot":"","sources":["../../../src/internals/package/check-package-json.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,YAEjB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internals/package/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@planet-matrix/mobius-mono",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": {
|
|
9
|
+
"@planet-matrix/mobius-monorepo": "./src/index.ts",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"bun": "./src/index.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"./tsconfig.base.json": "./src/internals/typescript/tsconfig.base.json",
|
|
16
|
+
"./oxlintrc.json": "./src/internals/lint/oxlintrc.json",
|
|
17
|
+
"./oxfmtrc.json": "./src/internals/lint/oxfmtrc.json"
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"mono": "./src/app/index.ts"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"lint": "bun oxlint",
|
|
24
|
+
"build": "bun ./scripts/build.ts",
|
|
25
|
+
"prepublishOnly": "bun run build"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/bun": "catalog:",
|
|
29
|
+
"@types/node": "catalog:",
|
|
30
|
+
"oxlint": "catalog:",
|
|
31
|
+
"oxlint-tsgolint": "catalog:",
|
|
32
|
+
"oxfmt": "catalog:",
|
|
33
|
+
"typescript": "catalog:",
|
|
34
|
+
"@typescript/native-preview": "catalog:"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"zx": "catalog:",
|
|
38
|
+
"@opentui/core": "catalog:"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@changesets/cli": "catalog:"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/planet-matrix/mobius.git",
|
|
46
|
+
"directory": "packages/mono"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"registry": "https://registry.npmjs.org",
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"*"
|
|
54
|
+
]
|
|
55
|
+
}
|
package/scripts/build.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { $, build } from "bun"
|
|
2
|
+
|
|
3
|
+
// Ensure the outdir is existing and cleaned up before building
|
|
4
|
+
console.log("Cleaning and preparing ./dist directory...")
|
|
5
|
+
await $`rm -rf dist`
|
|
6
|
+
|
|
7
|
+
console.log("Building the typescript ...")
|
|
8
|
+
await $`bun run tsgo --emitDeclarationOnly`
|
|
9
|
+
|
|
10
|
+
console.log("Building the library...")
|
|
11
|
+
const builtLibraryOutput = await build({
|
|
12
|
+
banner: "// Enjoy using Mobius Mono!",
|
|
13
|
+
bytecode: false,
|
|
14
|
+
conditions: [],
|
|
15
|
+
define: {},
|
|
16
|
+
drop: [],
|
|
17
|
+
emitDCEAnnotations: false,
|
|
18
|
+
entrypoints: ["./src/index.ts"],
|
|
19
|
+
env: "PUBLIC_*",
|
|
20
|
+
external: [],
|
|
21
|
+
footer: "// Made with ♥ by the Planet Matrix team!",
|
|
22
|
+
format: "esm",
|
|
23
|
+
ignoreDCEAnnotations: false,
|
|
24
|
+
loader: {},
|
|
25
|
+
minify: {
|
|
26
|
+
identifiers: true,
|
|
27
|
+
keepNames: false,
|
|
28
|
+
syntax: true,
|
|
29
|
+
whitespace: true,
|
|
30
|
+
},
|
|
31
|
+
naming: {
|
|
32
|
+
entry: '[dir]/[name].[ext]',
|
|
33
|
+
chunk: '[name]-[hash].[ext]',
|
|
34
|
+
asset: '[name]-[hash].[ext]',
|
|
35
|
+
},
|
|
36
|
+
outdir: "./dist",
|
|
37
|
+
packages: "external",
|
|
38
|
+
plugins: [],
|
|
39
|
+
publicPath: undefined,
|
|
40
|
+
root: undefined,
|
|
41
|
+
sourcemap: "linked",
|
|
42
|
+
splitting: true,
|
|
43
|
+
target: "bun",
|
|
44
|
+
throw: false,
|
|
45
|
+
tsconfig: "./tsconfig.json",
|
|
46
|
+
})
|
|
47
|
+
if (builtLibraryOutput.success === false) {
|
|
48
|
+
console.error('Build library failed:', builtLibraryOutput.logs);
|
|
49
|
+
throw new Error('Build library process failed.');
|
|
50
|
+
} else {
|
|
51
|
+
console.log("Build library completed successfully.");
|
|
52
|
+
}
|
package/src/app/index.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import process from "node:process"
|
|
2
|
+
import { add, publish, version } from "Source/internals/index"
|
|
3
|
+
|
|
4
|
+
// 获取调用此文件时的命令
|
|
5
|
+
const command = process.argv;
|
|
6
|
+
|
|
7
|
+
const isChangeAdd = (command: string[]): boolean => {
|
|
8
|
+
return command.includes("change") && command.includes("add")
|
|
9
|
+
}
|
|
10
|
+
const isChangeVersion = (command: string[]): boolean => {
|
|
11
|
+
return command.includes("change") && command.includes("version")
|
|
12
|
+
}
|
|
13
|
+
const isChangePublish = (command: string[]): boolean => {
|
|
14
|
+
return command.includes("change") && command.includes("publish")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (isChangeAdd(command)) {
|
|
18
|
+
await add()
|
|
19
|
+
} else if (isChangeVersion(command)) {
|
|
20
|
+
await version()
|
|
21
|
+
} else if (isChangePublish(command)) {
|
|
22
|
+
await publish()
|
|
23
|
+
} else {
|
|
24
|
+
console.log("未知的命令")
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./internals/index"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { $ } from "zx"
|
|
2
|
+
|
|
3
|
+
export const add = async (): Promise<void> => {
|
|
4
|
+
await $({ stdio: 'inherit' })`bun changeset add`
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const version = async (): Promise<void> => {
|
|
8
|
+
await $({ stdio: 'inherit' })`bun changeset version && bun update`
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @see https://ianm.com/posts/2025-08-18-setting-up-changesets-with-bun-workspaces
|
|
13
|
+
*/
|
|
14
|
+
export const publish = async (): Promise<void> => {
|
|
15
|
+
await $({ stdio: 'inherit' })`
|
|
16
|
+
echo "[Publish] Publishing packages..."
|
|
17
|
+
for dir in packages/*; do
|
|
18
|
+
# 确保是目录
|
|
19
|
+
if [ ! -d "$dir" ]; then
|
|
20
|
+
echo "[Publish] Skipping $dir, not a directory."
|
|
21
|
+
continue
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
echo "[Publish] Processing $dir..."
|
|
25
|
+
# 尝试进入目录
|
|
26
|
+
cd "$dir" || {
|
|
27
|
+
echo "[Publish] Cannot enter $dir, skipping..."
|
|
28
|
+
continue
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# 发布
|
|
32
|
+
if ! bun publish; then
|
|
33
|
+
echo "[Publish] Publish failed for $dir, skipping..."
|
|
34
|
+
cd - >/dev/null # 返回原目录
|
|
35
|
+
continue
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
echo "[Publish] Publish succeeded for $dir."
|
|
39
|
+
|
|
40
|
+
# 返回原目录
|
|
41
|
+
cd - >/dev/null
|
|
42
|
+
done
|
|
43
|
+
echo "[Publish] Publish complete."
|
|
44
|
+
|
|
45
|
+
echo "[Publish] Add tags..."
|
|
46
|
+
bun changeset tag
|
|
47
|
+
echo "[Publish] Tagging complete."
|
|
48
|
+
`
|
|
49
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../node_modules/oxfmt/configuration_schema.json",
|
|
3
|
+
"ignorePatterns": [],
|
|
4
|
+
"arrowParens": "always",
|
|
5
|
+
"bracketSameLine": false,
|
|
6
|
+
"bracketSpacing": true,
|
|
7
|
+
"embeddedLanguageFormatting": "auto",
|
|
8
|
+
"endOfLine": "lf",
|
|
9
|
+
"insertFinalNewline": true,
|
|
10
|
+
"jsxSingleQuote": false,
|
|
11
|
+
"objectWrap": "preserve",
|
|
12
|
+
"printWidth": 200,
|
|
13
|
+
"quoteProps": "as-needed",
|
|
14
|
+
"semi": false,
|
|
15
|
+
"singleAttributePerLine": false,
|
|
16
|
+
"singleQuote": false,
|
|
17
|
+
"tabWidth": 2,
|
|
18
|
+
"trailingComma": "all",
|
|
19
|
+
"useTabs": false,
|
|
20
|
+
}
|