Skip to content

Commit f5dfa2b

Browse files
committed
chore: Complete conversion to pnpm
Moves all of the markdown documentation of pnpm scripts into package.json5, thanks to its ability to have comments. Rmoves npm-run-all as no longer being used. Resolves #140.
1 parent 70f5725 commit f5dfa2b

4 files changed

Lines changed: 694 additions & 972 deletions

File tree

doc/working-with-pm.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ nav:
1212
- Contributing:
1313
- doc/contributing.md
1414
- doc/visual-studio-code-setup.md
15-
- doc/working-with-pm.md
15+
- package.md
1616
- Other Information:
1717
- ... | flat | doc/*.md
1818
docs_dir: doc
@@ -33,7 +33,7 @@ plugins:
3333
include_extensions: ['.png']
3434
merge_docs_dir: false
3535
semiliterate:
36-
- pattern: '\.ts' # Standard in-code markup
36+
- pattern: '\.(?:ts|json5)' # Standard in-code markup
3737
extract:
3838
start: '^\s*/\*\*+\W?md\b' # Opening like /** md
3939
stop: '^\s*\*\*/\s*$' # closing **/ by itself on a line

package.json5

Lines changed: 77 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,100 @@
22
# Using package manager scripts
33
44
This repository is designed to work with the [pnpm](https://pnpm.io/) package
5-
manager, and precludes installation of packages with other package managers.
5+
manager, and so precludes installation of packages with other package managers.
66
It also sets up a number of utility "scripts" that you can run via the package
77
manager to manipulate and execute the project's code. This page documents all
88
of the available scripts.
9-
*/
9+
**/
1010
{
1111
name: 'frontscope',
1212
version: '0.3.0',
1313
scripts: {
14-
'help:help': 'echo Prints a list of available scripts and a reminder about how to get more help.',
15-
help: "echo Available scripts -- execute \\`pnpm help:SCRIPTNAME\\` for help on SCRIPTNAME: && (pnpm run | grep '^\\s\\s\\S' | grep -v 'help\\|only\\|postinstall\\|prepare')",
16-
'help:dev': 'run-s -s help:dev:*',
17-
'help:dev:1': 'echo Compiles frontscope and starts a server running it.',
18-
'help:dev:2': 'echo Note the server will hot-reload the code from any',
19-
'help:dev:3': 'echo source files as they change, to ease development.',
14+
/** md
15+
### pnpm dev
16+
17+
Compiles frontscope and starts a server running it. Note the server will
18+
hot-reload the code from any source files as they change, to ease development.
19+
The documentation pages are not available in this server.
20+
**/
2021
dev: 'pnpm typecheck && vite',
21-
'help:doc:serve': 'run-s -s help:doc:serve:*',
22-
'help:doc:serve:1': "echo This is like the 'dev' script, but for the",
23-
'help:doc:serve:2': 'echo embedded documentation rather than the',
24-
'help:doc:serve:3': 'echo Numberscope interface itself.',
22+
/** md
23+
### pnpm doc:serve
24+
25+
This is like the 'dev' script, but for the embedded documentation rather
26+
than the Numberscope interface itself. So Numberscope visualizers will not
27+
be available, but the documentation pages will hot-reload as doc files are
28+
changed.
29+
**/
2530
'doc:serve': '.venv/bin/mkdocs serve',
26-
'help:build': 'run-s -s help:build:*',
27-
'help:build:1': 'echo Compiles frontscope and minifies the result,',
28-
'help:build:2': 'echo producing a bundle ready for installation',
29-
'help:build:3': 'echo on a server.',
31+
/** md
32+
### pnpm build
33+
34+
Compiles frontscope and minifies the result, producing a bundle ready for
35+
preview or installation on a server.
36+
**/
3037
build: 'pnpm typecheck && vite build && .venv/bin/mkdocs build',
31-
'help:preview': 'run-s -s help:build:*',
32-
'help:preview:1': 'echo Serves the most recently built files -- the',
33-
'help:preview:2': "echo contents of the 'dist/' directory -- for you",
34-
'help:preview:3': "echo to preview. This script differs from 'dev' in",
35-
'help:preview:4': "echo that there isn't any hot module reload. It is",
36-
'help:preview:5': 'echo closer to what you will run in production.',
38+
/** md
39+
### pnpm preview
40+
41+
Serves the most recently built files (i.e., the contents of the `dist/`
42+
directory) for you to preview. This script differs from 'dev' in that there
43+
isn't any hot module reload. On the other hand, it is closer to what you will
44+
run in production, and both the Numberscope interface and the documentation
45+
pages are available.
46+
**/
3747
preview: 'vite preview',
38-
'help:test:unit': 'echo Runs unit tests.',
48+
/** md
49+
### pnpm test:unit
50+
51+
Runs unit tests.
52+
**/
3953
'test:unit': 'vitest run',
40-
'help:typecheck': 'run-s -s help:typecheck:*',
41-
'help:typecheck:1': 'echo Checks for TypeScript errors in both .vue',
42-
'help:typecheck:2': 'echo and .ts files.',
54+
/** md
55+
### pnpm typecheck
56+
57+
Checks for TypeScript errors in both .vue and .ts files.
58+
**/
4359
typecheck: 'vue-tsc --noEmit -p tsconfig.vitest.json --composite false',
44-
'help:lint': 'run-s -s help:lintx:*',
45-
'help:lintx:01': 'echo If you would like to format your code before you',
46-
'help:lintx:02': 'echo make a commit with git -- which has hooks to do',
47-
'help:lintx:03': 'echo automatic formatting -- you can call this script',
48-
'help:lintx:04': "echo at any time. It runs 'prettier' and",
49-
'help:lintx:05': "echo 'eslint --fix' on the project files. Note that",
50-
'help:lintx:06': 'echo this operation does not simply _check_ the',
51-
'help:lintx:07': 'echo formatting of your files, it _formats_ them!',
52-
'help:lintx:08': 'echo At least, if possible -- there are some',
53-
'help:lintx:09': 'echo formatting/code errors that it does not know how',
54-
'help:lintx:10': 'echo to fix. These will simply be reported as errors.',
55-
'help:lintx:11': 'echo If any such issues are present at the time of a',
56-
'help:lintx:12': 'echo of a commit, presuming the standard git hooks',
57-
'help:lintx:13': 'echo this project sets up are in place, the commit',
58-
'help:lintx:14': 'echo will be rejected.',
60+
/** md
61+
### pnpm lint
62+
63+
If you would like to format your code before you make a commit with git (which
64+
has hooks to do automatic formatting), you can call this script at any time.
65+
It runs [prettier](https://prettier.io/) and `eslint --fix`
66+
(see https://eslint.org/) on the project files. Note that this operation does
67+
not simply _check_ the formatting of your files, it automatically _reformats_
68+
them when it finds problems!
69+
70+
At least, if possible -- there are some formatting/code errors that it does
71+
not know how to fix. These will simply be reported as errors. If any such
72+
issues are present at the time of a commit, presuming the standard git hooks
73+
this project sets up are in place, the commit will be rejected.
74+
**/
5975
lint: 'prettier-eslint --write "**/*.*" && pnpm lint:check',
60-
'help:lint:check': 'run-s -s help:lint:check:*',
61-
'help:lint:check:01': "echo This is like the 'lint' script but only",
62-
'help:lint:check:02': 'echo reports problems; does not modify any of',
63-
'help:lint:check:03': 'echo your source files. Note that this script',
64-
'help:lint:check:04': 'echo might not report any errors but then a run',
65-
'help:lint:check:05': "echo of the 'lint' script might modify files.",
66-
'help:lint:check:06': "echo That can happen because 'prettier' does not",
67-
'help:lint:check:07': "echo have a 'diagnostic' mode in which it",
68-
'help:lint:check:08': 'echo reports discrepancies with its preferred',
69-
'help:lint:check:09': 'echo formatting, while some formatting not',
70-
'help:lint:check:10': 'echo preferred by prettier is nevertheless',
71-
'help:lint:check:11': 'echo acceptable to eslint.',
76+
/** md
77+
### pnpm lint:check
78+
79+
This is like the 'lint' script but only reports problems; it does not modify
80+
any of your source files. Note that this script might not report any errors
81+
but then a run of the 'lint' script might modify files. That behavior can
82+
occur because 'prettier' does not have a 'diagnostic' mode in which it
83+
reports discrepancies with its preferred formatting, while some formatting
84+
_not_ preferred by prettier is nevertheless acceptable to eslint.
85+
**/
7286
'lint:check': 'eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore',
73-
'help:lint:list': 'run-s -s help:lint:list:*',
74-
'help:lint:list:1': "echo This is like the 'lint' script but only",
75-
'help:lint:list:2': 'echo _lists_ the files that would be changed.',
76-
'help:lint:list:3': 'echo It does not modify any source files or report',
77-
'help:lint:list:4': 'echo what the problems were or report any problems',
78-
'help:lint:list:5': 'echo that the tools do not know how to fix.',
87+
/** md
88+
### pnpm lint:list
89+
90+
This is like the 'lint' script but only _lists_ the files that would be
91+
changed. It does not modify any source files or report what the problems
92+
were or report any problems that the tools do not know how to fix.
93+
**/
7994
'lint:list': 'prettier-eslint --list-different "**/*.*"',
80-
'help:lint:staged': 'echo Only for internal use in the pre-commit hook.',
95+
// Nothing below here is "advertised" for command-line use
96+
// The following is only for internal use in the pre-commit hook:
8197
'lint:staged': 'lint-staged',
82-
'//only lifecycle scripts below here': 'echo',
98+
// And the remainder are life-cycle scripts:
8399
prepare: 'husky install',
84100
preinstall: 'npx only-allow pnpm',
85101
postinstall: 'python3 -m venv .venv && .venv/bin/pip install -U pip && .venv/bin/pip install -r requirements.txt',
@@ -107,7 +123,6 @@ of the available scripts.
107123
jsdom: '^19.0.0',
108124
'lint-staged': '^13.0.3',
109125
mathjs: '^10.5.3',
110-
'npm-run-all': '^4.1.5',
111126
prettier: '^2.7.1',
112127
'prettier-eslint': '^15.0.1',
113128
'prettier-eslint-cli': '^6.0.1',

0 commit comments

Comments
 (0)