Recent
use log::debug;
fn main() {
env_logger::init();
debug!(target: "tswc", "inputs {:?}", inputs);
}
`RUST_LOG=tswc cargo run`
`RUST_LOG=trace cargo test -- --nocapture`
use swc_core::ecma::{ast::Ident, visit::VisitMut};
use tracing::debug;
pub struct Whatplatform;
impl VisitMut for Whatplatform {
// Implement necessary visit_mut_* methods for actual custom transform.
// A comprehensive list of possible visitor methods can be found here:
// https://rustdoc.swc.rs/swc_ecma_visit/trait.VisitMut.html
fn visit_mut_ident(&mut self, n: &mut Ident) {
debug!("Values: {:#?}", n);
}
}
Use branch name
create branch named `hotfix/issue-<name-id>-anything`
, after it merged will automatic close issue namd `name-id`
in linear side.
e.g. `hotfix/issue-<jwx-159>-anything`
type Filter<T> = {
[K in keyof T]: {
fieldName: K;
operator: "like" | "equal" | "notLike" | "notEqual";
value: T[K];
};
}[keyof T];
PS: 这段代码的写法的确比较十分新奇
it will looks like
const model = {
stringProp: "str",
hamburgerProp: 123,
booleanProp: true
};
type FilterForModel = Filter<typeof model>;
/* type FilterForModel = {
fieldName: "stringProp";
operator: "like" | "equal" | "notLike" | "notEqual";
value: string;
} | {
fieldName: "hamburgerProp";
operator: "like" | "equal" | "notLike" | "notEqual";
value: number;
} | {
fieldName: "booleanProp";
operator: "like" | "equal" | "notLike" | "notEqual";
value: boolean;
} */
refs: https://github.com/microsoft/TypeScript/issues/36444
git commit --amend --author="Author Name <email@address.com>" --no-edit
after that, change entire project commit.
git rebase -r --root --exec "git commit --amend --no-edit --reset-author"
`Author Name <email@address.com>`
is newer author info.
refs: https://stackoverflow.com/questions/750172/how-do-i-change-the-author-and-committer-name-email-for-multiple-commits
import "package"
declare module "package" {
interface types {}
}
`permissions`
is required Check https://github.com/{repo}/settings/actions Workflow permissions with`Allow github actions create and approve pull request`
&`Read & Write permissons`
.
name: Release
on:
push:
branches:
- main
- master
- 'releases/*'
env:
CI: true
jobs:
version:
timeout-minutes: 15
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
packages: write
pull-requests: write
issues: read
steps:
- name: checkout code repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: setup node.js
uses: actions/setup-node@v2
with:
node-version: 14
- name: install pnpm
run: npm i pnpm@7.23.0 -g
- name: install dependencies
run: pnpm install --frozen-lockfile=false
- name: create and publish versions
uses: changesets/action@master
with:
version: pnpm ci:version
commit: "chore: update versions"
title: "chore: update versions"
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
docs: https://nodejs.org/api/corepack.html
important
{
"packageManager": "pnpm@version"
}
`corepack enable`
will auto switch to`pnpm@7`
(from`package.json`
) if`pnpm@7`
available.- use pnpm@7 -
`corepack prepare pnpm@latest-7 --activate`
- use pnpm@8 -
`corepack prepare pnpm@latest-8 --activate`
Somethings, corepack will not working as expect, please uninstall pnpm older pnpm version with `pnpm uninstall pnpm@version -g`
.
refs:
- https://github.com/pnpm/pnpm/issues/1383