@unisphere/cli 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -135,9 +135,30 @@ module.exports = (unisphereConfig) => {
135
135
  const projectJsonPath = path.join(unisphereConfig.cwd, 'project.json');
136
136
  const projectJson = JSON.parse(fs.readFileSync(projectJsonPath, 'utf8'));
137
137
  const sourcePath = projectJson.sourceRoot.replace(/\/src$/, '').split('/');
138
- const isValidNewPattern = sourcePath.length === 4 && ['local', 'kaltura-corp', 'unisphere', 'kaltura-ai'].includes(sourcePath[2]);
139
- if (sourcePath[0] !== 'unisphere' || sourcePath[1] !== 'packages' || !isValidNewPattern) {
140
- throw new Error('sourcePath must follow pattern unisphere/packages/<package-name> or unisphere/packages/<subdirectory>/<package-name> (subdirectory: local, kaltura-corp, unisphere, kaltura-ai)')
138
+
139
+ // Expected: unisphere/packages/<subdirectory>/<package-name>
140
+ // Subdirectories: local, kaltura-corp, unisphere, kaltura-ai
141
+ const validSubdirectories = ['local', 'kaltura-corp', 'unisphere', 'kaltura-ai'];
142
+ const isValidPath =
143
+ sourcePath[0] === 'unisphere' &&
144
+ sourcePath[1] === 'packages' &&
145
+ sourcePath.length === 4 &&
146
+ validSubdirectories.includes(sourcePath[2]);
147
+
148
+ if (!isValidPath) {
149
+ const isOldPattern = sourcePath[0] === 'unisphere' && sourcePath[1] === 'packages' && sourcePath.length === 3;
150
+
151
+ if (!isOldPattern) {
152
+ throw new Error('sourcePath must follow pattern unisphere/packages/<subdirectory>/<package-name> (subdirectory: local, kaltura-corp, unisphere, kaltura-ai)');
153
+ }
154
+
155
+ // Old pattern: allow during project graph creation (migrations), error during actual builds
156
+ const isGraphCreation = global.NX_GRAPH_CREATION === true;
157
+ if (isGraphCreation) {
158
+ console.warn(`[unisphere] WARNING: Package "${sourcePath[2]}" uses deprecated path. Will fail during builds.`);
159
+ } else {
160
+ throw new Error(`Package "${sourcePath[2]}" must be moved to a subdirectory. Run: npx nx migrate @unisphere/nx@latest --run-migrations`);
161
+ }
141
162
  }
142
163
 
143
164
  return getWithNx({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unisphere/cli",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "bin": {
5
5
  "unisphere": "./src/cli.js"
6
6
  },