Skip to content

Commit

Permalink
fix(cli): replace chalk with kleur (#285)
Browse files Browse the repository at this point in the history
* fix(cli): replace chalk with kleur

* include kleur in the bundle output
  • Loading branch information
eunjae-lee authored Oct 17, 2023
1 parent 75eb310 commit 0468022
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion packages/field-plugin/helpers/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"vite-plugin-dts": "3.5.0"
},
"dependencies": {
"chalk": "5.3.0"
"kleur": "4.1.5"
}
}
9 changes: 1 addition & 8 deletions packages/field-plugin/helpers/vite/src/utils/text.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
import { Chalk } from 'chalk'

const chalk = new Chalk({ level: 1 })

export const green = (text: string) => chalk.green(text)
export const gray = (text: string) => chalk.gray(text)
export const red = (text: string) => chalk.red(text)
export const bold = (text: string) => chalk.bold(text)
export { green, gray, red, bold } from 'kleur/colors'
2 changes: 1 addition & 1 deletion packages/field-plugin/helpers/vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineConfig({
fileName: 'index',
},
rollupOptions: {
external: ['querystring', 'fs', 'path', 'chalk'],
external: ['querystring', 'fs', 'path'],
},
},
})
21 changes: 12 additions & 9 deletions scripts/dev-template.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { $ } from 'zx'
import fs from 'fs/promises'
import path from 'path'

// eslint-disable-next-line functional/immutable-data
process.env.FORCE_COLOR = '1'

const template = process.argv[3]
if (!template) {
console.error('[ERROR] This script requires a template name as an argument.')
Expand All @@ -35,21 +38,21 @@ file = file.replace(
alias: [{
find: /^@storyblok\\/field-plugin$/,
replacement: '${path.resolve(
__dirname,
'../packages/field-plugin/src/index.ts',
)}'
__dirname,
'../packages/field-plugin/src/index.ts',
)}'
}, {
find: /^@storyblok\\/field-plugin\\/vue3$/,
replacement: '${path.resolve(
__dirname,
'../packages/field-plugin/helpers/vue3/src/index.ts',
)}'
__dirname,
'../packages/field-plugin/helpers/vue3/src/index.ts',
)}'
}, {
find: /^@storyblok\\/field-plugin\\/react$/,
replacement: '${path.resolve(
__dirname,
'../packages/field-plugin/helpers/react/src/index.ts',
)}'
__dirname,
'../packages/field-plugin/helpers/react/src/index.ts',
)}'
}]
},
plugins:`,
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3925,13 +3925,6 @@ __metadata:
languageName: node
linkType: hard

"chalk@npm:5.3.0, chalk@npm:^5.0.0, chalk@npm:^5.2.0":
version: 5.3.0
resolution: "chalk@npm:5.3.0"
checksum: 623922e077b7d1e9dedaea6f8b9e9352921f8ae3afe739132e0e00c275971bdd331268183b2628cf4ab1727c45ea1f28d7e24ac23ce1db1eb653c414ca8a5a80
languageName: node
linkType: hard

"chalk@npm:^2.0.0":
version: 2.4.2
resolution: "chalk@npm:2.4.2"
Expand All @@ -3953,6 +3946,13 @@ __metadata:
languageName: node
linkType: hard

"chalk@npm:^5.0.0, chalk@npm:^5.2.0":
version: 5.3.0
resolution: "chalk@npm:5.3.0"
checksum: 623922e077b7d1e9dedaea6f8b9e9352921f8ae3afe739132e0e00c275971bdd331268183b2628cf4ab1727c45ea1f28d7e24ac23ce1db1eb653c414ca8a5a80
languageName: node
linkType: hard

"char-regex@npm:^1.0.2":
version: 1.0.2
resolution: "char-regex@npm:1.0.2"
Expand Down Expand Up @@ -6305,7 +6305,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "helper-vite@workspace:packages/field-plugin/helpers/vite"
dependencies:
chalk: 5.3.0
kleur: 4.1.5
typescript: ^5.0.2
vite: ^4.4.5
vite-plugin-dts: 3.5.0
Expand Down

1 comment on commit 0468022

@vercel
Copy link

@vercel vercel bot commented on 0468022 Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.