Skip to content

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

Closed
chalin wants to merge 1 commit intogoogle:mainfrom
chalin:chalin-im-npm-local-build-2023-06-26
Closed

Add NPM script in support of local builds via sibling folder#227
chalin wants to merge 1 commit intogoogle:mainfrom
chalin:chalin-im-npm-local-build-2023-06-26

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
Contributor

@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.

"_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
Contributor

@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.

"_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
Contributor

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
Contributor

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