Closed tidoust closed 3 years ago
@tidoust This is looking fine to me, I'll test it locally in day tomorrow.
How to test:
yarn dev
.
1.1. Comment out these lines as we don't want to test deployment or validation..github/workflows/*.yml
file (w3c/epub-specs as that's where the issue is found) and cd <repo>
.node /path/to/spec-prod/test/index.test.js
(from the epub-specs repo)Alternatively, you can edit the PR to use tidoust/spec-prod@fix-issue-92
instead of w3c/spec-prod@v2
(testing in production).
Edit: I tested, it works (no build error that is).
Released v2 ≡ v2.4.1
@sidvishnoi Thanks for the detailed instructions!
FWIW, the TypeScript errors I got occurred because I used Npm to install dependencies, which installed the latest compatible versions of dependencies without using the ones explicitly mentioned in the yarn.lock
file.
These errors also happen with Yarn if you delete the yarn.lock
file before running yarn install
, so I suspect that the latest version of one of the TypeScript dependencies introduces some incompatible change.
Errors reported with latest versions of dependencies are:
src/build.ts:103:4 - error TS2345: Argument of type '{ output: string; env: { PUPPETEER_SKIP_CHROMIUM_DOWNLOAD?: undefined; PUPPETEER_EXECUTABLE_PATH?: undefined; } | { PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: string; PUPPETEER_EXECUTABLE_PATH: string; }; }' is not assignable to parameter of type 'ShOptions | ShOutput | undefined'.
Object literal may only specify known properties, and 'env' does not exist in type 'ShOptions'.
103 env: PUPPETEER_ENV,
~~~~~~~~~~~~~~~~~~
src/build.ts:159:40 - error TS2345: Argument of type '{ output: string; cwd: string; }' is not assignable to parameter of type 'ShOptions | ShOutput | undefined'.
Object literal may only specify known properties, and 'cwd' does not exist in type 'ShOptions'.
159 await sh(`ls -R`, { output: "buffer", cwd: destinationDir });
~~~~~~~~~~~~~~~~~~~
src/deploy-w3c-echidna.ts:100:41 - error TS2345: Argument of type '{ cwd: string; }' is not assignable to parameter of type 'ShOptions | ShOutput | undefined'.
Object literal may only specify known properties, and 'cwd' does not exist in type 'ShOptions'.
100 await sh(`mv ${file} Overview.html`, { cwd: outputDir });
~~~~~~~~~~~~~~
src/deploy-w3c-echidna.ts:103:3 - error TS2345: Argument of type '{ output: string; cwd: string; }' is not assignable to parameter of type 'ShOptions | ShOutput | undefined'.
Object literal may only specify known properties, and 'cwd' does not exist in type 'ShOptions'.
103 cwd: outputDir,
~~~~~~~~~~~~~~
src/deploy-w3c-echidna.ts:105:41 - error TS2345: Argument of type '{ cwd: string; }' is not assignable to parameter of type 'ShOptions | ShOutput | undefined'.
Object literal may only specify known properties, and 'cwd' does not exist in type 'ShOptions'.
105 await sh(`mv Overview.html ${file}`, { cwd: outputDir });
~~~~~~~~~~~~~~
src/setup.ts:27:5 - error TS2345: Argument of type '{ output: string; cwd: string; env: { PYTHONUSERBASE: string; }; }' is not assignable to parameter of type 'ShOptions | ShOutput | undefined'.
Object literal may only specify known properties, and 'cwd' does not exist in type 'ShOptions'.
27 cwd: ACTION_DIR,
~~~~~~~~~~~~~~~
src/utils.ts:12:29 - error TS2307: Cannot find module 'node:child_process' or its corresponding type declarations.
12 import { ExecOptions } from "node:child_process";
~~~~~~~~~~~~~~~~~~~~
src/utils.ts:13:24 - error TS2307: Cannot find module 'node:http' or its corresponding type declarations.
13 import { Server } from "node:http";
~~~~~~~~~~~
src/utils.ts:51:43 - error TS2345: Argument of type '{ cwd: string; env: any; }' is not assignable to parameter of type 'ShOptions | ShOutput | undefined'.
Object literal may only specify known properties, and 'cwd' does not exist in type 'ShOptions'.
51 return sh(`yarn add ${name} --silent`, { cwd: ACTION_DIR, env });
~~~~~~~~~~~~~~~
src/utils.ts:91:43 - error TS2339: Property 'env' does not exist on type '{}'.
91 env: { ...process.env, ...execOptions.env },
~~~
src/utils.ts:164:58 - error TS7006: Parameter 'err' implicitly has an 'any' type.
164 return new Promise<void>(resolve => this._server.close(err => resolve()));
~~~
src/validate-markup.ts:23:4 - error TS2345: Argument of type '{ output: string; cwd: string; }' is not assignable to parameter of type 'ShOptions | ShOutput | undefined'.
Object literal may only specify known properties, and 'cwd' does not exist in type 'ShOptions'.
23 cwd: dest,
~~~~~~~~~
[10:12:03] Found 12 errors. Watching for file changes.
@tidoust Thanks for the heads up! The cause of error was in the update to @types/node
(not TypeScript to be precise). Newer version of the @types/node
don't support the use of node:
prefix imports (or I've misconfigured).
Fixed it in https://github.com/w3c/spec-prod/commit/5d2f64f794e9d612b7f87ee178a960993a15f1f7#diff-39b2554fd18da165b59a6351b1aafff3714e2a80c1435f2de9706355b4d32351 (along with updating rest of the dependencies, so using npm should be fine (though not recommended, as we've lockfile for yarn only)).
See #92.
I'm not sure how to test this. Issuing
npm run build
on my machine with the current contents of the repository reports 12 TypeScript errors. Is there something special I should be doing to set things up?