You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Next, update the contents of the new package, which is likely to include the following:
66
66
67
-
- The package name (`package.json`, `lib/index.js`, `README.md`, and any other files which include the name of the original package.
67
+
- The package name, as found in files, such as `package.json`, `lib/index.js`, `README.md`, and any other files which include the name of the original package.
68
68
69
69
- If a package contains `src` and `include` directories,
70
70
71
-
- update the directory tree according to the path of the new package (e.g., `include/stdlib/stats/base/dmax` would become `include/stdlib/stats/strided/dmax`).
71
+
- update the `include`directory tree according to the path of the new package (e.g., `include/stdlib/stats/base/dmax` would become `include/stdlib/stats/strided/dmax`).
72
72
- update header guards within header files in the `include` directory (e.g., `STDLIB_STATS_BASE_DMAX` would become `STDLIB_STATS_STRIDED_DMAX`).
73
73
74
74
There may be other contents needing updating, so be sure to carefully inspect package contents.
@@ -91,7 +91,7 @@ make install-node-addons NODE_ADDONS_PATTERN="stats/strided/dmax"
91
91
92
92
To ensure that the new package works as intended, run the package's unit tests and other quality control commands.
93
93
94
-
#### Unit tests
94
+
#### a. Unit tests
95
95
96
96
```bash
97
97
make test TESTS_FILTER=".*/path/to/new/package/.*"
@@ -103,7 +103,7 @@ For example,
103
103
make test TESTS_FILTER=".*/stats/strided/dmax/.*"
104
104
```
105
105
106
-
#### Examples
106
+
#### b. Examples
107
107
108
108
```bash
109
109
make examples EXAMPLES_FILTER=".*/path/to/new/package/.*"
@@ -127,7 +127,7 @@ For example,
127
127
make examples-c EXAMPLES_FILTER=".*/stats/strided/dmax/.*"
128
128
```
129
129
130
-
#### Benchmarks
130
+
#### c. Benchmarks
131
131
132
132
```bash
133
133
make benchmark BENCHMARKS_FILTER=".*/path/to/new/package/.*"
### 6. Remove the export of the original package from its parent namespace
179
179
180
-
Next, open the `lib/index.js` file found in the parent namespace of the original package (e.g., `lib/node_modules/@stdlib/stats/base/lib/index.js`.
180
+
Next, open the `lib/index.js` file found in the parent namespace of the original package (e.g., `lib/node_modules/@stdlib/stats/base/lib/index.js`).
181
181
182
182
If that file includes an exported symbol from the original package, remove it. For example,
183
183
@@ -212,13 +212,13 @@ In your commit message, you should include a `BREAKING_CHANGE`, migration instru
212
212
```text
213
213
remove: remove `dmax` from namespace
214
214
215
-
This commit removes the `dmax` symbol from the `stats/base`
215
+
This commit removes the `dmax` symbol from the `@stdlib/stats/base`
216
216
namespace due to a package migration.
217
217
218
218
BREAKING CHANGE: remove `dmax`
219
219
220
220
To migrate, users should access the same symbol via the
221
-
`stats/strided` namespace.
221
+
`@stdlib/stats/strided` namespace.
222
222
```
223
223
224
224
### 8. Update paths using a global find-and-replace
@@ -227,13 +227,13 @@ Next, perform a global find-and-replace to migrate all `require` (and `import`)
227
227
228
228
For example, the following `require` statement
229
229
230
-
```text
230
+
```javascript
231
231
var dmax =require( 'stats/base/dmax' );
232
232
```
233
233
234
234
should become
235
235
236
-
```text
236
+
```javascript
237
237
var dmax =require( 'stats/strided/dmax' );
238
238
```
239
239
@@ -246,27 +246,33 @@ A couple of very important notes to keep in mind when performing a global find-a
246
246
247
247
There are three packages where we do **not** want to update `require` paths.
248
248
249
-
- The original package. The original package should remain working and keeps its original paths.
250
-
- The global error database. The global error database is an append-only log. We need to avoid invalidating any existing references.
251
-
- The REPL databases. Given the high velocity of stdlib development, updating these databases will create merge conflicts, which do not need to be immediately resolved. We can avoid the hassle of needing to rectify these conflicts by deferring to stdlib's daily cron job which automatically maintains and updates these databases.
249
+
-**The original package.** The original package should remain working and keep its original paths.
250
+
-**The global error database.** The global error database is an append-only log. We need to avoid invalidating any existing references.
251
+
-**The REPL databases.** Given the high velocity of stdlib development, updating these databases will create merge conflicts, which do not need to be immediately resolved. We can avoid the hassle of needing to rectify these conflicts by deferring to stdlib's daily cron job which automatically maintains and updates these databases.
252
252
253
253
To dismiss any changes made to the above, run the following command
After running the above, double-check the results of `git status` to check that the list of changed files matches expectation.
266
272
267
273
### 10. Commit changes
268
274
269
-
Now that you've cleaned up the path updates, commit the changes to your branch.
275
+
Now that you've cleaned up paths, commit the changes to your branch.
270
276
271
277
```bash
272
278
git add .&& git commit
@@ -344,8 +350,8 @@ If you made these changes on a fork, you should open a pull request against the
344
350
345
351
- A pull request should **only** migrate a single package. Please do **not** open pull request which attempts to migrate multiple packages at the same time.
346
352
- Notice that every commit includes a `Ref:` link back to the RFC issue on the main project repository. This is useful for providing additional context regarding changes, especially those involving deprecations.
347
-
- Provided you have properly setup your local repository (see the [contributing][stdlib-contributing] and [development][stdlib-development] guides), linting will be performed after every commit, and, prior to pushing changes to a remote repository, affected unit tests, examples, and benchmarks should automatically run. Depending on how widely used the original package was throughout stdlib, these quality control steps may take considerable time, and it is possible that unrelated lint errors may be flagged. If possible, address any failures, restage the changes, and attempt to commit or push again. Note that resolution of failures, may require amending previous commits.
348
-
- As mentioned above, be **very careful** when performing global find-and-replace. It can be easy to mistakenly update non-applicable paths, thus breaking packages and all downstream dependents. You've been warned.
353
+
- Provided you have properly setup your local repository (see the [contributing][stdlib-contributing] and [development][stdlib-development] guides), linting will be performed after every commit, and, prior to pushing changes to a remote repository, affected unit tests, examples, and benchmarks should automatically run. Depending on how widely used the original package was throughout stdlib, these quality control steps may take considerable time, and it is possible that unrelated lint errors may be flagged. If possible, address any failures, restage the changes, and attempt to commit or push again. Note that resolution of failures may require amending previous commits.
354
+
- As mentioned above, be **very careful** when performing a global find-and-replace. It can be easy to mistakenly update non-applicable paths, thus breaking packages and all downstream dependents. You've been warned.
349
355
350
356
* * *
351
357
@@ -359,16 +365,16 @@ The following is a checklist you can use when performing a package migration:
359
365
-[ ] Updated include directories in the new package.
360
366
-[ ] Updated header guards in the new package.
361
367
-[ ] Compiled native code and ran unit tests for the new package.
362
-
-[ ] Committed the new package to the migration branch.
368
+
-[ ] Committed the new package to a migration branch, with a link to any relevant public GitHub issues.
363
369
-[ ] Removed the export of the original package from its parent namespace (if applicable).
364
-
-[ ] Committed the changes to the parent namespace (if applicable).
370
+
-[ ] Committed the changes to the parent namespace (if applicable), with a link to any relevant public GitHub issues and with user migration instructions.
365
371
-[ ] Updated `require` paths across the project to refer to the new package.
366
372
-[ ] Discarded any path changes to the original package.
367
373
-[ ] Discarded any path changes to the `@stdlib/error` namespace.
368
-
-[ ] Discarded any path changes to the `@stdlib/repl/**/data` database files.
369
-
-[ ] Committed path updates.
374
+
-[ ] Discarded any path changes to `@stdlib/repl/**/data` database files.
375
+
-[ ] Committed path updates, with a link to any relevant public GitHub issues.
370
376
-[ ] Removed the original package.
371
-
-[ ] Committed removal of the original package.
377
+
-[ ] Committed removal of the original package, with a link to any relevant public GitHub issues and with user migration instructions.
372
378
-[ ] Resolved any encountered lint errors or test failures when committing and/or pushing changes.
373
379
-[ ] Opened a pull request which performs one and only one package migration.
374
380
-[ ] The pull request includes at most `4` commits.
@@ -388,15 +394,15 @@ When reviewing a pull request involving a package migration, one should do the f
388
394
3. Inspect each commit for the following:
389
395
390
396
-`feat`: should only add the new package. Ensure that all `require` paths have been updated and correctly refer to the new package. Ensure that any `include` directories have been renamed. Ensure that header guards have been updated.
391
-
-`remove`: should only remove the symbol from the original package.
392
-
-`refactor`: check as many files as possible, ensuring a wide cross-section of affected files, to ensure that the updated paths correctly point to the new package.
397
+
-`remove`: should only remove the symbol from the parent namespace of the original package.
398
+
-`refactor`: should only update paths, but may include lint fixes if these were encountered while committing. Check as many files as possible in order to obtain a wide cross-section of affected files and ensure that the updated paths correctly point to the new package. Verify that affected packages do **not** include the original package, error databases, or REPL databases.
393
399
-`remove`: should only remove the original package.
394
400
395
401
If there exists a public issue associated with the migration, ensure that each commit refers to that public issue with a `ref:` Git trailer.
396
402
397
403
Ensure that each `remove` commit message body includes a `BREAKING CHANGE` section, along with migration steps.
398
404
399
-
4. If the pull request has merge conflicts, inspect the conflicts and determine whether you can easily resolve. If the conflicts cannot be resolved, you'll likely need to block the pull request from being merged. If they can be resolve, go ahead and resolve them, creating a merge commit.
405
+
4. If the pull request has merge conflicts, inspect the conflicts and determine whether you can easily resolve. If the conflicts cannot be resolved, you'll likely need to block the pull request from being merged. If they can be resolved, go ahead and resolve them, creating a merge commit.
400
406
401
407
5. If everything looks okay, approve the pull request changes.
402
408
@@ -417,6 +423,7 @@ When reviewing a pull request involving a package migration, one should do the f
417
423
- Select "Rebase and merge".
418
424
- Confirm that you wish to perform the operation.
419
425
- Merge.
426
+
- Disable "Allow rebase merging" on GitHub in repository settings. Our default merge setting should be "Squash and merge", and we do not want to mistakenly perform rebase commits in future PRs.
0 commit comments