Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
bertdeblock committed Sep 21, 2023
0 parents commit 869177d
Show file tree
Hide file tree
Showing 31 changed files with 3,782 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";

module.exports = {
env: {
node: true,
},
extends: ["eslint:recommended", "plugin:n/recommended"],
parser: "@babel/eslint-parser",
parserOptions: {
requireConfigFile: false,
sourceType: "module",
},
root: true,
};
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

concurrency:
cancel-in-progress: true
group: ci-${{github.head_ref || github.ref}}

on:
pull_request:
branches: main
push:
branches: main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v2
- run: pnpm lint

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v2
- run: pnpm test

scenario:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v2
- run: pnpm build
- run: pnpm install
working-directory: test-app
- run: node ../bin/try-or-die.js scenario ${{matrix.scenario}}
working-directory: test-app
strategy:
matrix:
scenario:
- ember-lts-4.8
- ember-lts-4.12
- ember-release
- ember-beta
- ember-canary
- embroider-safe
- embroider-optimized

scenarios:
needs: test
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v2
- run: pnpm build
- run: pnpm install
working-directory: test-app
- run: node ../bin/try-or-die.js scenarios
working-directory: test-app
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage/
dist/
node_modules/
.eslintcache
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# try-or-die

[![CI](https://github.com/bertdeblock/try-or-die/workflows/CI/badge.svg)](https://github.com/bertdeblock/try-or-die/actions?query=workflow%3ACI)

An experiment inspired by [ember-try](https://github.com/ember-cli/ember-try),
but decoupled from [ember-cli](https://github.com/ember-cli/ember-cli).

## Configuration

```js
// try-or-die.config.js

import { embroiderOptimized, embroiderSafe } from "@embroider/test-setup";
import emberSourceChannelURL from "ember-source-channel-url";

export default {
// Type: "bun" | "npm" | "pnpm" | "yarn"
// Default: "npm"
packageManager: "pnpm",

// Type: string[]
// Default: []
packageManagerInstallOptions: ["--no-lockfile"],

// Type: [string, ...string[]]
// Default: [config.packageManager, "test"]
testCommand: ["pnpm", "test:ember"],

// Type: Scenario[]
// Default: []
scenarios: [
{
name: "ember-lts-4.8",
packageJson: {
devDependencies: {
"ember-source": "~4.8.0",
},
},
},
{
name: "ember-lts-4.12",
packageJson: {
devDependencies: {
"ember-source": "~4.12.0",
},
},
},
{
name: "ember-release",
packageJson: {
devDependencies: {
"ember-source": await emberSourceChannelURL("release"),
},
},
},
{
name: "ember-beta",
packageJson: {
devDependencies: {
"ember-source": await emberSourceChannelURL("beta"),
},
},
},
{
name: "ember-canary",
packageJson: {
devDependencies: {
"ember-source": await emberSourceChannelURL("canary"),
},
},
},
// `ember-try` scenarios are supported as well:
embroiderSafe(),
embroiderOptimized(),
],
};
```

## Usage

```shell
# Run a single scenario:
try-or-die scenario ember-release

# Run all scenarios:
try-or-die scenarios

# Run multiple scenarios:
try-or-die scenarios --names ember-release ember-beta ember-canary

# Use a custom path to a `try-or-die` config file:
try-or-die scenarios --config-path=config/try-or-die.config.js

# See all options:
try-or-die --help
try-or-die --help scenario
try-or-die --help scenarios
```
4 changes: 4 additions & 0 deletions bin/try-or-die.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

// eslint-disable-next-line n/no-missing-import
import "../dist/cli/index.js";
64 changes: 64 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "try-or-die",
"version": "0.1.0",
"description": "Try? Or die?",
"license": "MIT",
"author": "Bert De Block",
"type": "module",
"main": "index.js",
"bin": {
"try-or-die": "bin/try-or-die.js"
},
"files": [
"bin/",
"dist/"
],
"scripts": {
"build": "tsc --project tsconfig.json",
"lint": "concurrently --group --prefix-colors auto \"npm:lint:*(!fix)\"",
"lint:fix": "concurrently --group --prefix-colors auto \"npm:lint:*:fix\"",
"lint:format": "prettier . --cache --check",
"lint:format:fix": "prettier . --cache --write",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"lint:types": "tsc --noEmit",
"prepack": "tsc --project tsconfig.json",
"prepare": "pnpm build",
"start": "pnpm build --watch",
"test": "vitest",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"chalk": "^5.3.0",
"debug": "^4.3.4",
"execa": "^8.0.1",
"find-up": "^6.3.0",
"flatten-anything": "^3.0.5",
"fs-extra": "^11.1.1",
"lodash.set": "^4.3.2",
"temp-dir": "^3.0.0",
"yargs": "^17.7.2"
},
"devDependencies": {
"@babel/core": "^7.22.17",
"@babel/eslint-parser": "^7.22.15",
"@types/debug": "^4.1.8",
"@types/fs-extra": "^11.0.1",
"@types/lodash.set": "^4.3.7",
"@types/node": "^20.6.0",
"@types/yargs": "^17.0.24",
"@vitest/coverage-v8": "^0.34.4",
"concurrently": "^8.2.1",
"eslint": "^8.49.0",
"eslint-plugin-n": "^16.0.2",
"fixturify-project": "^6.0.0",
"prettier": "^3.0.3",
"type-fest": "^4.3.1",
"typescript": "^5.2.2",
"vitest": "^0.34.4"
},
"packageManager": "pnpm@8.7.4",
"volta": {
"node": "18.17.1"
}
}
Loading

0 comments on commit 869177d

Please sign in to comment.