Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jaywcjlove/tsbb
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.0.1
Choose a base ref
...
head repository: jaywcjlove/tsbb
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.0.2
Choose a head ref
  • 3 commits
  • 24 files changed
  • 1 contributor

Commits on Mar 29, 2023

  1. Copy the full SHA
    9625b57 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    targos Michaël Zasso
    Copy the full SHA
    c92da6d View commit details
  3. released v4.0.2

    jaywcjlove committed Mar 29, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    targos Michaël Zasso
    Copy the full SHA
    1b49c9e View commit details
125 changes: 13 additions & 112 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: Build & Deploy
on:
push:
branches:
- master
name: Node.js CI

on: push

jobs:
build-deploy:
test:
name: Ubuntu Node.js ${{ matrix.node-version }}
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- 18
- 16
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
node-version: ${{ matrix.node-version }}

- run: npm install
- run: npm run build
@@ -76,107 +81,3 @@ jobs:
- name: example @example/vue
working-directory: examples/vue
run: npm run build

- run: npm install idoc@1.25.0 -g
- run: idoc -s "TSBB {{version}}"
working-directory: packages/tsbb

- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
output: ./packages/tsbb/dist/CONTRIBUTORS.svg
avatarSize: 36

- name: Is a tag created auto?
id: create_tag
uses: jaywcjlove/create-tag-action@main
with:
package-path: ./packages/tsbb/package.json

- name: get tag version
id: tag_version
uses: jaywcjlove/changelog-generator@main

- name: Build and Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
force_orphan: true
publish_branch: gh-pages
publish_dir: ./packages/tsbb/dist/

- name: Generate Changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
if: steps.create_tag.outputs.successful
with:
head-ref: ${{ steps.create_tag.outputs.version }}
filter-author: (renovate-bot|Renovate Bot)
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'

- name: Create Release
uses: jaywcjlove/create-tag-action@main
with:
package-path: ./packages/tsbb/package.json
release: true
body: |
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/tsbb@${{steps.create_tag.outputs.versionNumber}}/file/README.md)
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/jaywcjlove/tsbb/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
```bash
npm i tsbb@${{steps.create_tag.outputs.versionNumber}}
```
${{ steps.changelog.outputs.changelog }}
- run: npm publish --access public
name: 📦 tsbb publish to NPM
continue-on-error: true
working-directory: packages/tsbb
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: copy example to create-tsbb
working-directory: packages/create-tsbb
run: npm run copy

- run: npm publish --access public
name: 📦 create-tsbb publish to NPM
continue-on-error: true
working-directory: packages/create-tsbb
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: npm publish --access public
name: 📦 @tsbb/typescript publish to NPM
continue-on-error: true
working-directory: packages/typescript
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: npm publish --access public
name: 📦 @tsbb/jest publish to NPM
continue-on-error: true
working-directory: packages/jest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: npm publish --access public
name: 📦 @tsbb/core publish to NPM
continue-on-error: true
working-directory: packages/core
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: npm publish --access public
name: 📦 @tsbb/babel publish to NPM
continue-on-error: true
working-directory: packages/babel
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
182 changes: 182 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
name: Build & Deploy
on:
push:
branches:
- master

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'

- run: npm install
- run: npm run build
- run: npm install
- run: npm run build:create-tsbb
- run: npm run build:template
- run: npm run type-check

- name: copy create-tsbb examples
working-directory: packages/create-tsbb
run: npm run copy

- name: example @example/babel-transform-ts
working-directory: examples/babel-transform-ts
run: npm run build

- name: example @example/basic
working-directory: examples/basic
run: npm run build && npm run coverage

- name: example @example/express
working-directory: examples/express
run: npm run build

- name: example @example/hapi
working-directory: examples/hapi
run: npm run build

- name: example @example/koa
working-directory: examples/koa
run: npm run build

- name: example @example/react-component
working-directory: examples/react-component
env:
CI: true
run: |
npm run build
npm run doc
npm run coverage
- name: example @example/react-component-tsx
working-directory: examples/react-component-tsx
env:
CI: true
run: |
npm run build
npm run doc
npm run coverage
cd lib/
ls -al
- name: example @example/typenexus
working-directory: examples/typenexus
run: npm run build && npm run coverage

- name: example @example/umd
working-directory: examples/umd
run: npm run build && npm run coverage

- name: example @example/vue
working-directory: examples/vue
run: npm run build

- run: npm install idoc@1.25.0 -g
- run: idoc -s "TSBB {{version}}"
working-directory: packages/tsbb

- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@main
with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
output: ./packages/tsbb/dist/CONTRIBUTORS.svg
avatarSize: 36

- name: Is a tag created auto?
id: create_tag
uses: jaywcjlove/create-tag-action@main
with:
package-path: ./packages/tsbb/package.json

- name: get tag version
id: tag_version
uses: jaywcjlove/changelog-generator@main

- name: Build and Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
force_orphan: true
publish_branch: gh-pages
publish_dir: ./packages/tsbb/dist/

- name: Generate Changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
if: steps.create_tag.outputs.successful
with:
head-ref: ${{ steps.create_tag.outputs.version }}
filter-author: (renovate-bot|Renovate Bot)
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'

- name: Create Release
uses: jaywcjlove/create-tag-action@main
with:
package-path: ./packages/tsbb/package.json
release: true
body: |
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/tsbb@${{steps.create_tag.outputs.versionNumber}}/file/README.md)
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/jaywcjlove/tsbb/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
```bash
npm i tsbb@${{steps.create_tag.outputs.versionNumber}}
```
${{ steps.changelog.outputs.changelog }}
- run: npm publish --access public
name: 📦 tsbb publish to NPM
continue-on-error: true
working-directory: packages/tsbb
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: copy example to create-tsbb
working-directory: packages/create-tsbb
run: npm run copy

- run: npm publish --access public
name: 📦 create-tsbb publish to NPM
continue-on-error: true
working-directory: packages/create-tsbb
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: npm publish --access public
name: 📦 @tsbb/typescript publish to NPM
continue-on-error: true
working-directory: packages/typescript
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: npm publish --access public
name: 📦 @tsbb/jest publish to NPM
continue-on-error: true
working-directory: packages/jest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: npm publish --access public
name: 📦 @tsbb/core publish to NPM
continue-on-error: true
working-directory: packages/core
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: npm publish --access public
name: 📦 @tsbb/babel publish to NPM
continue-on-error: true
working-directory: packages/babel
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions examples/babel-transform-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@template/babel-transform-ts",
"private": true,
"version": "4.0.1",
"version": "4.0.2",
"description": "Transform Typescript Example.",
"scripts": {
"watch": "tsbb watch 'src/**/*.ts' --use-babel --no-esm",
@@ -17,6 +17,6 @@
"keywords": [],
"license": "MIT",
"devDependencies": {
"tsbb": "4.0.1"
"tsbb": "4.0.2"
}
}
4 changes: 2 additions & 2 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@template/basic",
"version": "4.0.1",
"version": "4.0.2",
"description": "Basic Example.",
"license": "MIT",
"private": true,
@@ -17,6 +17,6 @@
},
"keywords": [],
"devDependencies": {
"tsbb": "4.0.1"
"tsbb": "4.0.2"
}
}
4 changes: 2 additions & 2 deletions examples/express/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@template/express",
"version": "4.0.1",
"version": "4.0.2",
"private": true,
"description": "Express Example.",
"scripts": {
@@ -31,7 +31,7 @@
"@types/http-errors": "~2.0.1",
"nodemon": "~2.0.22",
"ts-node-dev": "~2.0.0",
"tsbb": "4.0.1"
"tsbb": "4.0.2"
},
"dependencies": {
"compression": "~1.7.4",
4 changes: 2 additions & 2 deletions examples/hapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@template/hapi",
"version": "4.0.1",
"version": "4.0.2",
"private": true,
"description": "hapi Example.",
"main": "index.js",
@@ -29,7 +29,7 @@
},
"devDependencies": {
"nodemon": "~2.0.22",
"tsbb": "4.0.1"
"tsbb": "4.0.2"
},
"dependencies": {
"@hapi/hapi": "^21.3.0"
4 changes: 2 additions & 2 deletions examples/koa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@template/koa",
"version": "4.0.1",
"version": "4.0.2",
"private": true,
"description": "Koa Example",
"scripts": {
@@ -28,7 +28,7 @@
"devDependencies": {
"@types/koa": "^2.13.5",
"nodemon": "~2.0.22",
"tsbb": "4.0.1"
"tsbb": "4.0.2"
},
"dependencies": {
"koa": "^2.14.1"
4 changes: 2 additions & 2 deletions examples/react-component-tsx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@template/react-component-tsx",
"version": "4.0.1",
"version": "4.0.2",
"description": "React Component Example for TypeScript.",
"private": true,
"main": "lib/index.js",
@@ -51,7 +51,7 @@
"prettier": "^2.8.6",
"react": "~18.2.0",
"react-dom": "~18.2.0",
"tsbb": "4.0.1"
"tsbb": "4.0.2"
},
"eslintConfig": {
"extends": [
8 changes: 4 additions & 4 deletions examples/react-component/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@template/react-component",
"version": "4.0.1",
"version": "4.0.2",
"private": true,
"description": "React Component Example.",
"scripts": {
"watch": "tsbb watch src/*.{jsx,js} --useBabel",
"build": "tsbb build src/*.{jsx,js} --useBabel && npm run css:build && npm run css:build:dist",
"watch": "tsbb watch src/*.{jsx,js,d.ts} --useBabel",
"build": "tsbb build src/*.{jsx,js,d.ts} --useBabel && npm run css:build && npm run css:build:dist",
"css:build": "compile-less -d src -o esm",
"css:watch": "compile-less -d src -o esm --watch",
"css:build:dist": "compile-less -d src --combine dist/markdown-editor.css --rm-global",
@@ -43,7 +43,7 @@
"less": "~4.1.3",
"parcel": "~2.8.3",
"react-test-renderer": "~18.2.0",
"tsbb": "4.0.1"
"tsbb": "4.0.2"
},
"dependencies": {
"@parcel/transformer-react-refresh-wrap": "~2.8.3",
4 changes: 2 additions & 2 deletions examples/typenexus/package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "@template/typenexus",
"private": true,
"type": "module",
"version": "4.0.1",
"version": "4.0.2",
"description": "TypeNexus Example.",
"scripts": {
"start": "npm run build && node dist/main.js",
@@ -32,6 +32,6 @@
"supertest": "^6.3.3",
"supertest-session": "^4.1.0",
"ts-node": "^10.9.1",
"tsbb": "4.0.1"
"tsbb": "4.0.2"
}
}
4 changes: 2 additions & 2 deletions examples/umd/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@template/umd",
"private": true,
"version": "4.0.1",
"version": "4.0.2",
"description": "UMD Example.",
"scripts": {
"watch": "tsbb watch",
@@ -16,6 +16,6 @@
"keywords": [],
"license": "MIT",
"devDependencies": {
"tsbb": "4.0.1"
"tsbb": "4.0.2"
}
}
4 changes: 2 additions & 2 deletions examples/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@template/vue",
"private": true,
"version": "4.0.1",
"version": "4.0.2",
"description": "",
"main": "./cjs/index.js",
"module": "./esm/index.js",
@@ -15,6 +15,6 @@
"vue": "^3.0.0"
},
"devDependencies": {
"tsbb": "4.0.1"
"tsbb": "4.0.2"
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.0.1",
"version": "4.0.2",
"packages": ["examples/*", "packages/*"],
"useWorkspaces": true
}
4 changes: 2 additions & 2 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsbb/babel",
"version": "4.0.1",
"version": "4.0.2",
"description": "TSBB is a zero-config CLI that helps you develop, test, and publish modern TypeScript project.",
"author": "kenny wang <wowohoo@qq.com>",
"homepage": "https://jaywcjlove.github.io/tsbb",
@@ -38,7 +38,7 @@
"@babel/preset-env": "~7.20.2",
"@babel/preset-react": "~7.18.6",
"@babel/preset-typescript": "~7.21.0",
"@tsbb/typescript": "4.0.1",
"@tsbb/typescript": "4.0.2",
"@types/babel__core": "^7.20.0",
"@types/semver": "~7.3.13",
"@vue/babel-plugin-jsx": "~1.1.1",
9 changes: 5 additions & 4 deletions packages/babel/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import fs from 'fs-extra';
import path from 'node:path';
import { Log, __dirname } from '@tsbb/typescript';
import { Log, getEmojiIcon, getExt, __dirname } from '@tsbb/typescript';
import { TransformOptions } from '@babel/core';
import babelPluginJsx from '@vue/babel-plugin-jsx';
// import { TransformOptions } from '@babel/core';
import { transform } from './transform.js';
import { getOutputPath } from './utils.js';
import { getCjsTransformOption, getESMTransformOption } from './config.js';
@@ -126,13 +125,15 @@ function transformFile(
.then((result) => {
fs.ensureFileSync(outputFile);
fs.writeFile(outputFile, result?.code || '');
log.icon('🐶').success(`┈┈▶ \x1b[33;1m${folderFilePath}\x1b[0m => \x1b[33;1m${outFileName}\x1b[0m`);
log
.icon(getEmojiIcon(outputFile))
.success(`${getExt(outFileName)}┈┈▶ \x1b[33;1m${folderFilePath}\x1b[0m => \x1b[33;1m${outFileName}\x1b[0m`);
if (options.sourceMaps === 'both' || options.sourceMaps) {
if (result?.map) {
const sourceMapPath = path.join(outputFile + '.map');
fs.writeFileSync(sourceMapPath, JSON.stringify(result?.map, null, 2));
log
.icon('🐶')
.icon(getEmojiIcon(outputFile))
.success(
`┈┈▶ \x1b[33;1m${folderFilePath}\x1b[0m => \x1b[33;1m${path.relative(
projectDirectory,
2 changes: 1 addition & 1 deletion packages/babel/src/utils.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import { BabelCompileOptions } from './index.js';
* Convert suffix
*/
export const convertExtname = (str: string = '') => {
return str.replace(/\.(m?js|m?ts)$/i, '.js').replace(/\.(jsx?|tsx?|c?js)$/i, '.js');
return str.replace(/\.(m?ts|m?js|jsx?|tsx?|c?js)(?<!\.d\.ts)$/i, '.js');
};

interface OutputPathResult {
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsbb/core",
"version": "4.0.1",
"version": "4.0.2",
"description": "TSBB is a zero-config CLI that helps you develop, test, and publish modern TypeScript project.",
"author": "kenny wang <wowohoo@qq.com>",
"homepage": "https://jaywcjlove.github.io/tsbb",
@@ -32,9 +32,9 @@
"node": ">=16.0.0"
},
"dependencies": {
"@tsbb/babel": "4.0.1",
"@tsbb/jest": "4.0.1",
"@tsbb/typescript": "4.0.1",
"@tsbb/babel": "4.0.2",
"@tsbb/jest": "4.0.2",
"@tsbb/typescript": "4.0.2",
"@types/fs-extra": "^11.0.1",
"chokidar": "~3.5.3",
"fs-extra": "^11.1.1",
38 changes: 27 additions & 11 deletions packages/core/src/watcher/babelTransform.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import babelCompile, { getOutputPath } from '@tsbb/babel';
import tsCompile, { findConfigFile, Log, getRootsFolderName, CopyFilesOptions } from '@tsbb/typescript';
import tsCompile, { findConfigFile, Log, getExt, getRootsFolderName, CopyFilesOptions } from '@tsbb/typescript';
import path from 'node:path';
import ts from 'typescript';
import fs from 'fs-extra';
@@ -11,26 +11,42 @@ export function babelTransform(options: CompileOptions = {}) {
const rootDirsRelative = [...new Set(getRootsFolderName(options.entry))];
const entry = rootDirsRelative.map((item) => path.resolve(item));
const onFilesChange: CopyFilesOptions['onFilesChange'] = (eventName, filepath, stats) => {
if (/\.(m?js|jsx?|m?ts|tsx?|c?js)$/i.test(filepath) && !/\.d\.ts$/i.test(filepath)) {
const log = new Log();
if (/^(add|change)$/.test(eventName)) {
if (/\.(m?js|jsx?|m?ts|tsx?|c?js)$/i.test(filepath)) {
const log = new Log().name();
const dt = getOutputPath(filepath, options);
if (/^(add|change)$/.test(eventName) && !/\.d\.ts$/i.test(filepath)) {
babelCompile(filepath, { ...options });
} else if (/\.d\.ts$/i.test(filepath)) {
if (typeof cjs !== 'boolean') {
fs.ensureDirSync(path.dirname(dt.cjs.path));
fs.copyFile(filepath, dt.cjs.path);
log
.icon('🐶')
.success(
`${getExt(filepath)}┈┈▶ \x1b[32;1m${dt.folderFilePath}\x1b[0m => \x1b[34;1m${dt.cjs.tsFileName}\x1b[0m`,
);
}
if (typeof esm !== 'boolean') {
fs.ensureDirSync(path.dirname(dt.esm.path));
fs.copyFile(filepath, dt.esm.path);
log
.icon('🐶')
.success(
`${getExt(filepath)}┈┈▶ \x1b[32;1m${dt.folderFilePath}\x1b[0m => \x1b[34;1m${dt.esm.tsFileName}\x1b[0m`,
);
}
}
if (/^(unlink|unlinkDir)$/.test(eventName)) {
const dt = getOutputPath(filepath, options);
fs.remove(dt.cjs.path);
fs.remove(dt.esm.path);
log
.name()
.icon('🗑️')
.success(`┈┈▶ \x1b[32;1m${path.relative(process.cwd(), filepath)}\x1b[0m`);
log.icon('🗑️').success(`┈┈▶ \x1b[32;1m${path.relative(process.cwd(), filepath)}\x1b[0m`);
}
}
};
const onReady = () => {
const log = new Log();
if (!options.watch) {
log.name().icon('\n🎉').error('\x1b[32;1mCompilation successful!\x1b[0m\n');
// log.name().icon('\n🎉').error('\x1b[32;1mCompilation successful!\x1b[0m\n');
} else {
log.name().icon('\n🎉').error('\x1b[32;1mWatching for file changes.\x1b[0m\n');
}
@@ -69,5 +85,5 @@ const writeFile = (to: string, target: string, fileName: string, content: string
const log = new Log();
log.name();
ts.sys.writeFile(to, content, writeByteOrderMark);
log.icon('🐳').success(`┈┈▶ [ts] \x1b[32;1m${fileName}\x1b[0m => \x1b[34;1m${target}\x1b[0m`);
log.icon('🐳').success(`${getExt(fileName)}┈┈▶ \x1b[32;1m${fileName}\x1b[0m => \x1b[34;1m${target}\x1b[0m`);
};
4 changes: 2 additions & 2 deletions packages/create-tsbb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-tsbb",
"version": "4.0.1",
"version": "4.0.2",
"description": "Creates a TSBB application using the command line.",
"homepage": "https://jaywcjlove.github.io/tsbb/create-tsbb.html",
"author": "Kenny Wong <wowohoo@qq.com> (https://github.com/jaywcjlove)",
@@ -55,6 +55,6 @@
},
"devDependencies": {
"cpy": "^9.0.1",
"tsbb": "4.0.1"
"tsbb": "4.0.2"
}
}
2 changes: 1 addition & 1 deletion packages/jest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsbb/jest",
"version": "4.0.1",
"version": "4.0.2",
"description": "TSBB is a zero-config CLI that helps you develop, test, and publish modern TypeScript project.",
"author": "kenny wang <wowohoo@qq.com>",
"homepage": "https://jaywcjlove.github.io/tsbb",
2 changes: 2 additions & 0 deletions packages/tsbb/README.md
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@ TSBB is a CLI tool that enables the development, testing, and publishing of mode

`TypeScript + Babel` = `TSBB`

Migrate from tsbb [3.x to 4.x](https://github.com/jaywcjlove/tsbb/issues/439).

## `Features`

- 🔥 Single dependency zero-configuration
4 changes: 2 additions & 2 deletions packages/tsbb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tsbb",
"version": "4.0.1",
"version": "4.0.2",
"description": "TSBB is a zero-config CLI that helps you develop, test, and publish modern TypeScript project.",
"author": "kenny wang <wowohoo@qq.com>",
"homepage": "https://jaywcjlove.github.io/tsbb",
@@ -33,6 +33,6 @@
"node": ">=16.0.0"
},
"dependencies": {
"@tsbb/core": "4.0.1"
"@tsbb/core": "4.0.2"
}
}
2 changes: 1 addition & 1 deletion packages/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsbb/typescript",
"version": "4.0.1",
"version": "4.0.2",
"description": "TSBB is a zero-config CLI that helps you develop, test, and publish modern TypeScript project.",
"author": "kenny wang <wowohoo@qq.com>",
"homepage": "https://jaywcjlove.github.io/tsbb",
16 changes: 10 additions & 6 deletions packages/typescript/src/utils.ts
Original file line number Diff line number Diff line change
@@ -27,8 +27,8 @@ const getLnCol = (text: string = '', pos: number = 0) => {
return { ln: lineNum, col: lineStartPos, text: lines[lineNum - 1] };
};

const getEmoji = (extname: string) => {
let ext = extname.toLocaleUpperCase().replace(/^\./, '');
export const getExt = (extname: string) => {
let ext = path.extname(extname).toLocaleUpperCase().replace(/^\./, '');
ext = ext.padEnd(4, ' ');
if (/^MAP/.test(ext)) {
return `\x1b[34;1m${ext}\x1b[0m`;
@@ -41,16 +41,20 @@ const getEmoji = (extname: string) => {
}
};

export const getEmojiIcon = (fileName: string) => {
let icon = /.d.ts$/i.test(fileName) ? '🐳' : '👉';
icon = /.js.map$/i.test(fileName) ? '🚩' : icon;
return icon;
};

export const writeFile = (fileName: string, data: string, writeByteOrderMark?: boolean) => {
const outputFile = path.join(process.cwd(), fileName);
ts.sys.writeFile(outputFile, data, writeByteOrderMark);
const log = new Log();
let icon = /.d.ts$/i.test(fileName) ? '🐳' : '👉';
icon = /.js.map$/i.test(fileName) ? '🚩' : icon;
log
.name()
.icon(icon)
.success(`${getEmoji(path.extname(fileName))}┈┈▶ \x1b[32;1m${fileName}\x1b[0m`);
.icon(getEmojiIcon(fileName))
.success(`${getExt(fileName)}┈┈▶ \x1b[32;1m${fileName}\x1b[0m`);
};

export const getSourceFile: ts.CompilerHost['getSourceFile'] = (fileName, languageVersion, onError) => {