Skip to content

Commit

Permalink
Upgrade to matrix ES edition
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalh committed Apr 16, 2024
1 parent 992dd90 commit ce8e1a8
Show file tree
Hide file tree
Showing 15 changed files with 295 additions and 90 deletions.
45 changes: 45 additions & 0 deletions .dnt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { dirname as pathDirname } from "node:path";
import { transform, type TransformOutput } from "DNT/transform";
import { copy as fsCopy } from "STD/fs/copy.ts";
import { emptyDir } from "STD/fs/empty_dir.ts";
import { ensureDir } from "STD/fs/ensure_dir.ts";
import { walk as readDir, type WalkEntry } from "STD/fs/walk.ts";
const pathsMain: WalkEntry[] = await Array.fromAsync(readDir("."));
const transformResult: TransformOutput = await transform({
entryPoints: ["mod.ts"],
mappings: {
"node:crypto": { name: "node:crypto" }
},
shims: [],
target: "Latest"
});
const npmOutputDir = "npm";
const npmOutputDirDist = `${npmOutputDir}/dist`;
const npmOutputDirSource = `${npmOutputDir}/src`;
await ensureDir(npmOutputDirDist);
await ensureDir(npmOutputDirSource);
await emptyDir(npmOutputDirDist);
await emptyDir(npmOutputDirSource);
for (const { filePath, fileText } of transformResult.main.files) {
const filePathOutput = `${npmOutputDirSource}/${filePath}`;
await ensureDir(pathDirname(filePathOutput));
await Deno.writeTextFile(filePathOutput, fileText);
}
for (const { path } of pathsMain) {
if (
/^LICENSE[^\\\/]*\.md$/.test(path) ||
/^README[^\\\/]*\.md$/.test(path)
) {
await fsCopy(path, `${npmOutputDir}/${path}`, {
overwrite: true,
preserveTimestamps: true
});
}
}
await new Deno.Command("pwsh", {
args: ["-NonInteractive", "-Command", "$ErrorActionPreference = 'Stop'; npm install; npm run build; npm publish --dry-run"],
cwd: `${Deno.cwd()}/${npmOutputDir}`,
stderr: "inherit",
stdin: "inherit",
stdout: "inherit"
}).output();
17 changes: 16 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ updates:
- "Platform/GitHubActions"
- "Status/Pending 🔵"
- "Type/Dependency 📦"
open-pull-requests-limit: 100
open-pull-requests-limit: 256
pull-request-branch-name:
separator: "/"
- package-ecosystem: "npm"
directory: "/npm"
schedule:
interval: "weekly"
day: "sunday"
time: "00:00"
timezone: "Etc/UTC"
labels:
- "Platform/NodeJS"
- "Status/Pending 🔵"
- "Type/Dependency 📦"
open-pull-requests-limit: 256
pull-request-branch-name:
separator: "/"
versioning-strategy: "widen"
7 changes: 5 additions & 2 deletions .github/workflows/announce-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
with:
key: "${{secrets.DISCORD_HXHS_PROJECTNEWRELEASEANNOUNCER_WEBHOOK}}"
embeds: |
- title: "Shuffle Array (TypeScript)"
- title: "Shuffle Array (ES)"
description: |
> ${{github.event.repository.description}}
Version ${{github.event.release.name}} (`${{github.event.release.tag_name}}`) just released!
timestamp: "${{github.event.release.published_at}}"
color: "#3178C6"
color: "#F7DF1E"
author:
name: "${{github.event.release.author.login}}"
url: "${{github.event.release.author.html_url}}"
Expand All @@ -39,3 +39,6 @@ jobs:
- name: "JSR"
value: "https://jsr.io/@hugoalh/shuffle-array"
inline: false
- name: "NPM"
value: "https://www.npmjs.com/package/@hugoalh/shuffle-array"
inline: false
25 changes: 25 additions & 0 deletions .github/workflows/invoke-devskim-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Invoke DevSkim Analysis"
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
types:
- "edited"
- "opened"
- "reopened"
- "synchronize"
schedule:
- cron: "0 0 * * SUN"
workflow_dispatch:
jobs:
main:
name: "Main"
permissions:
actions: "read"
contents: "read"
security-events: "write"
uses: "hugoalh/hugoalh/.github/workflows/call-invoke-devskim-analysis-0.yml@main"
7 changes: 6 additions & 1 deletion .github/workflows/publish-deno-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ jobs:
main:
name: "Main"
permissions:
contents: "read"
contents: "write"
id-token: "write"
uses: "hugoalh/hugoalh/.github/workflows/call-publish-deno-package-0.yml@main"
with:
deployment_jsr: true
deployment_npm: true
secrets:
NPM_TOKEN: "${{secrets.NPM_TOKEN}}"
10 changes: 6 additions & 4 deletions .github/workflows/review-deno-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ on:
workflow_dispatch:
jobs:
main:
name: "${{matrix.runon}}"
name: "${{matrix.run_on}}"
permissions:
contents: "read"
strategy:
matrix:
runon:
run_on:
- "ubuntu-latest"
fail-fast: false
uses: "hugoalh/hugoalh/.github/workflows/call-review-deno-code-1.yml@main"
uses: "hugoalh/hugoalh/.github/workflows/call-review-deno-code-2.yml@main"
with:
runon: "${{matrix.runon}}"
run_on: "${{matrix.run_on}}"
deployment_jsr: true
deployment_npm: true
8 changes: 6 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# yaml-language-server: $schema=https://citation-file-format.github.io/1.2.0/schema.json
cff-version: "1.2.0"
title: "Shuffle Array (TypeScript)"
title: "Shuffle Array (ES)"
message: "If you use this software, please cite it using the metadata from this file."
type: "software"
authors:
- name: "hugoalh Studio"
repository-code: "https://github.com/hugoalh-studio/shuffle-array-ts"
repository-code: "https://github.com/hugoalh-studio/shuffle-array-es"
keywords:
- "array"
- "es"
- "javascript"
- "js"
- "modulejs"
- "shuffle"
- "ts"
- "typescript"
Expand Down
Loading

0 comments on commit ce8e1a8

Please sign in to comment.