From f78f1e81cce1f10136cadae15a57b0288d867fac Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Thu, 29 Jun 2023 18:32:49 -0700 Subject: [PATCH] A prepare script, making it easy to install Prism from outside of NPM. The `prepare` script is the NPM-standard way in which outside-of-NPM packages can be build, for example with installed from a git location. After merging this into the main branch (currently `master`), people will be able to do this: ```sh npm install prismjs@github:PrismJS/prism ``` If they want to try it right now before v2 is merged (if this is merged into v2), they can do this: ```sh npm install prismjs@github:PrismJS/prism#v2 ``` Without this, such installations are not possible. What NPM does during the `install` process is - it clones the specified repo, - checks out the specified git ref (f.e. `v2`), - installs dependencies including dev dependencies, - runs the `prepare` script if any (the `prepare` script will *always* have dev dependencies available to it), - and finally packages the result in the same way as `npm pack` such that build outputs are included in the final package that gets installed into the user's node_modules This would be a way for people to easily test v2 right now and provide feedback. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 47e3e0e75..717c4faca 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "scripts": { "benchmark": "ts-node benchmark/benchmark.ts", "build": "ts-node scripts/build.ts", + "prepare": "npm run build", "lint": "eslint . --cache", "lint:fix": "npm run lint -- --fix", "lint:ci": "eslint . --max-warnings 0",