@temir.ra/create-ts-lib 0.3.0 → 0.4.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 +8 -0
- package/buildinfo.txt +1 -1
- package/dist/cli.bundle.js +2 -2
- package/dist/cli.bundle.js.map +5 -4
- package/dist/cli.js +10 -16
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Version 0
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
1. Added support for scoped package names in the CLI argument parsing and asset resolution.
|
|
6
|
+
|
|
7
|
+
## 0.3.1-pre.1 (unreleased)
|
|
8
|
+
|
|
9
|
+
1. Removed `dev.ts` file.
|
|
10
|
+
|
|
3
11
|
## 0.3.0
|
|
4
12
|
|
|
5
13
|
1. Removed AI Assistant Context files to be generated by the user with the provided prompts in the README.
|
package/buildinfo.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.4.0+2637470
|
package/dist/cli.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{cpSync as
|
|
2
|
+
import{cpSync as s,readFileSync as f,renameSync as u,writeFileSync as P}from"fs";import{resolve as t,basename as k}from"path";import{resolve as o}from"path";import{fileURLToPath as h}from"url";var d=new URL("../",import.meta.url),n=o(h(d)),m=o(n,"template/"),p=o(n,"CHANGELOG.md"),g=o(n,"buildinfo.txt"),l=o(n,"README.md");try{let r=process.argv[2];if(!r)throw Error("Package name argument is required. Usage: `create-ts-lib <package-name>`");let a=r.replace(/\\/g,"/"),e=k(t(process.cwd(),a));s(m,e,{recursive:!0}),s(p,t(e,"CHANGELOG-template.md")),s(g,t(e,"buildinfo-template.txt")),s(l,t(e,"README-template.md"));let c=t(e,"package.json"),i=JSON.parse(f(c,"utf-8"));i.name=a,P(c,JSON.stringify(i,null,2)),u(t(e,"gitignore"),t(e,".gitignore")),console.log(`Template has been successfully instantiated at '${e}' with package name '${a}'.`)}catch(r){let a=r instanceof Error?r:Error(String(r));console.error("Error:",a.message),process.exit(1)}
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=3338AF0F4222D38464756E2164756E21
|
package/dist/cli.bundle.js.map
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["..\\src\\cli.ts"],
|
|
3
|
+
"sources": ["..\\src\\cli.ts", "..\\src\\constants.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 {
|
|
5
|
+
"#!/usr/bin/env node\r\n\r\nimport { cpSync, readFileSync, renameSync, writeFileSync } from 'fs';\r\nimport { resolve, basename } from 'path';\r\nimport {\r\n templatePath,\r\n changelogPath,\r\n buildinfoPath,\r\n readmePath\r\n} from './constants.js';\r\n\r\n\r\ntry {\r\n\r\n const packageNameArgument = process.argv[2];\r\n if (!packageNameArgument) throw new Error('Package name argument is required. Usage: `create-ts-lib <package-name>`');\r\n const packageName = packageNameArgument.replace(/\\\\/g, '/');\r\n\r\n const destinationPath = basename(resolve(process.cwd(), packageName));\r\n\r\n cpSync(templatePath, destinationPath, { recursive: true });\r\n cpSync(changelogPath, resolve(destinationPath, 'CHANGELOG-template.md'));\r\n cpSync(buildinfoPath, resolve(destinationPath, 'buildinfo-template.txt'));\r\n cpSync(readmePath, 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",
|
|
6
|
+
"import { resolve } from 'path';\r\nimport { fileURLToPath } from 'url';\r\n\r\n\r\nexport const packageUrl: URL = new URL('../', import.meta.url);\r\nexport const packagePath: string = resolve(fileURLToPath(packageUrl));\r\n\r\nexport const templatePath: string = resolve(packagePath, 'template/');\r\n\r\nexport const changelogPath: string = resolve(packagePath, 'CHANGELOG.md');\r\nexport const buildinfoPath: string = resolve(packagePath, 'buildinfo.txt');\r\nexport const readmePath: string = resolve(packagePath, 'README.md');\r\n"
|
|
6
7
|
],
|
|
7
|
-
"mappings": ";AAEA,iBAAS,kBAAQ,gBAAc,mBAAY,WAC3C,kBAAS,cAAS,
|
|
8
|
-
"debugId": "
|
|
8
|
+
"mappings": ";AAEA,iBAAS,kBAAQ,gBAAc,mBAAY,WAC3C,kBAAS,cAAS,aCHlB,kBAAS,aACT,wBAAS,YAGF,IAAM,EAAkB,IAAI,IAAI,MAAO,YAAY,GAAG,EAChD,EAAsB,EAAQ,EAAc,CAAU,CAAC,EAEvD,EAAuB,EAAQ,EAAa,WAAW,EAEvD,EAAwB,EAAQ,EAAa,cAAc,EAC3D,EAAwB,EAAQ,EAAa,eAAe,EAC5D,EAAqB,EAAQ,EAAa,WAAW,EDClE,GAAI,CAEA,IAAM,EAAsB,QAAQ,KAAK,GACzC,GAAI,CAAC,EAAqB,MAAU,MAAM,0EAA0E,EACpH,IAAM,EAAc,EAAoB,QAAQ,MAAO,GAAG,EAEpD,EAAkB,EAAS,EAAQ,QAAQ,IAAI,EAAG,CAAW,CAAC,EAEpE,EAAO,EAAc,EAAiB,CAAE,UAAW,EAAK,CAAC,EACzD,EAAO,EAAe,EAAQ,EAAiB,uBAAuB,CAAC,EACvE,EAAO,EAAe,EAAQ,EAAiB,wBAAwB,CAAC,EACxE,EAAO,EAAY,EAAQ,EAAiB,oBAAoB,CAAC,EAEjE,IAAM,EAAkB,EAAQ,EAAiB,cAAc,EACzD,EAAc,KAAK,MAAM,EAAa,EAAiB,OAAO,CAAC,EACrE,EAAY,KAAO,EACnB,EAAc,EAAiB,KAAK,UAAU,EAAa,KAAM,CAAC,CAAC,EAEnE,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",
|
|
9
|
+
"debugId": "3338AF0F4222D38464756E2164756E21",
|
|
9
10
|
"names": []
|
|
10
11
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { cpSync, readFileSync, renameSync, writeFileSync } from 'fs';
|
|
3
3
|
import { resolve, basename } from 'path';
|
|
4
|
-
import {
|
|
5
|
-
const packageUrl = new URL('../', import.meta.url);
|
|
6
|
-
const packagePath = resolve(fileURLToPath(packageUrl));
|
|
7
|
-
const templatePath = resolve(packagePath, 'template/');
|
|
8
|
-
const changelogPath = resolve(packagePath, 'CHANGELOG.md');
|
|
9
|
-
const buildinfoPath = resolve(packagePath, 'buildinfo.txt');
|
|
10
|
-
const readmePath = resolve(packagePath, 'README.md');
|
|
4
|
+
import { templatePath, changelogPath, buildinfoPath, readmePath } from './constants.js';
|
|
11
5
|
try {
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
throw new Error('
|
|
15
|
-
const
|
|
16
|
-
const
|
|
6
|
+
const packageNameArgument = process.argv[2];
|
|
7
|
+
if (!packageNameArgument)
|
|
8
|
+
throw new Error('Package name argument is required. Usage: `create-ts-lib <package-name>`');
|
|
9
|
+
const packageName = packageNameArgument.replace(/\\/g, '/');
|
|
10
|
+
const destinationPath = basename(resolve(process.cwd(), packageName));
|
|
17
11
|
cpSync(templatePath, destinationPath, { recursive: true });
|
|
18
12
|
cpSync(changelogPath, resolve(destinationPath, 'CHANGELOG-template.md'));
|
|
19
13
|
cpSync(buildinfoPath, resolve(destinationPath, 'buildinfo-template.txt'));
|
|
20
14
|
cpSync(readmePath, resolve(destinationPath, 'README-template.md'));
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
writeFileSync(
|
|
15
|
+
const packageJsonPath = resolve(destinationPath, 'package.json');
|
|
16
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
17
|
+
packageJson.name = packageName;
|
|
18
|
+
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
|
25
19
|
renameSync(resolve(destinationPath, 'gitignore'), resolve(destinationPath, '.gitignore'));
|
|
26
20
|
console.log(`Template has been successfully instantiated at '${destinationPath}' with package name '${packageName}'.`);
|
|
27
21
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const packageUrl: URL;
|
|
2
|
+
export declare const packagePath: string;
|
|
3
|
+
export declare const templatePath: string;
|
|
4
|
+
export declare const changelogPath: string;
|
|
5
|
+
export declare const buildinfoPath: string;
|
|
6
|
+
export declare const readmePath: string;
|
|
7
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,EAAE,GAAqC,CAAC;AAC/D,eAAO,MAAM,WAAW,EAAE,MAA2C,CAAC;AAEtE,eAAO,MAAM,YAAY,EAAE,MAA0C,CAAC;AAEtE,eAAO,MAAM,aAAa,EAAE,MAA6C,CAAC;AAC1E,eAAO,MAAM,aAAa,EAAE,MAA8C,CAAC;AAC3E,eAAO,MAAM,UAAU,EAAE,MAA0C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
export const packageUrl = new URL('../', import.meta.url);
|
|
4
|
+
export const packagePath = resolve(fileURLToPath(packageUrl));
|
|
5
|
+
export const templatePath = resolve(packagePath, 'template/');
|
|
6
|
+
export const changelogPath = resolve(packagePath, 'CHANGELOG.md');
|
|
7
|
+
export const buildinfoPath = resolve(packagePath, 'buildinfo.txt');
|
|
8
|
+
export const readmePath = resolve(packagePath, 'README.md');
|