Skip to content

Commit

Permalink
Merge pull request #45 from long-woo/dev
Browse files Browse the repository at this point in the history
1.4.0
  • Loading branch information
long-woo authored Feb 27, 2024
2 parents 4e84543 + 6036207 commit 10caa25
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 389 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ For convenience, STC can not only develop plugins in Deno, but also provides `@l

```ts
// 引用模块
import { start } from 'https://deno.land/x/stc@1.3.0/mod.ts'
import { start } from 'https://deno.land/x/stc@1.4.0/mod.ts'

// 定义插件
const myPlugin: IPlugin = {
Expand Down
12 changes: 6 additions & 6 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@loongwoo/stc",
"version": "1.3.0",
"version": "1.4.0",
"exports": "./mod.ts",
"tasks": {
"dev": "deno run -A --watch=src src/main.ts --url 'https://petstore3.swagger.io/api/v3/openapi.json' --outDir=out",
"version": "echo '1.3.0' > release/version",
"version": "echo '1.4.0' > release/version",
"build:npm": "deno run -A src/npm/index.ts",
"build:mac": "deno compile --output release/stc src/main.ts -A --target x86_64-apple-darwin",
"build:mac-m": "deno compile --output release/stc-m src/main.ts -A --target aarch64-apple-darwin",
"build:win": "deno compile --output release/stc-win src/main.ts -A --target x86_64-pc-windows-msvc",
"build:linux": "deno compile --output release/stc-linux src/main.ts -A --target x86_64-unknown-linux-gnu",
"build:mac": "deno compile -A --target x86_64-apple-darwin --output release/stc src/main.ts",
"build:mac-m": "deno compile -A --target aarch64-apple-darwin --output release/stc-m src/main.ts",
"build:win": "deno compile -A --target x86_64-pc-windows-msvc --output release/stc-win src/main.ts",
"build:linux": "deno compile -A --target x86_64-unknown-linux-gnu --output release/stc-linux src/main.ts",
"esm:add": "deno run -A https://esm.sh/v130 add",
"esm:update": "deno run -A https://esm.sh/v130 update",
"esm:remove": "deno run -A https://esm.sh/v130 remove"
Expand Down
374 changes: 14 additions & 360 deletions deno.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/my-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "my-plugin",
"scripts": {
"dev": "node index.mjs"
"dev": "node index.mjs",
"test": "stc --version"
},
"devDependencies": {
"@loongwoo/stc": "file:../../npm_dist"
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Args, parseArgs, type ParseOptions } from "std/cli/parse_args.ts";
import ProgressBar from "x/progress@v1.3.8/mod.ts";
import ProgressBar from "x/progress@v1.4.5/mod.ts";

import Logs from "./console.ts";
import { ISwaggerOptions } from "./swagger.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18next from "x/i18next@v23.4.1/index.js";
import i18next from "x/i18next@v23.10.0/index.js";

import enTranslation from "./locales/en.json" with { type: "json" };
import zhCNTranslation from "./locales/zh-CN.json" with { type: "json" };
Expand Down
8 changes: 3 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { main } from "./cli.ts";
import { start } from "./app.ts";

if (import.meta.main) {
const options = await main();
const options = await main();

// 启动
start(options);
}
// 启动
start(options);
17 changes: 12 additions & 5 deletions src/npm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ import pkg from "./package.json" with { type: "json" };
// platform: "node",
// });
// console.log(res);
await dnt.emptyDir("./npm_dist");

const OUTDIR = "npm_dist";

await dnt.emptyDir(`./${OUTDIR}`);

await dnt.build({
entryPoints: ["./mod.ts"],
outDir: "./npm_dist",
entryPoints: [{
kind: "bin",
name: "stc",
path: "./src/main.ts",
}, "./mod.ts"],
outDir: `./${OUTDIR}`,
shims: {
deno: true,
},
Expand All @@ -33,7 +40,7 @@ await dnt.build({
importMap: "./import_map.json",
package: pkg,
postBuild() {
Deno.copyFile("LICENSE", "./npm_dist/LICENSE");
Deno.copyFile("README.md", "./npm_dist/README.md");
Deno.copyFile("LICENSE", `./${OUTDIR}/LICENSE`);
Deno.copyFile("README.md", `./${OUTDIR}/README.md`);
},
});
4 changes: 2 additions & 2 deletions src/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@loongwoo/stc",
"version": "1.3.0",
"description": "Swagger、Apifox 文档转换为接口文件",
"version": "1.4.0",
"description": "OpenAPI(Swagger)、Apifox 文档转换为接口文件",
"type": "module",
"module": "esm/mod.js",
"types": "esm/mod.d.ts",
Expand Down
5 changes: 0 additions & 5 deletions src/npm/pnpm-lock.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions src/plugins/javascript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ const esTransform = async (code: string) => {
format: "esm",
});

esbuild.stop();

return result.code;
};

Expand Down

0 comments on commit 10caa25

Please sign in to comment.