Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: Bump Deno to v1.0.0 #51

Merged
merged 15 commits into from
May 16, 2020
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
- uses: actions/checkout@master
- uses: denolib/setup-deno@master
with:
deno-version: 0.42.0
deno-version: 1.0.0
- name: Run tests
run: |
cp ./ormconfig.gh-actions.json ./ormconfig.json
deno run --allow-read --allow-write --allow-env --allow-net --config ./tsconfig.json -r ./test.ts
deno run --allow-read --allow-write --allow-env --allow-net --unstable --config ./tsconfig.json -r ./test.ts
14 changes: 7 additions & 7 deletions dem.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
{
"protocol": "https",
"path": "deno.land/std",
"version": "v0.42.0",
"version": "v0.51.0",
"files": [
"/async/deferred.ts",
"/fmt/colors.ts",
"/fs/mod.ts",
"/node/process.ts",
"/path/mod.ts",
"/util/async.ts"
"/path/mod.ts"
]
},
{
"protocol": "https",
"path": "deno.land/x/mysql",
"version": "1.9.1",
"version": "2.1.0",
"files": [
"/mod.ts"
]
},
{
"protocol": "https",
"path": "deno.land/x/postgres",
"version": "v0.3.11",
"version": "v0.4.0",
"files": [
"/mod.ts"
]
Expand All @@ -39,15 +39,15 @@
{
"protocol": "https",
"path": "deno.land/x/sqlite",
"version": "73935087a1ebe9108d784503bc5474662ba54b73",
"version": "v1.0.0",
"files": [
"/mod.ts"
]
},
{
"protocol": "https",
"path": "unpkg.com/cac",
"version": "v6.5.8",
"version": "v6.5.9",
"files": [
"/mod.js"
]
Expand Down
8 changes: 7 additions & 1 deletion src/connection/ConnectionOptionsReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class ConnectionOptionsReader {
connectionOptions = await mod.default;

} else if (foundFileFormat === "json") {
connectionOptions = await import(configFile);
connectionOptions = await this.loadJson(configFile);

} else if (foundFileFormat === "yml") {
connectionOptions = new ConnectionOptionsYmlReader().read(configFile);
Expand All @@ -136,6 +136,12 @@ export class ConnectionOptionsReader {
return undefined;
}

protected async loadJson(path: string): Promise<ConnectionOptions> {
const content = await PlatformTools.readFile(path);
const decoder = new TextDecoder();
return JSON.parse(decoder.decode(content));
}

/**
* Normalize connection options.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/driver/DriverUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Driver } from "./Driver.ts";
import { hash } from "../util/StringUtils.ts";
import type { AutoSavable, AutoSavableDriver } from "./types/AutoSavable.ts";
import type { AutoSavableDriver } from "./types/AutoSavable.ts";

/**
* Common driver utility functions.
Expand Down
2 changes: 1 addition & 1 deletion src/driver/mysql/MysqlDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {ApplyValueTransformers} from "../../util/ApplyValueTransformers.ts";
import {NotImplementedError} from "../../error/NotImplementedError.ts";
import type * as DenoMysql from "../../../vendor/https/deno.land/x/mysql/mod.ts";
import type {ReleaseConnection, RawExecuteResult} from "./typings.ts";
import {deferred} from "../../../vendor/https/deno.land/std/util/async.ts";
import {deferred} from "../../../vendor/https/deno.land/std/async/deferred.ts";

/**
* Organizes communication with MySQL DBMS.
Expand Down
2 changes: 1 addition & 1 deletion src/driver/postgres/PostgresDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ export class PostgresDriver implements Driver {

// build connection options for the driver
const connectionOptions = Object.assign({}, {
host: credentials.host,
hostname: credentials.host,
user: credentials.username,
password: credentials.password,
database: credentials.database,
Expand Down
4 changes: 4 additions & 0 deletions src/platform/PlatformTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export class PlatformTools {
return fs.existsSync(pathStr);
}

static readFile(filename: string): Promise<Uint8Array> {
return Deno.readFile(filename);
}

static readFileSync(filename: string): Buffer {
throw new NotImplementedError('PlatformTools.readFileSync');
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/PromiseQueue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {deferred, Deferred} from "../../vendor/https/deno.land/std/util/async.ts";
import {deferred, Deferred} from "../../vendor/https/deno.land/std/async/deferred.ts";

export class PromiseQueue<T> {
private queue = [] as Array<{ fn: () => Promise<T>, promise: Deferred<T> }>;
Expand Down
6 changes: 6 additions & 0 deletions test/deps/global.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
(window as any)['global'] = window;

// * `window.location` was removed in Deno@v1.0.0-rc1.
// * Mocha depends on `window.location`.
if ((window as any).location == null) {
(window as any).location = {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
Category,
} from "./entity/Category.ts";
import {EntitySchema} from "../../../../../src/index.ts";
import UserSchemaJSON from "./schema/user.json";
import ProfileSchemaJSON from "./schema/profile.json";
import UserSchemaJSON from "./schema/user.js";
import ProfileSchemaJSON from "./schema/profile.js";

/**
* Because lazy relations are overriding prototype is impossible to run these tests on multiple connections.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"name": "Profile",
"table": {
"name": "profile"
Expand All @@ -23,4 +23,4 @@
"lazy": true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"name": "User",
"table": {
"name": "user"
Expand Down Expand Up @@ -27,4 +27,4 @@
"lazy": true
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {Blog} from "./entity/Blog.ts";
import {Category} from "./entity/Category.ts";
import {DeepPartial} from "../../../../src/common/DeepPartial.ts";
import {EntitySchema} from "../../../../src/index.ts";
import userSchema from "./schema/user.json";
import userSchema from "./schema/user.js";

describe("repository > basic methods", () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
export default {
"name": "User",
"table": {
"name": "user"
Expand All @@ -18,4 +18,4 @@
"nullable": false
}
}
}
}
1 change: 1 addition & 0 deletions vendor/https/deno.land/std/async/deferred.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from 'https://deno.land/std@v0.51.0/async/deferred.ts';
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/fmt/colors.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://deno.land/std@v0.42.0/fmt/colors.ts';
export * from 'https://deno.land/std@v0.51.0/fmt/colors.ts';
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/fs/mod.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://deno.land/std@v0.42.0/fs/mod.ts';
export * from 'https://deno.land/std@v0.51.0/fs/mod.ts';
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/node/process.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://deno.land/std@v0.42.0/node/process.ts';
export * from 'https://deno.land/std@v0.51.0/node/process.ts';
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/path/mod.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://deno.land/std@v0.42.0/path/mod.ts';
export * from 'https://deno.land/std@v0.51.0/path/mod.ts';
1 change: 0 additions & 1 deletion vendor/https/deno.land/std/util/async.ts

This file was deleted.

2 changes: 1 addition & 1 deletion vendor/https/deno.land/x/mysql/mod.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://deno.land/x/mysql@1.9.1/mod.ts';
export * from 'https://deno.land/x/mysql@2.1.0/mod.ts';
2 changes: 1 addition & 1 deletion vendor/https/deno.land/x/postgres/mod.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://deno.land/x/postgres@v0.3.11/mod.ts';
export * from 'https://deno.land/x/postgres@v0.4.0/mod.ts';
2 changes: 1 addition & 1 deletion vendor/https/deno.land/x/sqlite/mod.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://deno.land/x/sqlite@73935087a1ebe9108d784503bc5474662ba54b73/mod.ts';
export * from 'https://deno.land/x/sqlite@v1.0.0/mod.ts';
2 changes: 1 addition & 1 deletion vendor/https/unpkg.com/cac/mod.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://unpkg.com/cac@v6.5.8/mod.js';
export * from 'https://unpkg.com/cac@v6.5.9/mod.js';