@merkur/cli 0.44.0-rc.4 → 0.44.0-rc.6

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 CHANGED
@@ -40,36 +40,6 @@ 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
-
73
43
  Thank you to all the people who already contributed to Merkur!
74
44
 
75
45
  <a href="https://github.com/mjancarik/merkur/graphs/contributors">
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)
@@ -114,7 +116,7 @@ program
114
116
  ...cmd.optsWithGlobals(),
115
117
  ...options,
116
118
  };
117
- process.env.NODE_ENV = process.env.NODE_ENV ?? 'production';
119
+ process.env.NODE_ENV = process.env.NODE_ENV ?? 'development';
118
120
 
119
121
  await buildPlayground({ args, command: COMMAND_NAME.BUILD_PLAYGROUND });
120
122
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkur/cli",
3
- "version": "0.44.0-rc.4",
3
+ "version": "0.44.0-rc.6",
4
4
  "description": "Merkur is tiny and extensible library for creating front-end microservices.",
5
5
  "bin": {
6
6
  "merkur": "./bin/merkur.mjs"
@@ -66,5 +66,5 @@
66
66
  "engines": {
67
67
  "node": ">=20"
68
68
  },
69
- "gitHead": "ff40f1103ae445e8f6774168903119a1ca990ef2"
69
+ "gitHead": "e7a99c8e4397050d88a2838dc8465408a51adc9b"
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: { path: playgroundPath },
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 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
- throw new Error('Failed to fetch playground', response.body);
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();