@temir.ra/create-template 0.5.0 → 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.
@@ -1 +1 @@
1
- 0.5.0+49754e1
1
+ 0.5.2+cc0d30d
@@ -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
- .map(([key, conditions]) => {
61
- if (!conditions.entrypoint)
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 format = build.initialOptions.format || 'unknown';
109
+ const buildFormat = build.initialOptions.format ? `${build.initialOptions.format} ` : '';
113
110
  build.onStart(() => {
114
- console.log(`[esbuild-log plugin] ${format} build started...`);
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] ${format} build failed.`);
115
+ console.error(`[esbuild-log plugin] ${buildFormat}build failed.`);
119
116
  } else {
120
- console.log(`[esbuild-log plugin] ${format} build finished.`);
117
+ console.log(`[esbuild-log plugin] ${buildFormat}build finished.`);
121
118
  }
122
119
  });
123
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temir.ra/create-template",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "A template for a template package.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "tests": "node --import tsx --test tests/**/*.test.ts",
37
37
  "prebuild": "npm run buildinfo",
38
38
  "build": "npm run build:bundle",
39
- "build:bundle": "tsx scripts/build-bundle.ts"
39
+ "build:bundle": "tsx scripts/build-bundle.ts -- --omit-iife"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "latest",
@@ -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 l=new URL("../",__importMetaUrl),a=new URL("dist/",l),m=new URL("buildinfo.txt",a),p=new URL("CHANGELOG.md",a),g=new URL("README.md",l),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/', distUrl);\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,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,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
- }