Skip to content

Commit

Permalink
fix: use fully qualified import names (*.mjs)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed May 3, 2019
1 parent c53b7b6 commit 0af8fcb
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/content.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import globby from "globby";
import { join, dirname } from "path";
import { asArray, copyTemplate } from "./util";
import fs from "fs";
import globby from "globby";
import { asArray, copyTemplate } from "./util.mjs";

export async function content(context, stagingDir) {
const pkg = context.pkg;
Expand Down
2 changes: 1 addition & 1 deletion src/context.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from "path";
import fs from "fs";
import { createContext as ee } from "expression-expander";
import { utf8StreamOptions } from "./util";
import { utf8StreamOptions } from "./util.mjs";

export async function loadPackage(dir) {
const pkgFile = join(dir, "package.json");
Expand Down
23 changes: 12 additions & 11 deletions src/npm-pkgbuild-cli.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { version, description } from "../package.json";
import { pkgbuild } from "./pkgbuild";
import { systemd } from "./systemd";
import { pacman } from "./pacman";
import { content } from "./content";
import fs, { createReadStream, createWriteStream } from "fs";
import program from "commander";
import { join } from "path";
import program from "commander";
import execa from "execa";
import { utf8StreamOptions } from "./util";
import { createContext } from "./context";
import { pkgbuild } from "./pkgbuild.mjs";
import { systemd } from "./systemd.mjs";
import { pacman } from "./pacman.mjs";
import { content } from "./content.mjs";
import { utf8StreamOptions } from "./util.mjs";
import { createContext } from "./context.mjs";

program
.description(description)
Expand Down Expand Up @@ -83,12 +83,13 @@ program

context.properties["arch"] = arch;

target = target.replace(/\{\{(\w+)\}\}/m, (match, key, offset, string) => context.evaluate(key));

console.log(
`cp ${name}-${version}-${arch}.pkg.tar.xz ${target}`
target = target.replace(
/\{\{(\w+)\}\}/m,
(match, key, offset, string) => context.evaluate(key)
);

console.log(`cp ${name}-${version}-${arch}.pkg.tar.xz ${target}`);

await execa(
"cp",
[`${name}-${version}-${arch}.pkg.tar.xz`, target],
Expand Down
2 changes: 1 addition & 1 deletion src/pacman.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from "path";
import fs from "fs";
import { copyTemplate } from "./util";
import { copyTemplate } from "./util.mjs";

export async function pacman(context, stagingDir) {
const pkg = context.pkg;
Expand Down
2 changes: 1 addition & 1 deletion src/pkgbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from "path";
import { promisify } from "util";
import { finished } from "stream";
import { quote } from "./util";
import { quote } from "./util.mjs";

export async function pkgbuild(context, stagingDir, out, options = {}) {
const pkg = Object.assign({ contributors: [], pacman: {} }, context.pkg);
Expand Down
2 changes: 1 addition & 1 deletion src/systemd.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import globby from "globby";
import { join, basename } from "path";
import { asArray, copyTemplate } from "./util";
import fs from "fs";
import { asArray, copyTemplate } from "./util.mjs";

export async function systemd(context, stagingDir) {
const pkg = context.pkg;
Expand Down
2 changes: 1 addition & 1 deletion src/util.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { iterableStringInterceptor } from "iterable-string-interceptor";
import { createReadStream, createWriteStream } from "fs";
import { join } from "path";
import { iterableStringInterceptor } from "iterable-string-interceptor";

export const utf8StreamOptions = { encoding: "utf8" };

Expand Down
6 changes: 3 additions & 3 deletions tests/content-test.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import test from "ava";
import { join, dirname } from "path";
import { content } from "../src/content";
import { readFileSync } from "fs";
import { utf8StreamOptions } from "../src/util";
import { createContext } from "../src/context";
import { fileURLToPath } from "url";
import { content } from "../src/content.mjs";
import { utf8StreamOptions } from "../src/util.mjs";
import { createContext } from "../src/context.mjs";

const here = dirname(fileURLToPath(import.meta.url));

Expand Down
7 changes: 3 additions & 4 deletions tests/context-test.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import test from "ava";
import { join, dirname } from "path";
import { utf8StreamOptions } from "../src/util";
import { createContext } from "../src/context";
import { fileURLToPath } from "url";
import { utf8StreamOptions } from "../src/util.mjs";
import { createContext } from "../src/context.mjs";

const here = dirname(fileURLToPath(import.meta.url));

Expand All @@ -14,9 +14,8 @@ test("context plain", async t => {
t.is(context.properties.description, "a description");
});


test("context expand", async t => {
const context = await createContext(fixturesDir);

t.is(context.expand('a${name}b'), "amyserviceb");
t.is(context.expand("a${name}b"), "amyserviceb");
});
6 changes: 3 additions & 3 deletions tests/pacman-test.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import test from "ava";
import { join, dirname } from "path";
import { readFileSync } from "fs";
import { pacman } from "../src/pacman";
import { utf8StreamOptions } from "../src/util";
import { createContext } from "../src/context";
import { fileURLToPath } from "url";
import { pacman } from "../src/pacman.mjs";
import { utf8StreamOptions } from "../src/util.mjs";
import { createContext } from "../src/context.mjs";

const here = dirname(fileURLToPath(import.meta.url));

Expand Down
6 changes: 3 additions & 3 deletions tests/pkgbuild-test.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import test from "ava";
import { join, dirname } from "path";
import WritableStreamBuffer from "stream-buffers/lib/writable_streambuffer";
import { utf8StreamOptions } from "../src/util";
import { createContext } from "../src/context";
import { pkgbuild } from "../src/pkgbuild";
import { fileURLToPath } from "url";
import { utf8StreamOptions } from "../src/util.mjs";
import { createContext } from "../src/context.mjs";
import { pkgbuild } from "../src/pkgbuild.mjs";

const here = dirname(fileURLToPath(import.meta.url));

Expand Down
8 changes: 4 additions & 4 deletions tests/systemd-test.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import test from "ava";
import { join, dirname } from "path";
import { systemd } from "../src/systemd";
import { readFileSync } from "fs";
import { utf8StreamOptions } from "../src/util";
import { createContext } from "../src/context";
import { fileURLToPath } from "url";
import { readFileSync } from "fs";
import { systemd } from "../src/systemd.mjs";
import { utf8StreamOptions } from "../src/util.mjs";
import { createContext } from "../src/context.mjs";

const here = dirname(fileURLToPath(import.meta.url));

Expand Down

0 comments on commit 0af8fcb

Please sign in to comment.