Skip to content
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

Add NPM script in support of local builds via sibling folder #227

Closed

Conversation

chalin
Copy link
Collaborator

@chalin chalin commented Jun 26, 2023

If you have a development setup where docsy and docsy-example are in the same parent folder, then npm run local -- <cmd> will run the NPM script <cmd> while using the version of docsy contained in the local folder.

/cc @geriom

Copy link
Collaborator

@deining deining left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I like the idea of having a local copy of the docsy theme at hand.
I had this need/idea already before and authored PR #194 which addresses this issue (incl. documentation). This PR is not fully up to date any more but if you like it and if there is the prospect that my PR will be merged, I am willing to rework my PR #194.

@@ -13,13 +13,15 @@
"_check:links": "echo IMPLEMENTATION PENDING for check-links; echo",
"_hugo": "hugo --cleanDestinationDir",
"_hugo-dev": "npm run _hugo -- -e dev -DFE",
"_local": "HUGO_MODULE_REPLACEMENTS=\"github.com/google/docsy -> ../../docsy\"",
Copy link
Collaborator

@deining deining Jun 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using environment variable HUGO_MODULE_WORKSPACE here:

"_local": "HUGO_MODULE_WORKSPACE=\"hugo.work\"",

If we make use of go wrkspaces here, the path is not hardcoded into package.json, instead users can customize the path according to their needs by editing the file hugo.work.

Have a look at PR #194 which makes use of this concept.

@@ -13,13 +13,15 @@
"_check:links": "echo IMPLEMENTATION PENDING for check-links; echo",
"_hugo": "hugo --cleanDestinationDir",
"_hugo-dev": "npm run _hugo -- -e dev -DFE",
"_local": "HUGO_MODULE_REPLACEMENTS=\"github.com/google/docsy -> ../../docsy\"",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code cross-plattform or does this work on Linux-based OS only?
I would propose to make use of the cross-env package in order to achieve cross-platform compatibility.

@deining
Copy link
Collaborator

deining commented Jun 29, 2023

I extended my pending PR #194, it now contains support for local builds via npm, too. With #194 merged, this PR can be closed, too.

@chalin
Copy link
Collaborator Author

chalin commented Nov 9, 2023

@chalin chalin closed this Nov 9, 2023
@chalin chalin deleted the chalin-im-npm-local-build-2023-06-26 branch November 9, 2023 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants