diff --git a/CLAUDE.md b/CLAUDE.md index 80bd6b9..b78a1ba 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,9 +10,13 @@ into a single parse result. A directive character (`@` by default) marks a reference; the plugin resolves it, processes the resolved text, and splices the result into the parse output. -The repository ships **two implementations**: +The repository ships **two implementations**, side by side, mirroring the +layout of [`github.com/voxgig/util`](https://github.com/voxgig/util): -- **TypeScript** — `src/`, tests in `test/`, built to `dist/` + `dist-test/`. +- **TypeScript** — lives entirely under `ts/`: sources in `ts/src/`, tests in + `ts/test/`, built to `ts/dist/` + `ts/dist-test/`. The npm package + (`ts/package.json`) is published from `ts/`, and all its paths are relative + to that folder. - **Go** — `go/`, a port published as the `github.com/jsonicjs/multisource/go` module. @@ -37,17 +41,19 @@ Use the `Makefile` targets (they wrap npm and go): ```sh make build # build-ts + build-go make test # test-ts + test-go -make build-ts # npm run build (tsc --build src test) -make test-ts # npm test (node --test dist-test/*.test.js) +make build-ts # cd ts && npm run build (tsc --build src test) +make test-ts # cd ts && npm test (node --test dist-test/*.test.js) make build-go # cd go && go build ./... make test-go # cd go && go test ./... ``` Notes: -- TS tests run against the **built** output in `dist-test/`, so run - `make build-ts` (or `npm run build`) before `make test-ts`. -- `npm run reset` does a clean reinstall + build + test. +- The TypeScript package lives in `ts/`; run npm commands from there + (`cd ts && npm ...`) or use the `make` targets, which `cd ts` for you. +- TS tests run against the **built** output in `ts/dist-test/`, so run + `make build-ts` (or `cd ts && npm run build`) before `make test-ts`. +- `cd ts && npm run reset` does a clean reinstall + build + test. - Go has no external runtime deps beyond the other `jsonicjs/*/go` modules. ## Resolver & processor parity diff --git a/Makefile b/Makefile index c008bf6..a6f263f 100644 --- a/Makefile +++ b/Makefile @@ -8,15 +8,15 @@ test: test-ts test-go clean: clean-ts clean-go -# TypeScript +# TypeScript (package lives in ts/) build-ts: - npm run build + cd ts && npm run build test-ts: - npm test + cd ts && npm test clean-ts: - rm -rf dist dist-test + rm -rf ts/dist ts/dist-test # Go build-go: @@ -45,7 +45,7 @@ tags-go: git tag -l 'go/v*' --sort=-version:refname reset: - npm run reset + cd ts && npm run reset cd go && go clean -cache cd go && go build ./... cd go && go test -v ./... diff --git a/ts/LICENSE b/ts/LICENSE new file mode 100644 index 0000000..c6db0db --- /dev/null +++ b/ts/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 jsonicjs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/dist-test/multisource.test.js b/ts/dist-test/multisource.test.js similarity index 100% rename from dist-test/multisource.test.js rename to ts/dist-test/multisource.test.js diff --git a/dist-test/multisource.test.js.map b/ts/dist-test/multisource.test.js.map similarity index 100% rename from dist-test/multisource.test.js.map rename to ts/dist-test/multisource.test.js.map diff --git a/dist/multisource.d.ts b/ts/dist/multisource.d.ts similarity index 100% rename from dist/multisource.d.ts rename to ts/dist/multisource.d.ts diff --git a/dist/multisource.js b/ts/dist/multisource.js similarity index 100% rename from dist/multisource.js rename to ts/dist/multisource.js diff --git a/dist/multisource.js.map b/ts/dist/multisource.js.map similarity index 100% rename from dist/multisource.js.map rename to ts/dist/multisource.js.map diff --git a/dist/processor/js.d.ts b/ts/dist/processor/js.d.ts similarity index 100% rename from dist/processor/js.d.ts rename to ts/dist/processor/js.d.ts diff --git a/dist/processor/js.js b/ts/dist/processor/js.js similarity index 100% rename from dist/processor/js.js rename to ts/dist/processor/js.js diff --git a/dist/processor/js.js.map b/ts/dist/processor/js.js.map similarity index 100% rename from dist/processor/js.js.map rename to ts/dist/processor/js.js.map diff --git a/dist/processor/jsonic.d.ts b/ts/dist/processor/jsonic.d.ts similarity index 100% rename from dist/processor/jsonic.d.ts rename to ts/dist/processor/jsonic.d.ts diff --git a/dist/processor/jsonic.js b/ts/dist/processor/jsonic.js similarity index 100% rename from dist/processor/jsonic.js rename to ts/dist/processor/jsonic.js diff --git a/dist/processor/jsonic.js.map b/ts/dist/processor/jsonic.js.map similarity index 100% rename from dist/processor/jsonic.js.map rename to ts/dist/processor/jsonic.js.map diff --git a/dist/resolver/file.d.ts b/ts/dist/resolver/file.d.ts similarity index 100% rename from dist/resolver/file.d.ts rename to ts/dist/resolver/file.d.ts diff --git a/dist/resolver/file.js b/ts/dist/resolver/file.js similarity index 100% rename from dist/resolver/file.js rename to ts/dist/resolver/file.js diff --git a/dist/resolver/file.js.map b/ts/dist/resolver/file.js.map similarity index 100% rename from dist/resolver/file.js.map rename to ts/dist/resolver/file.js.map diff --git a/dist/resolver/mem.d.ts b/ts/dist/resolver/mem.d.ts similarity index 100% rename from dist/resolver/mem.d.ts rename to ts/dist/resolver/mem.d.ts diff --git a/dist/resolver/mem.js b/ts/dist/resolver/mem.js similarity index 100% rename from dist/resolver/mem.js rename to ts/dist/resolver/mem.js diff --git a/dist/resolver/mem.js.map b/ts/dist/resolver/mem.js.map similarity index 100% rename from dist/resolver/mem.js.map rename to ts/dist/resolver/mem.js.map diff --git a/dist/resolver/pkg.d.ts b/ts/dist/resolver/pkg.d.ts similarity index 100% rename from dist/resolver/pkg.d.ts rename to ts/dist/resolver/pkg.d.ts diff --git a/dist/resolver/pkg.js b/ts/dist/resolver/pkg.js similarity index 100% rename from dist/resolver/pkg.js rename to ts/dist/resolver/pkg.js diff --git a/dist/resolver/pkg.js.map b/ts/dist/resolver/pkg.js.map similarity index 100% rename from dist/resolver/pkg.js.map rename to ts/dist/resolver/pkg.js.map diff --git a/package.json b/ts/package.json similarity index 100% rename from package.json rename to ts/package.json diff --git a/src/multisource.ts b/ts/src/multisource.ts similarity index 100% rename from src/multisource.ts rename to ts/src/multisource.ts diff --git a/src/processor/js.ts b/ts/src/processor/js.ts similarity index 100% rename from src/processor/js.ts rename to ts/src/processor/js.ts diff --git a/src/processor/jsonic.ts b/ts/src/processor/jsonic.ts similarity index 100% rename from src/processor/jsonic.ts rename to ts/src/processor/jsonic.ts diff --git a/src/resolver/file.ts b/ts/src/resolver/file.ts similarity index 100% rename from src/resolver/file.ts rename to ts/src/resolver/file.ts diff --git a/src/resolver/mem.ts b/ts/src/resolver/mem.ts similarity index 100% rename from src/resolver/mem.ts rename to ts/src/resolver/mem.ts diff --git a/src/resolver/pkg.ts b/ts/src/resolver/pkg.ts similarity index 100% rename from src/resolver/pkg.ts rename to ts/src/resolver/pkg.ts diff --git a/src/tsconfig.json b/ts/src/tsconfig.json similarity index 100% rename from src/tsconfig.json rename to ts/src/tsconfig.json diff --git a/test/e01.jsonic b/ts/test/e01.jsonic similarity index 100% rename from test/e01.jsonic rename to ts/test/e01.jsonic diff --git a/test/e02.jsonic b/ts/test/e02.jsonic similarity index 100% rename from test/e02.jsonic rename to ts/test/e02.jsonic diff --git a/test/f01/f01t01.jsonic b/ts/test/f01/f01t01.jsonic similarity index 100% rename from test/f01/f01t01.jsonic rename to ts/test/f01/f01t01.jsonic diff --git a/test/k01.jsonic b/ts/test/k01.jsonic similarity index 100% rename from test/k01.jsonic rename to ts/test/k01.jsonic diff --git a/test/k02.js b/ts/test/k02.js similarity index 100% rename from test/k02.js rename to ts/test/k02.js diff --git a/test/k03.json b/ts/test/k03.json similarity index 100% rename from test/k03.json rename to ts/test/k03.json diff --git a/test/k04.jsc b/ts/test/k04.jsc similarity index 100% rename from test/k04.jsc rename to ts/test/k04.jsc diff --git a/test/k05.js b/ts/test/k05.js similarity index 100% rename from test/k05.js rename to ts/test/k05.js diff --git a/test/multisource.test.ts b/ts/test/multisource.test.ts similarity index 100% rename from test/multisource.test.ts rename to ts/test/multisource.test.ts diff --git a/test/quick.js b/ts/test/quick.js similarity index 100% rename from test/quick.js rename to ts/test/quick.js diff --git a/test/t01.jsonic b/ts/test/t01.jsonic similarity index 100% rename from test/t01.jsonic rename to ts/test/t01.jsonic diff --git a/test/t02.jsonic b/ts/test/t02.jsonic similarity index 100% rename from test/t02.jsonic rename to ts/test/t02.jsonic diff --git a/test/t03.jsonic b/ts/test/t03.jsonic similarity index 100% rename from test/t03.jsonic rename to ts/test/t03.jsonic diff --git a/test/t04.foo b/ts/test/t04.foo similarity index 100% rename from test/t04.foo rename to ts/test/t04.foo diff --git a/test/tsconfig.json b/ts/test/tsconfig.json similarity index 100% rename from test/tsconfig.json rename to ts/test/tsconfig.json diff --git a/tsfmt.json b/ts/tsfmt.json similarity index 100% rename from tsfmt.json rename to ts/tsfmt.json