-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Details: - Drafts monorepo structure, based on Lerna (for publishing) and Preconstruct (for building, and linking for dev). The stack is based on sigma.js v3's one. - Drafts packages/storybook, to allow writing stories in there but also in each workspace independently.
- Loading branch information
0 parents
commit 306233b
Showing
19 changed files
with
334 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
**/dist/* | ||
**/build/* | ||
**/node_modules/* | ||
|
||
# Doc and examples | ||
**/storybook-static/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"env": { | ||
"jest": true, | ||
"browser": true | ||
}, | ||
"root": true, | ||
"ignorePatterns": ["*.js", "*.d.ts"], | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["import", "@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"prettier", | ||
"plugin:storybook/recommended" | ||
], | ||
"rules": { | ||
"no-prototype-builtins": "off", | ||
"no-console": "warn", | ||
"import/extensions": [ | ||
"warn", | ||
"never", | ||
{ | ||
"json": "always", | ||
"glsl": "always" | ||
} | ||
], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ | ||
"argsIgnorePattern": "^_", | ||
"varsIgnorePattern": "^_", | ||
"caughtErrorsIgnorePattern": "^_" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
*.tgz | ||
*.log | ||
*.swp | ||
.DS_Store | ||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
**/dist/* | ||
**/build/* | ||
**/node_modules/* | ||
|
||
# Doc and examples | ||
**/storybook-static/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"trailingComma": "all", | ||
"printWidth": 120, | ||
"importOrder": ["<THIRD_PARTY_MODULES>", "^[./]"], | ||
"importOrderSeparation": true, | ||
"importOrderSortSpecifiers": true, | ||
"importOrderGroupNamespaceSpecifiers": true, | ||
"plugins": ["@trivago/prettier-plugin-sort-imports"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Copyright (C) 2013-2024, Alexis Jacomy, Guillaume Plique https://www.sigmajs.org | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), | ||
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Gephi TypeScript utils | ||
|
||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ["@babel/preset-env", "@babel/preset-typescript"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json", | ||
"version": "independent", | ||
"private": false, | ||
"push": false, | ||
"includeMergedTags": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "@gephi/root", | ||
"description": "Various TypeScript helper modules used in the web Gephi ecosystem", | ||
"homepage": "https://gephi.org", | ||
"bugs": "http://github.com/gephi/typescript-utils/issues", | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"clean": "npm exec --workspaces -- npx rimraf node_modules && npx rimraf node_modules", | ||
"build": "preconstruct build", | ||
"prettify": "prettier --write .", | ||
"lint": "eslint .", | ||
"test": "npm run test --workspaces", | ||
"start": "npm run start --workspace=@gephi/ts-utils-storybook", | ||
"postinstall": "preconstruct dev", | ||
"postpublish": "preconstruct dev", | ||
"prepublishOnly": "npm run lint && npm run test && npm run build" | ||
}, | ||
"dependencies": { | ||
"@babel/core": "^7.24.0", | ||
"@babel/preset-typescript": "^7.23.3", | ||
"@preconstruct/cli": "^2.8.3", | ||
"@trivago/prettier-plugin-sort-imports": "^4.3.0", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-storybook": "^0.8.0", | ||
"lerna": "^8.1.2", | ||
"prettier": "^3.2.5", | ||
"rimraf": "^5.0.5", | ||
"typescript": "^5.4.2", | ||
"typescript-eslint": "^7.2.0" | ||
}, | ||
"preconstruct": { | ||
"packages": [], | ||
"exports": { | ||
"importConditionDefaultExport": "default" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
storybook-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { StorybookConfig } from "@storybook/html-vite"; | ||
import { dirname, join } from "path"; | ||
import { mergeConfig } from "vite"; | ||
|
||
/** @type { import('@storybook/html-vite').StorybookConfig } */ | ||
const config: StorybookConfig = { | ||
stories: ["../stories/**/stories.ts", "../../**/src/**/*.mdx", "../../**/src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [ | ||
getAbsolutePath("@storybook/addon-links"), | ||
getAbsolutePath("@storybook/addon-essentials"), | ||
getAbsolutePath("@storybook/addon-interactions"), | ||
getAbsolutePath("@storybook/addon-storysource"), | ||
], | ||
framework: getAbsolutePath("@storybook/html-vite"), | ||
typescript: { | ||
check: true, | ||
}, | ||
docs: { | ||
autodocs: "tag", | ||
}, | ||
core: { | ||
disableTelemetry: true, | ||
}, | ||
staticDirs: ["../public"], | ||
logLevel: "debug", | ||
async viteFinal(config) { | ||
return mergeConfig(config, { | ||
resolve: { | ||
preserveSymlinks: false, | ||
}, | ||
}); | ||
}, | ||
}; | ||
export default config; | ||
|
||
function getAbsolutePath(value: string): any { | ||
return dirname(require.resolve(join(value, "package.json"))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { addons } from "@storybook/manager-api"; | ||
|
||
import theme from "./theme"; | ||
|
||
addons.setConfig({ | ||
theme, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Preview } from "@storybook/html"; | ||
|
||
const forceReloadDecorator: Preview["decorators"] = (storyFn, context) => { | ||
if (context.globals.shouldReload) { | ||
// Change search params of the iframe | ||
const searchParams = new URLSearchParams(window.parent.location.search); | ||
searchParams.set( | ||
"args", | ||
Object.keys(context.args) | ||
.map((k) => `${k}:${context.args[k]}`) | ||
.join(";"), | ||
); | ||
history.pushState(null, "", "?" + searchParams.toString()); | ||
|
||
// reload iframe | ||
window.location.reload(); | ||
|
||
// The reload is fired, but the story renderer is already started. | ||
// To avoid blink effect and console error, we return the template inside a full | ||
// invisible div | ||
return `<div style="height:100%;width:100%;visibility:hidden">${storyFn()}</div>`; | ||
} | ||
|
||
context.globals.shouldReload = true; | ||
return storyFn(); | ||
}; | ||
|
||
const preview: Preview = { | ||
decorators: [forceReloadDecorator], | ||
parameters: { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { create } from "@storybook/theming/create"; | ||
|
||
export default create({ | ||
base: "light", | ||
fontCode: "monospace", | ||
brandTitle: "Gephi TypeScript utils", | ||
brandUrl: "https://gephi.org/", | ||
brandImage: "https://gephi.org/gephi-lite/gephi-logo.svg", | ||
brandTarget: "_self", | ||
colorPrimary: "#000000", | ||
colorSecondary: "#ffffff", | ||
textColor: "#000000", | ||
textInverseColor: "#ffffff", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@gephi/ts-utils-storybook", | ||
"private": true, | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "^8.0.0", | ||
"@storybook/addon-interactions": "^8.0.0", | ||
"@storybook/addon-links": "^8.0.0", | ||
"@storybook/addon-storysource": "^8.0.0", | ||
"@storybook/html": "^8.0.0", | ||
"@storybook/html-vite": "^8.0.0", | ||
"@storybook/web-components": "^8.0.0", | ||
"storybook": "^8.0.0" | ||
}, | ||
"scripts": { | ||
"start": "storybook dev -p 6006", | ||
"build": "storybook build" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"include": ["./types/raw.d.ts", ".storybook/*.tsx", "stories"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"compileOnSave": false, | ||
"compilerOptions": { | ||
"allowJs": false, | ||
"allowSyntheticDefaultImports": true, | ||
"allowUnreachableCode": false, | ||
"allowUnusedLabels": false, | ||
"alwaysStrict": true, | ||
"baseUrl": ".", | ||
"declaration": true, | ||
"diagnostics": false, | ||
"emitBOM": false, | ||
"emitDecoratorMetadata": false, | ||
"esModuleInterop": true, | ||
"experimentalDecorators": false, | ||
"forceConsistentCasingInFileNames": true, | ||
"importHelpers": true, | ||
"importsNotUsedAsValues": "remove", | ||
"inlineSourceMap": false, | ||
"inlineSources": false, | ||
"isolatedModules": false, | ||
"jsx": "react", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"listEmittedFiles": false, | ||
"listFiles": false, | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"noEmit": false, | ||
"noEmitHelpers": false, | ||
"noEmitOnError": false, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noImplicitUseStrict": false, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"paths": { | ||
"*": ["@types/*"] | ||
}, | ||
"preserveConstEnums": true, | ||
"pretty": true, | ||
"removeComments": true, | ||
"resolveJsonModule": true, | ||
"skipDefaultLibCheck": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"strictBindCallApply": true, | ||
"strictFunctionTypes": true, | ||
"strictNullChecks": true, | ||
"strictPropertyInitialization": true, | ||
"stripInternal": true, | ||
"suppressExcessPropertyErrors": false, | ||
"suppressImplicitAnyIndexErrors": false, | ||
"target": "es6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"extends": "./tsconfig.base.json", | ||
"files": [], | ||
"references": [ | ||
{ "path": "./packages/demo" }, | ||
{ "path": "./packages/test" }, | ||
{ "path": "./packages/storybook" }, | ||
{ "path": "./packages/sigma" }, | ||
{ "path": "./packages/node-border" }, | ||
{ "path": "./packages/node-image" }, | ||
{ "path": "./packages/node-piechart" }, | ||
{ "path": "./packages/edge-curve" } | ||
], | ||
"watchOptions": { | ||
"excludeDirectories": ["**/node_modules"] | ||
}, | ||
"compilerOptions": { | ||
"noFallthroughCasesInSwitch": false | ||
} | ||
} |