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

Get rid of cache option introduced previously to fix local dev #69

Merged
merged 4 commits into from
Aug 28, 2023

Conversation

mohammadxali
Copy link
Contributor

@mohammadxali mohammadxali commented Aug 28, 2023

Problem

I'm not able to release a new version of this package. Simply because the Pipeline fails locally.

Logs
content-renderer-react-js on  master is 📦 v0.31.0 via  v18.16.0 took 3s 
❯ npm run release

> @prezly/[email protected] release
> np --test-script='release:check'


Publish a new version of @prezly/content-renderer-react-js (current: 0.31.0)

Commits:
- Merge pull request #68 from prezly/feature/dev-11478-support-embednode-layout-in-prezlycontent-renderer-react-js  f3bc4b5
- [DEV-11478] Allow changing `Embed`'s layout in Storybook  8ee61e9
- [DEV-11478] Make controls expanded in Storybook  10f93ca
- [DEV-11478] Only enable cache in dev env  80dd4bf
- [DEV-11478] Set `api.cache(true)` to resolve babel error  d309437
- [DEV-11478] Fix embed object shape  dcf8f9d
- [DEV-11478] Support different layouts for `Embed`  48ef815
- [DEV-11478] Bump `story-content-format` to v0.64.0  8120d70

Commit Range:
v0.31.0...master

Registry:
https://registry.npmjs.org/

? Select semver increment or specify new version minor  0.32.0

  ✔ Prerequisite check
  ✔ Git
  ✔ Installing dependencies using npm
  ✖ Running tests using npm
    → [17:50:28] Starting 'build:cjs'...
    Bumping version using npm
    Publishing package using npm
    Pushing tags
    Creating release draft on GitHub

✖ Command failed with exit code 1: npm run release:check
`import sass from 'sass'` is deprecated.
Please use `import * as sass from 'sass'` instead.
[17:50:28] 'build:cjs' errored after 42 ms
[17:50:28] Error in plugin "gulp-babel"
Message:
    Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
for various types of caching, using the first param of their handler functions:

module.exports = function(api) {
  // The API exposes the following:

  // Cache the returned value forever and don't call this function again.
  api.cache(true);

  // Don't cache at all. Not recommended because it will be very slow.
  api.cache(false);

  // Cached based on the value of some function. If this function returns a value different from
  // a previously-encountered value, the plugins will re-evaluate.
  var env = api.cache(() => process.env.NODE_ENV);

  // If testing for a specific env, we recommend specifics to avoid instantiating a plugin for
  // any possible NODE_ENV value that might come up during plugin execution.
  var isProd = api.cache(() => process.env.NODE_ENV === "production");

  // .cache(fn) will perform a linear search though instances to find the matching plugin based
  // based on previous instantiated plugins. If you want to recreate the plugin and discard the
  // previous instance whenever something changes, you may use:
  var isProd = api.cache.invalidate(() => process.env.NODE_ENV === "production");

  // Note, we also expose the following more-verbose versions of the above examples:
  api.cache.forever(); // api.cache(true)
  api.cache.never();   // api.cache(false)
  api.cache.using(fn); // api.cache(fn)

  // Return the value that will be cached.
  return { };
};

> @prezly/[email protected] release:check
> npm run clean:build && npm run build && npm run check


> @prezly/[email protected] clean:build
> rimraf build/


> @prezly/[email protected] build
> NODE_ENV=production npm run build:all


> @prezly/[email protected] build:all
> npm run build:types && npm run build:cjs && npm run build:esm && npm run build:sass


> @prezly/[email protected] build:types
> tsc --project ./tsconfig.build.json


> @prezly/[email protected] build:cjs
> gulp build:cjs

[17:50:28] Using gulpfile ~/prezly/content-renderer-react-js/gulpfile.mjs
[17:50:28] Starting 'build:cjs'...

Aborted!

Investigation

I think the problem is because we're using .mjs for babel configs instead of .js.

In #2 the build pipeline was introduced but the babel configurations weren't .mjs yet.

Then we introduced the Storybook in #20 and we used .mjs for babel configurations. Still unsure why, but I guess that's the root cause of the issue.


Solution

I don't have any. I'm just reverting the stuff I added in #68 (To be able to develop locally because npm run start command was failing for me)

@mohammadxali mohammadxali self-assigned this Aug 28, 2023
@mohammadxali mohammadxali marked this pull request as ready for review August 28, 2023 14:22
@mohammadxali mohammadxali changed the title Address babel enforcing to use a cache option Get rid of cache option that were introduced previously to be able to develop locally Aug 28, 2023
@mohammadxali mohammadxali merged commit cbd7c1b into master Aug 28, 2023
9 checks passed
@mohammadxali mohammadxali deleted the fix/address-babel-cache-issue branch August 28, 2023 14:55
@e1himself e1himself changed the title Get rid of cache option that were introduced previously to be able to develop locally Get rid of cache option introduced previously to fix local dev Aug 29, 2023
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