diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..3d9718d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,14 @@ +{ + "name": "Ubuntu", + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "workspaceFolder": "/workspace", + "remoteEnv": { + "PATH": "/root/.proto/shims:/root/.proto/bin:${containerEnv:PATH}" + }, + "customizations": { + "jetbrains": { + "backend": "IntelliJ" + } + }, + "postCreateCommand": ".devcontainer/setup.sh" +} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 0000000..9898b84 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +curl -fsSL https://moonrepo.dev/install/proto.sh | PROTO_HOME=/usr/local bash -s -- --yes diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 16af3fb..590c775 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,15 +26,6 @@ jobs: steps: - uses: actions/checkout@v4 - - if: github.ref_name != 'main' - uses: actions-rs/cargo@v1 - with: - command: install - args: sd - - if: github.ref_name != 'main' - run: sd /appthrust/proto-toml-plugins/main/ /appthrust/proto-toml-plugins/${{ github.event.pull_request.head.ref }}/ .prototools - - if: github.ref_name != 'main' - run: cat .prototools - name: Install uses: moonrepo/setup-toolchain@v0 env: @@ -42,3 +33,5 @@ jobs: with: auto-install: true cache: false + - run: bun install --frozen-lockfile + - run: bun test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b1ee42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,175 @@ +# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore + +# Logs + +logs +_.log +npm-debug.log_ +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Caches + +.cache + +# Diagnostic reports (https://nodejs.org/api/report.html) + +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# Runtime data + +pids +_.pid +_.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover + +lib-cov + +# Coverage directory used by tools like istanbul + +coverage +*.lcov + +# nyc test coverage + +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) + +.grunt + +# Bower dependency directory (https://bower.io/) + +bower_components + +# node-waf configuration + +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) + +build/Release + +# Dependency directories + +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) + +web_modules/ + +# TypeScript cache + +*.tsbuildinfo + +# Optional npm cache directory + +.npm + +# Optional eslint cache + +.eslintcache + +# Optional stylelint cache + +.stylelintcache + +# Microbundle cache + +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history + +.node_repl_history + +# Output of 'npm pack' + +*.tgz + +# Yarn Integrity file + +.yarn-integrity + +# dotenv environment variable files + +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) + +.parcel-cache + +# Next.js build output + +.next +out + +# Nuxt.js build / generate output + +.nuxt +dist + +# Gatsby files + +# Comment in the public line in if your project uses Gatsby and not Next.js + +# https://nextjs.org/blog/next-9-1#public-directory-support + +# public + +# vuepress build output + +.vuepress/dist + +# vuepress v2.x temp and cache directory + +.temp + +# Docusaurus cache and generated files + +.docusaurus + +# Serverless directories + +.serverless/ + +# FuseBox cache + +.fusebox/ + +# DynamoDB Local files + +.dynamodb/ + +# TernJS port file + +.tern-port + +# Stores VSCode versions used for testing VSCode extensions + +.vscode-test + +# yarn v2 + +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/.prototools b/.prototools index a8f5ecc..be96c69 100644 --- a/.prototools +++ b/.prototools @@ -1,12 +1 @@ -black = "24.3.0" -k3d = "5.6.0" -k9s = "0.32.4" -moon = "1.23.4" -tilt = "0.33.12" - -[plugins] -black = "source:https://raw.githubusercontent.com/appthrust/proto-toml-plugins/main/black/plugin.toml" -k3d = "source:https://raw.githubusercontent.com/appthrust/proto-toml-plugins/main/k3d/plugin.toml" -k9s = "source:https://raw.githubusercontent.com/appthrust/proto-toml-plugins/main/k9s/plugin.toml" -moon = "source:https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml" -tilt = "source:https://raw.githubusercontent.com/appthrust/proto-toml-plugins/main/tilt/plugin.toml" +bun = "1.1.15" diff --git a/biome.jsonc b/biome.jsonc new file mode 100644 index 0000000..0f993f0 --- /dev/null +++ b/biome.jsonc @@ -0,0 +1,80 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.8.0/schema.json", + "files": { + // relative path from the workspace root + "ignore": [".moon"] + }, + "vcs": { + "enabled": true, + "clientKind": "git", + "defaultBranch": "main", + "useIgnoreFile": true + }, + "organizeImports": { + "enabled": true + }, + "formatter": { + "enabled": true, + "lineWidth": 120 + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "style": { + "useFilenamingConvention": { + "level": "warn", + "options": { + "strictCase": false, + "requireAscii": true, + "filenameCases": ["kebab-case"] + } + }, + "noDefaultExport": "warn", + "noNegationElse": "warn", + "useBlockStatements": "warn", + "useCollapsedElseIf": "warn", + "useConsistentArrayType": { + "level": "warn", + "options": { + "syntax": "shorthand" + } + }, + "useForOf": "warn", + "useFragmentSyntax": "warn", + "useShorthandArrayType": "warn", + "useShorthandAssign": "warn" + }, + "complexity": { + "useLiteralKeys": "off" + }, + "correctness": { + "useArrayLiterals": "warn", + "noUnusedVariables": "warn" + }, + "nursery": { + "useSortedClasses": "off", // why-not: eslint-plugin-tailwindcss does this + // ↓ We want to enable this rule, but we can't. Because it doesn't support monorepos at the moment. It's because it can't see the nearest package.json. This issue has been reported to the Issue: https://github.com/biomejs/biome/issues/2010 + // "noUndeclaredDependencies": "error"` + "noDuplicateElseIf": "warn", + "noDuplicateJsonKeys": "warn", + "noEvolvingTypes": "warn", + "noRestrictedImports": { + "level": "warn", + "options": { + "paths": { + "fs": "Use fs/promises instead of fs", + "node:fs": "Use node:fs/promises instead of node:fs", + "dns": "Use dns/promises instead of dns", + "node:dns": "Use node:dns/promises instead of node:dns" + } + } + }, + "noUselessUndefinedInitialization": "warn", + "useConsistentBuiltinInstantiation": "warn", + "useDefaultSwitchClause": "warn", + "useExplicitLengthCheck": "warn" + } + } + } +} diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..ed403c7 Binary files /dev/null and b/bun.lockb differ diff --git a/install.test.ts b/install.test.ts new file mode 100644 index 0000000..9bad56a --- /dev/null +++ b/install.test.ts @@ -0,0 +1,17 @@ +import { test } from "bun:test"; +import { mkdtemp } from "node:fs/promises"; +import os from "node:os"; +import { dirname } from "node:path"; +import { $, Glob } from "bun"; + +const tomlPattern = new Glob("*/*.toml"); +const tomlPaths = await Array.fromAsync(tomlPattern.scan(".")); +const dirs = tomlPaths.map(dirname); + +test.each(dirs)("proto install %s latest --pin local", async (name) => { + const dir = await mkdtemp(`${os.tmpdir()}/test-${name}-`); + const tomlPath = `${import.meta.dir}/${name}/plugin.toml`; + $.cwd(dir); + console.log(await $`proto plugin add ${name} source:${tomlPath}`.text()); + console.log(await $`proto install ${name} latest --pin local`.text()); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..21529fa --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "proto-toml-plugin", + "type": "module", + "devDependencies": { + "@biomejs/biome": "^1.8.1", + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..ffc08ab --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } +}