Skip to content

Commit 00b1c7b

Browse files
authored
Merge pull request #15 from mlabs-haskell/jared/typescript-use-symlinks-instead-of-copy
Changed TS's extra dependencies + data to use symlinks instead of copying + added an exe to the `package` outputs
2 parents b3818e7 + ce96cc1 commit 00b1c7b

File tree

19 files changed

+583
-47
lines changed

19 files changed

+583
-47
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# pre-commit autogenerated file
22
.pre-commit-config.yaml
33

4+
# Ignore results from nix build
5+
result
6+
47
# Haskell .gitignore
58
dist
69
dist-*

examples/build.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ _:
99
./rust-flake-project/build.nix
1010
./typescript-flake-project/build.nix
1111
./typescript-flake-project-with-extra-dependency/build.nix
12+
./typescript-flake-project-with-transitive-extra-dependency/build.nix
1213
];
1314
}

examples/typescript-flake-project-with-extra-dependency/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Nix generated files
2+
data
3+
.extra-dependencies
4+
node_modules
5+
16
# Logs
27
logs
38
*.log

examples/typescript-flake-project-with-extra-dependency/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/typescript-flake-project-with-extra-dependency/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "typescript-flake-sample-project-with-extra-dependency",
2+
"name": "typescript-flake-project-with-extra-dependency",
33
"version": "1.0.0",
4-
"description": "Typescript flake sample project with an extra dependency",
4+
"description": "Typescript flake project with an extra dependency",
55
"lockfileVersion": 2,
66
"exports": {
77
".": "./dist/index.js",
@@ -18,11 +18,12 @@
1818
},
1919
"author": "Jared Pon",
2020
"license": "ISC",
21-
"files": [
22-
"./dist/**/*"
23-
],
21+
"files":
22+
[ "./dist/**/*"
23+
, "./.extra-dependencies/**/*"
24+
],
2425
"dependencies": {
2526
"typescript": "^5.3.3",
26-
"typescript-flake-project": "file:extra-dependencies/typescript-flake-project-1.0.0.tgz"
27+
"typescript-flake-project": "file:.extra-dependencies/typescript-flake-project-1.0.0.tgz"
2728
}
2829
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as TsFlakeProject from 'typescript-flake-project'
22

3-
43
export function helloWorld() {
54
TsFlakeProject.helloWorld();
65
}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Nix generated files
2+
data
3+
.extra-dependencies
4+
node_modules
5+
6+
# Logs
7+
logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
lerna-debug.log*
13+
.pnpm-debug.log*
14+
15+
# Diagnostic reports (https://nodejs.org/api/report.html)
16+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
17+
18+
# Runtime data
19+
pids
20+
*.pid
21+
*.seed
22+
*.pid.lock
23+
24+
# Directory for instrumented libs generated by jscoverage/JSCover
25+
lib-cov
26+
27+
# Coverage directory used by tools like istanbul
28+
coverage
29+
*.lcov
30+
31+
# nyc test coverage
32+
.nyc_output
33+
34+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
35+
.grunt
36+
37+
# Bower dependency directory (https://bower.io/)
38+
bower_components
39+
40+
# node-waf configuration
41+
.lock-wscript
42+
43+
# Compiled binary addons (https://nodejs.org/api/addons.html)
44+
build/Release
45+
46+
# Dependency directories
47+
node_modules/
48+
jspm_packages/
49+
50+
# Snowpack dependency directory (https://snowpack.dev/)
51+
web_modules/
52+
53+
# TypeScript cache
54+
*.tsbuildinfo
55+
56+
# Optional npm cache directory
57+
.npm
58+
59+
# Optional eslint cache
60+
.eslintcache
61+
62+
# Optional stylelint cache
63+
.stylelintcache
64+
65+
# Microbundle cache
66+
.rpt2_cache/
67+
.rts2_cache_cjs/
68+
.rts2_cache_es/
69+
.rts2_cache_umd/
70+
71+
# Optional REPL history
72+
.node_repl_history
73+
74+
# Output of 'npm pack'
75+
*.tgz
76+
77+
# Yarn Integrity file
78+
.yarn-integrity
79+
80+
# dotenv environment variable files
81+
.env
82+
.env.development.local
83+
.env.test.local
84+
.env.production.local
85+
.env.local
86+
87+
# parcel-bundler cache (https://parceljs.org/)
88+
.cache
89+
.parcel-cache
90+
91+
# Next.js build output
92+
.next
93+
out
94+
95+
# Nuxt.js build / generate output
96+
.nuxt
97+
dist
98+
99+
# Gatsby files
100+
.cache/
101+
# Comment in the public line in if your project uses Gatsby and not Next.js
102+
# https://nextjs.org/blog/next-9-1#public-directory-support
103+
# public
104+
105+
# vuepress build output
106+
.vuepress/dist
107+
108+
# vuepress v2.x temp and cache directory
109+
.temp
110+
.cache
111+
112+
# Docusaurus cache and generated files
113+
.docusaurus
114+
115+
# Serverless directories
116+
.serverless/
117+
118+
# FuseBox cache
119+
.fusebox/
120+
121+
# DynamoDB Local files
122+
.dynamodb/
123+
124+
# TernJS port file
125+
.tern-port
126+
127+
# Stores VSCode versions used for testing VSCode extensions
128+
.vscode-test
129+
130+
# yarn v2
131+
.yarn/cache
132+
.yarn/unplugged
133+
.yarn/build-state.yml
134+
.yarn/install-state.gz
135+
.pnp.*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
import "../dist/MyLib/index.js";
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{ ... }:
2+
{
3+
perSystem = { pkgs, config, ... }:
4+
let
5+
typescriptFlake =
6+
config.lib.typescriptFlake {
7+
name = "typescript-flake-project-with-transitive-extra-dependency";
8+
src = ./.;
9+
10+
devShellTools = config.settings.shell.tools;
11+
devShellHook = config.settings.shell.hook;
12+
13+
npmExtraDependencies = [ config.packages.typescript-flake-project-with-extra-dependency-typescript-tgz ];
14+
};
15+
in
16+
{
17+
packages = {
18+
inherit (typescriptFlake.packages)
19+
typescript-flake-project-with-transitive-extra-dependency-typescript
20+
typescript-flake-project-with-transitive-extra-dependency-typescript-exe
21+
typescript-flake-project-with-transitive-extra-dependency-typescript-tgz
22+
typescript-flake-project-with-transitive-extra-dependency-typescript-node2nix;
23+
};
24+
25+
inherit (typescriptFlake) devShells;
26+
27+
checks = {
28+
inherit (typescriptFlake.checks) typescript-flake-project-with-transitive-extra-dependency-typescript-test;
29+
30+
# Quick derivation to verify that the executable (see the `bin` key of
31+
# `package.json`) really works.
32+
typescript-flake-project-with-transitive-extra-dependency-typescript-valid-exe =
33+
pkgs.runCommand "typescript-flake-project-with-transitive-extra-dependency-typescript-valid-exe"
34+
{ buildInputs = [ config.packages.typescript-flake-project-with-transitive-extra-dependency-typescript-exe ]; }
35+
''
36+
typescript-flake-project-with-transitive-extra-dependency
37+
touch "$out"
38+
'';
39+
};
40+
};
41+
}

examples/typescript-flake-project-with-transitive-extra-dependency/package-lock.json

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)