Skip to content

Commit

Permalink
feat: create slack-archive-tools (#1286)
Browse files Browse the repository at this point in the history
  • Loading branch information
noshiro-pf authored Aug 28, 2024
1 parent a02e782 commit 0db2bc4
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ packages/strict-ts-lib/output-branded/diff
packages/strict-ts-lib/output-branded/final
packages/strict-ts-lib/output-branded/packages

packages/others/slack-archive-tools/archive

# Optional eslint cache
.eslintcache
.eslintcache-deps
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@rollup/plugin-typescript": "^11.1.6",
"@types/argparse": "^2.0.16",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.24",
"@types/node": "20.12",
"@types/nodemailer": "^6.4.4",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.24",
Expand Down
2 changes: 2 additions & 0 deletions packages/others/slack-archive-tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
archive/**/*
archive/*
11 changes: 11 additions & 0 deletions packages/others/slack-archive-tools/configs/rollup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable import/no-default-export */
/* eslint-disable import/no-internal-modules */

import { toThisDir } from '@noshiro/mono-scripts';
import { defineRollupConfig } from '../../../../configs/define-rollup-config.mjs';
import tsconfig from './tsconfig.build.json' assert { type: 'json' };

export default defineRollupConfig({
configDir: toThisDir(import.meta.url),
outDirRelative: tsconfig.compilerOptions.outDir,
});
13 changes: 13 additions & 0 deletions packages/others/slack-archive-tools/configs/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": [
"../../../../configs/tsconfig/tsconfig.lib.build.json",
"../../../../configs/tsconfig/tsconfig.vite.json"
],
"compilerOptions": {
"outDir": "../dist",
"declarationDir": "../dist",
"rootDir": "../src"
},
"include": ["../src"],
"exclude": ["../src/**/*.test.mts"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": [
"../../../../configs/tsconfig/tsconfig.test.json",
"../../../../configs/tsconfig/tsconfig.vite.json"
],
"include": ["../src"]
}
18 changes: 18 additions & 0 deletions packages/others/slack-archive-tools/configs/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { toThisDir } from '@noshiro/mono-scripts';
import * as nodePath from 'node:path';
import { defineConfig } from 'vitest/config';

const thisDir: string = toThisDir(import.meta.url);

// https://github.com/vitest-dev/vitest/blob/v1.5.0/test/import-meta/vite.config.ts
export default defineConfig({
test: {
globals: true,
dir: nodePath.resolve(thisDir, '../src'),
includeSource: [nodePath.resolve(thisDir, '../src/**/*.mts')],
typecheck: {
tsconfig: nodePath.resolve(thisDir, 'tsconfig.test.json'),
},
passWithNoTests: true,
},
});
45 changes: 45 additions & 0 deletions packages/others/slack-archive-tools/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/** @typedef {import('@noshiro/eslint-configs').FlatConfig} FlatConfig */

import {
eslintFlatConfigForTypeScript,
eslintFlatConfigForVitest,
genEsLintRestrictedImportsDefFromDevDependencies,
} from '@noshiro/eslint-configs';
import { toThisDir } from '@noshiro/mono-scripts';
import * as nodePath from 'node:path';
import packageJson from './package.json' assert { type: 'json' };

const thisDir = toThisDir(import.meta.url);

/** @returns {Promise<readonly FlatConfig[]>} */
const defineConfig = async () => {
const restrictedImports =
await genEsLintRestrictedImportsDefFromDevDependencies(
packageJson.devDependencies,
);

/** @type {readonly FlatConfig[]} */
const configs = [
...eslintFlatConfigForTypeScript({
tsconfigRootDir: thisDir,
tsconfigFileName: './tsconfig.json',
packageDirs: [nodePath.resolve(thisDir, '../../..'), thisDir],
}),
eslintFlatConfigForVitest(),

{
rules: {
'@typescript-eslint/no-restricted-imports': [
'error',
...restrictedImports,
],
'security/detect-non-literal-fs-filename': 'off',
'no-await-in-loop': 'off',
},
},
];

return configs;
};

export default defineConfig();
53 changes: 53 additions & 0 deletions packages/others/slack-archive-tools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "@noshiro/slack-archive-tools",
"version": "1.0.0",
"license": "MIT",
"author": "noshiro-pf <[email protected]>",
"sideEffects": true,
"type": "module",
"main": "main.mjs",
"scripts": {
"build": "wireit",
"clean": "run-p clean:build clean:wireit",
"clean:build": "rimraf esm",
"clean:src": "rimraf src/*.mts",
"clean:wireit": "rimraf .wireit/**",
"fmt": "yarn zz:prettier .",
"lint": "yarn zz:eslint:src",
"lint:fix": "yarn zz:eslint:src --fix",
"main": "wireit",
"test": "yarn zz:vitest run",
"testw": "yarn zz:vitest watch",
"tsc": "yarn type-check",
"tscw": "tsc --noEmit --watch",
"type-check": "tsc --noEmit",
"zz:eslint": "ESLINT_USE_FLAT_CONFIG=true TIMING=1 eslint",
"zz:eslint:print-config": "yarn zz:eslint --print-config src/index.mts",
"zz:eslint:src": "yarn zz:eslint --config eslint.config.js './src/**/*'",
"zz:prettier": "prettier --cache --cache-strategy content --ignore-path ../../../.prettierignore --write",
"zz:vitest": "vitest --config ./configs/vitest.config.ts"
},
"dependencies": {
"@noshiro/io-ts": "*",
"@noshiro/ts-utils": "*"
},
"devDependencies": {
"@noshiro/eslint-configs": "*",
"@noshiro/mono-scripts": "*",
"@noshiro/ts-type-utils": "*"
},
"wireit": {
"build": {
"dependencies": [
"clean:build"
],
"command": "rollup --config ./configs/rollup.config.ts --configPlugin typescript"
},
"main": {
"dependencies": [
"build"
],
"command": "node ./dist/main.mjs"
}
}
}
5 changes: 5 additions & 0 deletions packages/others/slack-archive-tools/src/main.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const main = (): void => {
console.log('TODO');
};

main();
7 changes: 7 additions & 0 deletions packages/others/slack-archive-tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": [
"../../../configs/tsconfig/tsconfig.lib.type-check.json",
"../../../configs/tsconfig/tsconfig.vite.json"
],
"include": ["./src", "./configs"]
}
42 changes: 13 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4617,13 +4617,20 @@
resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.34.tgz#10964ba0dee6ac4cd462e2795b6bebd407303433"
integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==

"@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@^20.10.3", "@types/node@^20.11.24":
"@types/node@*", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@^20.10.3":
version "20.11.24"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.11.24.tgz#cc207511104694e84e9fb17f9a0c4c42d4517792"
integrity sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==
dependencies:
undici-types "~5.26.4"

"@types/[email protected]":
version "20.12.14"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.14.tgz#0c5cf7ef26aedfd64b0539bba9380ed1f57dcc77"
integrity sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg==
dependencies:
undici-types "~5.26.4"

"@types/node@^16.9.2":
version "16.18.69"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.69.tgz#84853c5562baeabc6e864e36ea106f8c09495b24"
Expand Down Expand Up @@ -16520,7 +16527,8 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0":
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
name string-width-cjs
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand All @@ -16538,15 +16546,6 @@ string-width@^3.0.0, string-width@^3.1.0:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^5.1.0"

string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^5.0.1, string-width@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
Expand Down Expand Up @@ -16676,7 +16675,7 @@ stringify-entities@^4.0.0:
character-entities-html4 "^2.0.0"
character-entities-legacy "^3.0.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand All @@ -16690,13 +16689,6 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
dependencies:
ansi-regex "^4.1.0"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1, strip-ansi@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -18251,7 +18243,8 @@ wordwrapjs@^5.1.0:
resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-5.1.0.tgz#4c4d20446dcc670b14fa115ef4f8fd9947af2b3a"
integrity sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
name wrap-ansi-cjs
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -18278,15 +18271,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 0db2bc4

Please sign in to comment.