Skip to content

Commit ccc201a

Browse files
committed
chore: improve setup
1 parent a9e50e2 commit ccc201a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+61
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/pack.js b/pack.js
2+
index e690cb08e667ceeea60d155c7d99aa373fcf467b..9cc2e1da6c0413e906b0f6b1547ec013703fb220 100644
3+
--- a/pack.js
4+
+++ b/pack.js
5+
@@ -106,12 +106,12 @@ const MAP_GLOB_PATTERN = "dist/**/*.map";
6+
const replaceString = (path) => {
7+
const dir = path_1.posix.dirname(path);
8+
const patch = path.startsWith("dist/_mjs/")
9+
- ? (x) => x.replace(/(.*)\.\.\/src(.*)/gm, "$1_src$2")
10+
- : (x) => x.replace(/(.*)\.\.\/\.\.\/src(.*)/gm, "$1_src$2");
11+
+ ? (x) => x.replace(/(.*)\.\.\/_src(.*)/gm, "$1_src$2")
12+
+ : (x) => x.replace(/(.*)\.\.\/\.\.\/_src(.*)/gm, "$1_src$2");
13+
return (0, Function_1.flow)(patch, (x) => path_1.posix.relative(dir, path_1.posix.join(dir, x)), (x) => (x.startsWith(".") ? x : "./" + x));
14+
};
15+
const replace = (content, path) => JSON.stringify((0, Function_1.pipe)(Object.entries(JSON.parse(content)), A.map(([k, v]) => k === "sources"
16+
? [k, A.map_(v, replaceString(path))]
17+
: [k, v]), A.reduce({}, (acc, [k, v]) => ({ ...acc, [k]: v }))));
18+
-(0, Function_1.pipe)((0, _common_1.exec)("rm -rf build/dist"), TE.tap(() => (0, _common_1.exec)("mkdir -p dist")), TE.tap(() => TE.when(() => fs.existsSync(`./src`))((0, _common_1.exec)(`mkdir -p ./dist/_src && cp -r ./src/* ./dist/_src`))), TE.tap(() => TE.when(() => fs.existsSync(`./build/mjs`))((0, _common_1.exec)(`mkdir -p ./dist/_mjs && cp -r ./build/mjs/* ./dist/_mjs`))), TE.tap(() => TE.when(() => fs.existsSync(`./build/cjs`))((0, _common_1.exec)(`cp -r ./build/cjs/* ./dist`))), TE.tap(() => TE.when(() => fs.existsSync(`./build/dts`))((0, _common_1.exec)(`cp -r ./build/dts/* ./dist`))), TE.tap(() => writePackageJsonContent), TE.tap(() => copyReadme), TE.tap(() => (0, _common_1.modifyGlob)(replace)(MAP_GLOB_PATTERN)), TE.fold(_common_1.onLeft, (0, _common_1.onRight)("pack succeeded!")), _common_1.runMain);
19+
+(0, Function_1.pipe)((0, _common_1.exec)("rm -rf build/dist"), TE.tap(() => (0, _common_1.exec)("mkdir -p dist")), TE.tap(() => TE.when(() => fs.existsSync(`./_src`))((0, _common_1.exec)(`mkdir -p ./dist/_src && cp -r ./_src/* ./dist/_src`))), TE.tap(() => TE.when(() => fs.existsSync(`./build/mjs`))((0, _common_1.exec)(`mkdir -p ./dist/_mjs && cp -r ./build/mjs/* ./dist/_mjs`))), TE.tap(() => TE.when(() => fs.existsSync(`./build/cjs`))((0, _common_1.exec)(`cp -r ./build/cjs/* ./dist`))), TE.tap(() => TE.when(() => fs.existsSync(`./build/dts`))((0, _common_1.exec)(`cp -r ./build/dts/* ./dist`))), TE.tap(() => writePackageJsonContent), TE.tap(() => copyReadme), TE.tap(() => (0, _common_1.modifyGlob)(replace)(MAP_GLOB_PATTERN)), TE.fold(_common_1.onLeft, (0, _common_1.onRight)("pack succeeded!")), _common_1.runMain);
20+
//# sourceMappingURL=pack.js.map
21+
\ No newline at end of file

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"vitest": "0.7.11"
6767
},
6868
"resolutions": {
69-
"eslint-plugin-codegen": "patch:eslint-plugin-codegen@npm:0.16.1#.yarn/patches/eslint-plugin-codegen-npm-0.16.1-87770191cd"
69+
"eslint-plugin-codegen": "patch:eslint-plugin-codegen@npm:0.16.1#.yarn/patches/eslint-plugin-codegen-npm-0.16.1-87770191cd",
70+
"@effect-ts/build-utils": "patch:@effect-ts/build-utils@npm:0.39.2#.yarn/patches/@effect-ts-build-utils-npm-0.39.2-f802d4baa8"
7071
}
7172
}

packages/stdlib/examples/main.ts packages/stdlib/_examples/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ImmutableArray } from "@tsplus/stdlib/collections/ImmutableArray";
2-
import { List } from "@tsplus/stdlib/collections/List";
1+
import { ImmutableArray } from "packages/stdlib/_src/collections/ImmutableArray";
2+
import { List } from "packages/stdlib/_src/collections/List";
33
import { Option } from "@tsplus/stdlib/data/Option";
44

55
console.log(ImmutableArray.from(List(0, 1, 2)) == ImmutableArray(0, 1, 2));
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/stdlib/test/ImmutableArray.test.ts packages/stdlib/_test/ImmutableArray.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ImmutableArray } from "@tsplus/stdlib/collections/ImmutableArray";
1+
import { ImmutableArray } from "packages/stdlib/_src/collections/ImmutableArray";
22
import { Option } from "@tsplus/stdlib/data/Option";
33
import { assert, describe, it } from "vitest";
44

packages/stdlib/test/IterableWeakMap.test.ts packages/stdlib/_test/IterableWeakMap.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IterableWeakMap } from "@tsplus/stdlib/collections/weak/IterableWeakMap";
1+
import { IterableWeakMap } from "packages/stdlib/_src/collections/weak/IterableWeakMap";
22
import { Option } from "@tsplus/stdlib/data/Option";
33
import { assert, describe, it } from "vitest";
44

packages/stdlib/test/List.test.ts packages/stdlib/_test/List.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { List } from "@tsplus/stdlib/collections/List";
1+
import { List } from "packages/stdlib/_src/collections/List";
22
import { assert, describe, it } from "vitest";
33

44
describe("List", () => {

packages/stdlib/test/Option.test.ts packages/stdlib/_test/Option.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Option } from "@tsplus/stdlib/data/Option";
2-
import { Tuple } from "@tsplus/stdlib/data/Tuple";
2+
import { Tuple } from "packages/stdlib/_src/data/Tuple";
33
import { assert, describe, it } from "vitest";
44

55
describe("Option", () => {

packages/stdlib/global.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import type {} from "@tsplus/stdlib";
1+
import type {} from "packages/stdlib/_src";

packages/stdlib/tsconfig.build-examples.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"declarationDir": "build/examples-dts",
66
"tsBuildInfoFile": "build/tsbuildinfo/examples.tsbuildinfo",
77
"tsPlusConfig": "../../tsplus.config.json",
8-
"rootDir": "examples"
8+
"rootDir": "_examples"
99
},
1010
"include": [
11-
"examples/**/*.ts"
11+
"_examples/**/*.ts"
1212
],
1313
"files": [
1414
"./global.d.ts"

packages/stdlib/tsconfig.build-test.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"declarationDir": "build/test-dts",
66
"tsBuildInfoFile": "build/tsbuildinfo/test.tsbuildinfo",
77
"tsPlusConfig": "../../tsplus.config.json",
8-
"rootDir": "test"
8+
"rootDir": "_test"
99
},
1010
"include": [
11-
"test/**/*.ts"
11+
"_test/**/*.ts"
1212
],
1313
"files": [
1414
"./global.d.ts"

packages/stdlib/tsconfig.build.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"declarationDir": "build/dts",
66
"tsBuildInfoFile": "build/tsbuildinfo/esm.tsbuildinfo",
77
"tsPlusConfig": "../../tsplus.config.json",
8-
"rootDir": "src"
8+
"rootDir": "_src"
99
},
1010
"include": [
11-
"src/**/*.ts"
11+
"_src/**/*.ts"
1212
]
1313
}

tsconfig.base.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@
3939
"removeComments": false,
4040
"paths": {
4141
"@tsplus/stdlib": [
42-
"./packages/stdlib/src/index.ts"
42+
"./packages/stdlib/_src/index.ts"
4343
],
44-
"@tsplus/stdlib/*": [
45-
"./packages/stdlib/src/*"
44+
"@tsplus/stdlib/test/*": [
45+
"./packages/stdlib/_test/*"
46+
],
47+
"@tsplus/stdlib/example/*": [
48+
"./packages/stdlib/_example/*"
4649
],
47-
"@tsplus-tests/stdlib/*": [
48-
"./packages/stdlib/test/*"
50+
"@tsplus/stdlib/*": [
51+
"./packages/stdlib/_src/*"
4952
],
5053
}
5154
},

tsplus.config.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"importMap": {
3-
"^(.*)/packages/([^/]*)/src(.*)/index\\.ts$": "@tsplus/$2$3",
4-
"^(.*)/packages/([^/]*)/src(.*)\\.ts$": "@tsplus/$2$3",
5-
"^(.*)/packages/([^/]*)/test/(.*)\\.ts$": "@tsplus/$2/test/$3",
6-
"^(.*)/packages/([^/]*)/examples/(.*)\\.ts$": "@tsplus/$2/examples/$3"
3+
"^(.*)/packages/([^/]*)/_src(.*)/index\\.ts$": "@tsplus/$2$3",
4+
"^(.*)/packages/([^/]*)/_src(.*)\\.ts$": "@tsplus/$2$3",
5+
"^(.*)/packages/([^/]*)/_test/(.*)\\.ts$": "@tsplus/$2/test/$3",
6+
"^(.*)/packages/([^/]*)/_examples/(.*)\\.ts$": "@tsplus/$2/examples/$3"
77
},
88
"traceMap": {
99
"^(.*)/packages/([^/]*)/(.*)$": "(@tsplus/$2) $3"

yarn.lock

+13
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,19 @@ __metadata:
595595
languageName: node
596596
linkType: hard
597597

598+
"@effect-ts/build-utils@patch:@effect-ts/build-utils@npm:0.39.2#.yarn/patches/@effect-ts-build-utils-npm-0.39.2-f802d4baa8::locator=tsplus%40workspace%3A.":
599+
version: 0.39.2
600+
resolution: "@effect-ts/build-utils@patch:@effect-ts/build-utils@npm%3A0.39.2#.yarn/patches/@effect-ts-build-utils-npm-0.39.2-f802d4baa8::version=0.39.2&hash=75edf1&locator=tsplus%40workspace%3A."
601+
peerDependencies:
602+
"@effect-ts/core": ">= 0.28.9"
603+
cpx: ">= 1.5.0"
604+
picocolors: ^1.0.0
605+
bin:
606+
build-utils: build-utils
607+
checksum: 8ff73b3b4c56ef6249a4ce4d43075fd059ab2786c074504306f6d61187a7a520a47475b9494da3687673e4f7f310136e541cade5cdbde8e954f0e78d48c47c38
608+
languageName: node
609+
linkType: hard
610+
598611
"@effect-ts/core@npm:^0.59.2":
599612
version: 0.59.2
600613
resolution: "@effect-ts/core@npm:0.59.2"

0 commit comments

Comments
 (0)