Skip to content

Commit 01a1784

Browse files
committed
siomplify release process
1 parent b003194 commit 01a1784

File tree

7 files changed

+19
-221
lines changed

7 files changed

+19
-221
lines changed

.github/workflows/README.md

Lines changed: 0 additions & 191 deletions
This file was deleted.

scripts/build-dist-package.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { join } from 'node:path';
2-
import { BIN_DIST_FOLDER_PATH } from '@shared/naming/project-fs-paths';
2+
import { DIST_PACKAGE_FOLDER_PATH } from '@shared/naming/project-fs-paths';
33
import { getPlatform } from '@shared/utils/bin-executable';
44
import { logInfo, logSuccess } from '@shared/utils/logging';
55
import { archiveItem } from '@shared/utils/zip';
@@ -34,7 +34,7 @@ const buildEverything = async () => {
3434

3535
logInfo(`Building binary for platform: ${platform}, version: ${version}`);
3636

37-
const distFolderPath = BIN_DIST_FOLDER_PATH;
37+
const distFolderPath = DIST_PACKAGE_FOLDER_PATH;
3838
await remove(distFolderPath);
3939

4040
const platformDistFolderPath = await buildBinaryFile({

scripts/build-npm.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import { NPM_PACKAGE_JSON_SOURCE_PATH, NPM_RELEASE_FOLDER_PATH } from '../shared
44
import { logInfo, logSuccess } from '../shared/utils/logging';
55
import { buildNpmMainExport } from './build-npm-main-export';
66
import { buildNpmSdkExport } from './build-npm-sdk-export.js';
7-
import { packageHelperLambdas } from './package-helper-lambdas.js';
87
import { getVersion } from './release/args';
98

109
export const copySdkPackageJson = async (version?: string) => {
1110
const packageJson = await readJson(NPM_PACKAGE_JSON_SOURCE_PATH);
1211

13-
// Update version if provided
1412
if (version) {
1513
packageJson.version = version;
1614
}
@@ -35,7 +33,6 @@ export const buildNpm = async ({ version }: { version?: string } = {}) => {
3533
await Promise.all([
3634
buildNpmMainExport(),
3735
buildNpmSdkExport({ distFolderPath: NPM_RELEASE_FOLDER_PATH }),
38-
packageHelperLambdas({ isDev: false, distFolderPath: NPM_RELEASE_FOLDER_PATH }),
3936
copySdkPackageJson(versionToUse),
4037
copyBinWrapper()
4138
]);

scripts/dev.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { CLI_DIST_PATH, CLI_SOURCE_PATH, DIST_FOLDER_PATH } from '@shared/naming/project-fs-paths';
1+
import { CLI_SOURCE_PATH, DEV_TMP_FOLDER_PATH } from '@shared/naming/project-fs-paths';
22
import { dynamicRequire } from '@shared/utils/fs-utils';
33
import { logError, logInfo, logWarn } from '@shared/utils/logging';
44
import packageJson from '../package.json';
5-
import { generateSourceMapInstall } from './build-cli-sources';
65
import { packageHelperLambdas } from './package-helper-lambdas';
6+
import { generateSourceMapInstall } from './release/build-cli-sources';
77

88
const buildSource = async () => {
99
const result = await Bun.build({
1010
entrypoints: [CLI_SOURCE_PATH],
11-
outdir: CLI_DIST_PATH,
11+
outdir: DEV_TMP_FOLDER_PATH,
1212
target: 'bun',
1313
minify: false,
1414
sourcemap: 'inline',
@@ -20,20 +20,21 @@ const buildSource = async () => {
2020
if (!result.success) {
2121
throw new Error(`Failed to build source: ${result.logs.map((log) => log.message).join('\n')}`);
2222
}
23+
return result.outputs[0].path;
2324
};
2425

2526
export const runDev = async () => {
26-
await Promise.all([
27+
const [cliDistPath] = await Promise.all([
2728
buildSource(),
28-
packageHelperLambdas({ isDev: true, distFolderPath: DIST_FOLDER_PATH }),
29-
generateSourceMapInstall({ distFolderPath: DIST_FOLDER_PATH })
29+
packageHelperLambdas({ isDev: true, distFolderPath: DEV_TMP_FOLDER_PATH }),
30+
generateSourceMapInstall({ distFolderPath: DEV_TMP_FOLDER_PATH })
3031
]);
3132

3233
logInfo('----- RUN -----');
3334
try {
3435
process.env.STP_DEV_MODE = 'true';
3536
const { runUsingCli } = dynamicRequire({
36-
filePath: CLI_DIST_PATH
37+
filePath: cliDistPath
3738
}) as typeof import('../src/api/cli');
3839
await runUsingCli();
3940
logInfo('----- FINISHED -----');

scripts/release/build-cli-sources.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { arch } from 'node:os';
2-
import { basename, dirname, join } from 'node:path';
2+
import { basename, join } from 'node:path';
33
import {
4-
CLI_BUILD_DIST_FOLDER_PATH,
5-
CLI_DIST_PATH,
64
COMPLETIONS_SCRIPTS_PATH,
75
CONFIG_SCHEMA_PATH,
86
DIST_FOLDER_PATH,
@@ -97,11 +95,11 @@ export const EXECUTABLE_FILE_PATTERNS = [
9795
'*/exec.exe'
9896
];
9997

100-
export const generateSourceMapInstall = async ({ distFolderPath }: { distFolderPath?: string }) => {
98+
export const generateSourceMapInstall = async ({ distFolderPath }: { distFolderPath: string }) => {
10199
logInfo('Generating source map install file...');
102100
await buildEsCode({
103101
rawCode: 'require("source-map-support").install({ environment: "node", handleUncaughtExceptions: false });',
104-
distPath: join(distFolderPath || CLI_BUILD_DIST_FOLDER_PATH, SOURCE_MAP_INSTALL_FILE_NAME),
102+
distPath: join(distFolderPath, SOURCE_MAP_INSTALL_FILE_NAME),
105103
externals: ['path'],
106104
excludeDependencies: ['path'],
107105
sourceMaps: 'disabled',
@@ -357,12 +355,6 @@ export const createReleaseDataFile = async ({
357355
logSuccess('Release data file created successfully.');
358356
};
359357

360-
export const copyLegalComments = async ({ distFolderPath }: { distFolderPath?: string }) => {
361-
logInfo('Copying config schema...');
362-
await copy(join(dirname(CLI_DIST_PATH), `${basename(CLI_DIST_PATH)}.LEGAL.txt`), join(distFolderPath, 'LEGAL.txt'));
363-
logSuccess('Config schema copied successfully.');
364-
};
365-
366358
export const getPlatformsToBuildFor = ({
367359
presetPlatforms
368360
}: {

scripts/release/github.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { basename, join } from 'node:path';
2-
import { BIN_DIST_FOLDER_PATH } from '@shared/naming/project-fs-paths';
2+
import { DIST_PACKAGE_FOLDER_PATH } from '@shared/naming/project-fs-paths';
33
import { createRelease, getReleaseByTag } from '@shared/utils/github-api';
44
import { uploadReleaseAsset } from '@shared/utils/github-file-manipulation';
55
import { logInfo, logSuccess } from '@shared/utils/logging';
@@ -31,12 +31,12 @@ export const createGithubRelease = async ({ version, isPrerelease }: { version:
3131

3232
export const uploadReleaseAssets = async ({ releaseId }: { uploadUrl: string; releaseId: number }) => {
3333
logInfo('Uploading release assets...');
34-
const allItems = await readdir(BIN_DIST_FOLDER_PATH);
34+
const allItems = await readdir(DIST_PACKAGE_FOLDER_PATH);
3535

3636
// Filter to only archive files (.tar.gz and .zip), skip directories
3737
const assetsToUpload: string[] = [];
3838
for (const item of allItems) {
39-
const absolutePath = join(BIN_DIST_FOLDER_PATH, item);
39+
const absolutePath = join(DIST_PACKAGE_FOLDER_PATH, item);
4040
const stats = await stat(absolutePath);
4141
if (stats.isFile() && (item.endsWith('.tar.gz') || item.endsWith('.zip'))) {
4242
assetsToUpload.push(item);
@@ -45,7 +45,7 @@ export const uploadReleaseAssets = async ({ releaseId }: { uploadUrl: string; re
4545

4646
await Promise.all(
4747
assetsToUpload.map((assetName) => {
48-
const absoluteAssetPath = join(BIN_DIST_FOLDER_PATH, assetName);
48+
const absoluteAssetPath = join(DIST_PACKAGE_FOLDER_PATH, assetName);
4949
return uploadReleaseAsset({
5050
assetName: basename(assetName),
5151
sourceFilePath: absoluteAssetPath,

shared/naming/project-fs-paths.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ export const BRIDGE_FILES_FOLDER_NAME = 'bridge-files';
66
export const HELPER_LAMBDAS_FOLDER_NAME = 'helper-lambdas';
77
const JSON_SCHEMAS_FOLDER_NAME = 'schemas';
88
const SOURCE_MAP_INSTALL_FILENAME = 'source-map-install.js';
9-
const BINARY_DIST_FOLDER_NAME = '__binary-dist';
109
const CLI_RELEASE_FOLDER_NAME = '__release';
1110
const SDK_RELEASE_FOLDER_NAME = '__release-npm';
1211
export const STARTER_PROJECTS_METADATA_FOLDER_NAME = 'starter-projects-metadata.json';
1312

1413
export const DIST_FOLDER_PATH = join(process.cwd(), DIST_FOLDER_NAME);
14+
export const DEV_TMP_FOLDER_PATH = join(process.cwd(), 'node_modules', '__dev-tmp');
1515
export const CLI_BUILD_DIST_FOLDER_PATH = join(process.cwd(), '__cli-dist', 'stacktape');
16-
export const BIN_DIST_FOLDER_PATH = join(process.cwd(), BINARY_DIST_FOLDER_NAME);
16+
export const DIST_PACKAGE_FOLDER_PATH = join(process.cwd(), '__dist');
1717
export const CLI_RELEASE_FOLDER_PATH = join(process.cwd(), CLI_RELEASE_FOLDER_NAME);
1818
export const NPM_RELEASE_FOLDER_PATH = join(process.cwd(), SDK_RELEASE_FOLDER_NAME);
1919
export const PUBLISH_GITHUB_REPO_DIR_PATH = join(process.cwd(), '__publish-gh-repo-dir');
@@ -29,7 +29,6 @@ export const RESOURCES_DESCRIPTION_DIST_PATH = join(process.cwd(), '.resource-de
2929
export const BRIDGE_FILES_SOURCE_FOLDER_PATH = join(SOURCE_FOLDER_NAME, 'utils', BRIDGE_FILES_FOLDER_NAME);
3030
export const HELPER_LAMBDAS_DIST_FOLDER_PATH = join(DIST_FOLDER_PATH, HELPER_LAMBDAS_FOLDER_NAME);
3131
export const HELPER_LAMBDAS_SOURCE_FOLDER_PATH = join(process.cwd(), HELPER_LAMBDAS_FOLDER_NAME);
32-
export const CLI_DIST_PATH = join(DIST_FOLDER_PATH, 'cli.js');
3332
export const GENERATED_FILES_FOLDER_PATH = join(process.cwd(), '@generated');
3433
export const JSON_SCHEMAS_FOLDER_PATH = join(process.cwd(), '@generated', JSON_SCHEMAS_FOLDER_NAME);
3534
export const PACK_GENERATED_FOLDER_PATH = join(process.cwd(), '@generated', 'pack');

0 commit comments

Comments
 (0)