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

feat: npm release #35

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*/assets/data/
dist
_site
npm
60 changes: 60 additions & 0 deletions build_npm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts"

const dir = "./npm"

await emptyDir(dir)
await build({
entryPoints: ["./graph/mod.ts"],
outDir: dir,
shims: {
deno: "dev",
},
test: false,
mappings: {
"https://deno.land/x/[email protected]/stream/mod.ts": {
name: "@rimbu/stream",
version: "2.1.0",
},
"https://deno.land/x/[email protected]/hashed/mod.ts": {
name: "@rimbu/hashed",
version: "2.1.0",
},
"https://deno.land/x/[email protected]/graph/mod.ts": {
name: "@rimbu/graph",
version: "2.0.1",
},
"https://deno.land/x/[email protected]/graph/custom/common/link.ts": {
name: "@rimbu/graph",
version: "2.0.1",
subPath: "custom",
},
"https://deno.land/x/[email protected]/mod.ts": {
name: "ts-morph",
version: "21.0.1",
},
"https://deno.land/x/[email protected]/common/mod.ts": {
name: "@ts-morph/common",
version: "0.22.0",
},
},
// scriptModule: false,
package: {
name: "stackgraph",
version: "0.0.0",
description: "(stacked) dependency graph visualizer",
license: "MIT",
repository: {
type: "git",
url: "git+https://github.com/daangn/stackgraph.git",
},
bugs: {
url: "https://github.com/daangn/stackgraph/issues",
},
},
postBuild: async () => {
await Promise.all([
Deno.copyFile("./README.md", `${dir}/README.md`),
Deno.copyFile("./LICENSE", `${dir}/LICENSE`),
])
},
})
3 changes: 2 additions & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"doc/assets/data",
"render/assets",
"_site",
"__snapshots__"
"__snapshots__",
"npm"
],
"tasks": {
"lume": "echo \"import 'lume/cli.ts'\" | deno run --unstable -A -",
Expand Down
51 changes: 51 additions & 0 deletions deno.lock

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

4 changes: 4 additions & 0 deletions deps/rimbu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from "https://deno.land/x/[email protected]/stream/mod.ts"
export * from "https://deno.land/x/[email protected]/graph/mod.ts"
export * from "https://deno.land/x/[email protected]/hashed/mod.ts"
export type * from "https://deno.land/x/[email protected]/graph/custom/common/link.ts"
1 change: 1 addition & 0 deletions deps/ts_morph_common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "https://deno.land/x/[email protected]/common/mod.ts"
2 changes: 1 addition & 1 deletion graph/_example_project.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Stream } from "../deps/rimbu.ts"
import { inMemoryProject } from "./_project.ts"
import outdent from "https://deno.land/x/[email protected]/mod.ts"

Expand Down
2 changes: 1 addition & 1 deletion graph/_format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Reducer, Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Reducer, Stream } from "../deps/rimbu.ts"
import { encodeVSCodeURI, prettyPrintURI } from "./vscode_uri.ts"

import type { Declaration, DeclDeps } from "./decl_deps.ts"
Expand Down
2 changes: 1 addition & 1 deletion graph/_project.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Reducer, Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Reducer, Stream } from "../deps/rimbu.ts"
import { Project, SourceFile } from "../deps/ts_morph.ts"
import { denoCompilerOptions } from "../utils/project.ts"

Expand Down
2 changes: 1 addition & 1 deletion graph/decl_deps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Stream } from "../deps/rimbu.ts"
import {
type ClassDeclaration,
type FunctionDeclaration,
Expand Down
2 changes: 1 addition & 1 deletion graph/decl_deps_bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getDeclDeps,
getTopDecl,
} from "./decl_deps.ts"
import { Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Stream } from "../deps/rimbu.ts"
import { getAllDecls } from "./decls.ts"

/**
Expand Down
2 changes: 1 addition & 1 deletion graph/decl_deps_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { inMemoryProject, withSrc } from "./_project.ts"
import { exampleSrc } from "./_example_project.ts"
import { assertEquals, assertSnapshot } from "../test_deps.ts"
import { Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Stream } from "../deps/rimbu.ts"
import { getAllDecls } from "./decls.ts"
import { asRecord, declDepsSerializer, serializeNoColor } from "./_format.ts"
import { snapshotTest } from "./_snapshot.ts"
Expand Down
5 changes: 1 addition & 4 deletions graph/decls.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
Stream,
StreamSource,
} from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Stream, StreamSource } from "../deps/rimbu.ts"
import { SourceFile } from "../deps/ts_morph.ts"
import { Declaration } from "./decl_deps.ts"

Expand Down
2 changes: 1 addition & 1 deletion graph/fs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RealFileSystemHost } from "https://deno.land/x/[email protected]/common/mod.ts"
import { RealFileSystemHost } from "../deps/ts_morph_common.ts"

/**
* Intercepts and skips file & directory lookup to speed up the process
Expand Down
4 changes: 1 addition & 3 deletions graph/graph.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { GraphElement } from "https://deno.land/x/[email protected]/graph/custom/common/link.ts"
import { ArrowGraphHashed } from "https://deno.land/x/[email protected]/graph/mod.ts"
import { Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { ArrowGraphHashed, type GraphElement, Stream } from "../deps/rimbu.ts"
import { type Declaration, type DeclDeps, getDeclDeps } from "./decl_deps.ts"
import { encodeVSCodeURI, type VSCodeURI } from "./vscode_uri.ts"

Expand Down
4 changes: 1 addition & 3 deletions graph/graph_descendants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { ArrowGraph } from "https://deno.land/x/[email protected]/graph/mod.ts"
import { HashMap, HashSet } from "https://deno.land/x/[email protected]/hashed/mod.ts"
import { Reducer } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { type ArrowGraph, HashMap, HashSet, Reducer } from "../deps/rimbu.ts"

export const getConnectionsTo = <T>(graph: ArrowGraph<T>, node: T) =>
graph.getConnectionStreamTo(node).map(([src]) => src)
Expand Down
2 changes: 1 addition & 1 deletion graph/graph_descendants_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArrowGraphHashed } from "https://deno.land/x/[email protected]/graph/mod.ts"
import { ArrowGraphHashed } from "../deps/rimbu.ts"

import { assertEquals } from "../test_deps.ts"
import { graphDescendants } from "./graph_descendants.ts"
Expand Down
2 changes: 1 addition & 1 deletion graph/graph_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Reducer, Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Reducer, Stream } from "../deps/rimbu.ts"
import { exampleSrc } from "./_example_project.ts"
import { inMemoryProject, withSrc } from "./_project.ts"
import { declDepsToGraph, Graph } from "./graph.ts"
Expand Down
2 changes: 1 addition & 1 deletion graph/top_decl_deps_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Stream } from "../deps/rimbu.ts"
import { assertSnapshot } from "../test_deps.ts"
import { exampleSrc } from "./_example_project.ts"
import { inMemoryProject, withSrc } from "./_project.ts"
Expand Down
2 changes: 1 addition & 1 deletion graph/vscode_uri_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Stream } from "https://deno.land/x/[email protected]/stream/mod.ts"
import { Stream } from "../deps/rimbu.ts"
import { assertEquals } from "../test_deps.ts"
import { declExampleText, exampleSrc } from "./_example_project.ts"
import { inMemoryProject, withSrc } from "./_project.ts"
Expand Down
2 changes: 1 addition & 1 deletion utils/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
type CompilerOptions,
type ProjectOptions,
ts,
} from "https://deno.land/x/ts_morph@21.0.1/mod.ts"
} from "../deps/ts_morph.ts"
import { FilteredFSHost } from "../graph/fs.ts"

const ignore = /http|npm:|node_modules|\.jsx?|\.d\.ts/
Expand Down
5 changes: 1 addition & 4 deletions utils/resolution_host.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
ResolutionHostFactory,
ts,
} from "https://deno.land/x/[email protected]/mod.ts"
import { ResolutionHostFactory, ts } from "../deps/ts_morph.ts"

export const deno: ResolutionHostFactory = (
moduleResolutionHost,
Expand Down