@temir.ra/create-ts-lib 0.9.0 → 0.10.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Version 0
2
2
 
3
+ ## 0.10.0
4
+
5
+ 1. Added `node:` prefix to imports.
6
+ 2. Switched to `node:test` for tests.
7
+ 3. Synced with `template@0.3.0-pre.3` template.
8
+
9
+ ## 0.9.1
10
+
11
+ 1. Updated from `template@0.2.1` template.
12
+
3
13
  ## 0.9.0
4
14
 
5
15
  1. Switched to `esbuild` for bundling.
package/README.md CHANGED
@@ -38,8 +38,7 @@ cd <NEW_PACKAGE>
38
38
  bun info "@temir.ra/create-ts-lib" version
39
39
 
40
40
  # create/update a package from the template in the current directory
41
- # clear the package manager cache to pick up the latest version when not pinning a specific version
42
- bun create --no-install --no-git "@temir.ra/ts-lib" .
41
+ bun create --no-install --no-git "@temir.ra/ts-lib@latest" .
43
42
 
44
43
  # set metadata in package.json
45
44
 
package/buildinfo.txt CHANGED
@@ -1 +1 @@
1
- 0.9.0+1a97fac
1
+ 0.10.0+e8469be
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temir.ra/create-ts-lib",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "A template for a distributable TypeScript library package.",
5
5
  "author": "temir.ra",
6
6
  "license": "MIT",
@@ -41,7 +41,6 @@
41
41
  "build:cli-bundle": "esbuild src/cli.ts --outdir=dist --entry-names=[dir]/[name].bundle --platform=node --format=esm --bundle --minify --sourcemap=external"
42
42
  },
43
43
  "devDependencies": {
44
- "@types/bun": "latest",
45
44
  "@types/node": "latest",
46
45
  "esbuild": "latest",
47
46
  "typescript": "^6.0.3"
@@ -1,5 +1,5 @@
1
- import { readFileSync } from 'fs';
2
- import { join } from 'path';
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
3
  import {
4
4
  build,
5
5
  type BuildFailure,
@@ -1,5 +1,5 @@
1
- import { execSync } from 'child_process';
2
- import { readFileSync, writeFileSync } from 'fs';
1
+ import { execSync } from 'node:child_process';
2
+ import { readFileSync, writeFileSync } from 'node:fs';
3
3
 
4
4
 
5
5
  const BUILD_INFO_FILE = 'buildinfo.txt';
@@ -52,7 +52,6 @@
52
52
  "build:tsc": "tsc --project tsconfig.build.json"
53
53
  },
54
54
  "devDependencies": {
55
- "@types/bun": "latest",
56
55
  "@types/node": "latest",
57
56
  "esbuild": "latest",
58
57
  "typescript": "^6.0.3"
@@ -1,5 +1,5 @@
1
- import { readFileSync } from 'fs';
2
- import { join } from 'path';
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
3
  import {
4
4
  build,
5
5
  type BuildFailure,
@@ -1,5 +1,5 @@
1
- import { execSync } from 'child_process';
2
- import { readFileSync, writeFileSync } from 'fs';
1
+ import { execSync } from 'node:child_process';
2
+ import { readFileSync, writeFileSync } from 'node:fs';
3
3
 
4
4
 
5
5
  const BUILD_INFO_FILE = 'buildinfo.txt';
@@ -1,4 +1,4 @@
1
- import { fileURLToPath } from 'url';
1
+ import { fileURLToPath } from 'node:url';
2
2
 
3
3
 
4
4
  const start: number = performance.now();
@@ -1,12 +1,12 @@
1
- /// <reference types="bun" />
2
- import { describe, it, expect } from 'bun:test';
3
- import { readFileSync } from 'fs';
4
- import { fileURLToPath } from 'url';
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert';
3
+ import { readFileSync } from 'node:fs';
4
+ import { fileURLToPath } from 'node:url';
5
5
 
6
6
 
7
7
  const buildinfoUrl = new URL('../buildinfo.txt', import.meta.url);
8
8
 
9
- // taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
9
+ // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
10
10
  // Captures: [1]=major, [2]=minor, [3]=patch, [4]=pre-release, [5]=build-metadata
11
11
  const SEMVER_REGEX =
12
12
  /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
@@ -18,7 +18,7 @@ function readBuildinfo(): string {
18
18
  describe('buildinfo.txt', () => {
19
19
 
20
20
  it('MUST contain a valid semver string', () => {
21
- expect(readBuildinfo()).toMatch(SEMVER_REGEX);
21
+ assert.match(readBuildinfo(), SEMVER_REGEX);
22
22
  });
23
23
 
24
24
  });
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{cpSync as a,readFileSync as g,renameSync as U,writeFileSync as d}from"fs";import{resolve as r}from"path";var n=new URL("../",import.meta.url),i=new URL("buildinfo.txt",n),u=new URL("dist/",n),l=new URL("template/",n),m=new URL("CHANGELOG.md",n),p=new URL("README.md",n);try{let t=process.argv[2];if(!t)throw new Error('First argument must be the package name (e.g. "my-package" or "@my-scope/my-package").');let o=t.replace(/\\/g,"/"),e=r(process.cwd(),o);a(l,e,{recursive:!0}),a(m,r(e,"CHANGELOG-template.md")),a(i,r(e,"buildinfo-template.txt")),a(p,r(e,"README-template.md"));let c=r(e,"package.json"),s=JSON.parse(g(c,"utf-8"));s.name=o,d(c,JSON.stringify(s,null,2)),U(r(e,"gitignore"),r(e,".gitignore")),console.log(`Template has been successfully instantiated at '${e}' with package name '${o}'.`)}catch(t){let o=t instanceof Error?t:new Error(String(t));console.error("Error:",o.message),process.exit(1)}
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/cli.ts", "../src/constants.ts"],
4
- "sourcesContent": ["#!/usr/bin/env node\r\n\r\nimport { cpSync, readFileSync, renameSync, writeFileSync } from 'fs';\r\nimport { resolve } from 'path';\r\nimport {\r\n templateUrl,\r\n changelogUrl,\r\n buildinfoUrl,\r\n readmeUrl\r\n} from './constants.js';\r\n\r\n\r\ntry {\r\n\r\n const packageNameArgument = process.argv[2];\r\n if (!packageNameArgument)\r\n throw new Error('First argument must be the package name (e.g. \"my-package\" or \"@my-scope/my-package\").');\r\n const packageName = packageNameArgument.replace(/\\\\/g, '/');\r\n\r\n const destinationPath = resolve(process.cwd(), packageName);\r\n\r\n cpSync(templateUrl, destinationPath, { recursive: true });\r\n cpSync(changelogUrl, resolve(destinationPath, 'CHANGELOG-template.md'));\r\n cpSync(buildinfoUrl, resolve(destinationPath, 'buildinfo-template.txt'));\r\n cpSync(readmeUrl, resolve(destinationPath, 'README-template.md'));\r\n\r\n const packageJsonPath = resolve(destinationPath, 'package.json');\r\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\r\n packageJson.name = packageName;\r\n writeFileSync(packageJsonPath, JSON.stringify(packageJson, 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", "export const packageUrl: URL = new URL('../', import.meta.url);\r\nexport const buildinfoUrl: URL = new URL('buildinfo.txt', packageUrl);\r\nexport const distUrl: URL = new URL('dist/', packageUrl);\r\n\r\nexport const templateUrl: URL = new URL('template/', packageUrl);\r\nexport const changelogUrl: URL = new URL('CHANGELOG.md', packageUrl);\r\nexport const readmeUrl: URL = new URL('README.md', packageUrl);\r\n"],
5
- "mappings": ";AAEA,OAAS,UAAAA,EAAQ,gBAAAC,EAAc,cAAAC,EAAY,iBAAAC,MAAqB,KAChE,OAAS,WAAAC,MAAe,OCHjB,IAAMC,EAAkB,IAAI,IAAI,MAAO,YAAY,GAAG,EAChDC,EAAoB,IAAI,IAAI,gBAAiBD,CAAU,EACvDE,EAAe,IAAI,IAAI,QAASF,CAAU,EAE1CG,EAAmB,IAAI,IAAI,YAAaH,CAAU,EAClDI,EAAoB,IAAI,IAAI,eAAgBJ,CAAU,EACtDK,EAAiB,IAAI,IAAI,YAAaL,CAAU,EDM7D,GAAI,CAEA,IAAMM,EAAsB,QAAQ,KAAK,CAAC,EAC1C,GAAI,CAACA,EACD,MAAM,IAAI,MAAM,wFAAwF,EAC5G,IAAMC,EAAcD,EAAoB,QAAQ,MAAO,GAAG,EAEpDE,EAAkBC,EAAQ,QAAQ,IAAI,EAAGF,CAAW,EAE1DG,EAAOC,EAAaH,EAAiB,CAAE,UAAW,EAAK,CAAC,EACxDE,EAAOE,EAAcH,EAAQD,EAAiB,uBAAuB,CAAC,EACtEE,EAAOG,EAAcJ,EAAQD,EAAiB,wBAAwB,CAAC,EACvEE,EAAOI,EAAWL,EAAQD,EAAiB,oBAAoB,CAAC,EAEhE,IAAMO,EAAkBN,EAAQD,EAAiB,cAAc,EACzDQ,EAAc,KAAK,MAAMC,EAAaF,EAAiB,OAAO,CAAC,EACrEC,EAAY,KAAOT,EACnBW,EAAcH,EAAiB,KAAK,UAAUC,EAAa,KAAM,CAAC,CAAC,EAEnEG,EAAWV,EAAQD,EAAiB,WAAW,EAAGC,EAAQD,EAAiB,YAAY,CAAC,EAExF,QAAQ,IAAI,mDAAmDA,CAAe,wBAAwBD,CAAW,IAAI,CAEzH,OACOa,EAAO,CACV,IAAMC,EAAMD,aAAiB,MAAQA,EAAQ,IAAI,MAAM,OAAOA,CAAK,CAAC,EACpE,QAAQ,MAAM,SAAUC,EAAI,OAAO,EACnC,QAAQ,KAAK,CAAC,CAClB",
6
- "names": ["cpSync", "readFileSync", "renameSync", "writeFileSync", "resolve", "packageUrl", "buildinfoUrl", "distUrl", "templateUrl", "changelogUrl", "readmeUrl", "packageNameArgument", "packageName", "destinationPath", "resolve", "cpSync", "templateUrl", "changelogUrl", "buildinfoUrl", "readmeUrl", "packageJsonPath", "packageJson", "readFileSync", "writeFileSync", "renameSync", "error", "err"]
7
- }