Skip to content

Commit

Permalink
@dr-js/core@0.3.0-dev.8
Browse files Browse the repository at this point in the history
notable change:
- temp-fix: ci: delay test 14.x, wait for: puppeteer/puppeteer#5719
- fix: ci: git CRLF config & longer test timeout
- fix: sanity test for `nodejs@14`
- node: add TLS server session ticket rotation
- use `response.writableEnded` (need nodejs@>=12.9)
- package update
  • Loading branch information
dr-js committed Apr 25, 2020
1 parent b3c92c5 commit 23e719f
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 74 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/ci-test.yml
Expand Up @@ -5,13 +5,19 @@ on: [ push ]
jobs:
build:
strategy:
fail-fast: false # allow all test to run to the end
matrix:
os: [ ubuntu-latest ] # [ ubuntu-latest, windows-latest, macos-latest ]
node-version: [ 12.x, 13.x ]
os: [ ubuntu-latest, windows-latest ] # [ ubuntu-latest, windows-latest, macos-latest ]
node-version: [ 12.x, 13.x ] # TODO: delay test 14.x, wait for: https://github.com/puppeteer/puppeteer/issues/5719

runs-on: ${{ matrix.os }}

steps:
- name: Reset Git config # fix win32 CI cause `something to commit` test error: https://github.com/actions/checkout/issues/135#issuecomment-602171132
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Setup Git repo
uses: actions/checkout@v2 # https://github.com/actions/checkout

Expand All @@ -27,7 +33,7 @@ jobs:
echo "npm: $(npm -v)"
- name: Patch `libgbm1` for `puppeteer@3` # https://github.com/puppeteer/puppeteer/issues/5674
run: sudo apt-get install -y libgbm1
run: node -e "process.exitCode = Number(os.platform() !== 'win32')" || sudo apt-get install -y libgbm1

- run: npm ci

Expand Down
4 changes: 4 additions & 0 deletions SPEC.md
Expand Up @@ -463,6 +463,8 @@
> basic system status: -J=isOutputJSON
> --open --o -o [OPTIONAL] [ARGUMENT=0-1]
> use system default app to open uri or path: $0=uriOrPath/cwd
> --which --w -w [OPTIONAL] [ARGUMENT=1]
> resolve to full executable path: -R=resolveRoot/cwd, $0=commandNameOrPath
> --fetch --f -f [OPTIONAL] [ARGUMENT=1-3]
> fetch "GET" uri: -O=outputFile/stdout, $@=initialUrl,jumpMax/4,timeout/0
> --process-status --ps [OPTIONAL] [ARGUMENT=0-1]
Expand Down Expand Up @@ -505,6 +507,7 @@
> export DR_JS_MODIFY_DELETE="[OPTIONAL] [ARGUMENT=0+]"
> export DR_JS_STATUS="[OPTIONAL] [ARGUMENT=0+]"
> export DR_JS_OPEN="[OPTIONAL] [ARGUMENT=0-1]"
> export DR_JS_WHICH="[OPTIONAL] [ARGUMENT=1]"
> export DR_JS_FETCH="[OPTIONAL] [ARGUMENT=1-3]"
> export DR_JS_PROCESS_STATUS="[OPTIONAL] [ARGUMENT=0-1]"
> export DR_JS_JSON_FORMAT="[OPTIONAL] [ARGUMENT=0-1]"
Expand Down Expand Up @@ -539,6 +542,7 @@
> "modifyDelete": [ "[OPTIONAL] [ARGUMENT=0+]" ],
> "status": [ "[OPTIONAL] [ARGUMENT=0+]" ],
> "open": [ "[OPTIONAL] [ARGUMENT=0-1]" ],
> "which": [ "[OPTIONAL] [ARGUMENT=1]" ],
> "fetch": [ "[OPTIONAL] [ARGUMENT=1-3]" ],
> "processStatus": [ "[OPTIONAL] [ARGUMENT=0-1]" ],
> "jsonFormat": [ "[OPTIONAL] [ARGUMENT=0-1]" ],
Expand Down
88 changes: 44 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@dr-js/core",
"version": "0.3.0-dev.7",
"version": "0.3.0-dev.8",
"description": "A collection of strange functions",
"author": "dr-js",
"license": "MIT",
Expand All @@ -28,11 +28,11 @@
"build-library-webpack-dev": "node -r @babel/register ./script/webpack development watch",
"build-module": "dr-dev --EE BABEL_ENV=module -E -- babel ./source --out-dir ./output-gitignore/module",
"// test ========================": "",
"test-dev": "dr-dev --EE BABEL_ENV=dev -E -- dr-dev --TR @babel/register -T source/common/module/AsyncTask.test.js",
"test-dev": "dr-dev --EE BABEL_ENV=dev -E -- dr-dev --TR @babel/register -T source/node/.sanity.test/memoryUsageDataType.test.js",
"test-sanity": "dr-dev --EE BABEL_ENV=dev -E -- dr-dev --TR @babel/register -T source/common/.sanity.test/promise.test.js",
"test-source": "dr-dev --TR @babel/register -T source/env/ source/common/ source/node/ --TFS .test.js",
"test-output-library": "dr-dev -T output-gitignore/library/env/ output-gitignore/library/common/ output-gitignore/library/node/ --TFS .test.js",
"test-output-module": "dr-dev --TR @babel/register -T output-gitignore/module/env/ output-gitignore/module/common/ output-gitignore/module/node/ --TFS .test.js",
"test-source": "dr-dev --TR @babel/register -T source/env/ source/common/ source/node/ --TFS .test.js --TT 42000",
"test-output-library": "dr-dev -T output-gitignore/library/env/ output-gitignore/library/common/ output-gitignore/library/node/ --TFS .test.js --TT 42000",
"test-output-module": "dr-dev --TR @babel/register -T output-gitignore/module/env/ output-gitignore/module/common/ output-gitignore/module/node/ --TFS .test.js --TT 42000",
"// test-browser ================": "",
"test-browser": "node -r @babel/register ./script/testBrowser production",
"test-browser-dev": "node -r @babel/register ./script/testBrowser development",
Expand All @@ -47,8 +47,8 @@
"npm": ">=6.12"
},
"devDependencies": {
"@dr-js/dev": "0.3.0-dev.6",
"@dr-js/dev-web-puppeteer": "0.3.0-dev.6"
"@dr-js/dev": "0.3.0-dev.7",
"@dr-js/dev-web-puppeteer": "0.3.0-dev.7"
},
"sideEffects": false
}
11 changes: 9 additions & 2 deletions source-bin/index.js
Expand Up @@ -19,6 +19,7 @@ import { autoTestServerPort } from '@dr-js/core/module/node/server/function'
import { createServerPack } from '@dr-js/core/module/node/server/Server'
import { createTCPProxyListener } from '@dr-js/core/module/node/server/Proxy'
import { getDefaultOpenCommandList } from '@dr-js/core/module/node/system/DefaultOpen'
import { resolveCommandAsync } from '@dr-js/core/module/node/system/ResolveCommand'
import { runSync } from '@dr-js/core/module/node/system/Run'
import { getAllProcessStatusAsync, describeAllProcessStatusAsync } from '@dr-js/core/module/node/system/Process'
import { getSystemStatus, describeSystemStatus } from '@dr-js/core/module/node/system/Status'
Expand Down Expand Up @@ -60,6 +61,7 @@ const runMode = async (modeName, optionData) => {

const argumentList = tryGet(modeName) || []
const isOutputJSON = Boolean(tryGet('json'))
const root = tryGetFirst('root') || process.cwd()
const inputFile = tryGetFirst('input-file')
const outputFile = tryGetFirst('output-file')
const outputBuffer = (buffer) => outputFile
Expand Down Expand Up @@ -133,6 +135,12 @@ const runMode = async (modeName, optionData) => {
const [ command, ...prefixArgList ] = getDefaultOpenCommandList()
return runSync({ command, argList: [ ...prefixArgList, uri.includes('://') ? uri : normalize(uri) ] })
}
case 'which': {
const commandNameOrPath = argumentList[ 0 ]
const resultCommand = await resolveCommandAsync(commandNameOrPath, root)
if (!resultCommand) throw new Error(`failed to resolve command: ${commandNameOrPath}`)
return logAuto(resultCommand)
}
case 'status':
return logAuto(isOutputJSON ? getSystemStatus() : describeSystemStatus())

Expand Down Expand Up @@ -175,8 +183,7 @@ const runMode = async (modeName, optionData) => {
case 'server-serve-static':
case 'server-serve-static-simple': {
const [ expireTime = 5 * 1000 ] = argumentList // expireTime: 5sec, in msec
const staticRoot = tryGetFirst('root') || process.cwd()
return startServer(configureServerServeStatic, { isSimpleServe: modeName === 'server-serve-static-simple', expireTime: Number(expireTime), staticRoot })
return startServer(configureServerServeStatic, { isSimpleServe: modeName === 'server-serve-static-simple', expireTime: Number(expireTime), staticRoot: root })
}
case 'server-websocket-group':
return startServer(configureServerWebSocketGroup)
Expand Down
1 change: 1 addition & 0 deletions source-bin/option.js
Expand Up @@ -32,6 +32,7 @@ const MODE_FORMAT_LIST = parseList(

'status,s/T|basic system status: -J=isOutputJSON',
'open,o//0-1|use system default app to open uri or path: $0=uriOrPath/cwd',
'which,w//1|resolve to full executable path: -R=resolveRoot/cwd, $0=commandNameOrPath',
'fetch,f//1-3|fetch "GET" uri: -O=outputFile/stdout, $@=initialUrl,jumpMax/4,timeout/0',
'process-status,ps//0-1|show system process status: -J=isOutputJSON, $0=outputMode/"pid--"',
'json-format,jf/AI/0-1|re-format JSON file: -O=outputFile/-I, -I=inputFile, $0=unfoldLevel/2',
Expand Down
2 changes: 1 addition & 1 deletion source/browser/net.test.js
Expand Up @@ -33,7 +33,6 @@ describe('Browser.Net', () => {
() => { throw new Error('should throw time out error') },
expectError('NETWORK_TIMEOUT')
)
await fetchLikeRequest(`${baseUrl}/test-timeout`, { timeout: 80 }) // should pass
await fetchLikeRequest(`${baseUrl}/test-timeout-payload`, { timeout: 80 }).then(
(response) => response.arrayBuffer(),
(error) => { throw new Error(`should not timeout: ${error}`) }
Expand All @@ -44,6 +43,7 @@ describe('Browser.Net', () => {
},
expectError('PAYLOAD_TIMEOUT')
)
await fetchLikeRequest(`${baseUrl}/test-timeout`, { timeout: 420 }) // should pass
})

it('fetchLikeRequest(): arrayBuffer(), text(), json()', async () => {
Expand Down

0 comments on commit 23e719f

Please sign in to comment.