Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .docker/apt/sources.list.d/nodesource.list
Original file line number Diff line number Diff line change
@@ -1 +1 @@
deb https://deb.nodesource.com/node_12.x buster main
deb https://deb.nodesource.com/node_18.x buster main
10 changes: 5 additions & 5 deletions lib/ES/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,10 @@ sub start_web_resources_watcher {

close STDIN;
open( STDIN, "</dev/null" );
exec( qw(/node_modules/parcel/bin/cli.js serve
exec( qw(/node_modules/parcel/lib/bin.js serve
--public-url /guide/static/
--hmr-port 8001
-d /tmp/parcel/
--dist-dir /tmp/parcel/
resources/web/docs_js/index-v1.js resources/web/styles-v1.pcss) );
}

Expand Down Expand Up @@ -731,10 +731,10 @@ sub build_web_resources {
# when you run the integration tests and saves about 1.5 seconds on
# every docs build.
say "Compiling web resources";
run '/node_modules/parcel/bin/cli.js', 'build',
run '/node_modules/parcel/lib/bin.js', 'build',
'--public-url', '/guide/static/',
'--experimental-scope-hoisting', '--no-source-maps',
'-d', $parcel_out,
'--no-source-maps',
'--dist-dir', $parcel_out,
'resources/web/docs_js/index-v1.js', 'resources/web/styles-v1.pcss';
die "Parcel didn't make $compiled_js" unless -e $compiled_js;
die "Parcel didn't make $compiled_css" unless -e $compiled_css;
Expand Down
31 changes: 27 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,32 @@
"license": "SEE LICENSE IN README.asciidoc",
"devDependencies": {
"jest": "^24.8.0",
"nock": "^10.0.6",
"nock": "^13.5.0",
"rmfr": "^2.0.0"
},
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"test": "jest"
"test": "jest",
"postinstall": "npx update-browserslist-db@latest || true"
},
"browserslist": "> 0.5%, last 2 versions, not dead",
"targets": {
"default": {
"engines": {
"browsers": [
"> 0.5%",
"last 2 versions",
"not dead"
]
}
},
"node": {
"engines": {
"node": ">= 18"
}
}
},
"jest": {
"setupFiles": [
Expand All @@ -19,12 +40,14 @@
"jquery": "3.5.1",
"js-cookie": "^2.1.0",
"linkstate": "^1.1.1",
"parcel": "^1.12.3",
"parcel": "^2.0.0",
"postcss": "^8.4.0",
"postcss-assets": "^5.0.0",
"postcss-import": "^16.0.0",
"postcss-nested": "^6.0.0",
"preact": "^8.4.2",
"preact-context": "^1.1.3",
"preact-redux": "^2.1.0",
"precss": "^4.0.0",
"ramda": "^0.26.1",
"recursive-copy": "^2.0.10",
"redux": "^4.0.4",
Expand Down
2 changes: 1 addition & 1 deletion preview/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
!preview
!template
!resources/web
resources/web/.cache
resources/web/.parcel-cache
resources/web/tests
9 changes: 7 additions & 2 deletions preview/__test__/clean.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ describe('Cleaner.is_pr_closed', () => {
token = Math.random().toString();
cleaner = new Cleaner(token, 'repo', null, null);
});
afterEach(() => {
nock.cleanAll();
});
test('returns true if github returns true', async () => {
mock_github().reply(200, github_result(true));
await expect(cleaner.is_pr_closed({repo: 'r', number: 1})).resolves.toBe(true);
Expand All @@ -114,15 +117,16 @@ describe('Cleaner.is_pr_closed', () => {
}
}));
await expect(cleaner.is_pr_closed({repo: 'r', number: 1})).rejects
.toThrow(/Cannot read property 'closed' of undefined/);
.toThrow(/Cannot read propert(?:y|ies) of undefined.*closed/);
});
test("backs off if there aren't many requests remaining", async () => {
// Mock setTimeout to immediately run. We don't use jest.useFakeTimers
// because that needs to be manually advanced which is complex for this
// test and not worth it.
const originalSetTimeout = global.setTimeout;
global.setTimeout = jest.fn((callback) => callback());
const oldNow = Date.now;
Date.now = jest.fn(() => new Date(0));
Date.now = jest.fn(() => 0);
try {
mock_github().reply(200, github_result(true), {
'x-ratelimit-remaining': 50,
Expand All @@ -134,6 +138,7 @@ describe('Cleaner.is_pr_closed', () => {
expect(setTimeout).toHaveBeenLastCalledWith(expect.any(Function), 1000);
} finally {
Date.now = oldNow;
global.setTimeout = originalSetTimeout;
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion preview/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function Cleaner(token, repo, cache_dir, tmp_dir) {
}
if (res.headers['x-ratelimit-remaining'] < 100) {
const until = res.headers['x-ratelimit-reset'];
const millis = until * 1000 - Date.now().getTime();
const millis = until * 1000 - Date.now();
console.info('Rate limited for', millis, 'milliseconds');
setTimeout(() => resolve(closed), millis);
} else {
Expand Down
2 changes: 1 addition & 1 deletion resources/web/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jest: tests
.PHONY: tests
tests:
rm -rf tests
$(DOCKER) node_test /node_modules/parcel/bin/cli.js build ./docs_js/__tests__/**/* ./docs_js/__tests__/* -d ./tests/ --target node --no-minify --no-source-maps
$(DOCKER) node_test sh -c 'cd /docs_build/resources/web && /node_modules/parcel/lib/bin.js build "docs_js/__tests__/**/*.js" "docs_js/__tests__/**/*.jsx" --dist-dir ./tests/ --target node --no-optimize --no-source-maps'
2 changes: 1 addition & 1 deletion resources/web/docs_js/prettify/lang-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const basic = PR.createSimpleLexer(
[PR.PR_PUNCTUATION, /^[/?=&]/, null, '/?=&'],
[PR.PR_PLAIN, /^\s+/, null, ' \t\r\n'],
[PR.PR_KEYWORD, /^DELETE|HEAD|GET|PATCH|POST|PUT/, null, 'DHGP'],
["lang-js", /^(\{.+?\})(?=\s*(DELETE|HEAD|GET|PATCH|POST|PUT|$))/s, null, '{'],
["lang-js", /^(\{[^]*?\})(?=\s*(?:DELETE|HEAD|GET|PATCH|POST|PUT|$))/s, null, '{'],
],
[
[PR.PR_STRING, /^[^ \s/?=&]+/],
Expand Down
9 changes: 7 additions & 2 deletions resources/web/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const path = require('path');

module.exports = {
plugins: [
require('precss')(),
require('postcss-assets'),
require('postcss-import')(),
require('postcss-nested')(),
require('postcss-assets')({
loadPaths: [path.join(__dirname, 'style')],
}),
],
};
Loading