Skip to content

Commit

Permalink
reconcile with lingust (#48)
Browse files Browse the repository at this point in the history
* reconcile

Signed-off-by: Benji Visser <benji@093b.org>

* rm

Signed-off-by: Benji Visser <benji@093b.org>

* update

Signed-off-by: Benji Visser <benji@093b.org>

* lock

Signed-off-by: Benji Visser <benji@093b.org>

---------

Signed-off-by: Benji Visser <benji@093b.org>
  • Loading branch information
noqcks authored Feb 15, 2025
1 parent a291052 commit fdf69ba
Showing 349 changed files with 39,813 additions and 5,644 deletions.
23 changes: 0 additions & 23 deletions .eslintrc.json

This file was deleted.

32 changes: 23 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
name: Publish Package to npmjs

on:
push:
tags:
- '*'
release:
types: [published]


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: latest
cache: pnpm
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm publish

- run: pnpm install --frozen-lockfile
- run: pnpm build

- name: Set version to release tag 📝
run: pnpm version from-git --no-commit-hooks --no-git-tag-version --allow-same-version

- run: pnpm publish --no-git-checks --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Push version changes to main branch
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: release ${{ github.event.release.tag_name }}"
branch: ${{ github.event.repository.default_branch }}
file_pattern: package.json
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -5,14 +5,14 @@ on:
tags:
- '*'

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
29 changes: 18 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Run Tests
name: Test

on:
# Trigger the workflow on push or pull request, but only for the master branch
push:
branches:
- master
@@ -12,14 +11,22 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
node-version: latest
cache: pnpm

- name: install dependencies
run: pnpm install

- name: build
run: pnpm build

- name: lint
run: pnpm lint

- name: test
run: pnpm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
dist/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 Benji Visser
Copyright (c) 2025 Benji Visser

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
40 changes: 16 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,42 +3,34 @@
Not all files are written by humans. Generated will detect files that have been
generated by computers. Items like a `package-lock.json` or files in `node_modules`.

For a full list of generated files detected, see [generated.js](lib/generated.js).
For a full list of generated files detected, see [generated.ts](lib/generated.ts).

This project is largely a node.js port of the `generated` functionality of [GitHub linguist](https://github.com/github/linguist). The versioning of this project will follow the versioning of linguist.
This project is largely a node.js port of the `generated` functionality of [GitHub linguist](https://github.com/github/linguist).

# Installation
# Installation

```bash
pnpm add @noqcks/generated
```
npm i @noqcks/generated
```

https://www.npmjs.com/package/@noqcks/generated

# Usage

See file [scripts/example.js](scripts/example.js) for an example of usage.

```
const fs = require('fs');
const path = require('path');
const Generated = require("@noqcks/generated");
See file [scripts/example.ts](scripts/example.ts) for an example of usage.

const fileName = "JavaScript/json2_backbone.js"
const filePath = path.join("./samples", fileName);
```typescript
import * as fs from "fs";
import * as path from "path";
import Generated from "@noqcks/generated";

try {
var contents = fs.readFileSync(filePath, 'utf8');
} catch (e) {
if (e.code !== 'ENOENT') throw err;
var contents = ''
}
const name: string = "JavaScript/json2_backbone.js";
const filePath: string = path.join("./samples", name);
const contents = fs.readFileSync(filePath, "utf8");

const g = new Generated(name, contents)
const g: Generated = new Generated(name, Buffer.from(contents));

console.log(g.isGenerated())
console.log(g.isGenerated());
```

# LICENSE

[MIT](LICENSE) © 2022 Benji Visser <benji@093b.org>
[MIT](LICENSE) © 2025 Benji Visser <benji@093b.org>
13 changes: 13 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{ignores: ["samples/", "test/fixtures/**/*", "dist/**/*", "node_modules/**/*", "eslint.config.js", "jest.config.js"]},
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
3 changes: 0 additions & 3 deletions index.js

This file was deleted.

3 changes: 3 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Generated from "./lib/generated";

export default Generated;
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
const config = {
preset: 'ts-jest',
testEnvironment: 'node',
};

export default config;
Loading
Oops, something went wrong.

0 comments on commit fdf69ba

Please sign in to comment.