Skip to content

Commit

Permalink
[202409251157] - Add monorepo and empty data structure lib project (#95)
Browse files Browse the repository at this point in the history
* modify files

* adding plugin

* adding libs

* add mono repo

* add data structures project
  • Loading branch information
Oscarz90 authored Sep 25, 2024
1 parent 4deecec commit fe7bbb0
Show file tree
Hide file tree
Showing 26 changed files with 1,178 additions and 249 deletions.
32 changes: 32 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2.1

orbs:
nx: nrwl/[email protected]

jobs:
main:
docker:
- image: cimg/node:lts-browsers
steps:
- checkout

# This enables task distribution via Nx Cloud
# Run this command as early as possible, before dependencies are installed
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
- run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"

- run: npm ci --legacy-peer-deps
- nx/set-shas:
main-branch-name: 'main'

# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: npx nx-cloud record -- echo Hello World
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
- run: npx nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build

workflows:
version: 2

ci:
jobs:
- main
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Finish your CI setup

[Click here to finish setting up your workspace!](https://cloud.nx.app/connect/Xfnk5zCpDt)
[Click here to finish setting up your workspace!](https://cloud.nx.app/connect/lvBhrJQl8C)


## Run tasks
Expand Down
2 changes: 1 addition & 1 deletion apps/bismarck-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" href="/src/styles.scss" />
<link rel="stylesheet" href="/src/styles.css" />
</head>
<body>
<div id="root"></div>
Expand Down
15 changes: 15 additions & 0 deletions apps/bismarck-web/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { join } = require('path');

// Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build
// option from your application's configuration (i.e. project.json).
//
// See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries

module.exports = {
plugins: {
tailwindcss: {
config: join(__dirname, 'tailwind.config.js'),
},
autoprefixer: {},
},
};
1 change: 0 additions & 1 deletion apps/bismarck-web/src/app/app.module.scss

This file was deleted.

3 changes: 0 additions & 3 deletions apps/bismarck-web/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import styles from './app.module.scss';

import NxWelcome from './nx-welcome';

export function App() {
Expand Down
2 changes: 1 addition & 1 deletion apps/bismarck-web/src/app/nx-welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ export function NxWelcome({ title }: { title: string }) {
<p>Your Nx Cloud remote cache setup is almost complete.</p>

<a
href="https://cloud.nx.app/connect/jL4XBgOm3w"
href="https://cloud.nx.app/connect/QOdLPP3Ksv"
target="_blank"
rel="noreferrer"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
/* You can add global styles to this file, and also import other style files */
17 changes: 17 additions & 0 deletions apps/bismarck-web/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');
const { join } = require('path');

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
join(
__dirname,
'{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}'
),
...createGlobPatternsForDependencies(__dirname),
],
theme: {
extend: {},
},
plugins: [],
};
29 changes: 0 additions & 29 deletions bismarck-cs.code-workspace

This file was deleted.

3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module.exports = [
...nx.configs['flat/base'],
...nx.configs['flat/typescript'],
...nx.configs['flat/javascript'],
{
ignores: ['**/dist'],
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {
Expand Down
11 changes: 11 additions & 0 deletions libs/data-structure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# data-structure

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build data-structure` to build the library.

## Running unit tests

Run `nx test data-structure` to execute the unit tests via [Jest](https://jestjs.io).
19 changes: 19 additions & 0 deletions libs/data-structure/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const baseConfig = require('../../eslint.config.js');

module.exports = [
...baseConfig,
{
files: ['**/*.json'],
rules: {
'@nx/dependency-checks': [
'error',
{
ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs}'],
},
],
},
languageOptions: {
parser: require('jsonc-eslint-parser'),
},
},
];
10 changes: 10 additions & 0 deletions libs/data-structure/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
displayName: 'data-structure',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/libs/data-structure',
};
11 changes: 11 additions & 0 deletions libs/data-structure/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@bismarck/data-structure",
"version": "0.0.1",
"dependencies": {
"tslib": "^2.3.0"
},
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts",
"private": true
}
19 changes: 19 additions & 0 deletions libs/data-structure/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "data-structure",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/data-structure/src",
"projectType": "library",
"tags": [],
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/data-structure",
"main": "libs/data-structure/src/index.ts",
"tsConfig": "libs/data-structure/tsconfig.lib.json",
"assets": ["libs/data-structure/*.md"]
}
}
}
}
1 change: 1 addition & 0 deletions libs/data-structure/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/data-structure';
7 changes: 7 additions & 0 deletions libs/data-structure/src/lib/data-structure.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { dataStructure } from './data-structure';

describe('dataStructure', () => {
it('should work', () => {
expect(dataStructure()).toEqual('data-structure');
});
});
3 changes: 3 additions & 0 deletions libs/data-structure/src/lib/data-structure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function dataStructure(): string {
return 'data-structure';
}
22 changes: 22 additions & 0 deletions libs/data-structure/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions libs/data-structure/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
14 changes: 14 additions & 0 deletions libs/data-structure/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
17 changes: 12 additions & 5 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"!{projectRoot}/src/test-setup.[jt]s",
"!{projectRoot}/test-setup.[jt]s"
],
"sharedGlobals": ["{workspaceRoot}/.github/workflows/ci.yml"]
"sharedGlobals": ["{workspaceRoot}/.circleci/config.yml"]
},
"nxCloudId": "66f39aa27e5a5c483f2f05e4",
"nxCloudId": "66f43cb0f8029747dfe64618",
"plugins": [
{
"plugin": "@nx/vite/plugin",
Expand Down Expand Up @@ -44,17 +44,24 @@
"@nx/react": {
"application": {
"babel": true,
"style": "scss",
"style": "tailwind",
"linter": "eslint",
"bundler": "vite"
},
"component": {
"style": "scss"
"style": "tailwind"
},
"library": {
"style": "scss",
"style": "tailwind",
"linter": "eslint"
}
}
},
"targetDefaults": {
"@nx/js:tsc": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
}
}
}
Loading

0 comments on commit fe7bbb0

Please sign in to comment.