Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish v8.0 #1523

Merged
merged 9 commits into from
Mar 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
58 changes: 16 additions & 42 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/cache@v4
- uses: pnpm/action-setup@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm install
- run: npm run build
version: 8
- run: pnpm install --force
- run: pnpm run build
- name: remove `private=true` from package.json
run: |
jq 'del(.private)' package.json > package.json.tmp
Expand All @@ -49,9 +45,12 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: lts/*
- run: npm install
- run: npm run eslint
- run: npm run prettier
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install --force
- run: pnpm run eslint
- run: pnpm run prettier

NodeJS:
runs-on: ubuntu-latest
Expand All @@ -63,44 +62,19 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v4
- uses: pnpm/action-setup@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm install
- run: npm run build
- run: npm run test

Bun:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: npm install
- run: npm run build
- run: npm run test:bun
version: 8
- run: pnpm install --force
- run: pnpm run build
- run: pnpm run test

action-timeline:
needs:
- Build-and-Upload-to-pkg-pr-new-and-artifactory
- Check-format
- NodeJS
- Bun
# - Bun
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ jobs:
with:
node-version: 20.x
registry-url: https://registry.npmjs.org/
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: npm install
run: pnpm install
- name: Publish to npm
run: npm run package:latest
run: pnpm run package:latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH }}
- name: Website Setup
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Root
run: npm install
run: pnpm install
- name: Build
working-directory: website
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ node_modules/

packages/typescript-json/src/
package-lock.json
pnpm-lock.yaml
bun.lockb
bun.lock

Expand Down
10 changes: 6 additions & 4 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@typegoose/typegoose": "^10.1.1",
"@types/autocannon": "^7.9.0",
"@types/benchmark": "^2.1.2",
"@types/body-parser": "^1.19.5",
"@types/d3": "^7.4.0",
"@types/express": "^4.17.14",
"@types/node": "^18.15.12",
Expand All @@ -41,7 +42,7 @@
"ajv": "^8.12.0",
"autocannon": "^7.10.0",
"benchmark": "^2.1.4",
"body-parser": "^1.20.2",
"body-parser": "^1.20.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"d3": "^5.16.0",
Expand All @@ -60,16 +61,17 @@
"ts-node": "^10.9.1",
"ts-patch": "^3.3.0",
"tstl": "^3.0.0",
"typescript": "~5.7.3",
"typescript": "~5.8.2",
"uuid": "^8.3.2",
"zod": "^3.19.1"
},
"dependencies": {
"fp-ts": "^2.16.9",
"randexp": "^0.5.3",
"source-map-support": "^0.5.21",
"suppress-warnings": "^1.0.2",
"tstl": "^3.0.0",
"uuid": "^9.0.1",
"typia": "../"
"typia": "workspace:^",
"uuid": "^9.0.1"
}
}
47 changes: 0 additions & 47 deletions deploy/bun.ts

This file was deleted.

16 changes: 8 additions & 8 deletions deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ const main = async (): Promise<void> => {
commands:
tag === "test" && template === true
? [
"npm run template",
"npm run build",
"npm start",
"npm run generate",
"pnpm run template",
"pnpm run build",
"pnpm start",
"pnpm run generate",
]
: ["npm run build", "npm start", "npm run generate"],
: ["pnpm run build", "pnpm start", "pnpm run generate"],
},
{
name: "test-esm",
commands: ["npm run build", "npm start"],
commands: ["pnpm run build", "pnpm start"],
},
{
name: "test-error",
commands: ["npm start"],
commands: ["pnpm start"],
},
{
name: "benchmark",
commands: ["npm run build"],
commands: ["pnpm run build"],
},
],
});
Expand Down
84 changes: 35 additions & 49 deletions deploy/internal/DeployRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import chalk from "chalk";
import cp from "child_process";
import fs from "fs";

import { ReplicaPublisher } from "./ReplicaPublisher";

export namespace DeployRunner {
export const main = async (props: {
tag: string;
Expand All @@ -19,7 +17,7 @@ export namespace DeployRunner {
process.chdir(__dirname + "/../..");
execLoudly({
label: "typia",
command: "npm run build",
command: "pnpm run build",
});
}
const version: string = props.setup
Expand All @@ -40,7 +38,6 @@ export namespace DeployRunner {
if (props.publish) {
title("DEPLOY TO NPM");
await publish(props.tag);
await ReplicaPublisher.replica(props.tag);
}
};

Expand All @@ -51,37 +48,42 @@ export namespace DeployRunner {

const publish = async (tag: string): Promise<string> => {
// LOAD PACKAGE.JSON CONTENT
const pack: any = JSON.parse(
fs.readFileSync(`${__dirname}/../../package.json`, "utf8"),
);
const load = () =>
JSON.parse(fs.readFileSync(`${__dirname}/../../package.json`, "utf8"));
const original: any = load();
const pack: any = load();
delete pack.private;

// CHECK VERSION AND TAG
const version: string = pack.version;
const dev: boolean = version.includes("-dev.");
if ((tag === "next" || tag === "patch") && !dev)
throw new Error(`${tag} tag can only be used for dev versions.`);
else if (tag === "latest" && dev)
throw new Error("latest tag can only be used for non-dev versions.");

// REMOVE PRIVATE FOR PUBLISHING
delete pack.private;
await fs.promises.writeFile(
`${__dirname}/../../package.json`,
JSON.stringify(pack, null, 2),
"utf8",
);
if (tag !== "test")
cp.execSync(
`npm publish --tag ${tag}${tag === "latest" ? " --provenance" : ""}`,
{ stdio: "inherit" },
try {
await fs.promises.writeFile(
`${__dirname}/../../package.json`,
JSON.stringify(pack, null, 2),
"utf8",
);

// RESTORE PRIVATE PROPERTY
pack.private = true;
fs.writeFileSync(
`${__dirname}/../../package.json`,
JSON.stringify(pack, null, 2),
"utf8",
);
return version;
if (tag !== "test")
cp.execSync(
`npm publish --tag ${tag}${tag === "latest" ? " --provenance" : ""}`,
{ stdio: "inherit" },
);
return version;
} catch (error) {
throw error;
} finally {
// RESTORE PRIVATE PROPERTY
await fs.promises.writeFile(
`${__dirname}/../../package.json`,
JSON.stringify(original, null, 2),
"utf8",
);
}
};

const test = async (props: {
Expand All @@ -91,31 +93,15 @@ export namespace DeployRunner {
commands: string[];
}): Promise<void> => {
process.chdir(`${__dirname}/../../${props.name}`);
if (props.setup) {
if (fs.existsSync("node_modules/typia"))
cp.execSync("npm uninstall typia --force", { stdio: "ignore" });

const pack: any = JSON.parse(
await fs.promises.readFile("package.json", "utf8"),
);
pack.dependencies ??= {};
pack.dependencies.typia = `../`;
await fs.promises.writeFile(
"package.json",
JSON.stringify(pack, null, 2),
"utf8",
);
}
if (props.commands.length) {
if (props.setup)
execLoudly({
label: `@typia/${props.name}`,
command: "npm install --force",
});
if (props.setup)
execLoudly({
label: `@typia/${props.name}`,
command: "pnpm install --force",
});
if (props.commands.length)
props.commands.forEach((command) =>
execLoudly({ label: `@typia/${props.name}`, command }),
);
}
process.chdir(__dirname + "/../..");
};

Expand Down
Loading