enablement-build-template-generate 1.5.0 → 1.6.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enablement-build-template-generate",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Generates build yaml for mono repos",
5
5
  "type": "module",
6
6
  "module": "./src/index.mjs",
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "globby": "^16.2.0",
11
11
  "user": "^0.0.0",
12
- "enablement-build-manifest": "1.6.0"
12
+ "enablement-build-manifest": "1.7.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "jest": "^30.4.2"
package/src/index.mjs CHANGED
@@ -199,7 +199,10 @@ async function detectAndAssignNewPackages(templated, cicd, options, templatePath
199
199
  const folderName = path.basename(path.dirname(pkgPath));
200
200
  if (options.exclude.includes(folderName)) return;
201
201
 
202
- const packageFolder = path.basename(path.dirname(path.dirname(pkgPath)));
202
+ const packageFolder = path.relative(
203
+ process.cwd(),
204
+ path.dirname(path.dirname(pkgPath)),
205
+ );
203
206
  const detected = detectCicdType(pkg.name, pkg, pkgPath);
204
207
  const { pipelineFile, placeholder, template } = chooseAssignmentForNewPackage({
205
208
  packageFolder,
@@ -184,6 +184,58 @@ describe('template-generate mode parity', () => {
184
184
  });
185
185
  });
186
186
 
187
+ describe('nested workspace package paths', () => {
188
+ it('preserves all workspace segments in {path} for newly discovered packages', () => {
189
+ const root = mkdtempSync(path.join(os.tmpdir(), 'template-generate-'));
190
+ try {
191
+ mkdirSync(path.join(root, '.cicd', 'templates'), { recursive: true });
192
+ mkdirSync(path.join(root, 'ux', 'packages', 'profile'), { recursive: true });
193
+ mkdirSync(path.join(root, 'ux', 'packages', 'seed'), { recursive: true });
194
+
195
+ writeJson(path.join(root, 'package.json'), {
196
+ private: true,
197
+ workspaces: ['ux/packages/*'],
198
+ });
199
+ writeJson(path.join(root, 'ux', 'packages', 'profile', 'package.json'), {
200
+ name: '@scope/profile',
201
+ version: '1.0.0',
202
+ });
203
+ writeJson(path.join(root, 'ux', 'packages', 'seed', 'package.json'), {
204
+ name: '@scope/seed',
205
+ version: '1.0.0',
206
+ });
207
+ writeJson(path.join(root, '.cicd', 'manifest.json'), {
208
+ templated: {
209
+ 'build.yml': {
210
+ PACKAGES: { '@scope/seed': 'job.yml' },
211
+ },
212
+ },
213
+ cicd: { '@scope/seed': { folderName: 'seed', packageFolder: 'ux/packages' } },
214
+ });
215
+ writeFileSync(
216
+ path.join(root, '.cicd', 'templates', 'build.yml'),
217
+ 'jobs:\n{PACKAGES}\n',
218
+ 'utf8',
219
+ );
220
+ writeFileSync(
221
+ path.join(root, '.cicd', 'templates', 'job.yml'),
222
+ ' script: cd ./{path}/{name}\n',
223
+ 'utf8',
224
+ );
225
+
226
+ const output = runGenerator(root);
227
+ const templatedJson = JSON.parse(
228
+ readFileSync(path.join(root, '.cicd', 'templates', 'templated.json'), 'utf8'),
229
+ );
230
+
231
+ expect(output).toContain('script: cd ./ux/packages/profile');
232
+ expect(templatedJson.cicd['@scope/profile'].packageFolder).toBe('ux/packages');
233
+ } finally {
234
+ rmSync(root, { recursive: true, force: true });
235
+ }
236
+ });
237
+ });
238
+
187
239
  describe('templated.json migration', () => {
188
240
  it("migrates manifest.json's templated section into templated.json and strips it from manifest.json", () => {
189
241
  const root = createFixtureWorkspace('manifest');