Skip to content

Commit

Permalink
Add minimum working example (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: Masafumi Koba <[email protected]>
Co-authored-by: Richard Hallows <[email protected]>
Co-authored-by: Marc G. <[email protected]>
  • Loading branch information
4 people authored Feb 7, 2023
1 parent bd5891b commit c6d6ada
Show file tree
Hide file tree
Showing 14 changed files with 13,673 additions and 1 deletion.
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

0 comments on commit c6d6ada

Please sign in to comment.