New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: Add npm script for new core developers #7539
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I think it should not be needed to run any command from the If we would like to use package.json scripts we need to make sure that they work with every OS a contributor may use. TW works well with So Node.js, npm, git and TiddlyWiki should be the only dependencies that are needed. We could even discuss about git. They should also work with different development setups. So every developer may have their own directory structure. |
I absolutely support the idea to have package.json scripts for all the needed functions to work with and test TiddlyWiki, if it's done in a generic way. |
Thanks @linonetwo I would very much like to have some sensible defaults in "scripts" in package.json. I'm open to any changes that make it easier for developers coming to TiddlyWiki for the first time. I agree with @pmario that it would be best to ignore the scripts in So, we'd be left with commands like this:
Can we parameterise those commands so that one could optionally pass the edition path? For example:
|
@Jermolene .. IMO it's important to know, which For the first run we should keep them and start to remove the old ones. BUT IMO we need to take care that building TWclassic still works. ... @YakovL Do you still need some stuff from the TW5 repo, to build TWc?? |
I think that should be a separate discussion |
Yes, you can use
with result
If you figure out what happened, hope you can add new scripts
To leave a default script (dev:tw5.com-server) for me to click-button-to-run. |
I mostly use buttons to run npm script, so there is no an input to add param. So a default version without additional param is needed. I also want to introducegoogle/zx to write scripts like https://github.com/tiddly-gittly/slate-write/tree/master/scripts , but that will need a rewrite of all sh, I don't want to do that... |
@pmario yes, currently TWC is built using the TW5 cli, although I'd like to change the building tool at some point for several reasons (including autotests, imports and IDE support etc). But as package.json has the TW5 version specified, I don't think that any update will hurt |
I personally would like to be able to have a basic development experience without the need to ever run If it is needed for "progressively enhanced" commands it may be fine. But for building empty.html, tiddlywiki5.html and running all tests |
Thanks @linonetwo @pmario
I strongly agree, I'd hope we could avoid it. Presumably that would mean we need to guard against adding dependencies that require npm install. It's not practical to have separate scripts for building each edition. I think that means we need to view these script commands as serving several needs:
With that frame of reference, we don't need to complexify things with parameters. We don't currently use npm scripts for CI but perhaps it might help with onboarding and reuse (I'm thinking of |
npm script is a standard dev doc for developers. So we can only add a command to start an edition, "command to start other editions" can be constructed by copying the script from package.json to the terminal and modifying it.
I rarely use them too. |
It has been a while since I worked with this but here is a very quick example of providing the edition as a commandline argument:
Run with: Commandline arguments are available as variables prefixed with $npm_config in the scripts, and as environmental variables int the scripts executed. We could also write a short wrapper script that assigns a default edition if one is not provided and then runs tiddlywiki. |
Interesting, haven't heard about this before. Better if it can provide a default value, so I can click button to start dev. I don't like using terminal and cli. But you said this requires a .sh file, and windows can't run this. This may be a separate script like |
I think we can figure out, what is convenient to use after we did some more testing with different platforms. |
I need this to be merged to add more scripts, like the inspector script for #7152 (comment) |
As I wrote test.sh cannot be executed on windows systems. About 60% of the desktop world uses windows. We should not ignore this fact. So as it is I'm against merging this PR |
You mean test script? Let me see how I can change that... |
package.json
Outdated
"dev": "node ./tiddlywiki.js ./editions/tw5.com-server --listen", | ||
"test": "node ./tiddlywiki.js ./editions/test --verbose --version --rendertiddler $:/core/save/all test.html text/plain --test && echo To run the tests in a browser, open \"editions/test/output/test.html\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should do the same thing node ./tiddlywiki.js ./editions/test --verbose --version --build index
except the echo.
--build index
is part of the test-edition tiddlywiki.info
configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? I can modify this tomorrow. I just copied it from the .sh file
Bump, I really need this, I forget the command to run today again, and have to come here to copy |
Can we delete tw5.com-server / tw5.com-docs ? They are confusing. I try to update doc today, and found I was updating tw5.com edition, but I'm serving tw5.com-server. Oh, seems it is just a pointer... Never mind. |
Have to visit this PR to copy the command again... |
Thanks @linonetwo |
When I first try to develop tw core, it was hard to find how to dev and how to test.
Other opensource projects use npm script as a "self-explained" way to provide dev methods. You don't need to look at ./bin/ folder, you just need to look at VSCode's
And click "test" button to run a test, this is very standardized. So I also add it to the tw for potential new developers (and me).