Skip to content

Commit

Permalink
feat: merge pull request #184 from nyaggah/develop
Browse files Browse the repository at this point in the history
chore: fix content script imports; clean up package.json scripts
  • Loading branch information
JoeyDoey authored Aug 18, 2023
2 parents 3e7a517 + bb22f55 commit c2c35aa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-news-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bedframe/cli': patch
---

fix content script imports; clean up package.json scripts
4 changes: 2 additions & 2 deletions packages/cli/public/stubs/scripts/content.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from '@/components/App/App'
import { Iframe } from '@/components/Iframe/Iframe'
import { App } from '@/components/App'
import { Iframe } from '@/components/Iframe'

const name = chrome.runtime.getManifest().name ?? 'bedframe'
export const extension = {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/make-bed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export async function makeBed(response: PromptsResponse) {
)}
${dim('Production:')}
${pm} build
${pm} build
${pm} build:all ${dim(
`generate prod builds for all browsers (${lightGray(
'./dist/<browser>',
Expand Down
26 changes: 14 additions & 12 deletions packages/cli/src/lib/write-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export function createScriptCommandsFrom(
// const { language, lintFormat, style, tests, git, gitHooks, changesets } =
// response.development.template.config

const pm = packageManager.toLowerCase()
const pmRun = pm === 'npm' ? `${pm} run` : pm

const devBuildScripts = () => {
const colors = ['magenta', 'green', 'cyan', 'yellow', 'red', 'blue']
const devScript = createScriptCommand('dev', 'vite')
Expand All @@ -90,9 +93,9 @@ export function createScriptCommandsFrom(
browsers.length > 1
? createScriptCommand(
`dev:all`,
`concurrently --names \"${browsers.join(', ')}\" -c \"${colors
`concurrently --names \"${browsers.join(',')}\" -c \"${colors
.slice(0, browsers.length)
.join(', ')}\" ${browsers
.join(',')}\" ${browsers
.map((browser: Browser) => `\"vite --mode ${browser}\"`)
.join(' ')}`,
)
Expand All @@ -107,11 +110,9 @@ export function createScriptCommandsFrom(
browsers.length > 1
? createScriptCommand(
`build:all`,
`tsc && concurrently --names \"${browsers.join(
', ',
)}\" -c \"${colors
`tsc && concurrently --names \"${browsers.join(',')}\" -c \"${colors
.slice(0, browsers.length)
.join(', ')}\" ${browsers
.join(',')}\" ${browsers
.map((browser: Browser) => `\"vite build --mode ${browser}\"`)
.join(' ')}`,
)
Expand All @@ -137,7 +138,7 @@ export function createScriptCommandsFrom(

const prettierWriteScript = createScriptCommand(
'format',
`${packageManager.toLowerCase()} prettier --write .`,
`${pm} prettier --write .`,
)

return lintFormat
Expand All @@ -164,7 +165,7 @@ export function createScriptCommandsFrom(
const releaseScript = createScriptCommand(
'release',
`${
lintFormat ? 'pnpm format && pnpm lint &&' : ''
lintFormat ? `${pmRun} format && ${pmRun} lint &&` : ''
} build:all && changeset version`,
)

Expand Down Expand Up @@ -200,6 +201,10 @@ export function createDependenciesFrom(response: prompts.Answers<string>): {
devDependencies?: Partial<DependencyType>
config?: Partial<ConfigType>
} {
const { packageManager } = response.development.template.config
const pm = packageManager.toLowerCase()
const pmRun = pm === 'npm' ? `${pm} run` : pm

const base: Partial<DependencyType>[] = [
{
dependencies: [
Expand Down Expand Up @@ -427,10 +432,7 @@ export function createDependenciesFrom(response: prompts.Answers<string>): {
? packageJsonField('husky', {
hooks: {
'commit-msg': 'commitlint --edit',
'pre-commit': `${
response.development.template.config.packageManager.toLowerCase() ??
'yarn'
} lint-staged`,
'pre-commit': `${pmRun} lint-staged`,
'prepare-commit-msg':
'exec < /dev/tty && node_modules/.bin/cz --hook || true',
},
Expand Down

0 comments on commit c2c35aa

Please sign in to comment.