Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimum working example #1

Merged
merged 23 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Testing

on:
push:
branches:
- main
pull_request:
branches:
- '**'

jobs:
lint:
uses: stylelint/.github/.github/workflows/lint.yml@main
test:
uses: stylelint/.github/.github/workflows/test.yml@main
with:
node-version: '["14", "16", "18"]'
os: '["ubuntu-latest", "windows-latest", "macos-latest"]'
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*~
*[._]sw[g-p]
.eslintcache

node_modules/
.idea/
.vscode/
*.log
.DS_Store
1 change: 1 addition & 0 deletions .npmpackagejsonlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# stylelint-create
# stylelint-create

The [`npm init`](https://docs.npmjs.com/cli/v9/commands/npm-init) script for [Stylelint](https://github.com/stylelint/stylelint).

## Usage

Run `npm init stylelint`

## Contributing

- `npm install`
- to test locally, run `node create-stylelint.mjs`
- to test with [Vitest](https://vitest.dev/), `npm test`

## Acknowledgements

Inspired by [create-astro](https://github.com/withastro/astro/blob/main/packages/create-astro).
23 changes: 23 additions & 0 deletions create-stylelint.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env node
/* eslint-disable no-process-exit */
/* eslint-disable no-console */
'use strict';

const currentVersion = process.versions.node;

import { fileURLToPath } from 'node:url';
import fs from 'node:fs';
import path from 'node:path';
import semver from 'semver';

const dirname = path.dirname(fileURLToPath(import.meta.url));
const pkg = JSON.parse(fs.readFileSync(path.join(dirname, 'package.json').toString()));

if (!semver.satisfies(currentVersion, pkg.engines.node)) {
console.error(`Unsupported Node.js version (v${currentVersion})`);
console.error(`Install a Node.js version within "${pkg.engines.node}" and then try again.`);
process.exit(1);
}

// eslint-disable-next-line node/no-unsupported-features/es-syntax
import('./src/index.mjs').then(({ main }) => main());
Loading