@temir.ra/create-workspace 0.4.6 → 0.4.8

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,13 @@
1
1
  # Version 0
2
2
 
3
+ ## 0.4.8
4
+
5
+ 1. Synced with `template` template.
6
+
7
+ ## 0.4.7
8
+
9
+ 1. Updated from `template@0.1.9` template.
10
+
3
11
  ## 0.4.6
4
12
 
5
13
  1. Minor updates to ensure consistency across templates.
package/README.md CHANGED
@@ -427,6 +427,8 @@ bun run clean
427
427
  bun run build
428
428
  bun run tests
429
429
 
430
+ bun run dist/cli.bundle.js -- example/
431
+
430
432
  # see publish section for publish instructions
431
433
  ```
432
434
 
package/buildinfo.txt CHANGED
@@ -1 +1 @@
1
- 0.4.6+9bbfe31
1
+ 0.4.8+2a16905
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{cpSync as s,readFileSync as f,renameSync as u,writeFileSync as P}from"fs";import{resolve as t}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('First argument must be the package name (e.g. "my-package" or "@my-scope/my-package").');let a=r.replace(/\\/g,"/"),e=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)}
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 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:Error(String(t));console.error("Error:",o.message),process.exit(1)}
3
3
 
4
- //# debugId=C4A0E6EEF1219B4364756E2164756E21
4
+ //# debugId=EF224A42FEFD5AB864756E2164756E21
@@ -2,10 +2,10 @@
2
2
  "version": 3,
3
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 } 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)\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(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"
5
+ "#!/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",
6
+ "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"
7
7
  ],
8
- "mappings": ";AAEA,iBAAS,kBAAQ,gBAAc,mBAAY,WAC3C,kBAAS,aCHT,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,EACD,MAAU,MAAM,wFAAwF,EAC5G,IAAM,EAAc,EAAoB,QAAQ,MAAO,GAAG,EAEpD,EAAkB,EAAQ,QAAQ,IAAI,EAAG,CAAW,EAE1D,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,I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ACnB,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": "EF224A42FEFD5AB864756E2164756E21",
10
10
  "names": []
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temir.ra/create-workspace",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "A template for a generic TypeScript workspace.",
5
5
  "author": "temir.ra",
6
6
  "license": "MIT",
@@ -28,16 +28,14 @@ function getManifest(packageIdentifier?: string): PackageManifest {
28
28
 
29
29
  const manifestPath = packageIdentifier
30
30
  ? join('node_modules', packageIdentifier, 'package.json')
31
- : 'package.json';
31
+ : 'package.json'
32
+ ;
32
33
 
33
34
  let manifest: PackageManifest;
34
35
  try {
35
36
  manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
36
37
  } catch {
37
- if (packageIdentifier)
38
- throw new Error(`[scripts/build-bundle.ts] Could not read manifest for '${packageIdentifier}' at '${manifestPath}'.`);
39
- else
40
- throw new Error(`[scripts/build-bundle.ts] Could not read package manifest at '${manifestPath}'.`);
38
+ throw new Error(`[scripts/build-bundle.ts] Failed to read package manifest at '${manifestPath}'.`);
41
39
  }
42
40
 
43
41
  return manifest;
@@ -104,7 +102,7 @@ const cdnRewritePlugin = {
104
102
  console.log(`[cdn-rewrite] '${importSpecifier}' → '${url}'`);
105
103
  }
106
104
 
107
- build.onResolve({ filter: /\*/ }, (args: any) => {
105
+ build.onResolve({ filter: /.*/ }, (args: any) => {
108
106
  const url = resolved.get(args.path);
109
107
  if (url) return { path: url, external: true };
110
108
  });
@@ -116,6 +114,8 @@ const cdnRewritePlugin = {
116
114
  const entrypoints = getManifestEntrypoints(getManifest());
117
115
  console.log('[scripts/build-bundle.ts] Entrypoints:', entrypoints);
118
116
 
117
+ const omitIife = process.argv.includes('--omit-iife');
118
+
119
119
  let buildResult;
120
120
 
121
121
  console.log('[scripts/build-bundle.ts] Starting ESM bundle build...');
@@ -139,23 +139,25 @@ if (!buildResult.success) {
139
139
  }
140
140
  console.log('[scripts/build-bundle.ts] ESM bundle build completed successfully.');
141
141
 
142
- console.log('[scripts/build-bundle.ts] Starting IIFE bundle build...');
143
- buildResult = await Bun.build({
144
- entrypoints,
145
- outdir: 'dist',
146
- naming: '[dir]/[name].iife.[ext]',
147
- target: 'browser',
148
- format: 'iife',
149
- minify: true,
150
- sourcemap: 'external',
151
- plugins: [cdnRewritePlugin],
152
- });
153
-
154
- if (!buildResult.success) {
155
- console.error('[scripts/build-bundle.ts] Build failed:');
156
- for (const message of buildResult.logs) {
157
- console.error(message);
142
+ if (!omitIife) {
143
+ console.log('[scripts/build-bundle.ts] Starting IIFE bundle build...');
144
+ buildResult = await Bun.build({
145
+ entrypoints,
146
+ outdir: 'dist',
147
+ naming: '[dir]/[name].iife.[ext]',
148
+ target: 'browser',
149
+ format: 'iife',
150
+ minify: true,
151
+ sourcemap: 'external',
152
+ plugins: [cdnRewritePlugin],
153
+ });
154
+
155
+ if (!buildResult.success) {
156
+ console.error('[scripts/build-bundle.ts] Build failed:');
157
+ for (const message of buildResult.logs) {
158
+ console.error(message);
159
+ }
160
+ process.exit(1);
158
161
  }
159
- process.exit(1);
162
+ console.log('[scripts/build-bundle.ts] IIFE bundle build completed successfully.');
160
163
  }
161
- console.log('[scripts/build-bundle.ts] IIFE bundle build completed successfully.');