Skip to content

Commit

Permalink
Migrating path.resolve to fs.resolvePath
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankagarwals committed Nov 30, 2020
1 parent 594be27 commit 7249a38
Show file tree
Hide file tree
Showing 46 changed files with 450 additions and 327 deletions.
33 changes: 17 additions & 16 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ winapi = "0.3.9"
[dependencies]
deno_crypto = { path = "../op_crates/crypto", version = "0.3.0" }
deno_core = { path = "../core", version = "0.69.0" }
deno_doc = "0.1.16"
deno_lint = "0.2.11"
deno_doc = "0.1.17"
deno_lint = "0.2.12"
deno_web = { path = "../op_crates/web", version = "0.20.0" }
deno_fetch = { path = "../op_crates/fetch", version = "0.12.0" }

Expand All @@ -47,7 +47,7 @@ clap = "2.33.3"
dissimilar = "1.0.2"
dlopen = "0.1.8"
encoding_rs = "0.8.24"
dprint-plugin-typescript = "0.32.9"
dprint-plugin-typescript = "0.35.0"
filetime = "0.2.12"
http = "0.2.1"
indexmap = "1.6.0"
Expand All @@ -66,8 +66,8 @@ shell-escape = "0.1.5"
sys-info = "0.7.0"
sourcemap = "6.0.1"
swc_bundler = "=0.17.1"
swc_common = { version = "=0.10.5", features = ["sourcemap"] }
swc_ecmascript = { version = "=0.14.1", features = ["codegen", "dep_graph", "parser", "react", "transforms", "visit"] }
swc_common = { version = "0.10.6", features = ["sourcemap"] }
swc_ecmascript = { version = "0.14.4", features = ["codegen", "dep_graph", "parser", "react", "transforms", "visit"] }
tempfile = "3.1.0"
termcolor = "1.1.0"
tokio = { version = "0.2.22", features = ["full"] }
Expand Down
17 changes: 14 additions & 3 deletions cli/bench/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
),
(
"check",
&["cache", "--reload", "std/examples/chat/server_test.ts"],
&[
"cache",
"--reload",
"--unstable",
"std/examples/chat/server_test.ts",
],
None,
),
(
Expand All @@ -84,18 +89,24 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"cache",
"--reload",
"--no-check",
"--unstable",
"std/examples/chat/server_test.ts",
],
None,
),
(
"bundle",
&["bundle", "std/examples/chat/server_test.ts"],
&["bundle", "--unstable", "std/examples/chat/server_test.ts"],
None,
),
(
"bundle_no_check",
&["bundle", "--no-check", "std/examples/chat/server_test.ts"],
&[
"bundle",
"--unstable",
"--no-check",
"std/examples/chat/server_test.ts",
],
None,
),
];
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/fmt/expected_fmt_check_tests_dir.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[WILDCARD]
error: Found 1 not formatted file in [WILDCARD] files
error: Found 2 not formatted files in [WILDCARD] files
4 changes: 2 additions & 2 deletions cli/tests/unit/test_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { assert, assertEquals } from "../../../std/testing/asserts.ts";
import * as colors from "../../../std/fmt/colors.ts";
export { colors };
import { resolve } from "../../../std/path/mod.ts";
import { resolvePath } from "../../../std/fs/mod.ts";
export {
assert,
assertEquals,
Expand Down Expand Up @@ -356,7 +356,7 @@ unitTest(
);

export function pathToAbsoluteFileUrl(path: string): URL {
path = resolve(path);
path = resolvePath(path);

return new URL(`file://${Deno.build.os === "windows" ? "/" : ""}${path}`);
}
33 changes: 33 additions & 0 deletions docs/contributing/release_schedule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Release Schedule

A new minor release for the `deno` cli is released every 6 weeks. A new patch
version is released weekly, except in the week before a new minor release.

The release dates for the upcoming minor releases are:

- 1.6.0: December 8th, 2020
- 1.7.0: January 19th, 2020
- 1.8.0: March 2nd, 2020

Stable releases can be found on the
[GitHub releases page](https://github.com/denoland/deno/releases).

### Canary channel

In addition to the stable channel described above, canaries are released
multiple times daily (for each commit on master). You can upgrade to the latest
canary release by running:

```
deno upgrade --canary
```

To update to a specifc canary, pass the commit has in the `--version` option:

```
deno upgrade --canary --version=973af61d8bb03c1709f61e456581d58386ed4952
```

To switch back to the stable channel, run `deno upgrade`.

Canaries can be downloaded from https://dl.deno.land.
1 change: 1 addition & 0 deletions docs/toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"name": "Contributing",
"children": {
"building_from_source": "Building from source",
"release_schedule": "Release schedule",
"development_tools": "Development tools",
"style_guide": "Style guide",
"architecture": "Architecture"
Expand Down
17 changes: 9 additions & 8 deletions std/archive/tar_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
*/
import { assert, assertEquals } from "../testing/asserts.ts";

import { dirname, fromFileUrl, resolve } from "../path/mod.ts";
import { dirname, fromFileUrl } from "../path/mod.ts";
import { resolvePath } from "../fs/mod.ts";
import { Tar, Untar } from "./tar.ts";

const moduleDir = dirname(fromFileUrl(import.meta.url));
const testdataDir = resolve(moduleDir, "testdata");
const filePath = resolve(testdataDir, "example.txt");
const testdataDir = resolvePath(moduleDir, "testdata");
const filePath = resolvePath(testdataDir, "example.txt");

interface TestEntry {
name: string;
Expand Down Expand Up @@ -201,7 +202,7 @@ Deno.test(
},
];

const outputFile = resolve(testdataDir, "test.tar");
const outputFile = resolvePath(testdataDir, "test.tar");

const tar = await createTar(entries);
const file = await Deno.open(outputFile, { create: true, write: true });
Expand Down Expand Up @@ -236,7 +237,7 @@ Deno.test("untarAsyncIteratorFromFileReader", async function (): Promise<void> {
},
];

const outputFile = resolve(testdataDir, "test.tar");
const outputFile = resolvePath(testdataDir, "test.tar");

const tar = await createTar(entries);
const file = await Deno.open(outputFile, { create: true, write: true });
Expand Down Expand Up @@ -312,7 +313,7 @@ Deno.test(
);

Deno.test("untarLinuxGeneratedTar", async function (): Promise<void> {
const filePath = resolve(testdataDir, "deno.tar");
const filePath = resolvePath(testdataDir, "deno.tar");
const file = await Deno.open(filePath, { read: true });

const expectedEntries = [
Expand Down Expand Up @@ -414,12 +415,12 @@ Deno.test("directoryEntryType", async function (): Promise<void> {
type: "directory",
});

const filePath = resolve(testdataDir);
const filePath = resolvePath(testdataDir);
tar.append("archive/testdata/", {
filePath,
});

const outputFile = resolve(testdataDir, "directory_type_test.tar");
const outputFile = resolvePath(testdataDir, "directory_type_test.tar");
const file = await Deno.open(outputFile, { create: true, write: true });
await Deno.copy(tar.getReader(), file);
await file.close();
Expand Down
3 changes: 2 additions & 1 deletion std/encoding/toml_test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../testing/asserts.ts";
import { existsSync } from "../fs/exists.ts";
import { resolvePath } from "../fs/mod.ts";
import * as path from "../path/mod.ts";
import { parse, stringify } from "./toml.ts";

const moduleDir = path.dirname(path.fromFileUrl(import.meta.url));
const testdataDir = path.resolve(moduleDir, "testdata");
const testdataDir = resolvePath(moduleDir, "testdata");

function parseFile(filePath: string): Record<string, unknown> {
if (!existsSync(filePath)) {
Expand Down
6 changes: 4 additions & 2 deletions std/examples/chat/server_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { assert, assertEquals } from "../../testing/asserts.ts";
import { TextProtoReader } from "../../textproto/mod.ts";
import { BufReader } from "../../io/bufio.ts";
import { delay } from "../../async/delay.ts";
import { dirname, fromFileUrl, resolve } from "../../path/mod.ts";
import { dirname, fromFileUrl } from "../../path/mod.ts";
import { resolvePath } from "../../fs/mod.ts";

const moduleDir = resolve(dirname(fromFileUrl(import.meta.url)));
const moduleDir = resolvePath(dirname(fromFileUrl(import.meta.url)));

async function startServer(): Promise<
Deno.Process<Deno.RunOptions & { stdout: "piped" }>
Expand All @@ -17,6 +18,7 @@ async function startServer(): Promise<
"--quiet",
"--allow-net",
"--allow-read",
"--unstable",
"server.ts",
],
cwd: moduleDir,
Expand Down
7 changes: 4 additions & 3 deletions std/examples/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../testing/asserts.ts";
import { dirname, fromFileUrl, relative, resolve } from "../path/mod.ts";
import { dirname, fromFileUrl, relative } from "../path/mod.ts";
import { resolvePath } from "../fs/mod.ts";

const moduleDir = dirname(fromFileUrl(import.meta.url));

Expand All @@ -21,8 +22,8 @@ Deno.test("catSmoke", async function (): Promise<void> {
"run",
"--quiet",
"--allow-read",
relative(Deno.cwd(), resolve(moduleDir, "cat.ts")),
relative(Deno.cwd(), resolve(moduleDir, "..", "README.md")),
relative(Deno.cwd(), resolvePath(moduleDir, "cat.ts")),
relative(Deno.cwd(), resolvePath(moduleDir, "..", "README.md")),
],
stdout: "null",
stderr: "null",
Expand Down
3 changes: 2 additions & 1 deletion std/fs/_util_test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Copyright the Browserify authors. MIT License.

import { assertEquals } from "../testing/asserts.ts";
import { resolvePath } from "../fs/mod.ts";
import * as path from "../path/mod.ts";
import { getFileInfoType, isSubdir, PathType } from "./_util.ts";
import { ensureFileSync } from "./ensure_file.ts";
import { ensureDirSync } from "./ensure_dir.ts";

const moduleDir = path.dirname(path.fromFileUrl(import.meta.url));
const testdataDir = path.resolve(moduleDir, "testdata");
const testdataDir = resolvePath(moduleDir, "testdata");

Deno.test("_isSubdir", function (): void {
const pairs = [
Expand Down
9 changes: 5 additions & 4 deletions std/fs/copy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { resolvePath } from "../fs/mod.ts";
import * as path from "../path/mod.ts";
import { ensureDir, ensureDirSync } from "./ensure_dir.ts";
import { getFileInfoType, isSubdir } from "./_util.ts";
Expand Down Expand Up @@ -243,8 +244,8 @@ export async function copy(
dest: string,
options: CopyOptions = {},
): Promise<void> {
src = path.resolve(src);
dest = path.resolve(dest);
src = resolvePath(src);
dest = resolvePath(dest);

if (src === dest) {
throw new Error("Source and destination cannot be the same.");
Expand Down Expand Up @@ -282,8 +283,8 @@ export function copySync(
dest: string,
options: CopyOptions = {},
): void {
src = path.resolve(src);
dest = path.resolve(dest);
src = resolvePath(src);
dest = resolvePath(dest);

if (src === dest) {
throw new Error("Source and destination cannot be the same.");
Expand Down
Loading

0 comments on commit 7249a38

Please sign in to comment.