Skip to content

Commit aa29697

Browse files
committed
build: fix plugin for semantic release
1 parent e981cf6 commit aa29697

File tree

5 files changed

+74
-65
lines changed

5 files changed

+74
-65
lines changed

release.config.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
'@semantic-release/release-notes-generator',
2020
'@semantic-release/changelog',
2121
[
22-
'./tools/semantic-plugins/publish-packages.js',
22+
'./tools/semantic-plugins/publish-packages.mjs',
2323
{
2424
packages: [
2525
{
@@ -29,20 +29,26 @@ module.exports = {
2929
},
3030
],
3131
[
32-
'./tools/semantic-plugins/copy-package-info.js',
32+
'./tools/semantic-plugins/copy-package-info.mjs',
3333
{
3434
original: 'package.json',
35-
keys: ['keywords', 'author', 'repository', 'bugs', 'homepage', 'license'],
36-
packages: [
37-
'dist/libs/ng-pixijs',
35+
keys: [
36+
'keywords',
37+
'author',
38+
'repository',
39+
'bugs',
40+
'homepage',
41+
'license',
3842
],
43+
packages: ['dist/libs/ng-pixijs'],
3944
},
4045
],
4146
[
4247
'@semantic-release/git',
4348
{
4449
assets: ['CHANGELOG.md', 'package.json'],
45-
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
50+
message:
51+
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
4652
},
4753
],
4854
[

tools/semantic-plugins/copy-package-info.js

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import * as fs from 'fs';
2+
import * as path from 'path';
3+
4+
// const fs = require('fs');
5+
// const path = require('path');
6+
7+
/* The plugin updates dependencies between packages based on the generated semantic-release version */
8+
9+
export function prepare(pluginConfig, { logger }) {
10+
const originalPackageJson = JSON.parse(
11+
fs.readFileSync(pluginConfig.original, { encoding: 'utf-8' })
12+
);
13+
14+
for (const packageDir of pluginConfig.packages) {
15+
logger.log('Updating package.json of %s', packageDir);
16+
17+
const packageJson = JSON.parse(
18+
fs.readFileSync(`${path.join(packageDir, 'package.json')}`, {
19+
encoding: 'utf-8',
20+
})
21+
);
22+
23+
for (const key of pluginConfig.keys) {
24+
packageJson[key] = originalPackageJson[key];
25+
}
26+
27+
fs.writeFileSync(
28+
`${path.join(packageDir, 'package.json')}`,
29+
JSON.stringify(packageJson, undefined, 2)
30+
);
31+
}
32+
}

tools/semantic-plugins/publish-packages.js

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {
2+
verifyConditions,
3+
prepare as prepareNpm,
4+
publish as publishNpm,
5+
addChannel as addChannelNpm,
6+
} from '@semantic-release/npm';
7+
8+
export async function verify(pluginConfig, context) {
9+
for (const config of pluginConfig.packages) {
10+
await verifyConditions(config, context);
11+
}
12+
}
13+
14+
export async function prepare(pluginConfig, context) {
15+
for (const config of pluginConfig.packages) {
16+
await prepareNpm(config, context);
17+
}
18+
}
19+
20+
export async function addChannel(pluginConfig, context) {
21+
for (const config of pluginConfig.packages) {
22+
await addChannelNpm(config, context);
23+
}
24+
}
25+
26+
export async function publish(pluginConfig, context) {
27+
for (const config of pluginConfig.packages) {
28+
await publishNpm(config, context);
29+
}
30+
}

0 commit comments

Comments
 (0)