Skip to content

Commit 7bb2842

Browse files
committed
Switch PACKAGE_OUTPUT_PATH to --dist flag in the package build script
1 parent b6ad5ac commit 7bb2842

14 files changed

Lines changed: 77 additions & 52 deletions

File tree

‎pkgs/core/examples/cdn/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"main": "example.ts",
99
"scripts": {
1010
"build": "rm -rf node_modules/date-fns && mkdir -p node_modules && cp -r ../../dist node_modules/date-fns || pnpm run build-date-fns",
11-
"build-date-fns": "env PACKAGE_OUTPUT_PATH=\"$(pwd)/node_modules/date-fns\" ../../scripts/build/package.sh",
11+
"build-date-fns": "../../scripts/build/package.sh --dist \"$(pwd)/node_modules/date-fns\"",
1212
"test": "pnpm run test-basic && pnpm run test-fp && pnpm run test-locale && pnpm run test-locales",
1313
"test-basic": "test $(env TZ=UTC node ./basic.js) = true",
1414
"test-fp": "test $(env TZ=UTC node ./fp.js) = true",

‎pkgs/core/examples/lodash-fp/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"main": "example.js",
88
"scripts": {
99
"build": "pnpm run build-date-fns && pnpm run build-esbuild",
10-
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || env PACKAGE_OUTPUT_PATH=\"$(pwd)/node_modules/date-fns\" ../../scripts/build/package.sh",
10+
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || ../../scripts/build/package.sh --dist \"$(pwd)/node_modules/date-fns\"",
1111
"build-esbuild": "esbuild example.js --outdir=dist",
1212
"stats-size": "gzip-size dist/example.min.js",
1313
"test": "test $(env TZ=UTC node ./dist/example.js) = true"

‎pkgs/core/examples/node-esm/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"main": "example.ts",
99
"scripts": {
1010
"build": "rm -rf node_modules/date-fns && mkdir -p node_modules && cp -r ../../dist node_modules/date-fns || pnpm run build-date-fns",
11-
"build-date-fns": "env PACKAGE_OUTPUT_PATH=\"$(pwd)/node_modules/date-fns\" ../../scripts/build/package.sh",
11+
"build-date-fns": "../../scripts/build/package.sh --dist \"$(pwd)/node_modules/date-fns\"",
1212
"test": "pnpm run test-example && pnpm run test-fp && pnpm run test-misc && pnpm run test-constants",
1313
"test-example": "test $(env TZ=UTC node ./example.js) = true",
1414
"test-fp": "test $(env TZ=UTC node ./fp.js) = true",

‎pkgs/core/examples/rollup/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"main": "example.js",
99
"scripts": {
1010
"build": "pnpm run build-date-fns && pnpm run build-rollup",
11-
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || env PACKAGE_OUTPUT_PATH=\"$(pwd)/node_modules/date-fns\" ../../scripts/build/package.sh",
11+
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || ../../scripts/build/package.sh --dist \"$(pwd)/node_modules/date-fns\"",
1212
"build-rollup": "rollup --config",
1313
"stats-size": "echo \"Minimal size: $(gzip-size dist/minimal.js)\nFormat size: $(gzip-size dist/example.js)\nFP size: $(gzip-size dist/fp.js)\nMisc size: $(gzip-size dist/misc.js)\"",
1414
"test": "pnpm run test-example && pnpm run test-fp && pnpm run test-misc && pnpm run test-constants",

‎pkgs/core/examples/typescript/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "Sasha Koss <[email protected]>",
77
"scripts": {
88
"build": "pnpm run build-date-fns && tsc && pnpm run build-tsc",
9-
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || env PACKAGE_OUTPUT_PATH=\"$(pwd)/node_modules/date-fns\" ../../scripts/build/package.sh",
9+
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || ../../scripts/build/package.sh --dist \"$(pwd)/node_modules/date-fns\"",
1010
"build-tsc": "tsc --outDir dist",
1111
"build-esbuild": "esbuild constants.ts example.ts fp.ts misc.ts --outdir=dist",
1212
"test": "pnpm run test-example && pnpm run test-fp && pnpm run test-misc && pnpm run test-constants",

‎pkgs/core/examples/vite/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"build": "pnpm run build-date-fns && tsc && vite build",
8-
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || env PACKAGE_OUTPUT_PATH=\"$(pwd)/node_modules/date-fns\" ../../scripts/build/package.sh",
8+
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || ../../scripts/build/package.sh --dist \"$(pwd)/node_modules/date-fns\"",
99
"test": "echo \"We're just testing if it builds atm\""
1010
},
1111
"dependencies": {

‎pkgs/core/examples/webpack/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"main": "example.js",
88
"scripts": {
99
"build": "pnpm run build-date-fns && pnpm run build-webpack",
10-
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || env PACKAGE_OUTPUT_PATH=\"$(pwd)/node_modules/date-fns\" ../../scripts/build/package.sh",
10+
"build-date-fns": "rm -rf node_modules/date-fns && cp -r ../../dist node_modules/date-fns || ../../scripts/build/package.sh --dist \"$(pwd)/node_modules/date-fns\"",
1111
"build-webpack": "webpack",
1212
"stats-size": "echo \"Minimal size: $(gzip-size dist/minimal.min.js)\nFormat size: $(gzip-size dist/example.min.js)\nFP size: $(gzip-size dist/fp.min.js)\nMisc size: $(gzip-size dist/misc.min.js)\"",
1313
"test": "pnpm run test-example && pnpm run test-fp && pnpm run test-misc && pnpm run test-constants",

‎pkgs/core/scripts/build/cdn.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { dirname, join, relative } from "path";
99
import { listLocales, type LocaleFile } from "../_lib/listLocales.ts";
1010
import { promiseQueue } from "../test/_lib/queue.ts";
1111

12-
if (!process.env.PACKAGE_OUTPUT_PATH)
13-
throw new Error("PACKAGE_OUTPUT_PATH is not set");
12+
const outputPath = process.argv[2];
13+
if (!outputPath) throw new Error("Output path is not set");
1414

15-
const out = relative(process.cwd(), process.env.PACKAGE_OUTPUT_PATH);
15+
const out = relative(process.cwd(), outputPath);
1616

1717
const indexPath = join(out, "cdn.js");
1818
const fpIndexPath = join(out, "fp", "cdn.js");

‎pkgs/core/scripts/build/cts.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
import { readdir, copyFile } from "fs/promises";
1111
import { join, resolve } from "path";
1212

13-
const root = resolve(process.env.PACKAGE_OUTPUT_PATH || "lib");
13+
const outputPath = process.argv[2];
14+
if (!outputPath) throw new Error("Output path is not set");
15+
16+
const root = resolve(outputPath);
1417

1518
createCTSFiles(resolve(root));
1619

‎pkgs/core/scripts/build/flatten.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import { readFile, readdir, rmdir, stat, unlink, writeFile } from "fs/promises";
44
import { dirname, join, relative, resolve } from "path";
55

66
const dirsToRemove = new Set<string>();
7-
const root = resolve(process.env.PACKAGE_OUTPUT_PATH || "lib");
7+
const outputPath = process.argv[2];
8+
if (!outputPath) throw new Error("Output path is not set");
9+
10+
const root = resolve(outputPath);
811
const relativeRoot = relative(process.cwd(), root);
912

1013
async function main() {

0 commit comments

Comments
 (0)