Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
dist
/tmp
/out-tsc
/packages/*/dist/bundle-size
Expand Down
5 changes: 4 additions & 1 deletion e2e/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "@griffel/e2e-eslint",
"version": "0.0.0",
"private": true,
"type": "module"
"type": "module",
"devDependencies": {
"@griffel/e2e-utils": "workspace:*"
}
}
2 changes: 1 addition & 1 deletion e2e/rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"sideEffects": false,
"dependencies": {
"@griffel/e2e-utils": "*",
"@griffel/e2e-utils": "workspace:*",
"@griffel/react": "^1.7.4",
"@griffel/webpack-extraction-plugin": "^0.5.19",
"@griffel/webpack-loader": "^2.2.28",
Expand Down
5 changes: 4 additions & 1 deletion e2e/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "@griffel/e2e-typescript",
"version": "0.0.0",
"private": true,
"type": "module"
"type": "module",
"devDependencies": {
"@griffel/e2e-utils": "workspace:*"
}
}
19 changes: 17 additions & 2 deletions packages/style-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,23 @@
"url": "https://github.com/microsoft/griffel"
},
"sideEffects": false,
"main": "./dist/index.js",
"types": "./src/index.ts",
"exports": {
".": {
"@griffel/source": "./src/index.ts",
"types": "./src/index.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"files": [
"dist/",
"README.md",
"LICENSE.md",
"CHANGELOG.md"
],
"dependencies": {
"csstype": "^3.2.3"
},
"types": "src/index.d.ts"
}
}
23 changes: 8 additions & 15 deletions packages/style-types/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,15 @@
"tags": [],
"targets": {
"build": {
"executor": "@nx/js:tsc",
"outputs": ["{options.outputPath}"],
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/packages/style-types/dist"],
"options": {
"outputPath": "dist/packages/style-types",
"tsConfig": "packages/style-types/tsconfig.lib.json",
"skipTypeField": true,
"packageJson": "packages/style-types/package.json",
"main": "packages/style-types/src/index.ts",
"assets": [
"packages/style-types/README.md",
{
"glob": "LICENSE.md",
"input": ".",
"output": "."
}
]
"cwd": "packages/style-types",
"commands": [
"tsc --build tsconfig.lib.json --pretty",
"node ../../tools/copy-pkg-assets.mjs packages/style-types"
],
"parallel": false
}
},
"lint": {
Expand Down
5 changes: 3 additions & 2 deletions packages/style-types/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"outDir": "./dist",
"rootDir": "./src",
"declaration": true,
"types": ["node", "environment"]
},
Expand All @@ -16,5 +17,5 @@
"**/*.test.jsx",
"jest.config.ts"
],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
"include": ["src/**/*.ts", "src/**/*.tsx"]
}
34 changes: 34 additions & 0 deletions tools/copy-pkg-assets.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copies a package's metadata files into its dist/ so the built tarball is
* self-contained:
* - <pkg>/package.json (with scripts and devDependencies stripped)
* - <pkg>/README.md if present, otherwise the workspace-root LICENSE.md
* - <pkg>/LICENSE.md if present, otherwise the workspace-root LICENSE.md
*
* Usage: node tools/copy-pkg-assets.mjs <package-dir>
*/
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';

const [pkgDir] = process.argv.slice(2);
if (!pkgDir) {
console.error('Usage: node tools/copy-pkg-assets.mjs <package-dir>');
process.exit(1);
}

const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const absPkg = resolve(repoRoot, pkgDir);
const distDir = join(absPkg, 'dist');

mkdirSync(distDir, { recursive: true });

const pkgJson = JSON.parse(readFileSync(join(absPkg, 'package.json'), 'utf8'));
delete pkgJson.scripts;
delete pkgJson.devDependencies;
writeFileSync(join(distDir, 'package.json'), JSON.stringify(pkgJson, null, 2) + '\n');

for (const f of ['README.md', 'LICENSE.md']) {
const src = existsSync(join(absPkg, f)) ? join(absPkg, f) : join(repoRoot, f);
if (existsSync(src)) copyFileSync(src, join(distDir, f));
}
3 changes: 0 additions & 3 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@
"@griffel/babel-preset": ["packages/babel-preset/src/index.ts"],
"@griffel/core": ["packages/core/src/index.ts"],
"@griffel/devtools": ["packages/devtools/src/index.ts"],
"@griffel/e2e-utils": ["e2e/utils/src/index.ts"],
"@griffel/eslint-plugin": ["packages/eslint-plugin/src/index.ts"],
"@griffel/jest-serializer": ["packages/jest-serializer/src/index.ts"],
"@griffel/postcss-syntax": ["packages/postcss-syntax/src/index.ts"],
"@griffel/react": ["packages/react/src/index.ts"],
"@griffel/style-types": ["packages/style-types/src/index.ts"],
"@griffel/transform": ["packages/transform/src/index.mts"],
"@griffel/transform-shaker": ["packages/transform-shaker/src/index.ts"],
"@griffel/update-shorthands": ["tools/update-shorthands/src/index.ts"],
"@griffel/webpack-extraction-plugin": ["packages/webpack-extraction-plugin/src/index.ts"],
"@griffel/webpack-loader": ["packages/webpack-loader/src/index.ts"],
"@griffel/webpack-plugin": ["packages/webpack-plugin/src/index.mts"]
Expand Down
8 changes: 6 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3771,14 +3771,16 @@ __metadata:
"@griffel/e2e-eslint@workspace:e2e/eslint":
version: 0.0.0-use.local
resolution: "@griffel/e2e-eslint@workspace:e2e/eslint"
dependencies:
"@griffel/e2e-utils": "workspace:*"
languageName: unknown
linkType: soft

"@griffel/e2e-rspack@workspace:e2e/rspack":
version: 0.0.0-use.local
resolution: "@griffel/e2e-rspack@workspace:e2e/rspack"
dependencies:
"@griffel/e2e-utils": "npm:*"
"@griffel/e2e-utils": "workspace:*"
"@griffel/react": "npm:^1.7.4"
"@griffel/webpack-extraction-plugin": "npm:^0.5.19"
"@griffel/webpack-loader": "npm:^2.2.28"
Expand All @@ -3789,10 +3791,12 @@ __metadata:
"@griffel/e2e-typescript@workspace:e2e/typescript":
version: 0.0.0-use.local
resolution: "@griffel/e2e-typescript@workspace:e2e/typescript"
dependencies:
"@griffel/e2e-utils": "workspace:*"
languageName: unknown
linkType: soft

"@griffel/e2e-utils@npm:*, @griffel/e2e-utils@workspace:e2e/utils":
"@griffel/e2e-utils@workspace:*, @griffel/e2e-utils@workspace:e2e/utils":
version: 0.0.0-use.local
resolution: "@griffel/e2e-utils@workspace:e2e/utils"
languageName: unknown
Expand Down
Loading