@temir.ra/create-test115 0.0.13 → 0.0.15
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 +1 -0
- package/dist/buildinfo.d.ts +2 -0
- package/dist/buildinfo.d.ts.map +1 -0
- package/dist/buildinfo.js +2 -0
- package/dist/index.bundle.js +4 -0
- package/dist/index.bundle.js.map +10 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/template/README.md +29 -0
- package/dist/{package.json → template/package.json} +3 -11
- package/dist/template/src/buildinfo.ts +2 -0
- package/package.json +7 -11
- package/template/CHANGELOG.md +5 -0
- package/template/README.md +29 -0
- package/template/package.json +32 -0
- package/template/scripts/build-cdn-map.json +1 -0
- package/template/scripts/build-cdn.ts +158 -0
- package/template/scripts/buildinfo.ts +25 -0
- package/template/src/buildinfo.ts +2 -0
- package/template/src/dev.ts +5 -0
- package/template/src/index.ts +0 -0
- package/template/tests/buildinfo.test.ts +20 -0
- package/template/tsconfig.build.json +18 -0
- package/template/tsconfig.json +35 -0
- package/README.md.template +0 -59
- package/dist/CHANGELOG.md +0 -46
- package/dist/README.md +0 -289
- package/dist/README.md.template +0 -59
- package/dist/gitignore +0 -2
- package/dist/src/buildinfo.ts +0 -2
- /package/dist/{CHANGELOG.md.template → template/CHANGELOG.md} +0 -0
- /package/dist/{scripts → template/scripts}/build-cdn-map.json +0 -0
- /package/dist/{scripts → template/scripts}/build-cdn.ts +0 -0
- /package/dist/{scripts → template/scripts}/buildinfo.ts +0 -0
- /package/dist/{src → template/src}/dev.ts +0 -0
- /package/dist/{src → template/src}/index.ts +0 -0
- /package/dist/{tests → template/tests}/buildinfo.test.ts +0 -0
- /package/dist/{tsconfig.build.json → template/tsconfig.build.json} +0 -0
- /package/dist/{tsconfig.json → template/tsconfig.json} +0 -0
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildinfo.d.ts","sourceRoot":"","sources":["../src/buildinfo.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,SAAS,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{cpSync as C,readFileSync as E,writeFileSync as G}from"fs";import{resolve as q,basename as H}from"path";import{fileURLToPath as I}from"url";var x=process.argv[2];if(!x)console.error("Usage: bun create my-template <destination>"),process.exit(1);var z=q(process.cwd(),x),A=H(z),J=q(I(import.meta.url),"../../template");C(J,z,{recursive:!0});var B=q(z,"package.json"),K=E(B,"utf8");G(B,K.replaceAll("{{PACKAGE_NAME}}",A));console.log(`✔ Created ${A}`);console.log(` cd ${x} && bun install`);
|
|
3
|
+
|
|
4
|
+
//# debugId=B480A6DF82A2DA2A64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["..\\src\\index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"#!/usr/bin/env node\r\n\r\nimport { cpSync, readFileSync, writeFileSync } from 'fs';\r\nimport { resolve, basename } from 'path';\r\nimport { fileURLToPath } from 'url';\r\n\r\n\r\nconst dest = process.argv[2];\r\nif (!dest) {\r\n console.error('Usage: bun create my-template <destination>');\r\n process.exit(1);\r\n}\r\n\r\nconst destDir = resolve(process.cwd(), dest);\r\nconst packageName = basename(destDir);\r\n\r\n// template/ dir is relative to the installed package\r\nconst templateDir = resolve(fileURLToPath(import.meta.url), '../../template');\r\n\r\n// Copy template to destination\r\ncpSync(templateDir, destDir, { recursive: true });\r\n\r\n// Replace placeholders in package.json\r\nconst pkgPath = resolve(destDir, 'package.json');\r\nconst pkg = readFileSync(pkgPath, 'utf8');\r\nwriteFileSync(pkgPath, pkg.replaceAll('{{PACKAGE_NAME}}', packageName));\r\n\r\nconsole.log(`✔ Created ${packageName}`);\r\nconsole.log(` cd ${dest} && bun install`);\r\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAEA,iBAAS,kBAAQ,mBAAc,WAC/B,kBAAS,cAAS,aAClB,wBAAS,YAGT,IAAM,EAAO,QAAQ,KAAK,GAC1B,GAAI,CAAC,EACD,QAAQ,MAAM,6CAA6C,EAC3D,QAAQ,KAAK,CAAC,EAGlB,IAAM,EAAU,EAAQ,QAAQ,IAAI,EAAG,CAAI,EACrC,EAAc,EAAS,CAAO,EAG9B,EAAc,EAAQ,EAAc,YAAY,GAAG,EAAG,gBAAgB,EAG5E,EAAO,EAAa,EAAS,CAAE,UAAW,EAAK,CAAC,EAGhD,IAAM,EAAU,EAAQ,EAAS,cAAc,EACzC,EAAM,EAAa,EAAS,MAAM,EACxC,EAAc,EAAS,EAAI,WAAW,mBAAoB,CAAW,CAAC,EAEtE,QAAQ,IAAI,aAAY,GAAa,EACrC,QAAQ,IAAI,QAAQ,kBAAqB",
|
|
8
|
+
"debugId": "B480A6DF82A2DA2A64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { cpSync, readFileSync, writeFileSync } from 'fs';
|
|
3
|
+
import { resolve, basename } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
const dest = process.argv[2];
|
|
6
|
+
if (!dest) {
|
|
7
|
+
console.error('Usage: bun create my-template <destination>');
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
const destDir = resolve(process.cwd(), dest);
|
|
11
|
+
const packageName = basename(destDir);
|
|
12
|
+
// template/ dir is relative to the installed package
|
|
13
|
+
const templateDir = resolve(fileURLToPath(import.meta.url), '../../template');
|
|
14
|
+
// Copy template to destination
|
|
15
|
+
cpSync(templateDir, destDir, { recursive: true });
|
|
16
|
+
// Replace placeholders in package.json
|
|
17
|
+
const pkgPath = resolve(destDir, 'package.json');
|
|
18
|
+
const pkg = readFileSync(pkgPath, 'utf8');
|
|
19
|
+
writeFileSync(pkgPath, pkg.replaceAll('{{PACKAGE_NAME}}', packageName));
|
|
20
|
+
console.log(`✔ Created ${packageName}`);
|
|
21
|
+
console.log(` cd ${dest} && bun install`);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
|
|
3
|
+
*<INTRO TEXT>*
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Quick Start](#quick-start)
|
|
8
|
+
2. [Documentation](#documentation)
|
|
9
|
+
3. [DevOps](#devops)
|
|
10
|
+
1. [Change Management](#change-management)
|
|
11
|
+
2. [Publish](#publish)
|
|
12
|
+
|
|
13
|
+
# Quick Start
|
|
14
|
+
|
|
15
|
+
*<QUICK START INSTRUCTIONS>*
|
|
16
|
+
|
|
17
|
+
# Documentation
|
|
18
|
+
|
|
19
|
+
*<DOCUMENTATION>*
|
|
20
|
+
|
|
21
|
+
# DevOps
|
|
22
|
+
|
|
23
|
+
## Change Management
|
|
24
|
+
|
|
25
|
+
1. Create a new branch for the change.
|
|
26
|
+
2. Make the changes and commit them to the branch.
|
|
27
|
+
3. Bump the version in [`package.json`](package.json).
|
|
28
|
+
4. Add an entry for the new version in [`CHANGELOG.md`](CHANGELOG.md).
|
|
29
|
+
5. Pull request the branch.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"version": "
|
|
2
|
+
"name": "",
|
|
3
|
+
"version": "",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,14 +14,6 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
-
"bun-create": {
|
|
18
|
-
"preinstall": [
|
|
19
|
-
"mv README.md README-template.md",
|
|
20
|
-
"mv README.md.template README.md",
|
|
21
|
-
"mv CHANGELOG.md CHANGELOG-template.md",
|
|
22
|
-
"mv CHANGELOG.md.template CHANGELOG.md"
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
17
|
"scripts": {
|
|
26
18
|
"clean": "rm -rf dist/",
|
|
27
19
|
"prebuild": "bun run scripts/buildinfo.ts",
|
|
@@ -29,7 +21,7 @@
|
|
|
29
21
|
"build": "bun run build:lib && bun run build:cdn && bun run build:assets",
|
|
30
22
|
"build:lib": "tsc --project tsconfig.build.json",
|
|
31
23
|
"build:cdn": "bun run scripts/build-cdn.ts",
|
|
32
|
-
"build:assets": "
|
|
24
|
+
"build:assets": "cp src/assets/* dist/assets/",
|
|
33
25
|
"typecheck": "tsc --noEmit",
|
|
34
26
|
"dev": "bun run --watch src/dev.ts"
|
|
35
27
|
},
|
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.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,17 +11,13 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"create-test115": "./dist/index.bundle.js"
|
|
16
|
+
},
|
|
14
17
|
"files": [
|
|
15
|
-
"dist"
|
|
18
|
+
"dist",
|
|
19
|
+
"template"
|
|
16
20
|
],
|
|
17
|
-
"bun-create": {
|
|
18
|
-
"preinstall": [
|
|
19
|
-
"mv README.md README-template.md",
|
|
20
|
-
"mv README.md.template README.md",
|
|
21
|
-
"mv CHANGELOG.md CHANGELOG-template.md",
|
|
22
|
-
"mv CHANGELOG.md.template CHANGELOG.md"
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
21
|
"scripts": {
|
|
26
22
|
"clean": "rm -rf dist/",
|
|
27
23
|
"prebuild": "bun run scripts/buildinfo.ts",
|
|
@@ -29,7 +25,7 @@
|
|
|
29
25
|
"build": "bun run build:lib && bun run build:cdn && bun run build:assets",
|
|
30
26
|
"build:lib": "tsc --project tsconfig.build.json",
|
|
31
27
|
"build:cdn": "bun run scripts/build-cdn.ts",
|
|
32
|
-
"build:assets": "
|
|
28
|
+
"build:assets": "cp -R template/ dist/template/",
|
|
33
29
|
"typecheck": "tsc --noEmit",
|
|
34
30
|
"dev": "bun run --watch src/dev.ts"
|
|
35
31
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
|
|
3
|
+
*<INTRO TEXT>*
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Quick Start](#quick-start)
|
|
8
|
+
2. [Documentation](#documentation)
|
|
9
|
+
3. [DevOps](#devops)
|
|
10
|
+
1. [Change Management](#change-management)
|
|
11
|
+
2. [Publish](#publish)
|
|
12
|
+
|
|
13
|
+
# Quick Start
|
|
14
|
+
|
|
15
|
+
*<QUICK START INSTRUCTIONS>*
|
|
16
|
+
|
|
17
|
+
# Documentation
|
|
18
|
+
|
|
19
|
+
*<DOCUMENTATION>*
|
|
20
|
+
|
|
21
|
+
# DevOps
|
|
22
|
+
|
|
23
|
+
## Change Management
|
|
24
|
+
|
|
25
|
+
1. Create a new branch for the change.
|
|
26
|
+
2. Make the changes and commit them to the branch.
|
|
27
|
+
3. Bump the version in [`package.json`](package.json).
|
|
28
|
+
4. Add an entry for the new version in [`CHANGELOG.md`](CHANGELOG.md).
|
|
29
|
+
5. Pull request the branch.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "",
|
|
3
|
+
"version": "",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"entrypoint": "./src/index.ts",
|
|
9
|
+
"browser": "./dist/index.bundle.js",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"clean": "rm -rf dist/",
|
|
19
|
+
"prebuild": "bun run scripts/buildinfo.ts",
|
|
20
|
+
"test": "bun test",
|
|
21
|
+
"build": "bun run build:lib && bun run build:cdn && bun run build:assets",
|
|
22
|
+
"build:lib": "tsc --project tsconfig.build.json",
|
|
23
|
+
"build:cdn": "bun run scripts/build-cdn.ts",
|
|
24
|
+
"build:assets": "cp src/assets/* dist/assets/",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"dev": "bun run --watch src/dev.ts"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/bun": "latest",
|
|
30
|
+
"typescript": "^5.9.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import CDN_MAP from 'scripts/build-cdn-map.json';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
interface ExportConditions {
|
|
7
|
+
|
|
8
|
+
[key: string]: string | undefined;
|
|
9
|
+
|
|
10
|
+
import?: string;
|
|
11
|
+
types?: string;
|
|
12
|
+
browser?: string;
|
|
13
|
+
entrypoint?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface DependencyMap {
|
|
17
|
+
[packageName: string]: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface PackageManifest {
|
|
21
|
+
version: string;
|
|
22
|
+
exports?: Record<string, ExportConditions>;
|
|
23
|
+
dependencies?: DependencyMap;
|
|
24
|
+
devDependencies?: DependencyMap;
|
|
25
|
+
peerDependencies?: DependencyMap;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getManifest(packageIdentifier?: string): PackageManifest {
|
|
29
|
+
|
|
30
|
+
const manifestPath = packageIdentifier
|
|
31
|
+
? join('node_modules', packageIdentifier, 'package.json')
|
|
32
|
+
: 'package.json';
|
|
33
|
+
|
|
34
|
+
let manifest: PackageManifest;
|
|
35
|
+
try {
|
|
36
|
+
manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
|
|
37
|
+
} catch {
|
|
38
|
+
if (packageIdentifier)
|
|
39
|
+
throw new Error("[build-cdn] Could not read manifest for '" + packageIdentifier + "' at '" + manifestPath + "'. Is it installed?");
|
|
40
|
+
else
|
|
41
|
+
throw new Error("[build-cdn] Could not read package manifest at '" + manifestPath + "'.");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return manifest;
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function getManifestEntrypoints(packageManifest: PackageManifest): string[] {
|
|
49
|
+
|
|
50
|
+
const exports = packageManifest.exports;
|
|
51
|
+
if (!exports) throw new Error('[build-cdn] No exports field found in package.json.');
|
|
52
|
+
|
|
53
|
+
const entrypoints = Object.entries(exports)
|
|
54
|
+
.map(([key, conditions]) => {
|
|
55
|
+
if (!conditions.entrypoint) throw new Error(`[build-cdn] Export '${key}' does not have an 'entrypoint' condition.`);
|
|
56
|
+
return conditions.entrypoint;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return entrypoints;
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function getPackageVersion(manifest: PackageManifest, packageIdentifier?: string): string {
|
|
64
|
+
|
|
65
|
+
let version: string | undefined;
|
|
66
|
+
if (packageIdentifier) {
|
|
67
|
+
|
|
68
|
+
const dependencies = {
|
|
69
|
+
...manifest.dependencies,
|
|
70
|
+
...manifest.devDependencies,
|
|
71
|
+
...manifest.peerDependencies,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
version = dependencies[packageIdentifier];
|
|
75
|
+
if (!version) throw new Error(`[build-cdn] Package '${packageIdentifier}' is not listed in dependencies.`);
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
if (!manifest.version) throw new Error('[build-cdn] Package manifest does not contain a version field.');
|
|
80
|
+
version = manifest.version;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return version;
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function resolveCdnUrl(importSpecifier: string, urlTemplate: string): string {
|
|
88
|
+
const manifest = getManifest();
|
|
89
|
+
const version = getPackageVersion(manifest, importSpecifier);
|
|
90
|
+
return urlTemplate.replace('<VERSION>', version);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const cdnRewritePlugin = {
|
|
94
|
+
name: 'cdn-rewrite',
|
|
95
|
+
setup(build: any) {
|
|
96
|
+
|
|
97
|
+
const resolved = new Map<string, string>();
|
|
98
|
+
for (const [importSpecifier, urlTemplate] of Object.entries(CDN_MAP) as [string, string][]) {
|
|
99
|
+
const url = resolveCdnUrl(importSpecifier, urlTemplate);
|
|
100
|
+
resolved.set(importSpecifier, url);
|
|
101
|
+
console.log(`[cdn-rewrite] '${importSpecifier}' → '${url}'`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
build.onResolve({ filter: /.*/ }, (args: any) => {
|
|
105
|
+
const url = resolved.get(args.path);
|
|
106
|
+
if (url) return { path: url, external: true };
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
const entrypoints = getManifestEntrypoints(getManifest());
|
|
114
|
+
console.log('[build-cdn] Entrypoints:', entrypoints);
|
|
115
|
+
|
|
116
|
+
let buildResult;
|
|
117
|
+
|
|
118
|
+
console.log('[build-cdn] Starting ESM CDN bundle build...');
|
|
119
|
+
buildResult = await Bun.build({
|
|
120
|
+
entrypoints,
|
|
121
|
+
outdir: 'dist',
|
|
122
|
+
naming: '[dir]/[name].bundle.[ext]',
|
|
123
|
+
target: 'browser',
|
|
124
|
+
format: 'esm',
|
|
125
|
+
minify: true,
|
|
126
|
+
sourcemap: 'external',
|
|
127
|
+
plugins: [cdnRewritePlugin],
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
if (!buildResult.success) {
|
|
131
|
+
console.error('[build-cdn] Build failed:');
|
|
132
|
+
for (const message of buildResult.logs) {
|
|
133
|
+
console.error(message);
|
|
134
|
+
}
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
console.log('[build-cdn] ESM CDN bundle build completed successfully.');
|
|
138
|
+
|
|
139
|
+
console.log('[build-cdn] Starting IIFE CDN bundle build...');
|
|
140
|
+
buildResult = await Bun.build({
|
|
141
|
+
entrypoints,
|
|
142
|
+
outdir: 'dist',
|
|
143
|
+
naming: '[dir]/[name].iife.[ext]',
|
|
144
|
+
target: 'browser',
|
|
145
|
+
format: 'iife',
|
|
146
|
+
minify: true,
|
|
147
|
+
sourcemap: 'external',
|
|
148
|
+
plugins: [cdnRewritePlugin],
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
if (!buildResult.success) {
|
|
152
|
+
console.error('[build-cdn] Build failed:');
|
|
153
|
+
for (const message of buildResult.logs) {
|
|
154
|
+
console.error(message);
|
|
155
|
+
}
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
console.log('[build-cdn] IIFE CDN bundle build completed successfully.');
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { writeFileSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const BUILD_INFO_FILE = join('src', 'buildinfo.ts');
|
|
7
|
+
const GIT_COMMAND = 'git rev-parse --short HEAD';
|
|
8
|
+
|
|
9
|
+
const version = process.env.npm_package_version ?? '0.0.0';
|
|
10
|
+
|
|
11
|
+
let gitHash = '';
|
|
12
|
+
try {
|
|
13
|
+
gitHash = execSync(GIT_COMMAND, { stdio: ['ignore', 'pipe', 'ignore'] })
|
|
14
|
+
.toString()
|
|
15
|
+
.trim();
|
|
16
|
+
} catch { }
|
|
17
|
+
|
|
18
|
+
const buildInfo = gitHash ? `${version}+${gitHash}` : version;
|
|
19
|
+
|
|
20
|
+
writeFileSync(
|
|
21
|
+
BUILD_INFO_FILE,
|
|
22
|
+
`// auto-generated by scripts/buildinfo.ts\nexport const buildInfo = '${buildInfo}';\n`
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
console.log(`'${BUILD_INFO_FILE}' has been updated with build info: ${buildInfo}`);
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, it, expect } from 'bun:test';
|
|
2
|
+
import { buildInfo } from '@/buildinfo';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
describe('buildInfo', () => {
|
|
6
|
+
|
|
7
|
+
it('should follow semantic versioning format with optional commit hash', () => {
|
|
8
|
+
expect(buildInfo).toMatch(/^\d+\.\d+\.\d+(\+[0-9a-f]+)?$/);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should not contain whitespace', () => {
|
|
12
|
+
expect(buildInfo).not.toMatch(/\s/);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should not be empty or dash', () => {
|
|
16
|
+
expect(buildInfo.length).toBeGreaterThan(0);
|
|
17
|
+
expect(buildInfo).not.toBe('-');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"moduleResolution": "nodenext",
|
|
6
|
+
"emitDeclarationOnly": false,
|
|
7
|
+
},
|
|
8
|
+
"include": [
|
|
9
|
+
"src/**/*.ts"
|
|
10
|
+
],
|
|
11
|
+
"exclude": [
|
|
12
|
+
"src/dev.ts",
|
|
13
|
+
"node_modules",
|
|
14
|
+
"dist",
|
|
15
|
+
"tests",
|
|
16
|
+
"scripts"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2022",
|
|
7
|
+
"DOM"
|
|
8
|
+
],
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"declarationMap": true,
|
|
17
|
+
"emitDeclarationOnly": true,
|
|
18
|
+
"outDir": "./dist",
|
|
19
|
+
"baseUrl": ".",
|
|
20
|
+
"paths": {
|
|
21
|
+
"@/*": [
|
|
22
|
+
"src/*"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"include": [
|
|
27
|
+
"src/**/*.ts",
|
|
28
|
+
"tests/**/*.ts",
|
|
29
|
+
"scripts/**/*.ts"
|
|
30
|
+
],
|
|
31
|
+
"exclude": [
|
|
32
|
+
"node_modules",
|
|
33
|
+
"dist"
|
|
34
|
+
]
|
|
35
|
+
}
|
package/README.md.template
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Introduction
|
|
2
|
-
|
|
3
|
-
*<INTRO TEXT>*
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
1. [Quick Start](#quick-start)
|
|
8
|
-
2. [Documentation](#documentation)
|
|
9
|
-
3. [DevOps](#devops)
|
|
10
|
-
1. [Change Management](#change-management)
|
|
11
|
-
2. [Publish](#publish)
|
|
12
|
-
|
|
13
|
-
# Quick Start
|
|
14
|
-
|
|
15
|
-
*<QUICK START INSTRUCTIONS>*
|
|
16
|
-
|
|
17
|
-
# Documentation
|
|
18
|
-
|
|
19
|
-
*<DOCUMENTATION>*
|
|
20
|
-
|
|
21
|
-
# DevOps
|
|
22
|
-
|
|
23
|
-
## Change Management
|
|
24
|
-
|
|
25
|
-
1. Create a new branch for the change.
|
|
26
|
-
2. Make the changes and commit them to the branch.
|
|
27
|
-
3. Bump the version in [`package.json`](package.json).
|
|
28
|
-
4. Add an entry for the new version in [`CHANGELOG.md`](CHANGELOG.md).
|
|
29
|
-
5. Pull request the branch.
|
|
30
|
-
|
|
31
|
-
## Publish
|
|
32
|
-
|
|
33
|
-
### bun
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# placeholder:
|
|
37
|
-
# <SCOPE_WITHOUT_AT: <SCOPE_WITHOUT_AT>
|
|
38
|
-
# <REGISTRY_URL: <REGISTRY_URL>
|
|
39
|
-
# <BUN_PUBLISH_AUTH_TOKEN: <BUN_PUBLISH_AUTH_TOKEN>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
`bunfig.toml`:
|
|
43
|
-
|
|
44
|
-
```toml
|
|
45
|
-
[install.scopes]
|
|
46
|
-
<SCOPE_WITHOUT_AT> = { url = "<REGISTRY_URL>", token = "$BUN_PUBLISH_AUTH_TOKEN" }
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
```powershell
|
|
50
|
-
$env:BUN_PUBLISH_AUTH_TOKEN = "<BUN_PUBLISH_AUTH_TOKEN>"
|
|
51
|
-
bun publish
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### npm
|
|
55
|
-
|
|
56
|
-
```powershell
|
|
57
|
-
npm login --registry https://registry.npmjs.org/
|
|
58
|
-
npm publish --registry https://registry.npmjs.org/ --access public
|
|
59
|
-
```
|
package/dist/CHANGELOG.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Version 0
|
|
2
|
-
|
|
3
|
-
## next
|
|
4
|
-
|
|
5
|
-
1. Updated `scripts/buildinfo.ts` to use `join` from `path` module for better cross-platform compatibility.
|
|
6
|
-
2. Added `scripts/build-cdn.ts` to generate a bundled version of the library for CDN usage.
|
|
7
|
-
3. Added `scripts/build-cdn-map.json` to configure import path rewrites for the CDN build.
|
|
8
|
-
4. Cleaned up legacy fields `main`, `module`, and `types` from `package.json` to rely solely on the `exports` field for module resolution.
|
|
9
|
-
5. Added `browser` condition to the `exports` field in `package.json` to specify the bundled version for CDN usage.
|
|
10
|
-
6. Added `src/dev.ts` as a development entry point for testing and experimentation during development.
|
|
11
|
-
7. Added QoL `clean` and `test` scripts to `package.json`.
|
|
12
|
-
8. Updated `build` workflow in `package.json`. Now it runs `build:lib` to create JavaScript and declaration files, then runs `build:cdn` to create the bundled version for CDN, and finally runs `build:assets` as a placeholder for any future asset build steps.
|
|
13
|
-
9. Added `description` metadata field to `package.json`.
|
|
14
|
-
10. Updated `tsconfig.json` and `tsconfig.build.json` with opiniated settings for better development, build, and publishing experience.
|
|
15
|
-
11. Added documentation for custom scripts and rationale for the selected values in `tsconfig.json`, `tsconfig.build.json`, and `package.json`.
|
|
16
|
-
12. Updated Quick Start instructions to reflect the new scripts and workflow.
|
|
17
|
-
13. Renamed `README.md` and `CHANGELOG.md` to `README.md.template` and `CHANGELOG.md.template` respectively, and added a `bun-create` configuration in `package.json` to rename them back during project creation.
|
|
18
|
-
14. Added `gitignore` (note the missing dot) to the template to ensure that generated projects have a proper `.gitignore` file.
|
|
19
|
-
|
|
20
|
-
## 0.2.0
|
|
21
|
-
|
|
22
|
-
1. Added `tests/` directory for unit tests using Bun's built-in test runner.
|
|
23
|
-
2. Updated `tsconfig.json` to include `tests/` in the `include` array to allow TypeScript to recognize test files during development, while still excluding them from the build output using `tsconfig.build.json`.
|
|
24
|
-
3. Updated `tsconfig.build.json` to exclude `tests/` to ensure that test files are not included in the build output.
|
|
25
|
-
4. Updated `tsconfig.json` to include `baseUrl` and `paths` for better module resolution and cleaner import statements in the source code.
|
|
26
|
-
|
|
27
|
-
## 0.1.4
|
|
28
|
-
|
|
29
|
-
1. Introduced `tsconfig.build.json` to separate build-specific TypeScript configuration from development configuration, allowing for more tailored settings for each use case.
|
|
30
|
-
2. Updated scripts in `package.json` to utilize `tsconfig.build.json` for the build process, ensuring that the build is optimized and does not include unnecessary files or settings meant for development.
|
|
31
|
-
|
|
32
|
-
## 0.1.3
|
|
33
|
-
|
|
34
|
-
1. Added `--no-git` to `bun create` command in Quick Start instructions to allow users to choose when to initialize git repository.
|
|
35
|
-
|
|
36
|
-
## 0.1.2
|
|
37
|
-
|
|
38
|
-
1. Added `--no-install` to `bun create` command in Quick Start instructions to allow users to choose when to install dependencies.
|
|
39
|
-
|
|
40
|
-
## 0.1.1
|
|
41
|
-
|
|
42
|
-
1. Fixed github user in Quick Start instructions.
|
|
43
|
-
|
|
44
|
-
## 0.1.0
|
|
45
|
-
|
|
46
|
-
1. First version of the template.
|
package/dist/README.md
DELETED
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
# Introduction
|
|
2
|
-
|
|
3
|
-
This package serves as a template for creating Bun libraries. It includes a basic setup with TypeScript, build scripts, and versioning information.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
1. [Quick Start](#quick-start)
|
|
8
|
-
2. [Documentation](#documentation)
|
|
9
|
-
1. [`tsconfig.json` and `tsconfig.build.json`](#tsconfigjson-and-tsconfigbuildjson)
|
|
10
|
-
2. [`package.json`](#packagejson)
|
|
11
|
-
3. [Script `scripts/buildinfo.ts`](#script-scriptsbuildinfots)
|
|
12
|
-
4. [Script `scripts/build-cdn.ts`](#script-scriptsbuild-cdn-ts)
|
|
13
|
-
5. [CDN Map `scripts/build-cdn-map.json`](#cdn-map-scriptsbuild-cdn-mapjson)
|
|
14
|
-
3. [DevOps](#devops)
|
|
15
|
-
1. [Change Management](#change-management)
|
|
16
|
-
2. [Publish](#publish)
|
|
17
|
-
|
|
18
|
-
# Quick Start
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
# placeholder:
|
|
22
|
-
# <PACKAGE: <PACKAGE>
|
|
23
|
-
|
|
24
|
-
bun create temir-ra/bun-lib-template --no-install --no-git <PACKAGE>
|
|
25
|
-
cd <PACKAGE>
|
|
26
|
-
bun install
|
|
27
|
-
|
|
28
|
-
bun run dev
|
|
29
|
-
bun run test
|
|
30
|
-
|
|
31
|
-
bun run build
|
|
32
|
-
|
|
33
|
-
bun publish
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
# Documentation
|
|
37
|
-
|
|
38
|
-
`README-template.md` and `CHANGELOG-template.md` are the actual documentation files for this template package. Whereas `README.md` and `CHANGELOG.md` are copied as part of the package creation process and should be modified by the user to reflect the specifics of their library.
|
|
39
|
-
|
|
40
|
-
## `tsconfig.json` and `tsconfig.build.json`
|
|
41
|
-
|
|
42
|
-
```json
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
"compilerOptions": {
|
|
46
|
-
|
|
47
|
-
// supported JavaScript features and syntax in the emitted JavaScript files
|
|
48
|
-
// ES2022 is a reasonable modern baseline
|
|
49
|
-
"target": "ES2022",
|
|
50
|
-
|
|
51
|
-
// how import and export statements are written in the emitted JavaScript files
|
|
52
|
-
// ESNext emits standard ES module syntax unchanged
|
|
53
|
-
"module": "ESNext",
|
|
54
|
-
|
|
55
|
-
// available built-in types
|
|
56
|
-
"lib": [
|
|
57
|
-
"ES2022", // standard JavaScript runtime APIs
|
|
58
|
-
"DOM" // browser globals or import.meta.url
|
|
59
|
-
],
|
|
60
|
-
|
|
61
|
-
// permissive about file extensions in import statements
|
|
62
|
-
// `tsconfig.build.json` switches to a stricter resolution mode
|
|
63
|
-
"moduleResolution": "bundler",
|
|
64
|
-
|
|
65
|
-
// collection of type-safety checks
|
|
66
|
-
"strict": true,
|
|
67
|
-
|
|
68
|
-
// compatibility shims that make it easier to import CommonJS modules as if they were ES modules
|
|
69
|
-
"esModuleInterop": true,
|
|
70
|
-
|
|
71
|
-
// do not type-check `.d.ts` files in `node_modules/`
|
|
72
|
-
"skipLibCheck": true,
|
|
73
|
-
|
|
74
|
-
// enforce consistent casing across import statements
|
|
75
|
-
"forceConsistentCasingInFileNames": true,
|
|
76
|
-
|
|
77
|
-
// allow importing JSON files as modules and infer the full type of the JSON structure
|
|
78
|
-
"resolveJsonModule": true,
|
|
79
|
-
|
|
80
|
-
// generate .d.ts type declaration files alongside the JavaScript output
|
|
81
|
-
"declaration": true,
|
|
82
|
-
// allow a consumer's editor to "go to definition" on something from the library
|
|
83
|
-
"declarationMap": true,
|
|
84
|
-
|
|
85
|
-
// prevents tsc from emitting any JavaScript files
|
|
86
|
-
// during development, rely on executing environment to handle TypeScript directly
|
|
87
|
-
// during build, use `tsconfig.build.json` to override this setting and emit JavaScript files for distribution
|
|
88
|
-
"emitDeclarationOnly": true,
|
|
89
|
-
|
|
90
|
-
// the directory where the emitted JavaScript and declaration files will be placed when building the library for distribution
|
|
91
|
-
// matches the `files` field in `package.json` that determines what gets published
|
|
92
|
-
"outDir": "./dist",
|
|
93
|
-
|
|
94
|
-
// the base directory to resolve non-relative module imports
|
|
95
|
-
"baseUrl": ".",
|
|
96
|
-
|
|
97
|
-
// a mapping of module import paths to physical paths in the project
|
|
98
|
-
// `paths` is a TypeScript-only feature - it must not be used in import statements in `src/` files
|
|
99
|
-
"paths": {
|
|
100
|
-
"@/*": [
|
|
101
|
-
"src/*"
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
// files to be included/excluded by the TypeScript compiler and the development environment
|
|
108
|
-
// `tsconfig.build.json` overrides these settings to include only `src/` files
|
|
109
|
-
"include": [
|
|
110
|
-
"src/**/*.ts",
|
|
111
|
-
"tests/**/*.ts",
|
|
112
|
-
"scripts/**/*.ts"
|
|
113
|
-
],
|
|
114
|
-
"exclude": [
|
|
115
|
-
"node_modules",
|
|
116
|
-
"dist"
|
|
117
|
-
]
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
During development, the `tsconfig.json` configuration prevents emitting JavaScript files and relies on the executing environment to handle TypeScript directly. The `include` and `exclude` settings ensure that all relevant TypeScript files are included in the development environment.
|
|
123
|
-
|
|
124
|
-
When building the library for distribution, the `tsconfig.build.json` configuration overrides the settings to emit JavaScript files and include only the `src/` files.
|
|
125
|
-
|
|
126
|
-
```json
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
"extends": "./tsconfig.json",
|
|
130
|
-
|
|
131
|
-
"compilerOptions": {
|
|
132
|
-
|
|
133
|
-
// `nodenext` is the strictest and most forward-compatible ESM mode
|
|
134
|
-
// imports must include explicit `.js` file extensions
|
|
135
|
-
"module": "nodenext",
|
|
136
|
-
"moduleResolution": "nodenext",
|
|
137
|
-
|
|
138
|
-
// emit both JavaScript files and declaration files for distribution
|
|
139
|
-
"emitDeclarationOnly": false,
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
// include only the source files for the build, excluding tests and scripts
|
|
144
|
-
"include": [
|
|
145
|
-
"src/**/*.ts"
|
|
146
|
-
],
|
|
147
|
-
"exclude": [
|
|
148
|
-
"node_modules",
|
|
149
|
-
"dist",
|
|
150
|
-
"tests",
|
|
151
|
-
"scripts"
|
|
152
|
-
]
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## `package.json`
|
|
158
|
-
|
|
159
|
-
```json
|
|
160
|
-
{
|
|
161
|
-
"name": "package",
|
|
162
|
-
"version": "0.0.0",
|
|
163
|
-
"description": "",
|
|
164
|
-
|
|
165
|
-
// "module" makes every `.js` file in the package to be treated as an ES module unless explicitly named `.cjs`
|
|
166
|
-
"type": "module",
|
|
167
|
-
|
|
168
|
-
// runtime consults "exports" to find the actual file to load
|
|
169
|
-
// "import" condition is used by ESM consumers
|
|
170
|
-
// "types" condition is used by TypeScript to find the declaration files
|
|
171
|
-
// "browser" condition is used by CDN infrastructure
|
|
172
|
-
// "entrypoint" is a custom condition used by the build script to find the entry point for the CDN build
|
|
173
|
-
"exports": {
|
|
174
|
-
".": {
|
|
175
|
-
"entrypoint": "./src/index.ts",
|
|
176
|
-
"browser": "./dist/index.bundle.js",
|
|
177
|
-
"import": "./dist/index.js",
|
|
178
|
-
"types": "./dist/index.d.ts"
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
// files to include in the published package
|
|
183
|
-
"files": [
|
|
184
|
-
"dist"
|
|
185
|
-
],
|
|
186
|
-
|
|
187
|
-
"scripts": {
|
|
188
|
-
|
|
189
|
-
// cleans the `dist/` directory before building
|
|
190
|
-
"clean": "rm -rf dist/",
|
|
191
|
-
|
|
192
|
-
// overwrites `src/buildinfo.ts` with the current version and git hash (if available)
|
|
193
|
-
"prebuild": "bun run scripts/buildinfo.ts",
|
|
194
|
-
|
|
195
|
-
// runs all tests
|
|
196
|
-
"test": "bun test",
|
|
197
|
-
|
|
198
|
-
// runs all build steps in sequence
|
|
199
|
-
"build": "bun run build:lib && bun run build:cdn && bun run build:assets",
|
|
200
|
-
|
|
201
|
-
// uses `tsconfig.build.json` to compile the TypeScript source files
|
|
202
|
-
"build:lib": "tsc --project tsconfig.build.json",
|
|
203
|
-
|
|
204
|
-
// bundles the library for CDN distribution in both ESM and IIFE formats
|
|
205
|
-
"build:cdn": "bun run scripts/build-cdn.ts",
|
|
206
|
-
|
|
207
|
-
// placeholder for any asset build steps (e.g. copying static files, generating documentation, etc.)
|
|
208
|
-
"build:assets": "echo 'no assets to build'",
|
|
209
|
-
|
|
210
|
-
// type checks the TypeScript source files without emitting any output
|
|
211
|
-
"typecheck": "tsc --noEmit",
|
|
212
|
-
|
|
213
|
-
// runs the development file
|
|
214
|
-
"dev": "bun run --watch src/dev.ts"
|
|
215
|
-
|
|
216
|
-
},
|
|
217
|
-
"devDependencies": {
|
|
218
|
-
"@types/bun": "latest",
|
|
219
|
-
"typescript": "^5.9.3"
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
## Script `scripts/buildinfo.ts`
|
|
225
|
-
|
|
226
|
-
This script overwrites `src/buildinfo.ts` with the current version from `package.json` and the current git hash (if available).
|
|
227
|
-
|
|
228
|
-
## Script `scripts/build-cdn.ts`
|
|
229
|
-
|
|
230
|
-
This script bundles the library for CDN distribution in both ESM and IIFE formats. It reads the `exports` field from `package.json` to determine the entry points for the library and generates bundled files in the `dist/` directory. A custom condition `entrypoint` is used in the `exports` field to specify the entry point for the CDN build.
|
|
231
|
-
|
|
232
|
-
During the bundling process, the import paths in the source files can be rewritten to point to a CDN URL of a package, instead of using the package name that would be resolved from `node_modules/`.
|
|
233
|
-
|
|
234
|
-
The list of import paths to rewrite and their corresponding CDN URLs can be configured in the `scripts/build-cdn-map.json` file.
|
|
235
|
-
|
|
236
|
-
## CDN Map `scripts/build-cdn-map.json`
|
|
237
|
-
|
|
238
|
-
This JSON file contains a mapping of module import paths to their corresponding CDN URLs. During the CDN build process, if an import path in the source files matches a key in this map, it will be replaced with the corresponding CDN URL in the bundled output.
|
|
239
|
-
|
|
240
|
-
The URL can contain the placeholder `<VERSION>` which will be replaced with the current version of that package from `package.json`.
|
|
241
|
-
|
|
242
|
-
```json
|
|
243
|
-
{
|
|
244
|
-
"package-name": "https://cdn.jsdelivr.net/npm/package-name@<VERSION>/dist/index.bundle.js"
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
- Keys are the import specifiers as they appear in source code.
|
|
249
|
-
- Values are CDN URLs. The URL can contain the placeholder `<VERSION>` which will be replaced with the current version of that package from `package.json`.
|
|
250
|
-
|
|
251
|
-
# DevOps
|
|
252
|
-
|
|
253
|
-
## Change Management
|
|
254
|
-
|
|
255
|
-
1. Create a new branch for the change.
|
|
256
|
-
2. Make the changes and commit them to the branch.
|
|
257
|
-
3. Add an entry for the new version in [`CHANGELOG-template.md`](CHANGELOG-template.md).
|
|
258
|
-
4. Pull & publish request the branch.
|
|
259
|
-
|
|
260
|
-
## Publish
|
|
261
|
-
|
|
262
|
-
### `npmjs.org`
|
|
263
|
-
|
|
264
|
-
⚠️ Either run `npm login` or set up `~/.npmrc` or `bunfig.toml` with the appropriate auth token before running the publish command.
|
|
265
|
-
|
|
266
|
-
```powershell
|
|
267
|
-
bun publish --registry https://registry.npmjs.org/ --access public
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### Custom registry with `bun`
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
# placeholder:
|
|
274
|
-
# <SCOPE_WITHOUT_AT: <SCOPE_WITHOUT_AT>
|
|
275
|
-
# <REGISTRY_URL: <REGISTRY_URL>
|
|
276
|
-
# <BUN_PUBLISH_AUTH_TOKEN: <BUN_PUBLISH_AUTH_TOKEN>
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
`bunfig.toml`:
|
|
280
|
-
|
|
281
|
-
```toml
|
|
282
|
-
[install.scopes]
|
|
283
|
-
<SCOPE_WITHOUT_AT> = { url = "<REGISTRY_URL>", token = "$BUN_PUBLISH_AUTH_TOKEN" }
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
```powershell
|
|
287
|
-
$env:BUN_PUBLISH_AUTH_TOKEN = "<BUN_PUBLISH_AUTH_TOKEN>"
|
|
288
|
-
bun publish
|
|
289
|
-
```
|
package/dist/README.md.template
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Introduction
|
|
2
|
-
|
|
3
|
-
*<INTRO TEXT>*
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
1. [Quick Start](#quick-start)
|
|
8
|
-
2. [Documentation](#documentation)
|
|
9
|
-
3. [DevOps](#devops)
|
|
10
|
-
1. [Change Management](#change-management)
|
|
11
|
-
2. [Publish](#publish)
|
|
12
|
-
|
|
13
|
-
# Quick Start
|
|
14
|
-
|
|
15
|
-
*<QUICK START INSTRUCTIONS>*
|
|
16
|
-
|
|
17
|
-
# Documentation
|
|
18
|
-
|
|
19
|
-
*<DOCUMENTATION>*
|
|
20
|
-
|
|
21
|
-
# DevOps
|
|
22
|
-
|
|
23
|
-
## Change Management
|
|
24
|
-
|
|
25
|
-
1. Create a new branch for the change.
|
|
26
|
-
2. Make the changes and commit them to the branch.
|
|
27
|
-
3. Bump the version in [`package.json`](package.json).
|
|
28
|
-
4. Add an entry for the new version in [`CHANGELOG.md`](CHANGELOG.md).
|
|
29
|
-
5. Pull request the branch.
|
|
30
|
-
|
|
31
|
-
## Publish
|
|
32
|
-
|
|
33
|
-
### bun
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# placeholder:
|
|
37
|
-
# <SCOPE_WITHOUT_AT: <SCOPE_WITHOUT_AT>
|
|
38
|
-
# <REGISTRY_URL: <REGISTRY_URL>
|
|
39
|
-
# <BUN_PUBLISH_AUTH_TOKEN: <BUN_PUBLISH_AUTH_TOKEN>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
`bunfig.toml`:
|
|
43
|
-
|
|
44
|
-
```toml
|
|
45
|
-
[install.scopes]
|
|
46
|
-
<SCOPE_WITHOUT_AT> = { url = "<REGISTRY_URL>", token = "$BUN_PUBLISH_AUTH_TOKEN" }
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
```powershell
|
|
50
|
-
$env:BUN_PUBLISH_AUTH_TOKEN = "<BUN_PUBLISH_AUTH_TOKEN>"
|
|
51
|
-
bun publish
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### npm
|
|
55
|
-
|
|
56
|
-
```powershell
|
|
57
|
-
npm login --registry https://registry.npmjs.org/
|
|
58
|
-
npm publish --registry https://registry.npmjs.org/ --access public
|
|
59
|
-
```
|
package/dist/gitignore
DELETED
package/dist/src/buildinfo.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|