Skip to content

Commit

Permalink
Upgrade node_modules, change tagline, clean up root directory (denola…
Browse files Browse the repository at this point in the history
…nd#3247)

* Upgrade node_modules
* Simplify tagline
* Move gclient_config.py out of root
* Move package.json to tools
* Remove yarn.lock
* Remove CONTRIBUTING.md
  • Loading branch information
ry authored and piscisaureus committed Nov 1, 2019
1 parent 9d6cbb7 commit af61dbe
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 856 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Expand Up @@ -5,5 +5,4 @@
# Tell git which symlinks point to files, and which ones point to directories.
# This is relevant for Windows only, and requires git >= 2.19.2 to work.
/core/libdeno/* symlink=dir
/node_modules symlink=dir
/website/* symlink=dir
/cli/tests/symlink_to_subdir symlink=dir
12 changes: 8 additions & 4 deletions .gitignore
Expand Up @@ -4,9 +4,13 @@

/.idea/
/.vscode/
/gclient_config.py_entries
gclient_config.py_entries
/gh-pages/
/target/
/website/*.bundle.js
/website/data.json
/website/recent.json

# We use something stronger than lockfiles, we have all NPM modules stored in a
# git. We do not download from NPM during build.
# https://github.com/denoland/deno_third_party
yarn.lock
# yarn creates this in error.
tools/node_modules/
7 changes: 0 additions & 7 deletions CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Deno

A secure runtime for JavaScript and TypeScript built with V8, Rust, and Tokio.
A secure runtime for JavaScript and TypeScript.

[![Build Status](https://github.com/denoland/deno/workflows/ci/badge.svg?branch=master&event=push)](https://github.com/denoland/deno/actions)

Expand Down
9 changes: 6 additions & 3 deletions cli/http_util.rs
Expand Up @@ -143,7 +143,8 @@ mod tests {
fn test_fetch_sync_string() {
let http_server_guard = crate::test_util::http_server();
// Relies on external http server. See tools/http_server.py
let url = Url::parse("http://127.0.0.1:4545/package.json").unwrap();
let url =
Url::parse("http://127.0.0.1:4545/cli/tests/fixture.json").unwrap();

let fut = fetch_string_once(&url).then(|result| match result {
Ok(FetchOnceResult::Code(code, maybe_content_type)) => {
Expand All @@ -162,9 +163,11 @@ mod tests {
fn test_fetch_string_once_with_redirect() {
let http_server_guard = crate::test_util::http_server();
// Relies on external http server. See tools/http_server.py
let url = Url::parse("http://127.0.0.1:4546/package.json").unwrap();
let url =
Url::parse("http://127.0.0.1:4546/cli/tests/fixture.json").unwrap();
// Dns resolver substitutes `127.0.0.1` with `localhost`
let target_url = Url::parse("http://localhost:4545/package.json").unwrap();
let target_url =
Url::parse("http://localhost:4545/cli/tests/fixture.json").unwrap();
let fut = fetch_string_once(&url).then(move |result| match result {
Ok(FetchOnceResult::Redirect(url)) => {
assert_eq!(url, target_url);
Expand Down
18 changes: 9 additions & 9 deletions cli/js/fetch_test.ts
Expand Up @@ -21,15 +21,15 @@ testPerm({ net: true }, async function fetchConnectionError(): Promise<void> {
});

testPerm({ net: true }, async function fetchJsonSuccess(): Promise<void> {
const response = await fetch("http://localhost:4545/package.json");
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
const json = await response.json();
assertEquals(json.name, "deno");
});

test(async function fetchPerm(): Promise<void> {
let err;
try {
await fetch("http://localhost:4545/package.json");
await fetch("http://localhost:4545/cli/tests/fixture.json");
} catch (err_) {
err = err_;
}
Expand All @@ -38,27 +38,27 @@ test(async function fetchPerm(): Promise<void> {
});

testPerm({ net: true }, async function fetchUrl(): Promise<void> {
const response = await fetch("http://localhost:4545/package.json");
assertEquals(response.url, "http://localhost:4545/package.json");
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
assertEquals(response.url, "http://localhost:4545/cli/tests/fixture.json");
});

testPerm({ net: true }, async function fetchHeaders(): Promise<void> {
const response = await fetch("http://localhost:4545/package.json");
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
const headers = response.headers;
assertEquals(headers.get("Content-Type"), "application/json");
assert(headers.get("Server").startsWith("SimpleHTTP"));
});

testPerm({ net: true }, async function fetchBlob(): Promise<void> {
const response = await fetch("http://localhost:4545/package.json");
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
const headers = response.headers;
const blob = await response.blob();
assertEquals(blob.type, headers.get("Content-Type"));
assertEquals(blob.size, Number(headers.get("Content-Length")));
});

testPerm({ net: true }, async function fetchBodyUsed(): Promise<void> {
const response = await fetch("http://localhost:4545/package.json");
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
assertEquals(response.bodyUsed, false);
assertThrows(
(): void => {
Expand All @@ -71,7 +71,7 @@ testPerm({ net: true }, async function fetchBodyUsed(): Promise<void> {
});

testPerm({ net: true }, async function fetchAsyncIterator(): Promise<void> {
const response = await fetch("http://localhost:4545/package.json");
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
const headers = response.headers;
let total = 0;
for await (const chunk of response.body) {
Expand All @@ -82,7 +82,7 @@ testPerm({ net: true }, async function fetchAsyncIterator(): Promise<void> {
});

testPerm({ net: true }, async function responseClone(): Promise<void> {
const response = await fetch("http://localhost:4545/package.json");
const response = await fetch("http://localhost:4545/cli/tests/fixture.json");
const response1 = response.clone();
assert(response !== response1);
assertEquals(response.status, response1.status);
Expand Down
4 changes: 2 additions & 2 deletions cli/js/files_test.ts
Expand Up @@ -8,7 +8,7 @@ test(function filesStdioFileDescriptors(): void {
});

testPerm({ read: true }, async function filesCopyToStdout(): Promise<void> {
const filename = "package.json";
const filename = "cli/tests/fixture.json";
const file = await Deno.open(filename);
assert(file.rid > 2);
const bytesWritten = await Deno.copy(Deno.stdout, file);
Expand Down Expand Up @@ -81,7 +81,7 @@ testPerm({ write: false }, async function writePermFailure(): Promise<void> {
testPerm({ read: false }, async function readPermFailure(): Promise<void> {
let caughtError = false;
try {
await Deno.open("package.json", "r");
await Deno.open("cli/tests/fixture.json", "r");
} catch (e) {
caughtError = true;
assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
Expand Down
2 changes: 1 addition & 1 deletion cli/js/read_dir_test.ts
Expand Up @@ -43,7 +43,7 @@ testPerm({ read: true }, function readDirSyncNotDir(): void {
let src;

try {
src = Deno.readDirSync("package.json");
src = Deno.readDirSync("cli/tests/fixture.json");
} catch (err) {
caughtError = true;
assertEquals(err.kind, Deno.ErrorKind.Other);
Expand Down
8 changes: 4 additions & 4 deletions cli/js/read_file_test.ts
Expand Up @@ -2,7 +2,7 @@
import { testPerm, assert, assertEquals } from "./test_util.ts";

testPerm({ read: true }, function readFileSyncSuccess(): void {
const data = Deno.readFileSync("package.json");
const data = Deno.readFileSync("cli/tests/fixture.json");
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
const json = decoder.decode(data);
Expand All @@ -13,7 +13,7 @@ testPerm({ read: true }, function readFileSyncSuccess(): void {
testPerm({ read: false }, function readFileSyncPerm(): void {
let caughtError = false;
try {
Deno.readFileSync("package.json");
Deno.readFileSync("cli/tests/fixture.json");
} catch (e) {
caughtError = true;
assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
Expand All @@ -36,7 +36,7 @@ testPerm({ read: true }, function readFileSyncNotFound(): void {
});

testPerm({ read: true }, async function readFileSuccess(): Promise<void> {
const data = await Deno.readFile("package.json");
const data = await Deno.readFile("cli/tests/fixture.json");
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
const json = decoder.decode(data);
Expand All @@ -47,7 +47,7 @@ testPerm({ read: true }, async function readFileSuccess(): Promise<void> {
testPerm({ read: false }, async function readFilePerm(): Promise<void> {
let caughtError = false;
try {
await Deno.readFile("package.json");
await Deno.readFile("cli/tests/fixture.json");
} catch (e) {
caughtError = true;
assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
Expand Down
24 changes: 12 additions & 12 deletions cli/js/stat_test.ts
Expand Up @@ -4,11 +4,11 @@ import { testPerm, assert, assertEquals } from "./test_util.ts";
// TODO Add tests for modified, accessed, and created fields once there is a way
// to create temp files.
testPerm({ read: true }, async function statSyncSuccess(): Promise<void> {
const packageInfo = Deno.statSync("package.json");
const packageInfo = Deno.statSync("README.md");
assert(packageInfo.isFile());
assert(!packageInfo.isSymlink());

const modulesInfo = Deno.statSync("node_modules");
const modulesInfo = Deno.statSync("cli/tests/symlink_to_subdir");
assert(modulesInfo.isDirectory());
assert(!modulesInfo.isSymlink());

Expand All @@ -20,7 +20,7 @@ testPerm({ read: true }, async function statSyncSuccess(): Promise<void> {
testPerm({ read: false }, async function statSyncPerm(): Promise<void> {
let caughtError = false;
try {
Deno.statSync("package.json");
Deno.statSync("README.md");
} catch (e) {
caughtError = true;
assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
Expand All @@ -46,11 +46,11 @@ testPerm({ read: true }, async function statSyncNotFound(): Promise<void> {
});

testPerm({ read: true }, async function lstatSyncSuccess(): Promise<void> {
const packageInfo = Deno.lstatSync("package.json");
const packageInfo = Deno.lstatSync("README.md");
assert(packageInfo.isFile());
assert(!packageInfo.isSymlink());

const modulesInfo = Deno.lstatSync("node_modules");
const modulesInfo = Deno.lstatSync("cli/tests/symlink_to_subdir");
assert(!modulesInfo.isDirectory());
assert(modulesInfo.isSymlink());

Expand All @@ -62,7 +62,7 @@ testPerm({ read: true }, async function lstatSyncSuccess(): Promise<void> {
testPerm({ read: false }, async function lstatSyncPerm(): Promise<void> {
let caughtError = false;
try {
Deno.lstatSync("package.json");
Deno.lstatSync("README.md");
} catch (e) {
caughtError = true;
assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
Expand All @@ -88,11 +88,11 @@ testPerm({ read: true }, async function lstatSyncNotFound(): Promise<void> {
});

testPerm({ read: true }, async function statSuccess(): Promise<void> {
const packageInfo = await Deno.stat("package.json");
const packageInfo = await Deno.stat("README.md");
assert(packageInfo.isFile());
assert(!packageInfo.isSymlink());

const modulesInfo = await Deno.stat("node_modules");
const modulesInfo = await Deno.stat("cli/tests/symlink_to_subdir");
assert(modulesInfo.isDirectory());
assert(!modulesInfo.isSymlink());

Expand All @@ -104,7 +104,7 @@ testPerm({ read: true }, async function statSuccess(): Promise<void> {
testPerm({ read: false }, async function statPerm(): Promise<void> {
let caughtError = false;
try {
await Deno.stat("package.json");
await Deno.stat("README.md");
} catch (e) {
caughtError = true;
assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
Expand All @@ -130,11 +130,11 @@ testPerm({ read: true }, async function statNotFound(): Promise<void> {
});

testPerm({ read: true }, async function lstatSuccess(): Promise<void> {
const packageInfo = await Deno.lstat("package.json");
const packageInfo = await Deno.lstat("README.md");
assert(packageInfo.isFile());
assert(!packageInfo.isSymlink());

const modulesInfo = await Deno.lstat("node_modules");
const modulesInfo = await Deno.lstat("cli/tests/symlink_to_subdir");
assert(!modulesInfo.isDirectory());
assert(modulesInfo.isSymlink());

Expand All @@ -146,7 +146,7 @@ testPerm({ read: true }, async function lstatSuccess(): Promise<void> {
testPerm({ read: false }, async function lstatPerm(): Promise<void> {
let caughtError = false;
try {
await Deno.lstat("package.json");
await Deno.lstat("README.md");
} catch (e) {
caughtError = true;
assertEquals(e.kind, Deno.ErrorKind.PermissionDenied);
Expand Down
14 changes: 0 additions & 14 deletions cli/tests/fetch_deps.ts

This file was deleted.

14 changes: 14 additions & 0 deletions cli/tests/fixture.json
@@ -0,0 +1,14 @@
{
"name": "deno",
"private": true,
"devDependencies": {
"@types/prettier": "1.16.1",
"@typescript-eslint/eslint-plugin": "2.5.0",
"@typescript-eslint/parser": "2.5.0",
"eslint": "5.15.1",
"eslint-config-prettier": "4.1.0",
"magic-string": "0.25.2",
"prettier": "1.17.1",
"typescript": "3.6.3"
}
}
1 change: 1 addition & 0 deletions cli/tests/symlink_to_subdir
1 change: 0 additions & 1 deletion node_modules

This file was deleted.

2 changes: 1 addition & 1 deletion third_party
Submodule third_party updated 173 files
1 change: 1 addition & 0 deletions gclient_config.py → tools/gclient_config.py
@@ -1,4 +1,5 @@
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
# pylint: disable=line-too-long
solutions = [
{
'url': 'https://chromium.googlesource.com/v8/v8.git@7.9.317.12',
Expand Down
2 changes: 1 addition & 1 deletion tools/lint.py
Expand Up @@ -55,7 +55,7 @@ def pylint():
print "pylint"
script = os.path.join(third_party_path, "python_packages", "pylint")
rcfile = os.path.join(third_party_path, "depot_tools", "pylintrc")
source_files = git_ls_files(root_path, ["*.py", ":!:gclient_config.py"])
source_files = git_ls_files(root_path, ["*.py"])
run([sys.executable, script, "--rcfile=" + rcfile, "--"] + source_files,
env=python_env(),
shell=False,
Expand Down
1 change: 1 addition & 0 deletions package.json → tools/package.json
@@ -1,5 +1,6 @@
{
"name": "deno",
"private": true,
"devDependencies": {
"@types/prettier": "1.16.1",
"@typescript-eslint/eslint-plugin": "2.5.0",
Expand Down
12 changes: 9 additions & 3 deletions tools/third_party.py
Expand Up @@ -78,7 +78,13 @@ def google_env(env=None, merge_env=None, depot_tools_path_=depot_tools_path):

# Run Yarn to install JavaScript dependencies.
def run_yarn():
run(["yarn", "install"], cwd=third_party_path)
node_modules_path = os.path.join(third_party_path, "node_modules")
# Note to keep the root directory clean, we keep package.json is in tools/.
run([
"yarn", "install", "--no-lockfile",
"--modules-folder=" + node_modules_path
],
cwd=os.path.join(root_path, "tools"))


# Install python packages with pip.
Expand Down Expand Up @@ -119,7 +125,7 @@ def run_pip():
rmtree(temp_python_home)


# Run gclient to install other dependencies.
# Run gclient to install V8.
def run_gclient_sync():
# Depot_tools will normally try to self-update, which will fail because
# it's not checked out from it's own git repository; gclient will then try
Expand Down Expand Up @@ -151,7 +157,7 @@ def run_gclient_sync():
]
envs = {
"DEPOT_TOOLS_UPDATE": "0",
"GCLIENT_FILE": os.path.join(root_path, "gclient_config.py")
"GCLIENT_FILE": os.path.join(root_path, "tools", "gclient_config.py")
}
env = google_env(depot_tools_path_=depot_tools_temp_path, merge_env=envs)
run(args, cwd=third_party_path, env=env)
Expand Down

0 comments on commit af61dbe

Please sign in to comment.