Skip to content

Commit 7255957

Browse files
committed
✨ Initial version
1 parent a506ec8 commit 7255957

File tree

24 files changed

+6984
-0
lines changed

24 files changed

+6984
-0
lines changed

.eslintrc.cjs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
module.exports = {
2+
root: true,
3+
extends: [
4+
'eslint:recommended',
5+
],
6+
parserOptions: {
7+
ecmaVersion: 2021,
8+
sourceType: 'module',
9+
},
10+
rules: {
11+
'comma-dangle': ['error', 'always-multiline'],
12+
indent: ['error', 'tab', { SwitchCase: 1 }],
13+
'no-console': 'warn',
14+
'no-warning-comments': ['warn', { terms: ['TODO', 'FIXME', 'XXX'], location: 'start' }],
15+
quotes: ['error', 'single'],
16+
'quote-props': ['error', 'as-needed'],
17+
semi: ['error', 'always'],
18+
},
19+
overrides: [
20+
{
21+
files: ['**/.eslintrc.js', '**/.eslintrc.cjs'],
22+
env: {
23+
node: true,
24+
},
25+
parserOptions: {
26+
ecmaVersion: 'latest',
27+
sourceType: 'module',
28+
},
29+
},
30+
{
31+
files: ['**/*.ts'],
32+
plugins: ['@typescript-eslint'],
33+
parser: '@typescript-eslint/parser',
34+
extends: ['plugin:@typescript-eslint/recommended'],
35+
rules: {
36+
'@typescript-eslint/member-delimiter-style': 'error',
37+
'@typescript-eslint/no-empty-interface': 'warn',
38+
'@typescript-eslint/no-explicit-any': 'error',
39+
'no-shadow': 'off',
40+
'@typescript-eslint/no-shadow': 'error',
41+
semi: 'off',
42+
'@typescript-eslint/semi': 'error',
43+
},
44+
},
45+
{
46+
files: ['**/*.ts'],
47+
plugins: ['@typescript-eslint'],
48+
parser: '@typescript-eslint/parser',
49+
extends: ['plugin:@typescript-eslint/recommended-requiring-type-checking'],
50+
rules: {
51+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
52+
},
53+
parserOptions: {
54+
tsconfigRootDir: __dirname,
55+
project: ['./tsconfig.json'],
56+
},
57+
},
58+
],
59+
};

.github/workflows/CI.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
validate:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
node: [ current, lts/*, lts/-1 ]
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Use Node.js (${{ matrix.node }})
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ matrix.node }}
26+
cache: 'npm'
27+
28+
- name: npm ci
29+
run: npm ci
30+
31+
- name: Validate
32+
run: npm run validate

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ISC License
2+
3+
Copyright (c) 2022, @MethodGrab
4+
5+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# create-elm-package
2+
3+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/MethodGrab/create-elm-package/CI?style=flat-square)](https://github.com/MethodGrab/create-elm-package/actions/workflows/CI.yaml)
4+
[![npm version](https://img.shields.io/npm/v/create-elm-package?style=flat-square)](https://www.npmjs.com/package/create-elm-package)
5+
6+
> An [npm initializer](https://docs.npmjs.com/cli/commands/npm-init) for creating new [Elm](https://elm-lang.org) packages.
7+
8+
9+
## Usage
10+
11+
```
12+
mkdir my-elm-package
13+
cd my-elm-package
14+
npm init elm-package
15+
```
16+
17+
18+
## What's included
19+
20+
Please review the generated code before using it to ensure it meets your needs and doesn't include anything you don't want.
21+
22+
- Basic Elm package boilerplate.
23+
- GitHub [Workflow actions](./templates/base/.github/workflows/CI.yaml) to:
24+
- Validate the package.
25+
- Automatically publish new versions using [`elm-publish-action`](https://github.com/dillonkearns/elm-publish-action).
26+
Note the initial version 1.0.0 must be published manually.
27+
28+
Note the GitHub workflow assumes your default branch is called `main`. If that's not the case, you can update the 2 references to `main` at the top of `.github/workflows/CI.yaml` after you run the initializer.
29+
30+
31+
## Development
32+
33+
1. Clone the repo.
34+
1. `cd create-elm-package`
35+
1. `npm install`
36+
1. `npm run dev`
37+
38+
In a separate session/tab/window:
39+
1. `npm link`
40+
1. `npm init elm-package`
41+
This will run the local cloned/linked version.
42+
43+
Instead of running `npm init elm-package` you can run the `create-elm-package` global binary directly.
44+
45+
Instead of linking it with `npm link` and using the global binary you can run the local binary directly: `./dist/cli.js`.

ava.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export default {
2+
extensions: {
3+
ts: 'module',
4+
},
5+
nodeArguments: [
6+
'--loader=ts-node/esm',
7+
],
8+
files: [
9+
'src/**/*.test.ts',
10+
],
11+
// Disabling worker threads is required to use process.chdir() otherwise you get:
12+
// TypeError { code: 'ERR_WORKER_UNSUPPORTED_OPERATION', message: 'process.chdir() is not supported in workers' }
13+
// https://github.com/avajs/ava/issues/2956#issuecomment-1023770164
14+
workerThreads: false,
15+
};

0 commit comments

Comments
 (0)