@jakubmazanec/carson-templates 2.0.0-unstable.e147f50 → 2.0.0-unstable.e3501ac
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": "@jakubmazanec/carson-templates",
|
|
3
|
-
"version": "2.0.0-unstable.
|
|
3
|
+
"version": "2.0.0-unstable.e3501ac",
|
|
4
4
|
"description": "Collection of Carson templates.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"semver": "^7.3.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@jakubmazanec/carson": "0.3.0-unstable.
|
|
37
|
+
"@jakubmazanec/carson": "0.3.0-unstable.e3501ac",
|
|
38
38
|
"@jakubmazanec/fs-utils": "^0.1.0",
|
|
39
39
|
"@jest/globals": "^29.5.0",
|
|
40
40
|
"@types/fs-extra": "^9.0.13",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"zen-observable": "^0.10.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@jakubmazanec/carson": "0.3.0-unstable.
|
|
48
|
+
"@jakubmazanec/carson": "0.3.0-unstable.e3501ac"
|
|
49
49
|
},
|
|
50
50
|
"packageManager": "npm@8.19.4",
|
|
51
51
|
"engines": {
|
|
@@ -11,8 +11,10 @@ on:
|
|
|
11
11
|
|
|
12
12
|
jobs:
|
|
13
13
|
pull_request_check:
|
|
14
|
+
name: Check pull request
|
|
14
15
|
runs-on: ubuntu-latest
|
|
15
16
|
timeout-minutes: 15
|
|
17
|
+
if: "github.actor != 'renovate[bot]'"
|
|
16
18
|
steps:
|
|
17
19
|
- uses: actions/checkout@v3
|
|
18
20
|
with:
|
|
@@ -59,3 +61,24 @@ jobs:
|
|
|
59
61
|
|
|
60
62
|
- name: Check for changesets
|
|
61
63
|
run: npx changeset status --since=origin/development
|
|
64
|
+
|
|
65
|
+
renovate_pull_request_check:
|
|
66
|
+
name: Check Renovate bot pull request
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
timeout-minutes: 15
|
|
69
|
+
if: "github.actor == 'renovate[bot]'"
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v3
|
|
72
|
+
with:
|
|
73
|
+
token: ${{secrets.GITHUB_TOKEN}}
|
|
74
|
+
fetch-depth: 0
|
|
75
|
+
|
|
76
|
+
- uses: actions/setup-node@v3
|
|
77
|
+
with:
|
|
78
|
+
node-version: 16
|
|
79
|
+
|
|
80
|
+
- name: Install packages
|
|
81
|
+
run: npm ci
|
|
82
|
+
|
|
83
|
+
- name: Run tests
|
|
84
|
+
run: npm test
|
|
@@ -43,7 +43,7 @@ jobs:
|
|
|
43
43
|
|
|
44
44
|
if [[ -n $git_status ]]; then
|
|
45
45
|
echo "You have uncommitted changes!"
|
|
46
|
-
git
|
|
46
|
+
git diff
|
|
47
47
|
git config --unset core.filemode
|
|
48
48
|
exit 1
|
|
49
49
|
fi
|
|
@@ -60,7 +60,7 @@ jobs:
|
|
|
60
60
|
|
|
61
61
|
if [[ -n $git_status ]]; then
|
|
62
62
|
echo "You have uncommitted changes!"
|
|
63
|
-
git
|
|
63
|
+
git diff
|
|
64
64
|
git config --unset core.filemode
|
|
65
65
|
exit 1
|
|
66
66
|
fi
|
|
@@ -167,7 +167,7 @@ jobs:
|
|
|
167
167
|
|
|
168
168
|
if [[ -n $git_status ]]; then
|
|
169
169
|
echo "You have uncommitted changes!"
|
|
170
|
-
git
|
|
170
|
+
git diff
|
|
171
171
|
git config --unset core.filemode
|
|
172
172
|
exit 1
|
|
173
173
|
fi
|
|
@@ -184,7 +184,7 @@ jobs:
|
|
|
184
184
|
|
|
185
185
|
if [[ -n $git_status ]]; then
|
|
186
186
|
echo "You have uncommitted changes!"
|
|
187
|
-
git
|
|
187
|
+
git diff
|
|
188
188
|
git config --unset core.filemode
|
|
189
189
|
exit 1
|
|
190
190
|
fi
|
|
@@ -228,7 +228,7 @@ jobs:
|
|
|
228
228
|
name: Feature branch release
|
|
229
229
|
runs-on: ubuntu-latest
|
|
230
230
|
timeout-minutes: 15
|
|
231
|
-
if: "github.ref_name != '<%- getMainBranch(workspace) %>' && github.ref_name != '<%- getDevelopmentBranch(workspace) %>'"
|
|
231
|
+
if: "github.ref_name != '<%- getMainBranch(workspace) %>' && github.ref_name != '<%- getDevelopmentBranch(workspace) %>' && github.actor != 'renovate[bot]'"
|
|
232
232
|
steps:
|
|
233
233
|
- name: Cancel previous runs
|
|
234
234
|
uses: styfle/cancel-workflow-action@0.11.0
|
|
@@ -260,7 +260,7 @@ jobs:
|
|
|
260
260
|
|
|
261
261
|
if [[ -n $git_status ]]; then
|
|
262
262
|
echo "You have uncommitted changes!"
|
|
263
|
-
git
|
|
263
|
+
git diff
|
|
264
264
|
git config --unset core.filemode
|
|
265
265
|
exit 1
|
|
266
266
|
fi
|
|
@@ -277,7 +277,7 @@ jobs:
|
|
|
277
277
|
|
|
278
278
|
if [[ -n $git_status ]]; then
|
|
279
279
|
echo "You have uncommitted changes!"
|
|
280
|
-
git
|
|
280
|
+
git diff
|
|
281
281
|
git config --unset core.filemode
|
|
282
282
|
exit 1
|
|
283
283
|
fi
|
|
@@ -306,3 +306,174 @@ jobs:
|
|
|
306
306
|
env:
|
|
307
307
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
308
308
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
309
|
+
|
|
310
|
+
renovate_bot_release:
|
|
311
|
+
name: Renovate bot release
|
|
312
|
+
runs-on: ubuntu-latest
|
|
313
|
+
timeout-minutes: 15
|
|
314
|
+
if: "github.ref_name != '<%- getMainBranch(workspace) %>' && github.ref_name != '<%- getDevelopmentBranch(workspace) %>' && github.actor == 'renovate[bot]'"
|
|
315
|
+
steps:
|
|
316
|
+
- name: Cancel previous runs
|
|
317
|
+
uses: styfle/cancel-workflow-action@0.11.0
|
|
318
|
+
with:
|
|
319
|
+
access_token: ${{ secrets.GITHUB_TOKEN }}
|
|
320
|
+
|
|
321
|
+
- uses: actions/checkout@v3
|
|
322
|
+
with:
|
|
323
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
324
|
+
fetch-depth: 0
|
|
325
|
+
|
|
326
|
+
- name: Configure git
|
|
327
|
+
run: |
|
|
328
|
+
git config user.email "bot@mazanec.dev"
|
|
329
|
+
git config user.name "Bot"
|
|
330
|
+
|
|
331
|
+
- uses: actions/setup-node@v3
|
|
332
|
+
with:
|
|
333
|
+
node-version: 16
|
|
334
|
+
registry-url: 'https://registry.npmjs.org'
|
|
335
|
+
|
|
336
|
+
- name: Install packages
|
|
337
|
+
run: npm ci
|
|
338
|
+
|
|
339
|
+
- name: Run tests
|
|
340
|
+
run: npm test
|
|
341
|
+
|
|
342
|
+
- name: Build packages
|
|
343
|
+
run: npm run build
|
|
344
|
+
|
|
345
|
+
- name: Generate changeset
|
|
346
|
+
uses: actions/github-script@v6
|
|
347
|
+
with:
|
|
348
|
+
script: |
|
|
349
|
+
let { promises: fs } = require('fs');
|
|
350
|
+
|
|
351
|
+
async function getPackagesNames(files) {
|
|
352
|
+
let names = [];
|
|
353
|
+
|
|
354
|
+
for (let file of files) {
|
|
355
|
+
let data = JSON.parse(await fs.readFile(file, 'utf8'));
|
|
356
|
+
|
|
357
|
+
if (!data.private) {
|
|
358
|
+
names.push(data.name);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return names;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
async function createChangeset(fileName, packageBumps, packages) {
|
|
366
|
+
let message = '';
|
|
367
|
+
|
|
368
|
+
for (let [packageName, bump] of packageBumps) {
|
|
369
|
+
message =
|
|
370
|
+
message + `Dependency \`${packageName}\` updated to \`${bump}\`.\n`;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
let header = packages
|
|
374
|
+
.map((packageName) => `'${packageName}': patch`)
|
|
375
|
+
.join('\n');
|
|
376
|
+
|
|
377
|
+
await fs.writeFile(fileName, `---\n${header}\n---\n${message.trim()}\n`);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
async function getBumps(files) {
|
|
381
|
+
let bumps = new Map();
|
|
382
|
+
|
|
383
|
+
for (let file of files) {
|
|
384
|
+
let { stdout: changes } = await exec.getExecOutput('git', ['show', file]);
|
|
385
|
+
|
|
386
|
+
for (let change of changes.split('\n')) {
|
|
387
|
+
if (!change.startsWith('+ ')) {
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
let match = change.match(/"(.*?)"/g);
|
|
392
|
+
|
|
393
|
+
bumps.set(match[0].replace(/"/g, ''), match[1].replace(/"/g, ''));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return bumps;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
let branch = await exec.getExecOutput('git branch --show-current');
|
|
401
|
+
|
|
402
|
+
if (!branch.stdout.startsWith('renovate/')) {
|
|
403
|
+
console.log('Not a renovate branch, skipping...');
|
|
404
|
+
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
let diffOutput = await exec.getExecOutput('git diff --name-only HEAD~1');
|
|
409
|
+
let diffFiles = diffOutput.stdout.split('\n');
|
|
410
|
+
|
|
411
|
+
if (diffFiles.find((diffFile) => diffFile.startsWith('.changeset'))) {
|
|
412
|
+
console.log('Changeset already exists, skipping...');
|
|
413
|
+
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
let files = diffFiles
|
|
418
|
+
.filter((file) => file !== 'package.json') // skip root package.json
|
|
419
|
+
.filter((file) => file.includes('package.json'));
|
|
420
|
+
let packageNames = await getPackagesNames(files);
|
|
421
|
+
|
|
422
|
+
if (!packageNames.length) {
|
|
423
|
+
console.log('No package.json changes to published packages, skipping...');
|
|
424
|
+
|
|
425
|
+
await exec.exec('npx', ['changeset', '--empty']);
|
|
426
|
+
await exec.exec('git', ['add', '.', '--all']);
|
|
427
|
+
await exec.exec('git commit -C HEAD --amend --no-edit');
|
|
428
|
+
await exec.exec('git push --force');
|
|
429
|
+
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
let { stdout: shortHash } = await exec.getExecOutput(
|
|
434
|
+
'git rev-parse --short HEAD',
|
|
435
|
+
);
|
|
436
|
+
let fileName = `.changeset/renovate-${shortHash.trim()}.md`;
|
|
437
|
+
let packageBumps = await getBumps(files);
|
|
438
|
+
|
|
439
|
+
await createChangeset(fileName, packageBumps, packageNames);
|
|
440
|
+
await exec.exec('git', ['add', '.', '--all']);
|
|
441
|
+
await exec.exec('git commit -C HEAD --amend --no-edit');
|
|
442
|
+
await exec.exec('git push --force');
|
|
443
|
+
|
|
444
|
+
- name: Update Carson
|
|
445
|
+
uses: actions/github-script@v6
|
|
446
|
+
with:
|
|
447
|
+
script: |
|
|
448
|
+
let branch = await exec.getExecOutput('git branch --show-current');
|
|
449
|
+
|
|
450
|
+
if (!branch.stdout.startsWith('renovate/')) {
|
|
451
|
+
console.log('Not a renovate branch, skipping...');
|
|
452
|
+
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
await exec.exec('npm', ['install']);
|
|
457
|
+
await exec.exec('git', ['add', '.', '--all']);
|
|
458
|
+
await exec.exec('git commit -C HEAD --amend --no-edit');
|
|
459
|
+
await exec.exec('git push --force');
|
|
460
|
+
|
|
461
|
+
- name: Authenticate to npm registry
|
|
462
|
+
run: |
|
|
463
|
+
echo "//registry.npmjs.com/:_authToken=NPM_TOKEN" > .npmrc
|
|
464
|
+
env:
|
|
465
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
466
|
+
|
|
467
|
+
- name: Version packages
|
|
468
|
+
run: |
|
|
469
|
+
npx changeset version --snapshot unstable --snapshot-prerelease-template "{tag}.{commit}"
|
|
470
|
+
git status
|
|
471
|
+
env:
|
|
472
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
473
|
+
|
|
474
|
+
- name: Publish packages
|
|
475
|
+
run: |
|
|
476
|
+
npx changeset publish --tag unstable --no-git-tag
|
|
477
|
+
env:
|
|
478
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
479
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|