@temir.ra/create-test115 0.0.27 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/buildinfo.txt +1 -1
- package/dist/cli.bundle.js.map +1 -1
- package/package.json +4 -15
- package/template/CLAUDE.md +2 -2
- package/template/README.md +9 -6
- package/template/package.json +2 -4
- package/template/scripts/build-lib-bundle.ts +1 -1
- package/template/src/dev.ts +10 -0
package/README.md
CHANGED
|
@@ -197,10 +197,12 @@ bun install
|
|
|
197
197
|
}
|
|
198
198
|
},
|
|
199
199
|
|
|
200
|
-
// package-internal import
|
|
201
|
-
// use
|
|
200
|
+
// package-internal import alias resolved natively by Node.js and Bun at runtime; key must start with #
|
|
201
|
+
// for use in dev.ts, tests/, and scripts/ only — NOT in library source files compiled by tsconfig.build.json
|
|
202
|
+
// the .js extension is required in import statements (nodenext compliance);
|
|
203
|
+
// the runtime maps it to the actual .ts source file via this field
|
|
202
204
|
"imports": {
|
|
203
|
-
"#src
|
|
205
|
+
"#src/*.js": "./src/*.ts"
|
|
204
206
|
},
|
|
205
207
|
|
|
206
208
|
// CLI entry point; omit if the package is not a CLI tool
|
|
@@ -220,7 +222,7 @@ bun install
|
|
|
220
222
|
// lifecycle hook; runs automatically before "build"; generates buildinfo.txt
|
|
221
223
|
"prebuild": "bun run scripts/buildinfo.ts",
|
|
222
224
|
|
|
223
|
-
"
|
|
225
|
+
"tests": "bun test",
|
|
224
226
|
|
|
225
227
|
"build": "bun run build:lib && bun run build:lib-bundle",
|
|
226
228
|
|
|
@@ -299,10 +301,8 @@ AI assistant context files. Provide project layout, commands, and architecture n
|
|
|
299
301
|
|
|
300
302
|
## Build
|
|
301
303
|
|
|
302
|
-
`prebuild` runs automatically before `build`, generating `buildinfo.txt`.
|
|
303
|
-
|
|
304
304
|
```bash
|
|
305
|
-
bun run build
|
|
305
|
+
bun run build
|
|
306
306
|
```
|
|
307
307
|
|
|
308
308
|
## Change Management
|
package/buildinfo.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.28+db1b08e
|
package/dist/cli.bundle.js.map
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["..\\src\\cli.ts", "..\\src\\urls.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"#!/usr/bin/env node\r\n\r\nimport { cpSync, readFileSync, renameSync, writeFileSync } from 'fs';\r\nimport { resolve, basename } from 'path';\r\nimport { fileURLToPath } from 'url';\r\nimport { buildinfoUrl, changelogUrl, templateUrl } from '
|
|
5
|
+
"#!/usr/bin/env node\r\n\r\nimport { cpSync, readFileSync, renameSync, writeFileSync } from 'fs';\r\nimport { resolve, basename } from 'path';\r\nimport { fileURLToPath } from 'url';\r\nimport { buildinfoUrl, changelogUrl, templateUrl } from '#src/urls.js';\r\n\r\n\r\ntry {\r\n\r\n const dest = process.argv[2];\r\n if (!dest) throw new Error('Destination path is required. Usage: `bun/npm create <template> <destination>`');\r\n\r\n const destinationPath = resolve(process.cwd(), dest);\r\n const packageName = basename(destinationPath);\r\n\r\n const templatePath = resolve(fileURLToPath(templateUrl));\r\n\r\n cpSync(templatePath, destinationPath, { recursive: true });\r\n cpSync(resolve(fileURLToPath(changelogUrl)), resolve(destinationPath, 'CHANGELOG-template.md'));\r\n cpSync(resolve(fileURLToPath(buildinfoUrl)), resolve(destinationPath, 'buildinfo-template.txt'));\r\n\r\n const packageManifestPath = resolve(destinationPath, 'package.json');\r\n const packageManifest = JSON.parse(readFileSync(packageManifestPath, 'utf-8'));\r\n packageManifest.name = packageName;\r\n writeFileSync(packageManifestPath, JSON.stringify(packageManifest, null, 2));\r\n\r\n renameSync(resolve(destinationPath, 'gitignore'), resolve(destinationPath, '.gitignore'));\r\n\r\n console.log(`Template has been successfully instantiated at '${destinationPath}' with package name '${packageName}'.`);\r\n\r\n}\r\ncatch (error) {\r\n const err = error instanceof Error ? error : new Error(String(error));\r\n console.error('Error:', err.message);\r\n process.exit(1);\r\n}\r\n",
|
|
6
6
|
"export const distUrl: URL = new URL('.', import.meta.url);\r\nexport const changelogUrl: URL = new URL('../CHANGELOG.md', distUrl);\r\nexport const buildinfoUrl: URL = new URL('../buildinfo.txt', distUrl);\r\nexport const templateUrl: URL = new URL('../template', distUrl);\r\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";AAEA,iBAAS,kBAAQ,gBAAc,mBAAY,WAC3C,kBAAS,cAAS,aAClB,wBAAS,YCJF,IAAM,EAAe,IAAI,IAAI,IAAK,YAAY,GAAG,EAC3C,EAAoB,IAAI,IAAI,kBAAmB,CAAO,EACtD,EAAoB,IAAI,IAAI,mBAAoB,CAAO,EACvD,EAAmB,IAAI,IAAI,cAAe,CAAO,EDK9D,GAAI,CAEA,IAAM,EAAO,QAAQ,KAAK,GAC1B,GAAI,CAAC,EAAM,MAAU,MAAM,gFAAgF,EAE3G,IAAM,EAAkB,EAAQ,QAAQ,IAAI,EAAG,CAAI,EAC7C,EAAc,EAAS,CAAe,EAEtC,EAAe,EAAQ,EAAc,CAAW,CAAC,EAEvD,EAAO,EAAc,EAAiB,CAAE,UAAW,EAAK,CAAC,EACzD,EAAO,EAAQ,EAAc,CAAY,CAAC,EAAG,EAAQ,EAAiB,uBAAuB,CAAC,EAC9F,EAAO,EAAQ,EAAc,CAAY,CAAC,EAAG,EAAQ,EAAiB,wBAAwB,CAAC,EAE/F,IAAM,EAAsB,EAAQ,EAAiB,cAAc,EAC7D,EAAkB,KAAK,MAAM,EAAa,EAAqB,OAAO,CAAC,EAC7E,EAAgB,KAAO,EACvB,EAAc,EAAqB,KAAK,UAAU,EAAiB,KAAM,CAAC,CAAC,EAE3E,EAAW,EAAQ,EAAiB,WAAW,EAAG,EAAQ,EAAiB,YAAY,CAAC,EAExF,QAAQ,IAAI,mDAAmD,yBAAuC,KAAe,EAGzH,MAAO,EAAO,CACV,IAAM,EAAM,aAAiB,MAAQ,EAAY,MAAM,OAAO,CAAK,CAAC,EACpE,QAAQ,MAAM,SAAU,EAAI,OAAO,EACnC,QAAQ,KAAK,CAAC",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temir.ra/create-test115",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "Typescript library template",
|
|
5
5
|
"author": "temir.ra",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,18 +16,8 @@
|
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
18
|
"sideEffects": false,
|
|
19
|
-
"exports": {
|
|
20
|
-
".": {
|
|
21
|
-
"entrypoint": "./src/cli.ts",
|
|
22
|
-
"browser": "./dist/index.bundle.js",
|
|
23
|
-
"import": "./dist/index.js",
|
|
24
|
-
"types": "./dist/index.d.ts"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
19
|
"imports": {
|
|
28
|
-
"#src
|
|
29
|
-
"#scripts/*": "./scripts/*",
|
|
30
|
-
"#tests/*": "./tests/*"
|
|
20
|
+
"#src/*.js": "./src/*.ts"
|
|
31
21
|
},
|
|
32
22
|
"bin": "./dist/cli.bundle.js",
|
|
33
23
|
"files": [
|
|
@@ -39,10 +29,9 @@
|
|
|
39
29
|
"scripts": {
|
|
40
30
|
"clean": "rm -rf dist/",
|
|
41
31
|
"prebuild": "bun run scripts/buildinfo.ts",
|
|
42
|
-
"
|
|
43
|
-
"build": "bun run build:lib && bun run build:
|
|
32
|
+
"tests": "bun test",
|
|
33
|
+
"build": "bun run build:lib && bun run build:cli-bundle",
|
|
44
34
|
"build:lib": "tsc --project tsconfig.build.json",
|
|
45
|
-
"build:lib-bundle": "bun run scripts/build-lib-bundle.ts",
|
|
46
35
|
"build:cli-bundle": "bun build src/cli.ts --entry-naming \"[dir]/[name].bundle.[ext]\" --outdir dist --target node --format esm --minify --sourcemap=external",
|
|
47
36
|
"typecheck": "tsc --noEmit",
|
|
48
37
|
"dev": "bun run --watch src/dev.ts"
|
package/template/CLAUDE.md
CHANGED
|
@@ -27,7 +27,7 @@ A Bun TypeScript library.
|
|
|
27
27
|
```bash
|
|
28
28
|
bun install # Install dependencies
|
|
29
29
|
bun run build # Compile + bundle the library
|
|
30
|
-
bun run
|
|
30
|
+
bun run tests # Run unit tests
|
|
31
31
|
bun run typecheck # Type-check without emitting
|
|
32
32
|
bun run dev # Run src/dev.ts in watch mode
|
|
33
33
|
bun run clean # Remove dist/
|
|
@@ -66,7 +66,7 @@ The `exports` field in `package.json` maps consumers to the right file:
|
|
|
66
66
|
Key `package.json` fields:
|
|
67
67
|
|
|
68
68
|
- `"sideEffects": false` — enables full tree-shaking by bundlers
|
|
69
|
-
- `"imports": { "#src
|
|
69
|
+
- `"imports": { "#src/*.js": "./src/*.ts" }` — package-internal alias for `src/`; use as `import { foo } from "#src/module.js"`. **Only for `dev.ts`, `tests/`, and `scripts/`** — not for library source files compiled by `tsconfig.build.json`, as tsc emits the specifier verbatim and it would break in published unbundled output.
|
|
70
70
|
|
|
71
71
|
## Publishing
|
|
72
72
|
|
package/template/README.md
CHANGED
|
@@ -15,17 +15,20 @@
|
|
|
15
15
|
**Development**
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
|
|
19
|
-
bun
|
|
20
|
-
|
|
18
|
+
# run src/dev.ts in watch mode
|
|
19
|
+
bun run dev
|
|
20
|
+
|
|
21
|
+
# run tests
|
|
22
|
+
bun run tests
|
|
23
|
+
|
|
24
|
+
# type-check without emitting
|
|
25
|
+
bun run typecheck
|
|
21
26
|
```
|
|
22
27
|
|
|
23
28
|
**Build**
|
|
24
29
|
|
|
25
|
-
`prebuild` runs automatically before `build`, generating `buildinfo.txt`.
|
|
26
|
-
|
|
27
30
|
```bash
|
|
28
|
-
bun run build
|
|
31
|
+
bun run build
|
|
29
32
|
```
|
|
30
33
|
|
|
31
34
|
**Publish**
|
package/template/package.json
CHANGED
|
@@ -22,9 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"imports": {
|
|
25
|
-
"#src
|
|
26
|
-
"#scripts/*": "./scripts/*",
|
|
27
|
-
"#tests/*": "./tests/*"
|
|
25
|
+
"#src/*.js": "./src/*.ts"
|
|
28
26
|
},
|
|
29
27
|
"files": [
|
|
30
28
|
"dist",
|
|
@@ -34,7 +32,7 @@
|
|
|
34
32
|
"scripts": {
|
|
35
33
|
"clean": "rm -rf dist/",
|
|
36
34
|
"prebuild": "bun run scripts/buildinfo.ts",
|
|
37
|
-
"
|
|
35
|
+
"tests": "bun test",
|
|
38
36
|
"build": "bun run build:lib && bun run build:lib-bundle",
|
|
39
37
|
"build:lib": "tsc --project tsconfig.build.json",
|
|
40
38
|
"build:lib-bundle": "bun run scripts/build-lib-bundle.ts",
|
package/template/src/dev.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import { buildinfoUrl, changelogUrl, distUrl } from '#src/urls.js';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
|
|
1
5
|
const start: number = performance.now();
|
|
2
6
|
|
|
7
|
+
console.log(`'distPath':`, fileURLToPath(distUrl));
|
|
8
|
+
console.log(`'buildinfoPath':`, fileURLToPath(buildinfoUrl));
|
|
9
|
+
console.log(`'changelogPath':`, fileURLToPath(changelogUrl));
|
|
10
|
+
|
|
11
|
+
|
|
3
12
|
// dev code
|
|
4
13
|
|
|
14
|
+
|
|
5
15
|
console.log(`${(performance.now() - start).toFixed(3)}ms`);
|