Skip to content

Commit

Permalink
fs: add option parents to
Browse files Browse the repository at this point in the history
    - fs.open[Sync],
    - fs.writeFile[Sync],
    - fs.appendFile[Sync]

this feature is intended to improve ergonomics/simplify-scripting when:
- creating build-artifacts/coverage-files during ci
- scaffolding new web-projects
- cloning website with web-crawler

allowing user to lazily create ad-hoc directory-structures as need
during file-creation with ergonomic syntax:
```
fs.writeFileSync(
    "foo/bar/baz/qux.txt",
    "hello world!",
    { parents: true } // will lazily create parent foo/bar/baz/ as needed
);
```

fs: add new signature-form fs.open(path[, options], callback)
fs: add new signature-form fs.openSync(path[, options])

Fixes: #33559
  • Loading branch information
kaizhu256 committed Jan 11, 2021
1 parent b8d6132 commit a8ebcd3
Show file tree
Hide file tree
Showing 4,052 changed files with 114,803 additions and 39,977 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
lib/internal/v8_prof_polyfill.js
lib/punycode.js
test/addons/??_*
test/fixtures
Expand Down
16 changes: 13 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const ModuleFindPath = Module._findPath;
const hacks = [
'eslint-plugin-node-core',
'eslint-plugin-markdown',
'babel-eslint',
'@babel/eslint-parser',
'@babel/plugin-syntax-class-properties',
];
Module._findPath = (request, paths, isMain) => {
const r = ModuleFindPath(request, paths, isMain);
Expand All @@ -37,8 +38,14 @@ Module._findPath = (request, paths, isMain) => {
module.exports = {
root: true,
plugins: ['markdown', 'node-core'],
parser: 'babel-eslint',
parserOptions: { sourceType: 'script' },
parser: '@babel/eslint-parser',
parserOptions: {
babelOptions: {
plugins: [Module._findPath('@babel/plugin-syntax-class-properties')],
},
requireConfigFile: false,
sourceType: 'script',
},
overrides: [
{
files: [
Expand Down Expand Up @@ -150,6 +157,7 @@ module.exports = {
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
'no-new-require': 'error',
'no-new-symbol': 'error',
'no-nonoctal-decimal-escape': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'no-path-concat': 'error',
Expand Down Expand Up @@ -226,6 +234,8 @@ module.exports = {
'no-unreachable': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unsafe-optional-chaining': 'error',
'no-unused-expressions': ['error', { allowShortCircuit: true }],
'no-unused-labels': 'error',
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'all' }],
'no-use-before-define': ['error', {
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1-bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repo. https://github.com/nodejs/help
Please fill in as much of the template below as you're able.
Version: output of `node -v`
Platform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)
Platform: output of `uname -a` (UNIX), or output of `"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })"` in PowerShell console (Windows)
Subsystem: if known, please specify affected core module name
-->

Expand Down
22 changes: 8 additions & 14 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
<!--
Thank you for your pull request. Please provide a description above and review
the requirements below.
Before submitting a pull request, please read
https://github.com/nodejs/node/blob/master/CONTRIBUTING.md.
Bug fixes and new features should include tests and possibly benchmarks.
Commit message formatting guidelines:
https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines
Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->
For code changes:
1. Include tests for any bug fixes or new features.
2. Update documentation if relevant.
3. Ensure that `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes.
- [ ] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes
- [ ] tests and/or benchmarks are included
- [ ] documentation is changed or added
- [ ] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines)

<!--
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:

jobs:
build-tarball:
if: github.event.pull_request.draft == false
env:
PYTHON_VERSION: 3.9
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:

jobs:
build-windows-with-quic:
if: github.event.pull_request.draft == false
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/close-stalled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:

jobs:
stale:
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/comment-stalled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
staleComment:
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
steps:
- name: Post comment
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coverage-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:

jobs:
coverage-linux:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coverage-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:

jobs:
coverage-windows:
if: github.event.pull_request.draft == false
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/license-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
workflow_dispatch:

jobs:
update_routes:
update_license:
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
23 changes: 18 additions & 5 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:

jobs:
lint-addon-docs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -24,8 +25,9 @@ jobs:
- name: Environment Information
run: npx envinfo
- name: Lint addon docs
run: NODE=$(which node) make lint-addon-docs
run: NODE=$(command -v node) make lint-addon-docs
lint-cpp:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -38,6 +40,7 @@ jobs:
- name: Lint C/C++ files
run: make lint-cpp
lint-md:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -50,8 +53,9 @@ jobs:
- name: Lint docs
run: |
echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json"
NODE=$(which node) make lint-md
NODE=$(command -v node) make lint-md
lint-js:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -62,8 +66,9 @@ jobs:
- name: Environment Information
run: npx envinfo
- name: Lint JavaScript files
run: NODE=$(which node) make lint-js
run: NODE=$(command -v node) make lint-js
lint-py:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -76,9 +81,17 @@ jobs:
- name: Lint Python
run: |
make lint-py-build || true
NODE=$(which node) make lint-py
NODE=$(command -v node) make lint-py
lint-sh:
if: github.event.pull_request.draft == false
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: shellcheck -V
- name: Lint Shell scripts
run: tools/lint-sh.js .
lint-codeowners:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:

jobs:
build-docs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -23,7 +24,7 @@ jobs:
- name: Environment Information
run: npx envinfo
- name: Build
run: NODE=$(which node) make doc-only
run: NODE=$(command -v node) make doc-only
- uses: actions/upload-artifact@v1
with:
name: docs
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/notify-force-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
branches:
- master

name: Notify on Force Push
jobs:
slackNotification:
name: Slack Notification
if: ${{ github.event.forced && github.repository == 'nodejs/node' }}
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@master
env:
SLACK_COLOR: '#DE512A'
SLACK_ICON: https://github.com/nodejs.png?size=48
SLACK_TITLE: '${{ github.actor }} force-pushed to ${{ github.ref }}'
SLACK_MESSAGE: |
A commit was force-pushed to <https://github.com/${{ github.repository }}/tree/master|${{ github.repository }}@master> by <https://github.com/${{ github.actor }}|${{ github.actor }}>
Before: <https://github.com/${{ github.repository }}/commit/${{ github.event.before }}|${{ github.event.before }}>
After: <https://github.com/${{ github.repository }}/commit/${{ github.event.after }}|${{ github.event.after }}>
SLACK_USERNAME: nodejs-bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
1 change: 1 addition & 0 deletions .github/workflows/test-asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:

jobs:
test-asan:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
CC: clang
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:

jobs:
test-linux:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -30,6 +31,7 @@ jobs:
run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions"

test-linux-with-quic:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:

jobs:
test-macOS-with-quic:
if: github.event.pull_request.draft == false
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -25,6 +26,6 @@ jobs:
- name: Environment Information
run: npx envinfo
- name: Build
run: make build-ci -j8 V=1 CONFIG_FLAGS="--error-on-warn --experimental-quic"
run: make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn --experimental-quic"
- name: Test
run: make run-ci -j8 V=1 TEST_CI_ARGS="-p actions"
run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions"
2 changes: 1 addition & 1 deletion BSDmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FLAGS=${.MAKEFLAGS:C/\-J ([0-9]+,?)+//W}

all: .DEFAULT
.DEFAULT:
@which gmake > /dev/null 2>&1 ||\
@command -v gmake > /dev/null 2>&1 ||\
(echo "GMake is required for node.js to build.\
Install and try again" && exit 1)
@gmake ${.FLAGS} ${.TARGETS}
Expand Down
25 changes: 25 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ file a new issue.
* [Building the documentation](#building-the-documentation)
* [Building a debug build](#building-a-debug-build)
* [Building an ASAN build](#building-an-asan-build)
* [Speeding up frequent rebuilds when developing](#speeding-up-frequent-rebuilds-when-developing)
* [Troubleshooting Unix and macOS builds](#troubleshooting-unix-and-macos-builds)
* [Windows](#windows)
* [Prerequisites](#prerequisites)
Expand Down Expand Up @@ -113,6 +114,7 @@ platforms. This is true regardless of entries in the table below.
| Windows | x64, x86 | Windows Server 2012 (not R2) | Experimental | |
| Windows | arm64 | >= Windows 10 | Tier 2 (compiling) / Experimental (running) | |
| macOS | x64 | >= 10.13 | Tier 1 | |
| macOS | arm64 | >= 11 | Experimental | |
| SmartOS | x64 | >= 18 | Tier 2 | |
| AIX | ppc64be >=power7 | >= 7.2 TL02 | Tier 2 | |
| FreeBSD | x64 | >= 11 | Experimental | Downgraded as of Node.js 12 <sup>[7](#fn7)</sup> |
Expand Down Expand Up @@ -526,6 +528,29 @@ $ ./configure --debug --enable-asan && make -j4
$ make test-only
```

#### Speeding up frequent rebuilds when developing

If you plan to frequently rebuild Node.js, especially if using several branches,
installing `ccache` can help to greatly reduce build times. Set up with:
```console
$ sudo apt install ccache # for Debian/Ubuntu, included in most Linux distros
$ ccache -o cache_dir=<tmp_dir>
$ ccache -o max_size=5.0G
$ export CC="ccache gcc" # add to your .profile
$ export CXX="ccache g++" # add to your .profile
```
This will allow for near-instantaneous rebuilds even when switching branches.

When modifying only the JS layer in `lib`, it is possible to externally load it
without modifying the executable:
```console
$ ./configure --node-builtin-modules-path $(pwd)
```
The resulting binary won't include any JS files and will try to load them from
the specified directory. The JS debugger of Visual Studio Code supports this
configuration since the November 2020 version and allows for setting
breakpoints.

#### Troubleshooting Unix and macOS builds

Stale builds can sometimes result in `file not found` errors while building.
Expand Down
18 changes: 14 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,21 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V15.md#15.2.1">15.2.1</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V15.md#15.5.1">15.5.1</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.5.0">15.5.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.4.0">15.4.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.3.0">15.3.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.2.1">15.2.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.2.0">15.2.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.1.0">15.1.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.0.1">15.0.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V15.md#15.0.0">15.0.0</a><br/>
</td>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V14.md#14.15.1">14.15.1</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V14.md#14.15.4">14.15.4</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.15.3">14.15.3</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.15.2">14.15.2</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.15.1">14.15.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.15.0">14.15.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.14.0">14.14.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.13.1">14.13.1</a><br/>
Expand All @@ -60,7 +67,9 @@ release.
<a href="doc/changelogs/CHANGELOG_V14.md#14.0.0">14.0.0</a><br/>
</td>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V12.md#12.19.1">12.19.1</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V12.md#12.20.1">12.20.1</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.20.0">12.20.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.19.1">12.19.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.19.0">12.19.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.18.4">12.18.4</a><br/>
<a href="doc/changelogs/CHANGELOG_V12.md#12.18.3">12.18.3</a><br/>
Expand Down Expand Up @@ -96,7 +105,8 @@ release.
<a href="doc/changelogs/CHANGELOG_V12.md#12.0.0">12.0.0</a><br/>
</td>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V10.md#10.23.0">10.23.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V10.md#10.23.1">10.23.1</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V10.md#10.23.0">10.23.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V10.md#10.22.1">10.22.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V10.md#10.22.0">10.22.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V10.md#10.21.0">10.21.0</a><br/>
Expand Down
Loading

0 comments on commit a8ebcd3

Please sign in to comment.