Skip to content

feat(publish): Remove --require-scripts#1862

Closed
evocateur wants to merge 1 commit intolerna:mainfrom
evocateur:remove-exec-scripts
Closed

feat(publish): Remove --require-scripts#1862
evocateur wants to merge 1 commit intolerna:mainfrom
evocateur:remove-exec-scripts

Conversation

@evocateur
Copy link
Copy Markdown
Member

@evocateur evocateur commented Jan 9, 2019

Description

In order to simplify publish logic, remove "sidecar" lifecycle support.

Holding as "WIP" until other breaking changes can be batched together.

Motivation and Context

Refs #1767

How Has This Been Tested?

Tests pass (there were none for the feature itself)

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • All new and existing tests passed.

@evocateur evocateur added the WIP label Jan 9, 2019
@evocateur evocateur self-assigned this Jan 9, 2019
@evocateur evocateur force-pushed the remove-exec-scripts branch from ed657de to a0a7a47 Compare January 9, 2019 20:07
@evocateur evocateur force-pushed the remove-exec-scripts branch from a0a7a47 to d126fe6 Compare January 10, 2019 20:52
@evocateur evocateur force-pushed the remove-exec-scripts branch 2 times, most recently from 8fe04cc to 8d04aa8 Compare January 11, 2019 01:23
ThisIsMissEm
ThisIsMissEm previously approved these changes Jan 11, 2019
Copy link
Copy Markdown
Contributor

@ThisIsMissEm ThisIsMissEm left a comment

Choose a reason for hiding this comment

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

LGTM, should we bail/error out if a user passes --require-scripts?

@evocateur
Copy link
Copy Markdown
Member Author

I believe yargs will throw an error when it fails to recognize --require-scripts, but it won't be a particularly helpful message by default.

@evocateur evocateur force-pushed the remove-exec-scripts branch from 8d04aa8 to f4cc223 Compare January 11, 2019 17:47
@evocateur evocateur force-pushed the remove-exec-scripts branch from f4cc223 to f56890b Compare January 11, 2019 18:11
@ThisIsMissEm
Copy link
Copy Markdown
Contributor

ThisIsMissEm commented Jan 11, 2019 via email

@evocateur evocateur force-pushed the remove-exec-scripts branch from f56890b to cf38970 Compare January 17, 2019 21:28
@nicolo-ribaudo
Copy link
Copy Markdown
Contributor

Note that Babel currently uses --require-scripts. I will check if/how we can migrate.

BREAKING CHANGE: Automatic `require()` of `{pkg}/scripts/prepublish.js` and `{pkg}/scripts/postpublish.js` no longer occurs during `lerna publish` operations.

A descriptive error is now thrown and the process exits non-zero when `--require-scripts` is encountered.

Regular npm lifecycles (`prepare`, `prepack`, `postpack`, `prepublishOnly`, `publish`, and `postpublish`) are still called for each targeted package.
@mojavelinux
Copy link
Copy Markdown
Contributor

I use this feature extensively in the release for Antora (see https://gitlab.com/antora/antora/-/blob/master/releasing.adoc#readme-dance). I use to update various files in the repository (to propagate the version number and update dates) as well as to feed a consolidated README file to the npm registry. Lerna would be substantially less powerful without this feature, which works very well.

@evocateur
Copy link
Copy Markdown
Member Author

@mojavelinux I don't see how a proper prepack and postpack in each leaf cannot replace the convoluted copying and pasting of script files currently employed.

  "scripts": {
    "prepack": "node ../../scripts/prepublish.js",
    "postpack": "node ../../scripts/postpublish.js"
  }

(or, better yet, a root prepack/postpack that loops through all the leaves instead of a repetitive per-leaf scripts block)

@mojavelinux
Copy link
Copy Markdown
Contributor

I don't remember the exact details, but I'm quite sure I tried that and the timing simply wasn't right (it either missed the package or the tag). I need to be able to swap the AsciiDoc README with a Markdown README in both the tag and published package. Right now, the process works and I'd really rather not waste tons more hours trying to make it work a different way.

@evocateur evocateur changed the base branch from master to main November 8, 2020 00:40
@JamesHenry JamesHenry removed the WIP label Jun 3, 2022
@JamesHenry
Copy link
Copy Markdown
Member

I'm going to close this one because of its age, we may look to incorporate it into the recoverable publish work we are doing for v7

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.

5 participants