Skip to content

Commit 23841e2

Browse files
committed
feat(cli): Experimental flag to enable shared packages (#908)
1 parent 9f2a874 commit 23841e2

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

packages/cli/src/commands/generate/package/packageHandler.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import path from 'node:path'
44
import { paramCase, camelCase } from 'change-case'
55
import execa from 'execa'
66
import { Listr } from 'listr2'
7+
import { terminalLink } from 'termi-link'
78

89
import { recordTelemetryAttributes } from '@cedarjs/cli-helpers'
10+
import { getConfig } from '@cedarjs/project-config'
911
import { errorTelemetry } from '@cedarjs/telemetry'
1012

1113
import c from '../../../lib/colors.js'
@@ -120,6 +122,22 @@ export const handler = async ({ name, force, ...rest }) => {
120122
)
121123
}
122124

125+
if (!getConfig().experimental.packagesWorkspace.enabled) {
126+
const releaseNotes = terminalLink(
127+
'release notes',
128+
'https://github.com/cedarjs/cedar/releases',
129+
)
130+
131+
console.error(
132+
'This is an experimental feature. Please enable it in your ' +
133+
'redwood.toml file and then run this command again.',
134+
)
135+
console.error()
136+
console.error(`See the ${releaseNotes} for instructions on how to enable.`)
137+
138+
return
139+
}
140+
123141
let packageFiles = {}
124142
const tasks = new Listr(
125143
/** @type {import('listr2').ListrTask<ListrContext>[]} */ ([

packages/project-config/src/__tests__/config.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ describe('getConfig', () => {
6060
"enabled": false,
6161
"wrapApi": true,
6262
},
63+
"packagesWorkspace": {
64+
"enabled": false,
65+
},
6366
"reactCompiler": {
6467
"enabled": false,
6568
"lintOnly": false,

packages/project-config/src/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ export interface Config {
119119
enabled: boolean
120120
lintOnly: boolean
121121
}
122+
packagesWorkspace: {
123+
enabled: boolean
124+
}
122125
}
123126
eslintLegacyConfigWarning: boolean
124127
}
@@ -206,6 +209,9 @@ export const DEFAULT_CONFIG: Config = {
206209
enabled: false,
207210
lintOnly: false,
208211
},
212+
packagesWorkspace: {
213+
enabled: false,
214+
},
209215
},
210216
eslintLegacyConfigWarning: true,
211217
}

0 commit comments

Comments
 (0)