Haoqun Jiang [Mon, 16 Oct 2023 17:21:02 +0000 (01:21 +0800)]
refactor: improve locale detection
ECMA-402 support in Node.js should be reliable now, as it's building
with full-icu by default since Node.js 13. So I made it the first
choice.
Actually, I'm not even sure if the remaining variables are still useful.
But if they are used, here are my modifications:
- As for POSIX environment variables, I chose `LC_MESSAGES` over
`LC_CTYPE`, as it better reflects the purpose of the usage (we are using
the detection result to show prompt messages).
- I removed `LANGSPEC` because I can't find any documentation of it except
for one single mention in Wikipedia. I can't find any real usage of it
on my Windows machine.
- As we no longer use `LC_CTYPE`, it seems that `C` is no longer a
possible value for `shellLocale`, so I removed the fallback check logic.
If no more bug reports of Windows users are received in the coming
months, I think we can remove the TODO comment entirely.
It is a maintained fork of npm-run-all, which is not maintained anymore.
Both maintainers of the fork also maintain some other popular packages,
so I consider it a safe replacement.
Another popular alternative is [concurrently](https://www.npmjs.com/package/concurrently).
But [its size](https://packagephobia.com/result?p=concurrently@8.2.1) is too big,
I think it would be an overkill.
fix: work around vitest `mergeConfig`/`defineConfig` type issues
Until https://github.com/vitest-dev/vitest/pull/3804 is merged and
released, we can work around the issue by using the exports from `vite`,
they are identical anyway.
In later versions, we should import both `mergeConfig` and
`defineConfig` from `vitest`, though, to better align with their
official documentation.
fix: set moduleResolution: Bundler in tsconfig.node.json
It was `moduleResolution: "node"` in `@tsconfig/node18` v2, but later
changed to `node16` in v18.
This is a breaking change, and not suitable for our use cases.
We use the Node.js tsconfig for configuration files, most of which
expect either `moduleResolution: "node"` or
`moduleResolution: "bundler"` (e.g. Vite, which has its own bundling
logic for configuration file).
So in the commit, I'm setting it to `moduleResolution: "bundler"`.
I haven't seen any regressions myself, but if there are any, we can
revert to `moduleResolution: "node"`.
`node16` is obviously not compatible with many tools at the moment.
Haoqun Jiang [Tue, 13 Jun 2023 07:19:40 +0000 (15:19 +0800)]
fix: revert the `--tests` flag behavior
Fixes #297
To avoid confusions, the `--tests` flag should include exact *one* set
of test configurations. In the previous versions, it was Vitest for unit
testing and Cypress for E2E testing.
So for consistency, we remove the newly added Nightwatch template from
it.
But as we have more and more testing options, I would encourage everyone
to specify the name of the testing framework they want to use, rather
than use the general `--tests` flag. It would also be less prone to bugs
Haoqun Jiang [Mon, 12 Jun 2023 06:24:18 +0000 (14:24 +0800)]
refactor: use ejs templates for `vite.config.*` (#292)
The base template has a `vite.config.js.ejs` template file, which reads data from a corresponding `vite.config.js.data.mjs` file. The data file has a default export called `getData()`.
Other templates can also have data files that can be chained together so that they can modify the data fed into the template. They don't have to define the template again, though.
This fixes the issue mentioned in https://github.com/vuejs/create-vue/pull/257#issuecomment-1582022157
As we don't support plugins or extensions for this tool, I didn't choose to design the feature in an extensible way, but only considered ease of implementation and ease of modification.
This is the minimal upgrade to TypeScript 5.
I tried to upgrade only the necessary dependencies and keep the changes to a minimum.
Notable changes:
- `@vue/tsconfig` upgraded from 0.1.3 to 0.3.2. Note that according to semver, it contains breaking changes. See <https://github.com/vuejs/tsconfig#migrating-from-typescript--50> for more details.
- Vite, `vue-tsc`, and Cypress MUST be upgraded to the latest version to support TypeScript 5.
- The `tsconfig` files in the barebone TypeScript template have been updated.
- Previously, it was `tsconfig.json` + `tsconfig.node.json`, where `tsconfig.json` contains the configuration for the web app in the `src/` folder and a reference to the `tsconfig.node.json`.
- Now it is `tsconfig.json` + `tsconfig.app.json` + `tsconfig.node.json`, where `tsconfig.json` contains only references to the other 2 configs.
- This is to align it with the `tsconfig` files in the other templates, so that users can easily switch between templates. It also avoids some edge cases in solution-style tsconfigs.
Haoqun Jiang [Tue, 28 Feb 2023 06:17:47 +0000 (14:17 +0800)]
fix(cypress): update start-server-and-test to 2.0 and use full host url
A breaking change was introduced in start-server-and-test 1.5.5
and now :4173 is not equivalent to localhost:4173, which Vite uses by
default, so we have to use the full url in the command.