@merkur/cli 0.44.0-rc.3 → 0.44.0-rc.5
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 +5 -2
- package/bin/merkur.mjs +2 -0
- package/package.json +3 -3
- package/src/CLIConfig.mjs +1 -0
- package/src/commands/buildPlayground.mjs +21 -2
package/README.md
CHANGED
|
@@ -60,8 +60,11 @@ npm run release
|
|
|
60
60
|
npx lerna version <preminor | prepatch | prerelease> --no-git-tag-version --no-push
|
|
61
61
|
// prerelease increments the pre* version's last number, e.g. v0.44.0-rc.0 => v0.44.0-rc.1
|
|
62
62
|
```
|
|
63
|
-
2.
|
|
64
|
-
|
|
63
|
+
2. Restore all files not related to the package you intend to release. These files should remain:
|
|
64
|
+
- the package's own `package.json`
|
|
65
|
+
- `lerna.json` (otherwise lerna will stop incrementing the pre-version's number, for some reason)
|
|
66
|
+
- `package-lock.json`
|
|
67
|
+
3. Commit the changes (must still be a conventional commit. Suggested: `chore(release): publish`).
|
|
65
68
|
4. Tag the commit with the version (e.g. `v0.44.0-rc.0`).
|
|
66
69
|
5. Push the commit to the repo.
|
|
67
70
|
6. Push the tag to the repo: `git push origin tag <tagname>` (e.g. `git push origin tag v0.44.0-rc.0`).
|
package/bin/merkur.mjs
CHANGED
|
@@ -33,6 +33,7 @@ const sourcemapOption = new Option('--sourcemap', 'Generate sourcemap.');
|
|
|
33
33
|
const staticFolderOption = new Option('--staticFolder <string>', 'Static folder.');
|
|
34
34
|
const staticPathOption = new Option('--staticPath <string>', 'The static path for dev server and widget server.');
|
|
35
35
|
const staticPlaygroundOption = new Option('--staticPlayground <string>', 'Static playground folder.');
|
|
36
|
+
const playgroundPathOption = new Option('--playgroundPath <string>', `Relative path the playground is served at. Set if your 'path' is a RegExp.`);
|
|
36
37
|
const verboseOption = new Option('--verbose', 'Verbose mode which show debug information.');
|
|
37
38
|
const writeToDiskOption = new Option('--writeToDisk', 'Write built files to disk.');
|
|
38
39
|
|
|
@@ -103,6 +104,7 @@ program
|
|
|
103
104
|
.command(COMMAND_NAME.BUILD_PLAYGROUND)
|
|
104
105
|
.addOption(buildFolderOption)
|
|
105
106
|
.addOption(hasRunWidgetServerOption)
|
|
107
|
+
.addOption(playgroundPathOption)
|
|
106
108
|
.addOption(quietOption)
|
|
107
109
|
.addOption(silentOption)
|
|
108
110
|
.addOption(staticPlaygroundOption)
|
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.5",
|
|
4
4
|
"description": "Merkur is tiny and extensible library for creating front-end microservices.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"merkur": "./bin/merkur.mjs"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"build": "node ./scripts/build.mjs",
|
|
22
22
|
"test": "NODE_OPTIONS='--experimental-vm-modules' jest --no-watchman -c ./jest.config.js",
|
|
23
23
|
"dev": "node ./scripts/build.mjs --watch",
|
|
24
|
-
"
|
|
24
|
+
"postpublish": "node ../../utils/restoreLatestTag.mjs"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=20"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "9ca8e3b478b9ee42567b0c06f8588a616c893201"
|
|
70
70
|
}
|
package/src/CLIConfig.mjs
CHANGED
|
@@ -16,6 +16,7 @@ export async function createCLIConfig({ args, command } = {}) {
|
|
|
16
16
|
inspect: args.inspect ?? false,
|
|
17
17
|
isProduction,
|
|
18
18
|
outFile: args?.outFile ?? './build/widget.cjs',
|
|
19
|
+
playgroundPath: args?.playgroundPath,
|
|
19
20
|
port: args?.port ?? 4444,
|
|
20
21
|
projectFolder: args?.projectFolder ?? process.cwd(),
|
|
21
22
|
quiet: args?.quiet ?? false,
|
|
@@ -82,7 +82,7 @@ export async function buildPlayground({ args, command }) {
|
|
|
82
82
|
|
|
83
83
|
const {
|
|
84
84
|
devServer: { origin: devServerOrigin },
|
|
85
|
-
playground
|
|
85
|
+
playground,
|
|
86
86
|
widgetServer: { origin: widgetServerOrigin },
|
|
87
87
|
} = merkurConfig;
|
|
88
88
|
|
|
@@ -125,6 +125,20 @@ export async function buildPlayground({ args, command }) {
|
|
|
125
125
|
process.exit(1);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
let playgroundPath;
|
|
129
|
+
|
|
130
|
+
if (typeof playground?.path === 'string') {
|
|
131
|
+
playgroundPath = playground.path;
|
|
132
|
+
} else if (cliConfig.playgroundPath) {
|
|
133
|
+
playgroundPath = cliConfig.playgroundPath;
|
|
134
|
+
} else {
|
|
135
|
+
const isRegeExp = playground?.path?.constructor?.name === 'RegExp';
|
|
136
|
+
logger.warn(
|
|
137
|
+
`Static build requires a string playground path, but your path is ${isRegeExp ? 'a RegExp' : 'undefined'}. Using '/' as fallback; you can set the path path through the --playgroundPath CLI option.`,
|
|
138
|
+
);
|
|
139
|
+
playgroundPath = '/';
|
|
140
|
+
}
|
|
141
|
+
|
|
128
142
|
const playgroundUrl = path.join(devServerOrigin, playgroundPath);
|
|
129
143
|
|
|
130
144
|
logger.info(`Building playground`);
|
|
@@ -132,7 +146,12 @@ export async function buildPlayground({ args, command }) {
|
|
|
132
146
|
try {
|
|
133
147
|
const response = await fetch(playgroundUrl);
|
|
134
148
|
if (!response.ok) {
|
|
135
|
-
|
|
149
|
+
if (cliConfig.verbose) {
|
|
150
|
+
console.log(response); // eslint-disable-line no-console -- Debug log with maintained build-in code highlighting.
|
|
151
|
+
}
|
|
152
|
+
throw new Error(
|
|
153
|
+
`Failed to fetch playground (${response.status} ${response.statusText}).`,
|
|
154
|
+
);
|
|
136
155
|
}
|
|
137
156
|
|
|
138
157
|
let playgroundHtml = await response.text();
|