@merkur/cli 0.44.0-rc.1 → 0.44.0-rc.2
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/README.md +30 -0
- package/bin/merkur.mjs +1 -0
- package/package.json +2 -2
- package/src/CLIConfig.mjs +1 -1
- package/src/clearBuildFolder.mjs +6 -2
- package/src/commands/buildPlayground.mjs +11 -13
- package/src/handleExit.mjs +24 -20
package/README.md
CHANGED
|
@@ -40,6 +40,36 @@ Contribute to this project via [Pull-Requests](https://github.com/mjancarik/merk
|
|
|
40
40
|
|
|
41
41
|
We are following [Conventional Commits Specification](https://www.conventionalcommits.org/en/v1.0.0/#summary). To simplify the commit process, you can use `npm run commit` command. It opens an interactive interface, which should help you with commit message composition.
|
|
42
42
|
|
|
43
|
+
### Release
|
|
44
|
+
|
|
45
|
+
To release a version you must have the right permissions, please contact one of the repo maintainers.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
#### Regular version release
|
|
49
|
+
|
|
50
|
+
To do a regular release, in the root of the monorepo run:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
npm run release
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### RC (preversion) release
|
|
57
|
+
|
|
58
|
+
1. From the specific package directory, use this `lerna version` command to bump package versions:
|
|
59
|
+
```
|
|
60
|
+
npx lerna version <preminor | prepatch | prerelease> --no-git-tag-version --no-push
|
|
61
|
+
// prerelease increments the pre* version's last number, e.g. v0.44.0-rc.0 => v0.44.0-rc.1
|
|
62
|
+
```
|
|
63
|
+
2. restore all files not related to the package you intend to release (the whole lerna repo, `@merkur/create-widget`, other dependent packages).
|
|
64
|
+
3. Commit the changes.
|
|
65
|
+
4. Tag the commit with the version (e.g. `v0.44.0-rc.0`).
|
|
66
|
+
5. Push the commit to the repo.
|
|
67
|
+
6. Push the tag to the repo: `git push origin tag <tagname>` (e.g. `git push origin tag v0.44.0-rc.0`).
|
|
68
|
+
|
|
69
|
+
The packages are released from a GitHub Action that is triggered when a new version tag is pushed to the repository.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
43
73
|
Thank you to all the people who already contributed to Merkur!
|
|
44
74
|
|
|
45
75
|
<a href="https://github.com/mjancarik/merkur/graphs/contributors">
|
package/bin/merkur.mjs
CHANGED
|
@@ -110,6 +110,7 @@ program
|
|
|
110
110
|
.description('Build a static version of the widget playground')
|
|
111
111
|
.action(async (options, cmd) => {
|
|
112
112
|
const args = {
|
|
113
|
+
...{ writeToDisk: true, watch: false, hasRunWidgetServer: true, hasRunDevServer: true },
|
|
113
114
|
...cmd.optsWithGlobals(),
|
|
114
115
|
...options,
|
|
115
116
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@merkur/cli",
|
|
3
|
-
"version": "0.44.0-rc.
|
|
3
|
+
"version": "0.44.0-rc.2",
|
|
4
4
|
"description": "Merkur is tiny and extensible library for creating front-end microservices.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"merkur": "./bin/merkur.mjs"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=20"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "f17c30471460f9d6281604580b915030f5a9e916"
|
|
69
69
|
}
|
package/src/CLIConfig.mjs
CHANGED
|
@@ -24,7 +24,7 @@ export async function createCLIConfig({ args, command } = {}) {
|
|
|
24
24
|
sourcemap: args?.sourcemap ?? !isProduction,
|
|
25
25
|
staticFolder: args?.staticFolder ?? './build/static',
|
|
26
26
|
staticPath: args?.staticPath ?? '/static',
|
|
27
|
-
staticPlayground: args?.staticPlayground ?? './playground
|
|
27
|
+
staticPlayground: args?.staticPlayground ?? './build-playground',
|
|
28
28
|
verbose: args.verbose ?? false,
|
|
29
29
|
watch: args?.watch ?? !isProduction,
|
|
30
30
|
writeToDisk: args?.writeToDisk ?? isProduction,
|
package/src/clearBuildFolder.mjs
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { rm } from 'node:fs/promises';
|
|
2
2
|
|
|
3
|
-
export async function
|
|
3
|
+
export async function clearFolder(folderPath) {
|
|
4
4
|
try {
|
|
5
|
-
await rm(
|
|
5
|
+
await rm(folderPath, {
|
|
6
6
|
recursive: true,
|
|
7
7
|
force: true,
|
|
8
8
|
});
|
|
9
9
|
} catch {} //eslint-disable-line no-empty
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
export async function clearBuildFolder({ merkurConfig }) {
|
|
13
|
+
await clearFolder(merkurConfig.widgetServer.buildFolder);
|
|
14
|
+
}
|
|
@@ -3,8 +3,8 @@ import { runDevServer } from '../devServer.mjs';
|
|
|
3
3
|
import { runTask } from '../runTask.mjs';
|
|
4
4
|
import { runSocketServer } from '../websocket.mjs';
|
|
5
5
|
import { runWidgetServer } from '../widgetServer.mjs';
|
|
6
|
-
import { handleExit } from '../handleExit.mjs';
|
|
7
|
-
import { clearBuildFolder } from '../clearBuildFolder.mjs';
|
|
6
|
+
import { handleExit, killProcesses } from '../handleExit.mjs';
|
|
7
|
+
import { clearFolder, clearBuildFolder } from '../clearBuildFolder.mjs';
|
|
8
8
|
import { time } from '../utils.mjs';
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
import chalk from 'chalk';
|
|
@@ -12,13 +12,6 @@ import fs from 'node:fs/promises';
|
|
|
12
12
|
import process from 'node:process';
|
|
13
13
|
import { createLogger } from '../logger.mjs';
|
|
14
14
|
|
|
15
|
-
// this vs handleExit? it overlaps, it's not the same thing, wtf
|
|
16
|
-
function killServers(context) {
|
|
17
|
-
context?.process?.widgetServer?.kill();
|
|
18
|
-
context?.server?.devServer?.close();
|
|
19
|
-
context?.server?.socketServer?.close();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
15
|
function createServerTimer({ logger, cliConfig }) {
|
|
23
16
|
return function waitForServerReady(url, timeout = 10000, interval = 500) {
|
|
24
17
|
return new Promise((resolve, reject) => {
|
|
@@ -72,6 +65,9 @@ export async function buildPlayground({ args, command }) {
|
|
|
72
65
|
|
|
73
66
|
const childProcessCliConfig = { ...cliConfig, silent: !cliConfig.verbose };
|
|
74
67
|
|
|
68
|
+
// TODO maybe skip building tasks, to be used in CI where there's a separate build step?
|
|
69
|
+
|
|
70
|
+
await clearFolder(cliConfig.staticPlayground);
|
|
75
71
|
await clearBuildFolder({ merkurConfig, cliConfig: childProcessCliConfig });
|
|
76
72
|
|
|
77
73
|
logger.info(`Running build tasks`);
|
|
@@ -106,7 +102,7 @@ export async function buildPlayground({ args, command }) {
|
|
|
106
102
|
} catch (err) {
|
|
107
103
|
logger.error(chalk.red.bold(`x Widget server failed to start:`));
|
|
108
104
|
logger.error(chalk.red(err));
|
|
109
|
-
|
|
105
|
+
killProcesses({ context });
|
|
110
106
|
process.exit(1);
|
|
111
107
|
}
|
|
112
108
|
}
|
|
@@ -125,7 +121,7 @@ export async function buildPlayground({ args, command }) {
|
|
|
125
121
|
} catch (err) {
|
|
126
122
|
logger.error(chalk.red.bold('x Dev server failed to start:'));
|
|
127
123
|
logger.error(chalk.red(err));
|
|
128
|
-
|
|
124
|
+
killProcesses({ context });
|
|
129
125
|
process.exit(1);
|
|
130
126
|
}
|
|
131
127
|
|
|
@@ -162,10 +158,12 @@ export async function buildPlayground({ args, command }) {
|
|
|
162
158
|
chalk.green.bold('Playground built successfully in: ') +
|
|
163
159
|
chalk.green(playgroundFolderPath),
|
|
164
160
|
);
|
|
161
|
+
killProcesses({ context });
|
|
162
|
+
process.exit(0);
|
|
165
163
|
} catch (err) {
|
|
166
164
|
logger.error(chalk.red.bold('x Failed to build static playground:'));
|
|
167
165
|
logger.error(chalk.red(err));
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
killProcesses({ context });
|
|
167
|
+
process.exit(1);
|
|
170
168
|
}
|
|
171
169
|
}
|
package/src/handleExit.mjs
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
|
|
3
|
-
export async function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
3
|
+
export async function killProcesses({ context }) {
|
|
4
|
+
Object.values(context.process).forEach((childProcess) => {
|
|
5
|
+
childProcess.kill('SIGTERM');
|
|
6
|
+
});
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
Object.values(context.task).forEach((task) => {
|
|
9
|
+
task.dispose();
|
|
10
|
+
});
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
12
|
+
await Promise.all(
|
|
13
|
+
Object.values(context.server).map((server) => {
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
const timer = setTimeout(() => {
|
|
16
|
+
resolve();
|
|
17
|
+
}, 100);
|
|
18
|
+
server.close(() => {
|
|
19
|
+
clearTimeout(timer);
|
|
20
|
+
resolve();
|
|
23
21
|
});
|
|
24
|
-
})
|
|
25
|
-
)
|
|
22
|
+
});
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function handleExit({ context }) {
|
|
28
|
+
const handleExit = async () => {
|
|
29
|
+
await killProcesses({ context });
|
|
26
30
|
|
|
27
31
|
process.exit(0);
|
|
28
32
|
};
|