-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from Hexagon/dev
9.0 stable
- Loading branch information
Showing
79 changed files
with
4,519 additions
and
12,719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
dist/* linguist-generated | ||
dist-docs/* linguist-documentation | ||
src/helpers/minitz.ts linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Cross Runtime Tests | ||
|
||
on: | ||
push: | ||
branches: [main, dev, dev-9.0] | ||
pull_request: | ||
branches: [main, dev, dev-9.0] | ||
|
||
jobs: | ||
deno_ci: | ||
uses: cross-org/workflows/.github/workflows/deno-ci.yml@main | ||
with: | ||
entrypoint: src/croner.ts | ||
lint_docs: false | ||
bun_ci: | ||
uses: cross-org/workflows/.github/workflows/bun-ci.yml@main | ||
with: | ||
jsr_dependencies: "@cross/test @std/assert" | ||
node_ci: | ||
uses: cross-org/workflows/.github/workflows/node-ci.yml@main | ||
with: | ||
test_target: "test/*.test.ts" | ||
jsr_dependencies: "@cross/test @std/assert" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@jsr:registry=https://npm.jsr.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import esbuild from "esbuild"; | ||
import { dtsPlugin } from "esbuild-plugin-d.ts"; | ||
import { cp, readFile, writeFile } from "@cross/fs"; | ||
|
||
/** | ||
* Build helpers | ||
*/ | ||
export async function build( | ||
baseConfig: esbuild.BuildOptions, | ||
configs?: esbuild.BuildOptions[], | ||
): Promise<void> { | ||
const buildConfigs = configs?.map((config) => ({ ...baseConfig, ...config })) || [baseConfig]; | ||
try { | ||
await Promise.all(buildConfigs.map((config) => esbuild.build(config))); | ||
console.log("All builds completed successfully."); | ||
} catch (error) { | ||
console.error("Build failed:", error); | ||
} | ||
} | ||
async function readJson<T>(filePath: string): Promise<T> { | ||
const jsonData = await readFile(filePath); | ||
return JSON.parse(new TextDecoder().decode(jsonData)) as T; | ||
} | ||
|
||
/** | ||
* Now the actual build script | ||
*/ | ||
import { dirname, fromFileUrl, resolve } from "@std/path"; | ||
|
||
/* Preparations - Work out paths */ | ||
const baseRelativeProjectRoot = "../"; // Where is this script located relative to the project root | ||
const currentScriptDir = dirname(fromFileUrl(import.meta.url)); | ||
const relativeProjectRoot = resolve(currentScriptDir, baseRelativeProjectRoot); | ||
const resolvedDistPath = resolve(relativeProjectRoot, "dist"); | ||
|
||
/* Handle argument `clean`: Rimraf build artifacts */ | ||
if (Deno.args[1] === "clean") { | ||
for ( | ||
const filePath of [ | ||
"package.json", | ||
"tsconfig.json", | ||
"node_modules", | ||
"dist", | ||
] | ||
) { | ||
try { | ||
await Deno.remove(filePath, { recursive: true }); | ||
} catch (_e) { /* No-op */ } | ||
} | ||
|
||
/* Handle argument `build`: Transpile and generate typings */ | ||
} else if (Deno.args[1] === "build") { | ||
await build({ | ||
entryPoints: [resolve(relativeProjectRoot, "src/croner.ts")], | ||
bundle: true, | ||
minify: true, | ||
sourcemap: false, | ||
}, [ | ||
{ | ||
outdir: resolvedDistPath, | ||
platform: "node", | ||
format: "cjs", | ||
outExtension: { ".js": ".cjs" }, | ||
}, | ||
{ | ||
entryPoints: [], | ||
stdin: { | ||
contents: 'import { Cron } from "./croner.ts";module.exports = Cron;', | ||
resolveDir: "./src/", | ||
}, | ||
outfile: resolve(resolvedDistPath, "croner.umd.js"), | ||
platform: "browser", | ||
format: "iife", | ||
globalName: "Cron", | ||
}, | ||
{ | ||
outdir: resolvedDistPath, | ||
platform: "neutral", | ||
format: "esm", | ||
plugins: [dtsPlugin({ | ||
experimentalBundling: true, | ||
tsconfig: { | ||
compilerOptions: { | ||
declaration: true, | ||
emitDeclarationOnly: true, | ||
allowImportingTsExtensions: true, | ||
lib: ["es6", "dom"], | ||
}, | ||
}, | ||
})], | ||
}, | ||
]); | ||
|
||
// Just re-use the .d.ts for commonjs, as .d.cts | ||
await cp( | ||
resolve(resolvedDistPath, "croner.d.ts"), | ||
resolve(resolvedDistPath, "croner.d.cts"), | ||
); | ||
|
||
/* Handle argument `package`: Generate package.json based on a base config and values from deno,json */ | ||
} else if (Deno.args[1] === "package") { | ||
// Read version from deno.json | ||
const denoConfig = await readJson<{ version: string }>(resolve(relativeProjectRoot, "deno.json")); | ||
|
||
// Write package.json | ||
await writeFile( | ||
resolve(relativeProjectRoot, "package.json"), | ||
new TextEncoder().encode(JSON.stringify( | ||
{ | ||
...await readJson<object>(resolve(relativeProjectRoot, "build/package.template.json")), | ||
version: denoConfig.version, | ||
}, | ||
null, | ||
2, | ||
)), | ||
); | ||
} |
Oops, something went wrong.