@techninja/clearstack 0.3.21 → 0.3.23

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.
@@ -3,8 +3,13 @@
3
3
  * @module lib/package-gen
4
4
  */
5
5
 
6
- import { writeFileSync } from 'node:fs';
7
- import { resolve } from 'node:path';
6
+ import { writeFileSync, readFileSync } from 'node:fs';
7
+ import { resolve, dirname } from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+
10
+ const __dirname = dirname(fileURLToPath(import.meta.url));
11
+ const ownPkg = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf-8'));
12
+ const ownVersion = `^${ownPkg.version.replace(/^\^/, '')}`;
8
13
 
9
14
  /**
10
15
  * Write a package.json tailored to the project mode.
@@ -33,7 +38,7 @@ export async function writePackageJson(dest, vars, existing) {
33
38
  };
34
39
 
35
40
  const specDevDeps = {
36
- '@techninja/clearstack': '^0.2.0',
41
+ '@techninja/clearstack': ownVersion,
37
42
  '@types/node': '^22.0.0',
38
43
  '@open-wc/testing': '^4.0.0',
39
44
  '@web/test-runner': '^0.20.0',
@@ -32,14 +32,17 @@ function copySkipExisting(src, dest, label) {
32
32
  mkdirSync(dest, { recursive: true });
33
33
  let count = 0;
34
34
  for (const entry of readdirSync(src, { withFileTypes: true })) {
35
+ const srcPath = join(src, entry.name);
35
36
  const destPath = join(dest, entry.name);
36
- if (existsSync(destPath)) {
37
+ if (entry.isDirectory()) {
38
+ count += copySkipExisting(srcPath, destPath, `${label}/${entry.name}`);
39
+ } else if (existsSync(destPath)) {
37
40
  console.log(` ⏭ Skipped: ${label}/${entry.name} (exists)`);
38
- continue;
41
+ } else {
42
+ cpSync(srcPath, destPath);
43
+ console.log(` ✓ Created: ${label}/${entry.name}`);
44
+ count++;
39
45
  }
40
- cpSync(join(src, entry.name), destPath, { recursive: entry.isDirectory() });
41
- console.log(` ✓ Created: ${label}/${entry.name}`);
42
- count++;
43
46
  }
44
47
  return count;
45
48
  }
@@ -104,10 +107,16 @@ export function initPlatform(platform, projectDir) {
104
107
  }
105
108
  }
106
109
 
107
- /** Run platform update: re-vendor + sync docs only. */
110
+ /** Run platform update: re-vendor, sync docs, add new scripts/api. */
108
111
  export function updatePlatform(platform, projectDir) {
109
- const { name, manifest } = platform;
112
+ const { name, manifest, pkgDir } = platform;
110
113
  console.log(`\n📦 Platform: ${name} (${manifest.prefix})`);
111
114
  vendorPlatform(platform, projectDir);
112
115
  syncPlatformDocs(platform, projectDir);
116
+ if (manifest.scripts) {
117
+ copySkipExisting(resolve(pkgDir, manifest.scripts), resolve(projectDir, 'scripts'), 'scripts');
118
+ }
119
+ if (manifest.api) {
120
+ copySkipExisting(resolve(pkgDir, manifest.api), resolve(projectDir, 'api'), 'api');
121
+ }
113
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techninja/clearstack",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "type": "module",
5
5
  "description": "A no-build web component framework specification — scaffold, validate, and evolve spec-compliant projects",
6
6
  "bin": {
@@ -27,9 +27,7 @@ jobs:
27
27
  - run: npm ci
28
28
 
29
29
  - name: Publish to npm
30
- run: npm publish --provenance --access public
31
- env:
32
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30
+ run: NODE_AUTH_TOKEN="" npm publish --provenance --access public
33
31
 
34
32
  - name: Generate changelog from commits
35
33
  id: changelog
@@ -36,7 +36,11 @@ const pkgPath = resolve(ROOT, 'package.json');
36
36
  const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
37
37
  const [ma, mi, pa] = pkg.version.split('.').map(Number);
38
38
  const next =
39
- bump === 'major' ? `${ma + 1}.0.0` : bump === 'minor' ? `${ma}.${mi + 1}.0` : `${ma}.${mi}.${pa + 1}`;
39
+ bump === 'major'
40
+ ? `${ma + 1}.0.0`
41
+ : bump === 'minor'
42
+ ? `${ma}.${mi + 1}.0`
43
+ : `${ma}.${mi}.${pa + 1}`;
40
44
  pkg.version = next;
41
45
  writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
42
46
  console.log(`\n📦 ${pkg.name} → v${next}\n`);