Skip to content

Conversation

Copy link

Copilot AI commented Dec 9, 2025

Plan to Update react-native-hr

  • Update package.json with modern dependencies
    • Update Babel from v6 to v7 (babel-cli, babel-preset-env, babel-preset-react)
    • Update Gulp from v3 to v5
    • Update gulp-babel to v8
    • Add missing peer dependencies (react, react-native as peerDependencies)
    • Add prop-types to peer dependencies
    • Add babel-jest for testing
    • Add @babel/plugin-transform-runtime for better code generation
    • Add @babel/runtime dependency
  • Update .babelrc configuration file
    • Replace deprecated babel-preset-es2015 with @babel/preset-env
    • Update babel-preset-react to @babel/preset-react
    • Remove Node.js target (use default for React Native)
    • Add @babel/preset-flow for React Native compatibility
    • Add @babel/plugin-transform-runtime to use external helpers
  • Update gulpfile.js for Gulp 5 compatibility
    • Modernize gulp task definitions (use named functions)
    • Update babel preset names
  • Update package.json scripts
    • Update build script with new babel preset names
    • Update watch script with new babel preset names
    • Remove duplicate --presets flags (use .babelrc)
    • Add test script
  • Verify the build works
    • Run npm install
    • Run npm run build
    • Check generated dist/index.js
  • Add comprehensive tests
    • Add Jest test framework
    • Create 8 tests covering all component functionality
    • All tests passing
  • Update examples if needed (examples use compiled dist file which is now up to date)
  • Run security audit to verify vulnerabilities are fixed
  • Update README with compatibility information
  • Address all code review feedback
    • Remove Node.js target from .babelrc
    • Add prop-types to peer dependencies
    • Remove duplicate --presets flags
    • Add babel-jest to devDependencies
    • Fix redundant prototype writes using transform-runtime plugin
Original prompt

make sure this still works if not update it so we can still use it


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 9, 2025 12:55
Co-authored-by: joshuabalduff <11274822+joshuabalduff@users.noreply.github.com>
Co-authored-by: joshuabalduff <11274822+joshuabalduff@users.noreply.github.com>
@jestjosh jestjosh marked this pull request as ready for review December 9, 2025 12:59
Co-authored-by: joshuabalduff <11274822+joshuabalduff@users.noreply.github.com>
@jestjosh jestjosh requested a review from Copilot December 9, 2025 13:05
@jestjosh
Copy link
Owner

jestjosh commented Dec 9, 2025

@copilot can you add tests?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the react-native-hr package by upgrading from Babel 6 to Babel 7, Gulp 3 to Gulp 5, and adding explicit peer dependencies for React and React Native. The goal is to ensure the package works with modern React Native versions and resolves security vulnerabilities from outdated dependencies.

Key Changes:

  • Upgraded build tooling from Babel 6 to Babel 7 and Gulp 3 to Gulp 5
  • Added peer dependencies for React (>=16.8.0) and React Native (>=0.60.0)
  • Updated configuration files (.babelrc) and build scripts to use new Babel preset naming

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Updated dependencies to Babel 7 (@babel/cli, @babel/core, @babel/preset-env, @babel/preset-react), Gulp 5, and added React/React Native peer dependencies
.babelrc Created new Babel 7 configuration with @babel/preset-env and @babel/preset-react presets
gulpfile.js Modernized Gulp tasks to use Gulp 5's named function exports pattern and removed inline preset configuration
dist/index.js Generated output file transpiled with Babel 7 (auto-generated, no review needed)
examples/hr.dist.js Generated output file transpiled with Babel 7 (auto-generated, no review needed)
README.md Added compatibility section documenting React >= 16.8.0 and React Native >= 0.60.0 requirements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

.babelrc Outdated
Comment on lines 3 to 7
["@babel/preset-env", {
"targets": {
"node": "current"
}
}],
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

The .babelrc configuration targets "node": "current" but this package is meant to be consumed by React Native applications. React Native uses a JavaScript runtime that's not Node.js. This target configuration could result in transpiled code that's not optimized for React Native environments.

Consider removing the targets option to use Babel's default targets, or specify React Native-specific targets if needed.

Suggested change
["@babel/preset-env", {
"targets": {
"node": "current"
}
}],
["@babel/preset-env", {}],

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

Fixed. Removed the Node.js target configuration to use Babel's default targets which are appropriate for React Native environments. (d83ccf4)

package.json Outdated
"license": "ISC",
"peerDependencies": {
"react": ">=16.8.0",
"react-native": ">=0.60.0"
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

The peer dependencies should also include prop-types since the component uses it extensively. Without listing prop-types as a peer dependency, users may encounter runtime errors if they don't have it installed in their projects.

Add:

"prop-types": ">=15.0.0"
Suggested change
"react-native": ">=0.60.0"
"react-native": ">=0.60.0",
"prop-types": ">=15.0.0"

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

Fixed. Added prop-types (>=15.0.0) to peer dependencies. (d83ccf4)

package.json Outdated
Comment on lines 10 to 12
"build": "babel src/index.js --out-file examples/hr.dist.js --presets @babel/preset-env,@babel/preset-react",
"start": "gulp",
"watch": "babel src --out-dir dist --watch --presets es2015,react"
"watch": "babel src --out-dir dist --watch --presets @babel/preset-env,@babel/preset-react"
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

The build and watch scripts pass presets directly via the command line, but these presets are also configured in .babelrc. This creates duplicate configuration that could lead to maintenance issues if the presets need to be updated in the future.

Consider removing the --presets flags from the CLI commands and relying solely on .babelrc for consistency:

"build": "babel src/index.js --out-file examples/hr.dist.js",
"watch": "babel src --out-dir dist --watch"

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

Fixed. Removed --presets flags from build and watch scripts. Configuration now centralized in .babelrc file. (d83ccf4)

function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

This write to property 'prototype' is useless, since another property write always overrides it.

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Author

Choose a reason for hiding this comment

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

Fixed by adding @babel/plugin-transform-runtime. The generated code now uses external helpers from @babel/runtime instead of inline helpers, which eliminates the redundant prototype writes and reduces code size. (e9365cf)

Copilot AI changed the title [WIP] Update functionality to ensure continued usability Modernize dependencies to Babel 7 and Gulp 5 Dec 9, 2025
Copilot AI requested a review from jestjosh December 9, 2025 13:09
- Remove Node.js target from .babelrc (use default for React Native)
- Add prop-types to peer dependencies
- Remove duplicate preset flags from build scripts (rely on .babelrc)
- Add @babel/preset-flow for React Native compatibility
- Add Jest test framework with 8 comprehensive tests
- Configure Jest without react-native preset to avoid Flow parsing issues
- All tests passing (8/8)

Co-authored-by: joshuabalduff <11274822+joshuabalduff@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 9, 2025

@copilot can you add tests?

Added comprehensive test suite with 8 tests covering all component functionality. Tests verify solid lines, custom margins, text rendering, custom styles, and default props. All tests passing. (d83ccf4)

Copilot AI and others added 2 commits December 9, 2025 13:16
- Explicitly add babel-jest transformer for Jest tests

Co-authored-by: joshuabalduff <11274822+joshuabalduff@users.noreply.github.com>
Co-authored-by: joshuabalduff <11274822+joshuabalduff@users.noreply.github.com>
Copilot AI changed the title Modernize dependencies to Babel 7 and Gulp 5 Modernize dependencies to Babel 7 and Gulp 5, add comprehensive tests Dec 9, 2025
@jestjosh
Copy link
Owner

jestjosh commented Dec 9, 2025

@copilot apply changes based on the comments in this thread

- Add @babel/plugin-transform-runtime and @babel/runtime
- Use external helpers instead of inline helpers
- Fixes redundant prototype writes in generated code
- Reduces code size and improves maintainability
- All tests still passing (8/8)

Co-authored-by: joshuabalduff <11274822+joshuabalduff@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 9, 2025

@copilot apply changes based on the comments in this thread

All changes from that review thread have already been applied:

  • Removed Node.js target from .babelrc (d83ccf4)
  • Added prop-types to peerDependencies (d83ccf4)
  • Removed duplicate --presets flags from scripts (d83ccf4)
  • Fixed redundant prototype writes with transform-runtime (e9365cf)

All tests passing (8/8), build working, 0 vulnerabilities.

@jestjosh jestjosh merged commit f7d0091 into master Dec 9, 2025
1 check passed
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