@temir.ra/create-template 0.4.4 → 0.5.2
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/dist/CHANGELOG.md +4 -0
- package/dist/buildinfo.txt +1 -1
- package/dist/cli.bundle.js +1 -1
- package/dist/cli.bundle.js.map +2 -2
- package/{template → dist/template}/package.json +1 -2
- package/{template → dist/template}/scripts/build-bundle.ts +8 -10
- package/{template → dist/template}/src/package-urls.ts +1 -1
- package/package.json +3 -4
- package/dist/cli.bundle.iife.js +0 -3
- package/dist/cli.bundle.iife.js.map +0 -7
- /package/{template → dist/template}/CHANGELOG.md +0 -0
- /package/{template → dist/template}/README.md +0 -0
- /package/{template → dist/template}/buildinfo.txt +0 -0
- /package/{template → dist/template}/gitignore +0 -0
- /package/{template → dist/template}/scripts/buildinfo.ts +0 -0
- /package/{template → dist/template}/scripts/import-map.json +0 -0
- /package/{template → dist/template}/src/cli.ts +0 -0
- /package/{template → dist/template}/tests/buildinfo.test.ts +0 -0
- /package/{template → dist/template}/tsconfig.json +0 -0
package/dist/CHANGELOG.md
CHANGED
package/dist/buildinfo.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.5.2+cc0d30d
|
package/dist/cli.bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{cpSync as n,readFileSync as U,renameSync as d,writeFileSync as u}from"node:fs";import{resolve as r}from"node:path";var
|
|
2
|
+
import{cpSync as n,readFileSync as U,renameSync as d,writeFileSync as u}from"node:fs";import{resolve as r}from"node:path";var i=new URL("../",import.meta.url),a=new URL("dist/",i),l=new URL("buildinfo.txt",a),m=new URL("CHANGELOG.md",a),p=new URL("README.md",i),g=new URL("template/",a);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);n(g,e,{recursive:!0}),n(m,r(e,"CHANGELOG-template.md")),n(l,r(e,"buildinfo-template.txt")),n(p,r(e,"README-template.md"));let c=r(e,"package.json"),s=JSON.parse(U(c,"utf-8"));s.name=o,u(c,JSON.stringify(s,null,2)),d(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)}
|
package/dist/cli.bundle.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/cli.ts", "../src/package-urls.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\r\n\r\nimport { cpSync, readFileSync, renameSync, writeFileSync } from 'node:fs';\r\nimport { resolve } from 'node:path';\r\nimport {\r\n templateUrl,\r\n changelogUrl,\r\n buildinfoUrl,\r\n readmeUrl\r\n} from './package-urls.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\n\r\nexport const distUrl: URL = new URL('dist/', packageUrl);\r\nexport const buildinfoUrl: URL = new URL('buildinfo.txt', distUrl);\r\nexport const changelogUrl: URL = new URL('CHANGELOG.md', distUrl);\r\nexport const readmeUrl: URL = new URL('README.md', packageUrl);\r\n\r\nexport const templateUrl: URL = new URL('template/',
|
|
5
|
-
"mappings": ";AAEA,OAAS,UAAAA,EAAQ,gBAAAC,EAAc,cAAAC,EAAY,iBAAAC,MAAqB,UAChE,OAAS,WAAAC,MAAe,YCHjB,IAAMC,EAAkB,IAAI,IAAI,MAAO,YAAY,GAAG,EAEhDC,EAAe,IAAI,IAAI,QAASD,CAAU,EAC1CE,EAAoB,IAAI,IAAI,gBAAiBD,CAAO,EACpDE,EAAoB,IAAI,IAAI,eAAgBF,CAAO,EACnDG,EAAiB,IAAI,IAAI,YAAaJ,CAAU,EAEhDK,EAAmB,IAAI,IAAI,
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\r\n\r\nimport { cpSync, readFileSync, renameSync, writeFileSync } from 'node:fs';\r\nimport { resolve } from 'node:path';\r\nimport {\r\n templateUrl,\r\n changelogUrl,\r\n buildinfoUrl,\r\n readmeUrl\r\n} from './package-urls.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\n\r\nexport const distUrl: URL = new URL('dist/', packageUrl);\r\nexport const buildinfoUrl: URL = new URL('buildinfo.txt', distUrl);\r\nexport const changelogUrl: URL = new URL('CHANGELOG.md', distUrl);\r\nexport const readmeUrl: URL = new URL('README.md', packageUrl);\r\n\r\nexport const templateUrl: URL = new URL('template/', distUrl);\r\n"],
|
|
5
|
+
"mappings": ";AAEA,OAAS,UAAAA,EAAQ,gBAAAC,EAAc,cAAAC,EAAY,iBAAAC,MAAqB,UAChE,OAAS,WAAAC,MAAe,YCHjB,IAAMC,EAAkB,IAAI,IAAI,MAAO,YAAY,GAAG,EAEhDC,EAAe,IAAI,IAAI,QAASD,CAAU,EAC1CE,EAAoB,IAAI,IAAI,gBAAiBD,CAAO,EACpDE,EAAoB,IAAI,IAAI,eAAgBF,CAAO,EACnDG,EAAiB,IAAI,IAAI,YAAaJ,CAAU,EAEhDK,EAAmB,IAAI,IAAI,YAAaJ,CAAO,EDK5D,GAAI,CAEA,IAAMK,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
6
|
"names": ["cpSync", "readFileSync", "renameSync", "writeFileSync", "resolve", "packageUrl", "distUrl", "buildinfoUrl", "changelogUrl", "readmeUrl", "templateUrl", "packageNameArgument", "packageName", "destinationPath", "resolve", "cpSync", "templateUrl", "changelogUrl", "buildinfoUrl", "readmeUrl", "packageJsonPath", "packageJson", "readFileSync", "writeFileSync", "renameSync", "error", "err"]
|
|
7
7
|
}
|
|
@@ -57,11 +57,8 @@ function getManifestEntrypoints(packageManifest: PackageManifest): string[] {
|
|
|
57
57
|
throw new Error(`[scripts/build-bundle.ts] Failed to read entrypoints from package manifest: 'exports' field is missing.`);
|
|
58
58
|
|
|
59
59
|
const entrypoints = Object.entries(exports)
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
throw new Error(`[scripts/build-bundle.ts] Failed to read entrypoints from package manifest: 'entrypoint' condition is missing for export '${key}'.`);
|
|
63
|
-
return conditions.entrypoint;
|
|
64
|
-
});
|
|
60
|
+
.filter(([_, conditions]) => conditions.entrypoint)
|
|
61
|
+
.map(([_, conditions]) => conditions.entrypoint as string);
|
|
65
62
|
|
|
66
63
|
return entrypoints;
|
|
67
64
|
|
|
@@ -109,15 +106,15 @@ function resolveVersionInCdnUrl(importSpecifier: string, cdnUrl: string): string
|
|
|
109
106
|
const esbuildLog: EsbuildPlugin = {
|
|
110
107
|
name: 'esbuild-log',
|
|
111
108
|
setup(build: PluginBuild) {
|
|
112
|
-
const
|
|
109
|
+
const buildFormat = build.initialOptions.format ? `${build.initialOptions.format} ` : '';
|
|
113
110
|
build.onStart(() => {
|
|
114
|
-
console.log(`[esbuild-log plugin] ${
|
|
111
|
+
console.log(`[esbuild-log plugin] ${buildFormat}build started...`);
|
|
115
112
|
});
|
|
116
113
|
build.onEnd((result: BuildResult<BuildOptions>) => {
|
|
117
114
|
if (result.errors.length > 0) {
|
|
118
|
-
console.error(`[esbuild-log plugin] ${
|
|
115
|
+
console.error(`[esbuild-log plugin] ${buildFormat}build failed.`);
|
|
119
116
|
} else {
|
|
120
|
-
console.log(`[esbuild-log plugin] ${
|
|
117
|
+
console.log(`[esbuild-log plugin] ${buildFormat}build finished.`);
|
|
121
118
|
}
|
|
122
119
|
});
|
|
123
120
|
}
|
|
@@ -126,6 +123,7 @@ const COPY_FILES: string[] = [
|
|
|
126
123
|
"buildinfo.txt",
|
|
127
124
|
"buildinfo-template.txt",
|
|
128
125
|
"CHANGELOG.md",
|
|
126
|
+
"template/"
|
|
129
127
|
];
|
|
130
128
|
const copyFiles: EsbuildPlugin = {
|
|
131
129
|
name: 'copy-files',
|
|
@@ -136,7 +134,7 @@ const copyFiles: EsbuildPlugin = {
|
|
|
136
134
|
for (const file of COPY_FILES) {
|
|
137
135
|
const destination = join(outDir, file);
|
|
138
136
|
if (existsSync(file)) {
|
|
139
|
-
cpSync(file, destination);
|
|
137
|
+
cpSync(file, destination, { recursive: true });
|
|
140
138
|
console.log(`[copy-files plugin] Copied '${file}' to '${destination}'.`);
|
|
141
139
|
} else {
|
|
142
140
|
console.warn(`[copy-files plugin] File '${file}' does not exist. Skipping...`);
|
|
@@ -5,4 +5,4 @@ export const buildinfoUrl: URL = new URL('buildinfo.txt', distUrl);
|
|
|
5
5
|
export const changelogUrl: URL = new URL('CHANGELOG.md', distUrl);
|
|
6
6
|
export const readmeUrl: URL = new URL('README.md', packageUrl);
|
|
7
7
|
|
|
8
|
-
export const templateUrl: URL = new URL('template/',
|
|
8
|
+
export const templateUrl: URL = new URL('template/', distUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temir.ra/create-template",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "A template for a template package.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"files": [
|
|
18
|
-
"dist/"
|
|
19
|
-
"template/"
|
|
18
|
+
"dist/"
|
|
20
19
|
],
|
|
21
20
|
"bin": "./dist/cli.bundle.js",
|
|
22
21
|
"exports": {
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
"tests": "node --import tsx --test tests/**/*.test.ts",
|
|
38
37
|
"prebuild": "npm run buildinfo",
|
|
39
38
|
"build": "npm run build:bundle",
|
|
40
|
-
"build:bundle": "tsx scripts/build-bundle.ts"
|
|
39
|
+
"build:bundle": "tsx scripts/build-bundle.ts -- --omit-iife"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@types/node": "latest",
|
package/dist/cli.bundle.iife.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var __importMetaUrl = document.currentScript && document.currentScript.src || '';
|
|
3
|
-
"use strict";(()=>{var i=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var r=i("node:fs"),o=i("node:path");var a=new URL("../",__importMetaUrl),l=new URL("dist/",a),m=new URL("buildinfo.txt",l),p=new URL("CHANGELOG.md",l),g=new URL("README.md",a),U=new URL("template/",a);try{let e=process.argv[2];if(!e)throw new Error('First argument must be the package name (e.g. "my-package" or "@my-scope/my-package").');let n=e.replace(/\\/g,"/"),t=(0,o.resolve)(process.cwd(),n);(0,r.cpSync)(U,t,{recursive:!0}),(0,r.cpSync)(p,(0,o.resolve)(t,"CHANGELOG-template.md")),(0,r.cpSync)(m,(0,o.resolve)(t,"buildinfo-template.txt")),(0,r.cpSync)(g,(0,o.resolve)(t,"README-template.md"));let c=(0,o.resolve)(t,"package.json"),s=JSON.parse((0,r.readFileSync)(c,"utf-8"));s.name=n,(0,r.writeFileSync)(c,JSON.stringify(s,null,2)),(0,r.renameSync)((0,o.resolve)(t,"gitignore"),(0,o.resolve)(t,".gitignore")),console.log(`Template has been successfully instantiated at '${t}' with package name '${n}'.`)}catch(e){let n=e instanceof Error?e:new Error(String(e));console.error("Error:",n.message),process.exit(1)}})();
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/cli.ts", "../src/package-urls.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\r\n\r\nimport { cpSync, readFileSync, renameSync, writeFileSync } from 'node:fs';\r\nimport { resolve } from 'node:path';\r\nimport {\r\n templateUrl,\r\n changelogUrl,\r\n buildinfoUrl,\r\n readmeUrl\r\n} from './package-urls.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\n\r\nexport const distUrl: URL = new URL('dist/', packageUrl);\r\nexport const buildinfoUrl: URL = new URL('buildinfo.txt', distUrl);\r\nexport const changelogUrl: URL = new URL('CHANGELOG.md', distUrl);\r\nexport const readmeUrl: URL = new URL('README.md', packageUrl);\r\n\r\nexport const templateUrl: URL = new URL('template/', packageUrl);\r\n"],
|
|
5
|
-
"mappings": ";;4QAEA,IAAAA,EAAgE,aAChEC,EAAwB,eCHjB,IAAMC,EAAkB,IAAI,IAAI,MAAO,eAAe,EAEhDC,EAAe,IAAI,IAAI,QAASD,CAAU,EAC1CE,EAAoB,IAAI,IAAI,gBAAiBD,CAAO,EACpDE,EAAoB,IAAI,IAAI,eAAgBF,CAAO,EACnDG,EAAiB,IAAI,IAAI,YAAaJ,CAAU,EAEhDK,EAAmB,IAAI,IAAI,YAAaL,CAAU,EDK/D,GAAI,CAEA,IAAMM,EAAsB,QAAQ,KAAK,CAAC,EAC1C,GAAI,CAACA,EACD,MAAM,IAAI,MAAM,wFAAwF,EAC5G,IAAMC,EAAcD,EAAoB,QAAQ,MAAO,GAAG,EAEpDE,KAAkB,WAAQ,QAAQ,IAAI,EAAGD,CAAW,KAE1D,UAAOE,EAAaD,EAAiB,CAAE,UAAW,EAAK,CAAC,KACxD,UAAOE,KAAc,WAAQF,EAAiB,uBAAuB,CAAC,KACtE,UAAOG,KAAc,WAAQH,EAAiB,wBAAwB,CAAC,KACvE,UAAOI,KAAW,WAAQJ,EAAiB,oBAAoB,CAAC,EAEhE,IAAMK,KAAkB,WAAQL,EAAiB,cAAc,EACzDM,EAAc,KAAK,SAAM,gBAAaD,EAAiB,OAAO,CAAC,EACrEC,EAAY,KAAOP,KACnB,iBAAcM,EAAiB,KAAK,UAAUC,EAAa,KAAM,CAAC,CAAC,KAEnE,iBAAW,WAAQN,EAAiB,WAAW,KAAG,WAAQA,EAAiB,YAAY,CAAC,EAExF,QAAQ,IAAI,mDAAmDA,CAAe,wBAAwBD,CAAW,IAAI,CAEzH,OACOQ,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": ["import_node_fs", "import_node_path", "packageUrl", "distUrl", "buildinfoUrl", "changelogUrl", "readmeUrl", "templateUrl", "packageNameArgument", "packageName", "destinationPath", "templateUrl", "changelogUrl", "buildinfoUrl", "readmeUrl", "packageJsonPath", "packageJson", "error", "err"]
|
|
7
|
-
}
|
|
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
|