-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
295 additions
and
90 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 |
---|---|---|
@@ -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(); |
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,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" |
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
Oops, something went wrong.